|
1 | 1 | # openapi-python-client
|
2 |
| - |
3 |
| -## Purpose |
4 | 2 | Generate modern Python clients from OpenAPI
|
5 | 3 |
|
6 |
| -## Release Process |
7 |
| -1. Start a release with Git Flow |
8 |
| -1. Update the version number in `pyproject.toml` with `poetry version <rule>` |
9 |
| -1. Ensure all requirements are pointing to released versions |
10 |
| -1. Add the release date to the new version in [CHANGELOG.md] |
11 |
| -1. Commit and push any changes |
12 |
| -1. Create a pull request from the release branch to master |
13 |
| -1. Get approval from all stakeholders |
14 |
| -1. Ensure all checks pass (e.g. CircleCI) |
15 |
| -1. Open and merge the pull request |
16 |
| -1. Create a tag on the merge commit with the release number |
| 4 | +**This project is still in early development and does not support all OpenAPI features** |
| 5 | + |
| 6 | +## Why This? |
| 7 | +The Python clients generated by openapi-generator support Python 2 and therefore come with a lot of baggage. This tool |
| 8 | +aims to generate clients which: |
| 9 | +1. Use all the latest and greatest Python features like type annotations and dataclasses |
| 10 | +1. Don't carry around a bunch of compatibility code for older version of Python (e.g. the `six` package) |
| 11 | +1. Have better documentation and more obvious usage instructions |
| 12 | + |
| 13 | +Additionally, because this generator is written in Python, it should be more accessible to contribution by the people |
| 14 | +using it (Python developers). |
| 15 | + |
| 16 | +## Installation |
| 17 | +`pip install openapi-python-client` |
| 18 | + |
| 19 | +## Usage |
| 20 | +`openapi-python-client generate --url https://my.api.com/openapi.json` |
| 21 | + |
| 22 | +This will generate a new client library named based on the title in your OpenAPI spec. For example, if the title |
| 23 | +of your API is "My API", the expected output will be "my-api-client". If a folder already exists by that name, you'll |
| 24 | +get an error. |
| 25 | + |
| 26 | +## What You Get |
| 27 | +1. A `pyproject.toml` file with some basic metadata intended to be used with [Poetry]. |
| 28 | +1. A `README.md` you'll most definitely need to update with your project's details |
| 29 | +1. A Python module named just like the auto-generated project name (e.g. "my_api_client") which contains: |
| 30 | + 1. A `client` module which will have both a `Client` class and an `AuthenticatedClient` class. You'll need these |
| 31 | + for calling the functions in the `api` module. |
| 32 | + 1. An `api` module which will contain one module for each tag in your OpenAPI spec, as well as a `default` module |
| 33 | + for endpoints without a tag. Each of these modules in turn contains one function for calling each endpoint. |
| 34 | + 1. A `models` module which has all the classes defined by the various schemas in your OpenAPI spec |
| 35 | + |
| 36 | +## OpenAPI features supported |
| 37 | +1. All HTTP Methods |
| 38 | +1. JSON and form bodies, path and query parameters |
| 39 | +1. float, string, int, datetimes, string enums, and custom schemas or lists containing any of those |
| 40 | +1. html/text or application/json responses containing any of the previous types |
| 41 | +1. Bearer token security |
| 42 | + |
17 | 43 |
|
18 | 44 | ## Contributors
|
19 | 45 | - Dylan Anthony <[email protected]> (Owner)
|
20 | 46 |
|
21 | 47 |
|
22 | 48 | [CHANGELOG.md]: CHANGELOG.md
|
| 49 | +[Poetry]: https://python-poetry.org/ |
0 commit comments