protoc-gen-doc icon indicating copy to clipboard operation
protoc-gen-doc copied to clipboard

Add oneOf support

Open jason-fox opened this issue 7 years ago • 6 comments

In our proto files we use the oneof keyword and we have noticed that this is currently ignored in the generated outputs. Our documentation team would like to see oneof support added to the tool.

To generate oneOf support for the 0.96 release I had added the following QT code to the message generation (line 346 onwards)

// Add basic info.
field["field_name"] = QString::fromStdString(fieldDescriptor->name());
field["field_description"] = description;
field["field_label"] = labelName(fieldDescriptor->label());
field["field_default_value"] = defaultValue(fieldDescriptor);
if (fieldDescriptor->containing_oneof()){
    field["field_one_of"] = QString::fromStdString(fieldDescriptor->containing_oneof()->name());
    field["field_one_of_description"] = descriptionOf(fieldDescriptor->containing_oneof(), excluded);
}

Since then I see that the code has been ported to GO, and I have another have been working on adding the equivalent code to the 1.0.0 release.

Would you like to examine a PR for making this happen?

jason-fox avatar Jan 03 '18 15:01 jason-fox

Hey @jason-fox, I'd definitely be interested in a PR to add oneOf support!

pseudomuto avatar Jan 08 '18 00:01 pseudomuto

I added my patches as base in the existing PR https://github.com/pseudomuto/protoc-gen-doc/pull/336 Didn't have time to do a proper PR and add tests. Sorry for that :(

Falco20019 avatar Apr 16 '18 14:04 Falco20019

any updates on this, is it going to get done at some point ?

jorgheymans avatar May 29 '18 12:05 jorgheymans

https://gist.github.com/lambdalisue/1f5ec5ee66e66c51564ab0c6ab2e89ce

I've made a markdown template which support oneof and optional.

lambdalisue avatar Oct 07 '21 10:10 lambdalisue

It would be excellent to have this.

amrhassan avatar Mar 16 '22 09:03 amrhassan

any progress on this?

marcosrmendezthd avatar Sep 22 '22 00:09 marcosrmendezthd

No resolution in five years. Closing.

jason-fox avatar May 12 '23 06:05 jason-fox