Open jamesmanning opened 1 year ago
https://github.com/ccouzens/vcloud-rest-openapi/blob/main/36.3.json
Specifically via this url to the actual file: https://raw.githubusercontent.com/ccouzens/vcloud-rest-openapi/main/36.3.json
We might merge a workaround for this issue. In which case the links useful to this bug report will become:
https://github.com/ccouzens/vcloud-rest-openapi/blob/96d1afc005ab90cddf1d16d5c7073b679f714cd8/36.3.json and https://raw.githubusercontent.com/ccouzens/vcloud-rest-openapi/96d1afc005ab90cddf1d16d5c7073b679f714cd8/36.3.json
Very good point @ccouzens , I should have specified a commit-based version instead of the main branch version!
versions: NSwagStudio 13.19.0.0 NSwag 13.19.0.0 NJsonSchema 10.9.0.0 (Newtonsoft.Json v13.0.0.0)
NOTE: changing the mapping values so they're explicit schema refs (changing "Foo" to "#/components/schemas/Foo") is a viable workaround, so this isn't a blocker, just requires modifying the original openapi definition to make the mapping values explicit schema refs.
Was trying to use nswag to generate a client from this source:
https://github.com/ccouzens/vcloud-rest-openapi/blob/main/36.3.json
Specifically via this url to the actual file: https://raw.githubusercontent.com/ccouzens/vcloud-rest-openapi/main/36.3.json
nswag file contents:
It fails because (AFAICT) it takes the discriminator / mapping values and assumes they're schema references (I think, I may be misinterpreting the situation), so it tries to resolve the string value as a json path but there's no such external file.
Trying to use the csharp-netcore generator from openapi-generator seems to generate a client successfully.
AFAICT the issue is the spec allowing the mapping values to be either schema names or references
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#fixed-fields-21
where mapping is defined as
An object to hold mappings between payload values and schema **names or references**.
The example there includes a case where the mapping value is just the name of the schema
In this particular case, the mapping values aren't referencing external files, just names of existing schemas within the same document - specifically, this is the first problematic mapping entry that causes the error:
And the "ovf_AnnotationSection_Type" value it's referring to isn't a file, but an existing schema:
I'm not sure if the issue here is nswag or njsonschema, so I'm happy to move the issue if this is the wrong repository for it.
Thank you!