RicoSuter / NJsonSchema

JSON Schema reader, generator and validator for .NET
http://NJsonSchema.org
MIT License
1.4k stars 535 forks source link

Fields are only generated for some classes. #1575

Open tkdogan opened 1 year ago

tkdogan commented 1 year ago

I am new to JSON Schemas and would like to generate C# code from a given JSON Schema, but I am having trouble getting useful code out of the NJsonSchema code generator. It works for some classes but not for others. I skimmed through the settings NJsonSchema offers but could not find anything that seemed to be related to my problem.

I am attaching a simplified example here. The "BuildingSurface:Detailed" property seems to give me what I need but the "Building" is converted to a generic object, and no "Building" class is generated in C#. Any pointers would be greatly appreciated.

schema_code_example.zip

A more minor issue is that the "BuildingSurface:Detailed" class is named to "Anonymous" instead of something like "BuildingSurfaceDetailed". Is it possible to have it pick up the property name used in the Schema?