Add support for JSON type discriminators #16
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 extends class generation to support OpenAPI-style type discriminators.
This pattern is recognized by NJsonSchema, and its code generation framework already provides templates for implementing a
JsonInheritanceConverter
class andJsonInheritanceAttribute
which can be used to annotate generated classes with arbitrary discriminator properties and type mappings.A simple unit test for polymorphic deserialization of a discriminated type is provided.
Fixes #7