Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto-gen-swagger: provide default description for HTTP 200 responses #766

Closed
johnchildren opened this issue Oct 2, 2018 · 3 comments
Closed

Comments

@johnchildren
Copy link
Contributor

In the swagger specification it says the following about description fields:

Field Name Type Description
description string REQUIRED. A short description of the response. CommonMark syntax MAY be used for rich text representation.

https://swagger.io/specification/#responseObject

Currently proto-gen-swagger will generate an empty string for this field on a 200 response, but I am unsure if this is enough to meet the specification. This has some ramifications as at least one of the generators in swagger-codegen or openapi-codegen, rust-server will not compile if the description is set to an empty string without manual intervention.

It seems to be this line which is responsible, so it may just be a matter of setting a default value, though I am not sure what this value should actually be.

https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-swagger/genswagger/template.go#L697

@johanbrandhorst
Copy link
Collaborator

Thanks for submitting this issue @johnchildren! This does indeed seem to be in breach of the spec. What can I do to help you get a pull request in to fix this? I think it should be okay to introduce this backwards-incompatibility since any comments or explicit description will override it. How about just A successful response?

@johnchildren
Copy link
Contributor Author

Have created a pull request for the change, but I am unsure how best to provide automated tests. I also interested to see how the default value looks when used with streaming responses.

@johanbrandhorst
Copy link
Collaborator

Closed with #767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants