pseudomuto / protoc-gen-doc

Documentation generator plugin for Google Protocol Buffers
MIT License
2.61k stars 462 forks source link

generate validation rules (envoy) documentation #434

Open buzzdan opened 3 years ago

buzzdan commented 3 years ago

hello, i'm using protoc-gen-doc to generate markdown for my protos it would be greate if it could also generate documentation for the validations rules i define via envoyproxy PGV (protoc-gen-validate). for example:

string id = 1 [(validate.rules).string = { uuid: true, min_len: 1 }];

thanks a lot for this project :pray:

asandeep commented 2 years ago

Are there any plans to implement this. IMO this will be a great addition.

jtjeferreira commented 2 years ago

There is some support already. See https://github.com/pseudomuto/protoc-gen-doc/tree/master/extensions/envoyproxy_validate

asandeep commented 2 years ago

Thanks @jtjeferreira for your response. I added validate rules but nothing changes in the Markdown output. Do I have to do anything extra to make this extension work? May be the default template doesn't output valiation rules?

jtjeferreira commented 2 years ago

I think that not all validation rules are considered, but some are. An example from my project image

asandeep commented 2 years ago

Strange. I don't have any section called Validated Fields in my Markdown output.

Do you use Docker image to run the plugin?

jtjeferreira commented 2 years ago

Strange. I don't have any section called Validated Fields in my Markdown output.

This was the html output...

Do you use Docker image to run the plugin.

yes

asandeep commented 2 years ago

@jtjeferreira I see them in HTML output. Looks like the validation fields were just added to default HTML template.

Thanks a lot. I think I should be able to use a custom markdown template to get the desired output.