-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support specifying which schemes should be output in swagger.json #161
Comments
I hit this too. Reversing the order ( Is running grpc-gateway without HTTPS even supported? |
There is no need for it to be specified as https. It could be specified as http. You can edit the swagger output file by hand and serve it with that line saying just "http" if you don't want to bother to modify the protoc-gen-swagger binary. |
@achew22 I don't really understand your comment. In our config grpc-gateway is served under https only, so ideally for us schemes would just have one item, "https". Are there people running it http-only, for whom changing the order would break the swagger "try it out" buttons? |
I realized there is another option, just dropping the "schemes" key. If it's missing it defaults to the scheme the UI is being served from. https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schema |
Agree with @achew22's thinking this is a bug in swagger-ui. Filed swagger-api/swagger-ui#2342. |
Yeah, it seems to be a bug in swagger-js swagger-api/swagger-js#841 |
swagger-api/swagger-js#841 is now closed. Closing this issue with the assumption that is fixed. If that's not the case please feel free to reopen the issue. |
It is not possible to modify what the "schemes" list will contain when output from protoc-gen-swagger, as per
(https://github.com/gengo/grpc-gateway/blob/03164ec50aaf90b115daec838d3ce18f4b0a34ea/protoc-gen-swagger/genswagger/template.go#L432).
This means that on HTTPS only servers, the swagger "Try it out!" buttons will attempt to use HTTP, and thus fail. Currently the workaround is to edit the output of protoc-gen-swagger to remove HTTP from the schemes list.
I'm not sure what would be the best way to fix this, but I would like some kind of way to configured the schemes at "compile time", without having to edit the output.
swagger-api/swagger-ui#1006 describes my problem.
The text was updated successfully, but these errors were encountered: