Skip to content

undefined instead of null for default values #80

Description

@kjvalencik

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions