Refinement of serialization options #837
Merged
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 makes a cleanup pass on a number of issues related to serialization prior to the launch of the new interfaces in v0.17.
First of all, the model definitions used to define a schema now expect
serializationOptions
anddeserializationOptions
to be shortened to simplyserialization
anddeserialization
:The old names are deprecated for now, but won't be supported in v0.18.
This change clears the way for a sibling set of options,
validation
, to be included in a very symmetrical and ergonomic way.Along the lines of introducing validation concepts, this PR also removes the option
disallowNull
as a base serialization option in favor of encouraging this kind of check in validators instead. IMO this option added unnecessary complexity to every serializer and makes much more sense in a validation layer. Since this option was only supported for a few beta releases, I'm not going to go through the full deprecation process. I want it gone by v0.17 final.One last change is related to typings for serializers. The
Serializer
andSerializerClass
interfaces now better use generics and default to unknowns, eliminating the need for the awkward interfacesUnknownSerializer
andUnknownSerializerClass
.Apologies for some of the churn as I try to stabilize serialization concepts and typings before v0.17 final.