Allow values to be 'null' for types with a defined custom wrapper #1272
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR would give the ability to pass null for a property as long as a custom wrapper is defined for it. If a protobuf wrapper exists then the converter only checks for
undefined
rather thanundefined
ornull
.This is a breaking change because it changes behavior for objects serialized with null values on fields that have an existing protobuf wrapper. This could potentially be addressed with an added configuration option to enable this behavior.
Use Case
We would like to make message fields 'nullable' so that the grpc client can overwrite columns in our database with null. The only way to currently accomplish this is make every message field a non-primitive type that we can check for null values. We would like to add protobuf wrappers to handle the serialization and deserialization of the fields but currently this is not possible because all null values are filtered out.
Message:
Protobuf Wrapper:
This use case is also dependent on Pull Request 1271 in order to be able to pass
string | null
as the property value and not fail the object check.