RicoSuter / NJsonSchema

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

OpenAPI Spec Schema References Another Schema and Erroneously Throws Exception For Duplicate Property Name #1422

Open cculver opened 3 years ago

cculver commented 3 years ago

I'm working with an OpenAPI spec that is encountering errors where NJsonSchema determines if duplicate keys are present. In the spec, located here: https://developer.apiture.com/docs/apis/accounts/v0.67.0/openapi.json, there are two issues NJsonSchema encounters. The spec defines a schema named summaryExternalAccount. The schema includes a reference to another schema, abstractResource, which in turn includes a reference to yet another schema, abstractRequest, which defines a property called _embedded. Returning back to the summaryExternalAccountSchema, we find that this includes a further refined (but compatible) definition of _embedded. NJsonSchema does a nice job of pulling in the references, but fails to merge the compatible and identically-named _embedded properties. I'm having to hack in a fix for now, but it would be nice if we could fix this because other tools competing with NSwag are able to successfully process the OpenAPI spec.

cculver commented 2 years ago

Found a related PR - https://github.com/RicoSuter/NJsonSchema/pull/1228/files#diff-67995a49d2f5ec6ed3d828608c7aad8757e313e31421427e586bebd26684bd0dR250

sdi-apmm commented 2 months ago

Any chance this could get fixed? this is such a needed implementation. It makes no sense this PR has been opened for 4 years when a lot of people have been making posts regarding this issue