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

Document protoc-gen-swagger #427

Open
boosh opened this issue Jul 4, 2017 · 5 comments
Open

Document protoc-gen-swagger #427

boosh opened this issue Jul 4, 2017 · 5 comments

Comments

@boosh
Copy link

boosh commented Jul 4, 2017

There's no obvious documentation on how to actually comment .proto files so they can be parsed by protoc-gen-swagger. It'd be useful if some was added.

@achew22
Copy link
Collaborator

achew22 commented Jul 4, 2017

The parsing should be the same as for the gateway code. Can you elaborate on what more you would be interested in having than the link in our docs that says custom option?

@boosh
Copy link
Author

boosh commented Jul 5, 2017

The parsing should be the same as for the gateway code.

I don't really know what you're referring to here. As an end user I was hoping not to have to look into the source.

However, I've seen from digging around in the source of this plugin that various rules are applied to comments, like:

  • It'll treat the first line of a comment as the title of a swagger item, unless it ends with a period (not sure why but this isn't intuitive).
  • Blank comment lines appear to be necessary to separate paragraphs.
  • Subsequent paragraphs will be used as the summary or maybe description,
  • etc., etc.

It'd be useful to have a guide that explicitly states all these rules along with examples so it's obvious how .proto files should be commented so that swagger files are correctly generated in terms of documentation.

@achew22
Copy link
Collaborator

achew22 commented Dec 14, 2017

You can always look at our kitchen sink for a fully fleshed out version of a proto. It should have one of everything.

@ensonic
Copy link
Contributor

ensonic commented Feb 12, 2018

/sub.
Also, is there a way to supply some option via command line parameters or the idea to supply a skelleton swagger.spec via

option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) ...

and then let the tool overwrite/add things parsed from the proto.

@achew22
Copy link
Collaborator

achew22 commented Feb 13, 2018

I think subscribing to #521 is probably the way to go here. Is that PR what you were thinking of?

@tmc tmc added the openapi label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants