-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Type descriminator keys and casing #857
Comments
I can change the wiki example to be something other than objecttype as the key so it is a little more clear. Is that what you are looking for? |
@EdwardCooke it just wasn't obvious when configuring which property name to match on, that casing would play a role in the match. It doesn't really matter whether the c# object property name is called "Type" "ObjectType" or something else, if your yaml deserialiser is using different casing to whats in the yaml, it won't match. Maybe just a comment to explain the property name is case sensitive would be beneficial ;-) |
I'll do that when I get a minute. |
Comment is added to the docs. |
I followed the wiki example to configure type descriminator:
But notice that I am passing in "Type" as the descrimator key, but am also using
CamelCaseNamingConvention
- as such the deserialiser was erroring - saying it can't construct an abstract type (i.e the base type).It took me a while to figure out what was going on, so I wonder if there is a more elegant way to handle the matching of this key.
From the wiki example I should have twigged that there must have been a reason why you use the string literal "ObjectType" rather than
nameof(BaseType.ObjectType)
and now I know why ;-)To Reproduce
As above
The text was updated successfully, but these errors were encountered: