We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
protoc-gen-swagger appears to have an issue where an entity is omitted from the definitions when a field is specified for the body rather than *.
*
Reproduce with the following code:
example.proto
syntax = "proto3"; package example; import "google/api/annotations.proto"; service ExampleService { rpc DoSomething(DoSomethingRequest) returns (DoSomethingResponse) { option (google.api.http) = { post: "/do-something/{id}" body: "data" }; } } message ExtraData { string foo = 1; } message DoSomethingRequest { string id = 1; ExtraData data = 2; } message DoSomethingResponse { string bar = 1; }
Generate the code:
protoc -I. -I$GOPATH/src -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=plugins=grpc:. --swagger_out=logtostderr=true:. ./example.proto
Results in:
{ "swagger": "2.0", "info": { "title": "example.proto", "version": "version not set" }, "schemes": [ "http", "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/do-something/{id}": { "post": { "operationId": "DoSomething", "responses": { "200": { "description": "", "schema": { "$ref": "#/definitions/exampleDoSomethingResponse" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/exampleExtraData" } } ], "tags": [ "ExampleService" ] } } }, "definitions": { "exampleDoSomethingResponse": { "type": "object", "properties": { "bar": { "type": "string" } } } } }
Note that there is a $ref to #/definitions/exampleExtraData but it does not appear in the definitions.
#/definitions/exampleExtraData
edit: actually I don't know if the body attribute is relevant.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
protoc-gen-swagger appears to have an issue where an entity is omitted from the definitions when a field is specified for the body rather than
*
.Reproduce with the following code:
example.proto
Generate the code:
Results in:
Note that there is a $ref to
#/definitions/exampleExtraData
but it does not appear in the definitions.edit: actually I don't know if the body attribute is relevant.
The text was updated successfully, but these errors were encountered: