Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for JSON type discriminators #16

Merged
merged 3 commits into from
Jan 6, 2024
Merged

Conversation

glopesdev
Copy link
Member

@glopesdev glopesdev commented Jan 6, 2024

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 and JsonInheritanceAttribute 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

@glopesdev glopesdev added the feature New planned feature label Jan 6, 2024
@glopesdev glopesdev merged commit da2ce9d into main Jan 6, 2024
@glopesdev glopesdev deleted the discriminator-dev branch January 6, 2024 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New planned feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for discriminated Union types
1 participant