Comments (3)
to check with official protoc implement, the "optional oneof name" is "_field", so change name to fit it.
from lua-protobuf.
I see prefix is changed:
{"eventId":"175d252a-fd72-4e01-8260-88929a9b2aa9","_eventId":"eventId", "eventTime":{"timestampUTC":1413525601,"_timestampUTC":"timestampUTC"},"_eventTime":"eventTime"}
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.
When I serialize the same object to json in java using com.google.protobuf.util.JsonFormat.Printer, I have no "_"-prefixed fileds generated.
Is it possible to implement it some way?
May be new option like "enable_proto3_optional_fields_generation=false"?
UPD: 'oneof' is not used in my proro file at all.
...
message ZonedTime {
// Seconds since 1970-01-01 midnight UTC. For \"2022-03-22 16:47:37 (MSK)\":
optional int32 timestampUTC = 516260016;
// Optional. TZ name
optional string zone = 3744684;
}
message Event {
// The identifier of the notification.
optional string eventId = 302760621;
optional ZonedTime eventTime = 31415431;
}
from lua-protobuf.
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.
from lua-protobuf.
Related Issues (20)
- 希望支持 oneof 的 DefaultMessageDecoding HOT 1
- bad argument #1 to 'encode' (type 'Person' does not exists) HOT 8
- pb.so causes nginx to segfault HOT 4
- 循环引用场景下会导致stack overflow HOT 1
- pb.decode() 导致 out of memory HOT 1
- pb中uint64过长, 在decode时会被科学计数法 HOT 1
- pb.decode 问题。 HOT 1
- Option name expected
- Proto - JSON transcoder HOT 2
- nested message with default values regression HOT 1
- pb.encode double/float 类型数据,在C++里ParseFromString会有问题。 HOT 2
- Decode to a temporary message to extract or change data
- Segfaults with gcc 13 and `-fstrict-aliasing` HOT 12
- 请问下java的.proto文件存在import引用其它文件如何加载 HOT 1
- Running on ESP32: load() function not working HOT 3
- what causes change in state? HOT 1
- loading fail. HOT 1
- Name resolution is failing HOT 2
- ASAN下报内存泄漏 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-protobuf.