-
-
Notifications
You must be signed in to change notification settings - Fork 229
Can't generate new project with OpenAPI JSON file #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting the issue @Gelbpunkt, the problem actually isn't that the generator doesn't support JSON, YAML is a superset of JSON so YAML parsers naturally also parse JSON. In fact, if I run your JSON through a reformatter it suddenly starts parsing just fine. There's clearly still a bug here in that the parser sure doesn't like that JSON Which appears to be perfectly valid. I'm going to poke at this a while and see if I can come up with a minimal reproducible example to narrow down where the bug is. For now |
Interestingly if I run the generator from source I also don't get #479, only when I run the installed-in-pipx version against the reformatted JSON. |
Well that is not really the case. JSON supports tab as whitespace, but yaml don't. yaml will not parse it:
|
Interesting, perhaps this is a bug in the YAML parser then because YAML should support tabs in the JSON-like flow syntax. |
…509, #515]. Thanks @tardyp and @Gelbpunkt! (#515) Co-authored-by: Pierre Tardy <[email protected]>
Thanks for the report @Gelbpunkt and the fix @tardyp! Fix is on |
Describe the bug
The generator expects a YAML file, and doesn't work with JSON files, despite all examples using JSON files.
To Reproduce
Steps to reproduce the behavior:
openapi-python-client generate --url https://raw.githubusercontent.com/Nadybot/Nadybot/unstable/html/api.json
Expected behavior
I expect it to load the file with JSON if YAML fails.
openapi_python_client/__init__.py
in_get_document
only attempts to load with YAML, replacingyaml.safe_load(yaml_bytes)
withjson.loads(yaml_bytes)
"fixes" this issue.OpenAPI Spec File
https://raw.githubusercontent.com/Nadybot/Nadybot/unstable/html/api.json
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: