Last active
March 28, 2019 02:19
-
-
Save crazybob/71db05a47ef0379c1f5b5374a3b39cb6 to your computer and use it in GitHub Desktop.
Protobuf vs. Swagger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Protobuf: | |
service PetService { | |
// Finds pets by IDs | |
rpc findById(FindByIdRequest) returns (FindByIdResponse); | |
} | |
message FindByIdRequest { | |
// IDs to look up | |
repeated string ids = 1; | |
} | |
message FindByIdResponse { | |
// Found pets | |
repeated PetResponse pets = 1; | |
} | |
Swagger (YAML): | |
get: | |
description: Returns pets based on ID | |
summary: Find pets by ID | |
operationId: getPetsById | |
responses: | |
'200': | |
description: pet response | |
content: | |
'*/*' : | |
schema: | |
type: array | |
items: | |
$ref: '#/components/schemas/Pet' | |
default: | |
description: error payload | |
content: | |
'text/html': | |
schema: | |
$ref: '#/components/schemas/ErrorModel' | |
parameters: | |
- name: id | |
in: path | |
description: ID of pet to use | |
required: true | |
schema: | |
type: array | |
style: simple | |
items: | |
type: string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment