https://github.com/openapi-generators/openapi-python-client-action
GitHub Action to generate a python client package from an openapi spec
https://github.com/openapi-generators/openapi-python-client-action
Last synced: 10 months ago
JSON representation
GitHub Action to generate a python client package from an openapi spec
- Host: GitHub
- URL: https://github.com/openapi-generators/openapi-python-client-action
- Owner: openapi-generators
- License: mit
- Created: 2021-01-14T15:38:47.000Z (about 5 years ago)
- Default Branch: v2
- Last Pushed: 2024-10-23T16:07:27.000Z (over 1 year ago)
- Last Synced: 2025-03-27T16:56:11.352Z (10 months ago)
- Language: Shell
- Size: 12.7 KB
- Stars: 9
- Watchers: 2
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openapi-python-client-action
The official GitHub Action for [openapi-python-client](https://github.com/openapi-generators/openapi-python-client) - generates a modern Python client package from an OpenAPI document
## Inputs
### `openapi-python-client-version`
The version of the openapi-python-client package to use. If unspecified the latest released version will be used. **Version 2 of this action only supports version 0.9.0+ of the generator. Use version 1 of this action for older versions of the generator.**
### `openapi-file`
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.
### `openapi-url`
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.
### `config-file`
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/openapi-generators/openapi-python-client#configuration) for available configuration
### `extra-args`
This is a catch-all to allow you to pass additional arguments to `openapi-python-client`.
## Outputs
No outputs are returned.
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.
## Example usage
```yaml
jobs:
generate-python-client:
runs-on: ubuntu-latest
name: Example
steps:
# Checkout your code
- name: Checkout
uses: actions/checkout@v2
# Generate your openapi document (if you don't write it manually)
# Use the action to generate a client package
# This uses all defaults (latest version, openapi.json in the current workspace, no configuration)
- name: Generate Python Client
uses: openapi-generators/openapi-python-client-action@v2
# Do something with the generated client (likely publishing it somewhere)
# Here we assume that the info/title in the openapi document was "example-project"
- name: Do something with the client
run: |
cd example-project-client
```