Open mhording opened 2 years ago
Might be related https://github.com/RicoSuter/NJsonSchema/pull/1098 , but the test case for that external reference resolving does pass...
Can the problem be that the http://namespace.lantmateriet.se/distribution/produkter/fault/v1/fault-1.0.json#/definitions/fault seems to be self-referencing?
$ref": "#/definitions/fault",
Thats a bit odd. I have mailed the providers of the schema and asked them if this is correct.
I got a response now. They are saying "the only reference in the fault schema is the root, which is refering to a section in the schema where the fault object is defined. It s an unneccesary extra step, since the schema only contains one object which itself could be placed under the root, but it is not an error".
Just a reminder to my future self: remember to look at the inner exception. In my case, the external referenced schema was not valid.
Im using the schema found at http://namespace.lantmateriet.se/distribution/produkter/fastighetsamfallighet/v3/fastighet-samfallighet-3.0.0.json and trying to generate c# code from it.
It allways crashes on the external references it seems, with this error message: System.InvalidOperationException: Could not resolve the JSON path 'http://namespace.lantmateriet.se/distribution/produkter/fault/v1/fault-1.0.json#/definitions/fault' with the full JSON path 'http://namespace.lantmateriet.se/distribution/produkter/fault/v1/fault-1.0.json#/definitions/fault'. ---> System.InvalidOperationException: Could not resolve the path '#/definitions/fault'
This message is from nswag, but i got basically the same message when i tried to use the njsonschema nuget package to generate code from this schema.
Should the package not be able to resolve external references?