Skip to content

Can't generate new project with OpenAPI JSON file #488

Closed
@Gelbpunkt

Description

@Gelbpunkt

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:

  1. openapi-python-client generate --url https://raw.githubusercontent.com/Nadybot/Nadybot/unstable/html/api.json
  2. See error message about invalid YAML

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, replacing yaml.safe_load(yaml_bytes) with json.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):

  • OS: Fedora 34
  • Python Version: 3.9.6
  • openapi-python-client version 0.10.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions