NJsonSchema icon indicating copy to clipboard operation
NJsonSchema copied to clipboard

NJsonSchema is not producing valid C#

Open spierepf opened this issue 2 years ago • 0 comments

When I generate C# from either of the attached json schema files

position_schema.json.txt flightplan_schema.json.txt

the resulting C# gives me several ambiguity errors around _additionalProperties. I'm not sure why these entries are being generated.

I've tried adding additonalProperties:false to the schema as suggested in https://www.thecodebuzz.com/csharp-class-json-schema/comment-page-1/#comment-12531

And even added:

    schemaFromFile.AllowAdditionalProperties = false;
    foreach (var schema in schemaFromFile.AllInheritedSchemas)
    {
        schema.AllowAdditionalProperties = false;
    }

to my code. But no matter what I do I'm getting these entries, and the resulting code does not compile...

spierepf avatar Jun 06 '22 15:06 spierepf