-
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
Swagger-UI query parameters for enum types are sent as strings #320
Comments
@johanbrandhorst thanks for the issue report. My preference would be to allow either representation. |
The error is coming from https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/convert.go#L39. |
Here's a stack trace (edited):
|
That seems to indicate Line 150 in f3aa758
|
Indeed EnumValueMap is returning an empty map for the enum type |
AH this is because we've generated our code with gogo/proto instead of golang/proto, the enum is never registered with golang/proto which is what grpc-gateway calls to. Anything we can do about that? |
This is probably not grpc-gateways fault, so I'm gonna go ahead and close it. I'm doubtful the grpc-gateway will ever allow the user to specify the protobuf backend. |
@johanbrandhorst I also face this issue now. Could you tell about how did you fix this? |
https://jbrandhorst.com/post/gogoproto/ details some of the compatibility issues around using gogo/protobuf (like this one). I would recommend not using gogo/protobuf. |
Thank you very much for your reply! I’ve read your article and tested with 2 of the options ( Please let me know if I am wrong. |
Resolved, thanks a lot! @johanbrandhorst |
When using a
GET
endpoint and an enum type in the query parameter, the swagger definition shows a selection of the string representation of the enum as input options, but using that representation returns an error:The swagger definition needs to use the numeric representation of the enum for it to work.
The text was updated successfully, but these errors were encountered: