-
-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Hi,
I'm using polymorphic deserialization in the context of generated data classes. The fact that everything is configured through Attributes is really helping in this case because it means the models are self sufficient, they don't need a companion class that allow well configured deserialization. I don't want to have to set the type by hand or anything, but I still need to serialize deserializable JSON though (with the discriminator property serialized) ...
I forked this projet and found that adding the JsonSubtypesByDiscriminatorValueConverter
like so achieves what I want :
[JsonConverter(typeof(JsonSubtypesByDiscriminatorValueConverter), typeof(Animal), "type")]
(I basically changed the visibility of the constructor in the fork)
I didn't know at the time the reason for this limitation, but from my experience (2 years of production code), I never experienced any problems with it.
Now I'm years later, and I need to use the fallback type attribute (what a relief that this thing exists). The Attribute isn't working with the above method, though creating a new constructor will achieve what I want.
Describe the solution you'd like
Is there a reason for this class to be strictly internal even though you can get a neat feature using it directly ?
Would you consider exposing it correctly (I mean in a "compliant with the API vision" way) ?
With the correct directions, I could file a PR
Describe alternatives you've considered
I would keep my fork ...