-
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
YAML support for Swagger annotations #701
Comments
I think this is reasonably well documented at https://grpc-ecosystem.github.io/grpc-gateway/docs/grpcapiconfiguration.html. Can you check that out and report back what additional information you need or how we could make that easier? |
For instance, how would one accomplish the following in YAML:
|
What have you tried already? What documentation have you looked at? |
Support for YAML API definition is exciting, but somewhat basic: #521 It doesn't process most of the fields available in I believe you can only split out your routing proto |
Sounds like there's work that could be done here. |
need help too. |
So there is no documentation at all ? Because this:
It's not a documentation ... It's a snippet. This link can be useful: https://cloud.google.com/endpoints/docs/grpc/grpc-service-config#annotations_http_rules_only but does not answer to all my questions. This annotations, with responses, security... can we do that ? |
Swagger annotations are currently not supported in the yaml files, only inlined in the proto files. We would love your help to improve the documentation, how can I help you contribute updates? |
I'm interested in taking on adding YAML support for Swagger/OpenAPIv2 options. I took a look at protoc-gen-openapiv2/internal/template.go and it looks like I'd just need to extend the extract...From...Descriptor functions to look up YAML added options. Does this sound like the right track? To go into more detail, my plan is to:
For the sake of example, it could look like
Finally, where is the Any guidance or feedback would be greatly appreciated. |
Hi @jasonewang, that's great! I think you need to start here: https://github.com/grpc-ecosystem/grpc-gateway/blob/v2/internal/descriptor/grpc_api_configuration.go. The annotations used are sourced from https://github.com/grpc-ecosystem/grpc-gateway/blob/v2/internal/descriptor/apiconfig/apiconfig.proto. If you want to add more of them, you'd probably have to start here. As you can see, we're actually turning the YAML into JSON before You may even be able to add a test first and do a TDD style iteration (https://github.com/grpc-ecosystem/grpc-gateway/blob/v2/internal/descriptor/grpc_api_configuration_test.go). |
In #1665 this adds a new file rather than incompatibly forking the |
Hi there, first of all great project thanks for all your hard work.
I'm experimenting with the swagger doc generation and have got things to work fine in the proto file. I am interested in keeping all of the swagger / rest stuff out of the proto file and use the associated YAML file that can be used to configure endpoints, as per
https://cloud.google.com/endpoints/docs/grpc/grpc-service-config
Is it possible to add the protogen-swagger annotation messages in the YAML file instead? I'd like to write something like:
The text was updated successfully, but these errors were encountered: