https://github.com/alexdemure/gadopenapiconverter
A CLI tool that generates HTTP clients from an OpenAPI specification
https://github.com/alexdemure/gadopenapiconverter
http-client openapi-client python-client python-openapi
Last synced: 5 days ago
JSON representation
A CLI tool that generates HTTP clients from an OpenAPI specification
- Host: GitHub
- URL: https://github.com/alexdemure/gadopenapiconverter
- Owner: AlexDemure
- License: mit
- Created: 2025-03-25T15:35:07.000Z (about 2 months ago)
- Default Branch: production
- Last Pushed: 2025-04-15T16:08:36.000Z (about 1 month ago)
- Last Synced: 2025-04-23T21:02:14.774Z (27 days ago)
- Topics: http-client, openapi-client, python-client, python-openapi
- Language: Python
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A CLI tool that generates HTTP clients from an OpenAPI specification.---
### Installation
```
pip install gadopenapiconverter
```### Usage
```sh
gadopenapiconverter --file {config.toml} --context "{}"
```#### General Structure
```
workdir = "myproject"[[specifications]]
path = "{{name}}.py"
content = "file:openapi.json"
client = "httpx"
model = "pydantic"
async = true
operations = [][[scripts]]
command = "isort {{workdir}}"
check = true
```### Sections Overview
| Section | Format | Description | | |
|----------------------|--------------------------------------|---------------------------------------------------------------------------------------|---|---|
| `workdir` | `""` | Uses the current directory | | |
| | `"myproject"` | Uses the current directory + `/myproject` | | |
| | `"/home/myproject"` | Uses an absolute path | | |
| `[[specifications]]` | | Defines file creation rules | | |
| | `mode = "a"` | File writing mode: `"a"` (append), `"w"` (overwrite) | | |
| | `path = "src/__init__.py"` | Relative to workdir, specifies file location. | | |
| | `content = """ ... """ / path / url` | Raw content, local file path, or URL for remote content. | | |
| | `model = "pydantic"` | Type of models created (pydantic, dataclasses, typing, msgspec) | | |
| | `client = "httpx"` | Type of http-client created (requests, httpx, aiohttp, urllib, urllib3, http.client) | | |
| | `async = "true"` | Type of methods (true, false) | | |
| | `operations = []` | Filtering methods by operation_id | | |
| `[[scripts]]` | | Defines commands to be executed after generation. | | |
| | `command = "isort {{workdir}}"` | Command to execute, supports dynamic variables. | | |
| | `check = True\False"` | If true, raises an error if the command fails, otherwise logs output. | | |