Extensions may need to control serialization and deserialization of literals beyond the types including in-box.
Modifications
Define LiteralConverter and LiteralConverter<T> abstract base types for converters
Create LiteralConverterRegistry for registering converters
Create converters for all currently supported types and register them automatically
Rewrite LiteralSerializer to use the singleton from LiteralConverterRegistry.Instance
Add System.Collections.Immutable as a dependency on generated SDKs when targeting downlevel frameworks to get access to FrozenDictionary
Breaking Changes
The namespace of LiteralSerializer is changed to XXX.Serialization.Literals in generated SDKs.
Results
A more extensible framework for extensions that want to support additional types in headers, path parameters, and query strings. A potential future use is an extension for NodaTime type support.
SDK consumers that need to customize serialization may also do so by mutating the public LiteralConverterRegistry.Instance.
Also fixes a bug deserializing nullable enums from literals.
Motivation
Extensions may need to control serialization and deserialization of literals beyond the types including in-box.
Modifications
LiteralConverter
andLiteralConverter<T>
abstract base types for convertersLiteralConverterRegistry
for registering convertersLiteralSerializer
to use the singleton fromLiteralConverterRegistry.Instance
System.Collections.Immutable
as a dependency on generated SDKs when targeting downlevel frameworks to get access toFrozenDictionary
Breaking Changes
The namespace of
LiteralSerializer
is changed toXXX.Serialization.Literals
in generated SDKs.Results
A more extensible framework for extensions that want to support additional types in headers, path parameters, and query strings. A potential future use is an extension for NodaTime type support.
SDK consumers that need to customize serialization may also do so by mutating the public
LiteralConverterRegistry.Instance
.Also fixes a bug deserializing nullable enums from literals.
Resolves #268 Fixes #267