|
1 | 1 | # openapi-python-client-action
|
2 |
| -GitHub Action to generate a python client package from an openapi spec |
| 2 | +The official GitHub Action for [openapi-python-client](https://github.com/triaxtec/openapi-python-client) - generates a modern Python client package from an OpenAPI document |
| 3 | + |
| 4 | +## Inputs |
| 5 | + |
| 6 | +### `openapi-python-client-version` |
| 7 | + |
| 8 | +The version of the openapi-python-client package to use. If unspecified the latest released version will be used. |
| 9 | + |
| 10 | +### `openapi-file` |
| 11 | + |
| 12 | +The path (with respect to the current directory/the workspace) to the OpenAPI document (both JSON and YAML are supported). Defaults to just "openapi.json" i.e. a file in the current directory called openapi.json. |
| 13 | + |
| 14 | +### `openapi-url` |
| 15 | + |
| 16 | +The url of the OpenAPI document. Overrides `openapi-file` - If unspecified the value of the `openapi-file` input (which defaults to just `openapi.json`) will be used to generate the client. |
| 17 | + |
| 18 | +### `config-file` |
| 19 | + |
| 20 | +The path (with respect to the current directory/the workspace) to the config.yml to be used with openapi-python-client. Configuaration is not required so if this is unspecified then no configuration will be passed along. See [openapi-python-client's README](https://github.com/triaxtec/openapi-python-client#configuration) for available configuration |
| 21 | + |
| 22 | +## Outputs |
| 23 | + |
| 24 | +No outputs are returned. |
| 25 | +The generated client is placed in the current directory. The name of the package (unless configured differently) will be `title-client` where "title" comes from the field with the same name within the `info` section of the openapi document. |
| 26 | + |
| 27 | +## Example usage |
| 28 | +```yaml |
| 29 | +jobs: |
| 30 | + generate-python-client: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + name: Example |
| 33 | + steps: |
| 34 | + |
| 35 | + # Checkout your code |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v2 |
| 38 | + |
| 39 | + # Generate your openapi document (if you don't write it manually) |
| 40 | + |
| 41 | + # Use the action to generate a client package |
| 42 | + # This uses all defaults (latest version, openapi.json in the current workspace, no configuration) |
| 43 | + - name: Generate Python Client |
| 44 | + uses: triaxtec/openapi-python-client-action@v1 |
| 45 | + |
| 46 | + # Do something with the generated client (likely publishing it somewhere) |
| 47 | + # Here we assume that the info/title in the openapi document was "example-project" |
| 48 | + - name: Do something with the client |
| 49 | + run: | |
| 50 | + cd example-project-client |
| 51 | +``` |
0 commit comments