Open linuxluigi opened 1 year ago
I'm also wondering how to do this (switched from grpc-gateway).
In grpc-gateway, you can reference messages in the same proto file, in gnostic, I only found one way, that is manually write those common schemas in the top option (openapi.v3.document) { ... }
section.
The problem is you can't annotate a proto message as a component.
That should be possible as there are example tests that do something similar.
You might need to change the package name from gnostic.openapi.v3
to openapi.v3
though.
Do you have the default_response
option enabled? Perhaps it's wiping out your custom one?
@jeffsawatzky is this possible to set that for every single rpc without copy-pasting?
You can define some global schemas at the file level using the openapi.v3.document
option as seen here.
Then you can reference them later on in your rpcs at the rpc level using the openapi.v3.operation
options as seen here.
Any settings you specify in the openapi.v3.operation
option will merge/override any automatically derived settings.
I don't know if that answers your question though.
There is the default_response
as described in the README, but that will use the google.rpc.Status
message as the default response (which is the default return message for grpc-gateway, envoy, and other similar HTTP/JSON<->gRPC transcoders).
Is it possible to add a protobuff message to an OpenAPI schema component output?
I want to have a way to add a reference for an error case like 403.
Example:
Is this possible right now, or what would be the way to go for adding Error messages to OpenAPI Spec component?