Skip to content

Accessing the JSON type discriminator in the deserialized type #110817

Answered by pinkfloydx33
Arthri asked this question in Q&A
Discussion options

You must be logged in to vote

There's been a few issues open on this. Having a physical property that corresponds to metadata properties (like type discriminator) is not currently supported.

We originally wanted to do the same thing as you. For a while we just fell back to an abstract get-only property that was json ignored that all subclasses must implement. We eventually dropped that approach and just used type checks as the actual value of the discriminator was unimportant to us (as long as we could differentiate objects of the base type we were happy)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Arthri
Comment options

Answer selected by Arthri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants