-
Notifications
You must be signed in to change notification settings - Fork 388
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
protobuf3 optional: configurable "optional_" prefix #257
Comments
to check with official protoc implement, the "optional oneof name" is "_field", so change name to fit it. |
I see prefix is changed: { But I want to get the same result I had in 0.3.3. I do not want to have "_"-prefixed extra fields at all. Is it possible to implement it some way? UPD: 'oneof' is not used in my proro file at all.
|
Unfortunately it may difficult to do. The optional in proto3 is just a syntax sugar of single field oneof, and there is no way to distinguish it with single field oneof in FileDescriptor. In luapb, all oneof has a field set to indicate which field is setting. I cannot just ignore it for optional field. |
We are currently migrating from 0.3.3 and 0.5.0 and see optional label behavior is changed.
scenario: decode binary data and serialize it using json
version 0.3.3:
{"eventId":"175d252a-fd72-4e01-8260-88929a9b2aa9","eventTime":{"timestampUTC":1413525601} ...
version 0.5.0
{"eventId":"175d252a-fd72-4e01-8260-88929a9b2aa9","eventTime":{"timestampUTC":1413525601,"optional_timestampUTC":"timestampUTC"},"optional_eventTime":"eventTime"} ...
Is it possble to configure module to avoid "optional_" fields generation?
Thanks!
The text was updated successfully, but these errors were encountered: