-
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
Generated spec missing grpc errors #1122
Comments
If we wanted to be a little more specific and bound the error type to the 400/500 range, maybe we can use the status code range syntax that the spec defines, i.e |
Hi Sean! To be pedantic, we only support swagger 2, but happily the This makes great sense to me, and shouldn't break any existing users. I'd be happy to review this if you have spare cycles to contribute this. I'm not sure we need to export the type, unless you mean just to the swagger generator? We could still solve that with an internal package, which I'd prefer to adding to the API surface.
I think we can keep it as the default, we already allow users to specify custom responses, so really anything that isn't defined should be an error. |
Adds a "default" error entry to all responses in the swagger definitions. Fixes #1122
Adds a "default" error entry to all responses in the swagger definitions. Fixes #1122
Adds a "default" error entry to all responses in the swagger definitions. Fixes #1122
Adds a "default" error entry to all responses in the swagger definitions. Fixes #1122
Adds a "default" error entry to all responses in the swagger definitions. Fixes #1122
@johanbrandhorst I think that adding this default to all responses without a config option is a bit aggressive - for example, we have a custom error handler that translates an internal error details message into an RFC7807 https://tools.ietf.org/html/rfc7807 response for our REST clients (and so this default misrepresents the error format we return to clients) |
Argh, I did know this would be incorrect for those with custom error handlers, but I figured it was better than nothing. I agree it should be possible to turn this off... I'll add something. |
Adds a "default" error entry to all responses in the swagger definitions. Fixes grpc-ecosystem#1122
Adds a "default" error entry to all responses in the swagger definitions. Fixes grpc-ecosystem#1122
The gateway has an error object which any rpc can return- however it doesn't end up in the generated swagger/openapi.
grpc-gateway/runtime/errors.go
Lines 68 to 76 in 2da5bfa
OpenAPI's pattern for something like this is to include it as the
default
case.https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responses-object
Can we do the following?
With an entry in
schemas
for the new type:I wrote some jq to handle this in the meantime:
Not sure all that's required to make this change. I think at the least the errorBody struct would need to be made public. Thoughts?
The text was updated successfully, but these errors were encountered: