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

Support openapiv2_tag option in swagger generator #690

Closed
achow14 opened this issue Jul 2, 2018 · 6 comments · Fixed by #1866
Closed

Support openapiv2_tag option in swagger generator #690

achow14 opened this issue Jul 2, 2018 · 6 comments · Fixed by #1866

Comments

@achow14
Copy link

achow14 commented Jul 2, 2018

Hey guys,

I'm trying to use grpc-gateway to create a swagger.json directly from a .proto file
I was wondering if the tag option
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_tag)
was working?

I pasted this tag option inside a service and it should change the description for the service "tag" if I'm not mistaken. When I do this and generate a swagger.json file, the services do not have descriptions appended to them. (Snippet Below)

service APIService {

option (grpc.gateway.protoc_gen_swagger.options.openapiv2_tag) = {
description: "Some Description";
};
rpc someService(Request) returns (Response)
}

In addition, for passing parameters, is there any kind of header support? Reading through the documentation, I've figured out that you have an optional body field and an automatic query parameter generation from the requests you pass into the rpc. However, is there any header parameter support that isn't in the documentation?

Thank you for the help.

@johanbrandhorst
Copy link
Collaborator

Sounds like adding support for the tag option is a good first PR :).

@johanbrandhorst johanbrandhorst changed the title Headers/Tag Support? Support openapiv2_tag option in swagger generator Sep 9, 2018
@johanbrandhorst
Copy link
Collaborator

Passing parameters via headers is not currently supported. Headers map to gRPC metadata.

@drorventura
Copy link

Hi, did someone stated fixing this issue?

@johanbrandhorst
Copy link
Collaborator

I don't think so! Would you like to contribute a fix?

@drorventura
Copy link

I might :)
i'll try to make time for it soon

bandikishores added a commit to bandikishores/TestGo that referenced this issue Mar 5, 2020
rcgoodfellow pushed a commit to mergetb/grpc-gateway that referenced this issue Dec 8, 2020
@rcgoodfellow
Copy link
Contributor

PR for this: #1866

johanbrandhorst pushed a commit that referenced this issue Dec 9, 2020
* protoc-gen-openapiv2: support for openapiv2_tag

Fixes #690

Signed-off-by: Ryan Goodfellow <[email protected]>

* more consistent with rest of codebase

Signed-off-by: Ryan Goodfellow <[email protected]>

* update example specs, revert protoc version change

Signed-off-by: Ryan Goodfellow <[email protected]>

* Address review comments

- Factor service tag rendering out of service rendering function
- Add omitempty tags where applicable

Signed-off-by: Ryan Goodfellow <[email protected]>

* remove extraneous newline

Signed-off-by: Ryan Goodfellow <[email protected]>

* renderServices call to previous form

Signed-off-by: Ryan Goodfellow <[email protected]>
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.

4 participants