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

How to use the docs_out flag rather than doc_out #539

Open
Ekrekr opened this issue Aug 5, 2024 · 0 comments · May be fixed by #540
Open

How to use the docs_out flag rather than doc_out #539

Ekrekr opened this issue Aug 5, 2024 · 0 comments · May be fixed by #540

Comments

@Ekrekr
Copy link

Ekrekr commented Aug 5, 2024

I want to generate our protobuf documentation in camelCase rather than snake_case.

It seems to come down to the plugin trying to use protoc-gen-docs rather than protoc-gen-doc in the docker image. I'm a bit confused about the relationship between the two packages, but protoc-gen-docs allows the --docs_out=camel_case_fields=true:output_directory field https://pkg.go.dev/istio.io/tools/cmd/protoc-gen-docs#section-readme.

Using the docker image, I'm able to use:

$ protoc --plugin=/usr/bin/protoc-gen-doc --doc_opt=markdown,configs-reference.md --doc_out=/out protos/configs.proto

However, when I try to run

$ protoc --plugin=/usr/bin/protoc-gen-doc --doc_opt=markdown,configs-reference.md --docs_out=camel_case_fields=true:/out protos/configs.proto

I get the error protoc-gen-docs: program not found or is not executable.

I suspect that the doc_opt parameter should be able to extract this option, but it's not currently viable - it just writes an additional file camel_case_fields=true with the generated documentation.

docker run --rm \
  -v $(pwd)/docs:/out \
  -v $(pwd)/protos:/protos \
  pseudomuto/protoc-gen-doc configs.proto --doc_opt=markdown,camel_case_fields=true:configs-reference.md
@Ekrekr Ekrekr linked a pull request Aug 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant