Quick start
Make sure you have the latest version of openapi-python-generator
installed.
pip install openapi-python-generator --upgrade
Successfully installed openapi-python-generator
To call the generator, simply pass the OpenAPI spec (as a link or to a file), and an output folder. Optionally you can also pass the library you would like to use.
openapi-python-generator https://raw.githubusercontent.com/MarcoMuellner/openapi-python-generator/main/tests/test_data/test_api.json testclient
Generating data from https://raw.githubusercontent.com/MarcoMuellner/openapi-python-generator/main/tests/test_data/test_api.json
This will generate a folder called testclient, with the following structure (using the file above):
- models
- __init__.py
- HTTPValidationError.py
- RootResponse.py
- Team.py
- User.py
- ValidationError.py
- EnumComponent.py
- services
- __init__.py
- async_general_service.py
- general_service.py
- __init__.py
- api_config.py
To use it, simply import the module and call the functions:
from testclient import root__get
root__get() # Returns a RootResponse object
If you'd like more info, do check out our Tutorial or the API Reference.