Generate modern Python clients from OpenAPI 3.x documents.
This generator does not support OpenAPI 2.x FKA Swagger. If you need to use an older document, try upgrading it to version 3 first with one of many available converters.
This project is still in development and does not support all OpenAPI features
The Python clients generated by openapi-generator support Python 2 and therefore come with a lot of baggage. This tool aims to generate clients which:
- Use all the latest and greatest Python features like type annotations and dataclasses
- Don't carry around a bunch of compatibility code for older version of Python (e.g. the
sixpackage) - Have better documentation and more obvious usage instructions
Additionally, because this generator is written in Python, it should be more accessible to contribution by the people using it (Python developers).
I recommend you install with pipx so you don't conflict with any other packages
you might have: pipx install openapi-python-client.
Better yet, use pipx run openapi-python-client <normal params / options> to always use the latest version of the generator.
You can install with normal pip if you want to though: pip install openapi-python-client
Then, if you want tab completion: openapi-python-client --install-completion
openapi-python-client generate --url https://my.api.com/openapi.json
This will generate a new client library named based on the title in your OpenAPI spec. For example, if the title of your API is "My API", the expected output will be "my-api-client". If a folder already exists by that name, you'll get an error.
openapi-python-client update --url https://my.api.com/openapi.json
For more usage details run
openapi-python-client --helpor r