Many of our protobuf objects end up being eventually serialized as JSON. Currently, message fields have default values of null, which gets serialized into the result.
This is problematic because most specs for defining schema in JSON (e.g., swagger) define optional fields as being omitted from the result. This forces the need to prune null values before serialization in order to adhere to spec.
What are your thoughts on changing the default value of these types to undefined? What about a compile time option for deciding?
pbf --default-defined ./thing.proto
Many of our protobuf objects end up being eventually serialized as JSON. Currently, message fields have default values of
null, which gets serialized into the result.This is problematic because most specs for defining schema in JSON (e.g., swagger) define optional fields as being omitted from the result. This forces the need to prune
nullvalues before serialization in order to adhere to spec.What are your thoughts on changing the default value of these types to
undefined? What about a compile time option for deciding?