introduce GenericTriStateModule<T> as a base of tristate (undefined | null | value) serde.
fixes #107
Context
There are times where users need to model an API that need differentiate between:
absence of a field
presence of a field in json, but being set to null
presence of a field in json, with a value set
Option is a very specific case of the above where both absence and presence of a field with a null value indicates a None.
However it's important to note that these generalizations sometimes do not apply. For instance for PATCH endpoints where null means remove, and undefined means do nothing. In this PR we're extracting out this functionality as a separate module that users will be able to customize to support their requirements accordingly.
An example usage of the GenericTriStateModule<T> to form an option module is as follows:
In this PR
GenericTriStateModule<T>
as a base of tristate (undefined | null | value) serde.fixes #107
Context
There are times where users need to model an API that need differentiate between:
Option is a very specific case of the above where both absence and presence of a field with a null value indicates a
None
. However it's important to note that these generalizations sometimes do not apply. For instance for PATCH endpoints where null means remove, and undefined means do nothing. In this PR we're extracting out this functionality as a separate module that users will be able to customize to support their requirements accordingly.An example usage of the
GenericTriStateModule<T>
to form an option module is as follows:Out of scope