-
Notifications
You must be signed in to change notification settings - Fork 335
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
feat(docs) prepare api docs generation #1741
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Bart Smykla <bartek@smykla.com>
Hmm, why not add the proto file changes in this PR too? |
Can't speak to comment from @nickolaev but explanation of tool LGTM. This is awesome, can't wait to work with it when I'm back from time off! |
jakubdyszkiewicz
approved these changes
Apr 1, 2021
Signed-off-by: Bart Smykla <bartek@smykla.com>
Signed-off-by: Bart Smykla <bartek@smykla.com>
Signed-off-by: Bart Smykla <bartek@smykla.com>
mergify bot
pushed a commit
that referenced
this pull request
May 6, 2021
* feat(docs) prepare api docs generation Signed-off-by: Bart Smykla <bartek@smykla.com> * feat(docs) mark policy proto files to gen. docs Signed-off-by: Bart Smykla <bartek@smykla.com> (cherry picked from commit 9196f44) # Conflicts: # api/Makefile
bartsmykla
added a commit
that referenced
this pull request
May 6, 2021
* feat(docs) prepare api docs generation Signed-off-by: Bart Smykla <bartek@smykla.com> * feat(docs) mark policy proto files to gen. docs Signed-off-by: Bart Smykla <bartek@smykla.com> (cherry picked from commit 9196f44) Signed-off-by: Bart Smykla <bartek@smykla.com>
bartsmykla
added a commit
that referenced
this pull request
May 6, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Prerequisites (from repository root path)
cd api make install/protoc-gen-validate
To mark a file as a file containing policy resource, you should import
config.proto
and provideoption (doc.config)
proto extension. For example by adding to fileapi/mesh/v1alpha1/health_check.proto
lines below:after calling
make generate/docs
fromapi
there should be generated filehealth-check.md
in the same directory.Id you want to change the output path for generated files, you can specify a variable called
DOCS_OUTPUT_PATH
. For example:it will generate markdown files in
/tmp/kumadocs
. The path can be absolute or relativeEvery markdown file is generated from this template: https://github.com/kumahq/protoc-gen-kumadoc/blob/main/templates/policy.md.tpl and if you would like to test your own templates you should:
clone
protoc-gen-kumadoc
repositorymake changes in template
build plugin:
go build .
(use-o
flag if you want to build the plugin in different output path)run
make generate/docs
with specifiedPLUGIN
variable:PLUGIN=$(pwd)/protoc-gen-kumadoc make generate/docs
More configuration options for proto files can be found here: https://github.com/kumahq/protoc-gen-kumadoc/blob/main/proto/config.proto
If you want to mark some field as
required
(all of them are marked asoptional
by default), you can use[(doc.required) = true]
:By default all proto "messages" in policy files are being generated as if there would be more than one policy in a file, so if you have more "messages" but only one is considered a real "policy", you can mark rest of them as hidden using
option (doc.hide) = true;
: