-
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
Add example of using ref
to reference unused messages for openapi.json inclusion
#5241
Comments
Hi, thanks for the issue. I don't think this should need a new flag, I would expect us to be able to detect these top level definitions and use that to include the message. Does it work if you tie this response to a specific RPC instead? I think we had to do something similar for the gRPC Status message type. |
Hi @johanbrandhorst |
So as it happens we have an example of this working when defined globally as in your example:
As you can see, ErrorResponse isn't used in any rpcs in this protobuf but it's still being rendered. Could you try to reproduce the problem and compare it to the one in a_bit_of_everything.proto? |
Amazing, using the |
Great idea, would you be willing to contribute a little section to the docs? The files are in https://github.com/grpc-ecosystem/grpc-gateway/tree/main/docs/docs. |
ref
to reference unused messages for openapi.json inclusion
🚀 Feature
When defining generic responses for different status codes, I use an unbound message as follows
Because the message
GenericResponse
is not bound to any rpc, the swagger definition is not generated.The workaround is to generate a No-op service and rpc that use the message
Request
Allow for the generation of unbounded messages via configuration. Similar to the
generate_unbound_methods
flag.The text was updated successfully, but these errors were encountered: