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 how to expose custom annotations #490

Open
nurbo opened this issue Jul 5, 2022 · 1 comment
Open

Document how to expose custom annotations #490

nurbo opened this issue Jul 5, 2022 · 1 comment

Comments

@nurbo
Copy link

nurbo commented Jul 5, 2022

I found out that only some options (MethodOptions, MessageFieldOptions, etc.) are being processed, I presume those defined in the extensions module.

  • I tried implementing my own simple transformer and register it with extensions.SetTransformer. However, the transformer is never called, because my options are not present in protokit.FieldDescriptor's OptionExtensions map.
  • Moreover, GetOptions() does not return a "well formatted" value like the envoyproxy's validate options, but appears as a raw string, for example:
    "\n\x15\n\x10electriccurrent\x12\x01I\x12\x12\n\x06ampere\x12\x01A\x1a\x05milli\x18\x01X\x01"

What additional steps would I need to take to be able to get my custom annotations exposed? I have annotations for quantities of message fields and wanted to use it in my self-made template, similarly to how I already use the google.api.http options.

Would be great if some information was provided in the documentation about how extensions are handled, for example in the contributing document.

@sharonliao
Copy link

I made modifications to support the exposure of custom annotation on my branch, https://github.com/sharonliao/protoc-gen-doc You can probably have a try on it.
To support this feature, we need to modify the protokit first. And I'm planning to create a PR for it recently.

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

No branches or pull requests

2 participants