openapi2jsonschema icon indicating copy to clipboard operation
openapi2jsonschema copied to clipboard

$ref in generated files are mixed case, but generated files are lower case

Open jonahgraham opened this issue 3 years ago • 2 comments

The files generated by the tool are all lowercase file names because of this .lower() (and the subsequent ones?):

https://github.com/instrumenta/openapi2jsonschema/blob/d697cbff8a25f520e125e3a5f79cb4e9b972e8ce/openapi2jsonschema/command.py#L130

But the $refs are the case of the input, in my case mixed case:

https://github.com/instrumenta/openapi2jsonschema/blob/d697cbff8a25f520e125e3a5f79cb4e9b972e8ce/openapi2jsonschema/command.py#L222

The result is a schema that doesn't load properly.

This tool pretty much did exactly what I needed, thanks!

As a workaround, I lowercased the $ref lines in all the json files.

jonahgraham avatar Nov 02 '22 23:11 jonahgraham

This is the sed I use after running the generator:

sed -i '-es,\($ref.*\),\L\1,' schemas/*.json

jonahgraham avatar Nov 02 '22 23:11 jonahgraham

Previously: #20 and #40, also related #25 and #26

artob avatar May 14 '25 06:05 artob