Open alexbutler-iress-zz opened 5 years ago
Although, the ContainsKey is case sensitive, and I'm not entirely sure if JObject.AddFirst is case-sensitive. So this maybe a factor in considering the solution.
I’d say it’s a “bug” if the discriminator is already set. What is the scenario here?
We have address objects, UKAddress, OverseasAddress and more, they all extend Address
. They are differentiated by a property called AddressType, which we intend to be the discriminator.
The way the contract generation has happen, and the code-gen has happened on the other side, we get an Address object with no properties and several specialisations of address, each with an AddressType, and annoyingly each with their own version of the enumeration for AddressType.
When trying to use inheritance where the discriminator already exists on the object definition, the templated inheritance converter doesn't check for it. Simple one-line if check would fix this I believe.
Please note, the above is currently untested.