RicoSuter / NJsonSchema

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

One or more errors occurred. (Could not resolve the path '#/constraints/pricing'.) #559

Open gerrydodd opened 6 years ago

gerrydodd commented 6 years ago

Hi Using the following code I am getting the above error.

var schema2 = await NJsonSchema.JsonSchema4.FromUrlAsync("https://realtime-listings.webservices.zpg.co.uk/docs/latest/schemas/listing/update.json");

If I download the update.json schema and remove the lines (just removing the first line then has an error on the second line /constraints/price_per_unit_area) . { "$ref" : "#/constraints/pricing" }, { "$ref" : "#/constraints/price_per_unit_area" },

I am using the following code in this case, var schema2 = await NJsonSchema.JsonSchema4.FromFileAsync(fileLocation);

I can then go ahead and create the c# class, but without the "$ref" Lines. var generator = new NJsonSchema.CodeGeneration.CSharp.CSharpGenerator(schema2); var code = generator.GenerateFile();

It would be nice to be able to just run the schema through without having to edit it. The Schema is available at the above URL, or I can upload it. The Schema does seem to be valid.

Please could you Look into this.

Thanks

Gerry

RicoSuter commented 6 years ago

Same issue as: https://github.com/RSuter/NJsonSchema/issues/450

The property constraints is not a known property (it seems to be a dictionary of key/schema) and thus it is not serialized to a schema dictionary and cannot be resolved...