Generate typescript clients for OpenAPI (e.g. FastAPI) apps, using openapi-ts
Project description
Openapi Ts
Generate typescript clients for OpenAPI (e.g. FastAPI) apps, using openapi-ts
Usage
Make sure you have openapi-ts installed:
npm -g i @hey-api/openapi-ts
from fastapi import FastAPI
from pydantic import BaseModel
from openapi_ts import generate_client
# define your app
app = FastAPI(generate_unique_id_function=lambda route: route.name)
class User(BaseModel):
name: str
email: str
@app.get('/users')
def get_users(how_many: int | None = None) -> list[User]:
...
# generate client
generate_client(app.openapi(), 'path/to/client')
Read more
- See a full walkthrough of
fastapixopenapi-tsin the FastAPI docs - For configuration and more of
openapi-ts, see their website
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
openapi_ts-0.1.4.tar.gz
(2.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openapi_ts-0.1.4.tar.gz.
File metadata
- Download URL: openapi_ts-0.1.4.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75940f184173de3c67c05c41e4a4f10ec03ddee5c79b8f46168cfdb572b3e149
|
|
| MD5 |
1278faf1e529656b170dcfb6b11d635c
|
|
| BLAKE2b-256 |
bdf858162aa03e81a2655b8dfb5900902f453853884351a1846371a0e6c319ac
|
File details
Details for the file openapi_ts-0.1.4-py3-none-any.whl.
File metadata
- Download URL: openapi_ts-0.1.4-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a6e755943ee1e42bd102715402154ddc0325941901db1e36a27de670589ee21
|
|
| MD5 |
2fef26c089d44d315411c8a0624d12cc
|
|
| BLAKE2b-256 |
1373127dd9df9cb2df5228f1494f961e6b4f7735903f1dc7c84f2b7cf7cacee9
|