Replies: 2 comments
-
This would probably need to be a configurable setting. Depending on API conventions, omitting these values is a breaking change from a consumer point of view. Happy to accept a PR that adds this behaviour 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey @frankdejonge! 👋 Since #85 and a couple other PR's were merged, can you please release a new version? Thanks in advance 🙏 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to propose to omit null values from the serialized payload, where null values are currently included.
Motivation
Omitting null values from the serialized payload can make working with the payload more straightforward, since there's no need to distinguish between a null value and the absence of a property. This approach also aligns better with schema specifications (like JSON Schema, Avro, Protobuf), which don't have native nullability concepts. These specifications naturally handle absent fields, while null values require additional constructs like union types or wrapper types.
Additionally, consumers written to handle absent properties are more adaptive to payload evolution, making the overall system more compatible across versions and integrations.
Other benefits
This change would also reduce the payload size and remove the overhead of recursively filtering out null values from the payload in the case of validating the payload against a schema, which can be quite heavy performance-wise.
I would love to have your thoughts on this, @frankdejonge! 🙏
Beta Was this translation helpful? Give feedback.
All reactions