-
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
ENUM in swagger.json makes client code failed to parse response from gateway #153
Comments
I'm having this same issue right now. I don't think the right solution is to generate integer for enum type, that would defeat the purpose of having an enum in the first place. Here's what I would suggest: If I have the proto message
Then I should be able to create a ticket by making a POST request with this body
And I'd expect grpc-gateway to give me an error if I tried to set priority to "FOO" instead of "LOW" or "HIGH". Does that make sense? |
It would be fine to use strings, if
Translate JSON by hand at client side can be very tedious. |
@fabware this issue is fixed if you pull the latest from master. It works exactly as I describe able. |
Yes, I found it working that way, it's been a huge commit. Thanks for your reminder anyway. Still swagger ENUM object of swift client code seems not compatible with string. I have to modify protoc-swagger-gen to produce enum as strings, it is now working like charm. |
Just doing a little bit of tidying. I hope that your question was answered in a way that let your project continue. If you have any more questions feel free to open another issue. |
gRPC objective-C binding is currently broken, I come cross this project as rescue. It looks promising, except ENUM not working properly.
enumerate type in swagger.json is $ref.ENUM_TYPE of string enums, which cause swagger editor generated swift client code incompatible with http response of gateway, which actually treat enums as integers.
manually edit the swagger file to replace $ref.ENUM_TYPE with integer can solve the problem.
So, why not generate integer for enum type in the first place and make it actually works by default?
The text was updated successfully, but these errors were encountered: