Skip to content
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

Cannot set consumes definition per operation #726

Closed
3 tasks done
Arttii opened this issue Aug 16, 2018 · 6 comments · Fixed by #2995
Closed
3 tasks done

Cannot set consumes definition per operation #726

Arttii opened this issue Aug 16, 2018 · 6 comments · Fixed by #2995

Comments

@Arttii
Copy link

Arttii commented Aug 16, 2018

Please follow the general troubleshooting steps first:

  • Update your protoc to the latest version
  • Update your copy of grpc-gateway to the latest version from github. with
    git fetch https://github.com/grpc-ecosystem/grpc-gateway master && git reset --hard FETCH_HEAD
  • Delete the protoc-gen-grpc-gateway and protoc-gen-swagger binary from your PATH,
    and install locally built binaries.

Bug reports:

Cannot set consumes definition per operation, even though the consumes field is present in the openapiv2_operation message definition. This leads to problem with using the generated swagger spec to generate test server or client for non GRPC clients.

Steps you follow to reproduce the error:

  1. Set consumes via openapiv2_swagger
  2. Set consumes via openapiv2_operation for a seperate rpc method

What did you expect to happen instead:

  1. The consumes option should overwrite the global one, but its not

What's your theory on why it isn't working:

Looking at this it seems the per operation consumes is not being considered

@johanbrandhorst
Copy link
Collaborator

Indeed, it seems Consumes is hardcoded. Do you want to contribute a fix for this? It looks like it should be rather straightforward.

@Arttii
Copy link
Author

Arttii commented Aug 16, 2018

I can give a try, should we keep this open as a tracking issue?

@johanbrandhorst
Copy link
Collaborator

Yes :)

@Arttii
Copy link
Author

Arttii commented Aug 16, 2018

I am a bit unsure how to write the test I cannot seem to find any examples how to actually pass in options with MethodDescriptorProto

@johanbrandhorst
Copy link
Collaborator

If you put up a PR we can review it and help you create some tests for it!

@stomy13
Copy link
Contributor

stomy13 commented Nov 6, 2022

Hello @johanbrandhorst,
Created PR to contribute this fix, please check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants