forked from loafle/openapi-generator-original
Resolving an issue with serializing classes that contain required properties. When the only constructor has defaulted parameters, no parameterless constructor is generated but JSON.Net attempts to call the missing constructor on deserialization (because of DataContract). See: https://manski.net/2014/10/net-serializers-comparison-chart/ The fix here is to create a protected constructor, annotate it with JsonConstructorAttribute to inform JSON.Net it is the constructor to use during serialization, then provide settings that explicitly allow JSON.Net to access non-public constructors during serialiazation.