`oneof` generated class does not contain `enum` types
See original GitHub issueHi,
I was playing with oneof
keyword and found out that the generated class seems not following the doc. on https://developers.google.com/protocol-buffers/docs/reference/java-generated#oneof .
For example, if i have the follow in .proto:
message Message{
oneof payload{
int32 foo_int =4;
string foo_string =9;
}
}
it generates something like:
@WireField(
tag = 4,
adapter = "com.squareup.wire.ProtoAdapter#INT32"
)
public final Integer foo_int;
@WireField(
tag = 9,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String foo_string;
but not the enum types as I expected;
And with that, it seems the only way I can know what “type” of my payload
is checking foo_int
and foo_string
to see which one is not null. But what about if I want have adding more types in oneof
block, is there a quicker way to know the “type” of my payload
?
Thanks in advance
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
How to use OpenAPI "oneOf" property with openapi-generator ...
I have been battling to generate a PHP client for an API that heavily uses anyOf and oneOf. After some googling and finding...
Read more >oneOf, anyOf, allOf, not - Swagger
Besides these, there is a not keyword which you can use to make sure the value ... type: object; properties: bark: type: boolean;...
Read more >Handbook - Enums - TypeScript
Enums are one of the few features TypeScript has which is not a type-level extension of JavaScript. Enums allow a developer to define...
Read more >Documentation for the java Generator
Do not annotate Model and Api with complementary annotations. ... Annotate Model and Api using the Swagger Annotations 1.x library. none.
Read more >Enum Types - Java™ Tutorials
An enum type is a special data type that enables for a variable to be a set of ... The variable must be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m looking at this API and I don’t see the improvement. Presumably this is where you’re starting from:
The proposed API gets you here:
I think the closest we get with oneof that’s an improvement is a visitor, and it’s not really much better.
Hello All - I just found this, am wondering if there has been any change, since?