Comments (2)
Looks like there might be an option to tell Protobuf to include default value fields for the JSON ouptut https://stackoverflow.com/questions/31021797/protobuf-doesnt-serialize-default-values and https://protobuf.dev/reference/cpp/api-docs/google.protobuf.util.json_util/#JsonPrintOptions. Would you be up for submitting a PR?
I'm afraid it's not trivial to do the same for DebugString
.
from gz-transport.
@azeey My main reason to report the issue was just to make sure that this is normal behavior, and not a symptom of some other, underlying problem.
And indeed it turns out to be default and well documented behavior of protobuf, see this application note and this discussion.
There's an optional
keyword since protoc 3.12 (flag --experimental_allow_proto3_optional
) and 3.15 (no longer experimental), to indicate Explicit Presence
.
I did a test per these implementation instructions:
- Add this to Generator.hh:
uint64_t GetSupportedFeatures() const override {
return FEATURE_PROTO3_OPTIONAL;
}
-
Add
optional
keyword tofloat data
in float.proto -
Pass
--experimental_allow_proto3_optional
flag to protoc during build (I put it in a script as I don't know a better way):
colcon build --merge-install --packages-select gz-msgs9 --cmake-args -DPROTOC_EXEC=/tmp/protoc-exp
This works fine:
gz topic -t /foo -m gz.msgs.Float -p 'data:0.0'
gz topic -e -t /foo
data: 0
So that seems a possible resolution.
Anyway, as there is no real functional impact (other than the 0 values not being echoed), I close this issue.
from gz-transport.
Related Issues (20)
- `gz service -l` does not always output the full list of services HOT 2
- Compatibility with protobuf 22 (4.22) or later HOT 3
- :woman_farmer: Build regression on `gz-transport-13-debbuilder` error with ` fatal error: gz/math/AxisAlignedBox.hh: No such file or directory` HOT 4
- The gz::transport::Node construction is throwing exception out_of_range HOT 1
- Possible race condition in TopicInfo HOT 1
- Parameters implementation should use fully qualified protobuf message type names
- `gz topic -p` publishes an empty message even when the input message to publish is invalid HOT 2
- Add -h option to gz topic command line HOT 2
- Update "Using custom Protobuf messages"
- Missing messages shared inside docker container HOT 2
- Service requester starting before responder causes timeout when both are in the same process
- `gz service -r` should not require `--reqtype` and `--reptype`
- `gz service -r` should not require specifying a dummy message if the request type is `Empty` HOT 4
- Optional `--timeout` flag in `gz service -r`
- Provide a tool to diagnose network setup issues
- Service request should not be received after the requester has timed out
- Error build ignition-transport8 HOT 1
- :farmer: Gz-transport12-homebrew `UNIT_gz_TEST gzTest.TopicInfo` failing
- :farmer: Gz-transport11-homebrew `UNIT_gz_TEST ignTest.TopicInfo` failed HOT 1
- ModuleNotFoundError: No module named 'gz' HOT 4
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 gz-transport.