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
fastapi
xopenapi-ts
in the FastAPI docs - For configuration and more of
openapi-ts
, see their website
Project details
Release history Release notifications | RSS feed
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.3.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file openapi_ts-0.1.3.tar.gz
.
File metadata
- Download URL: openapi_ts-0.1.3.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93c261159b6a9a5404aecf3620ad799872111698b318adfb809854299b450db0 |
|
MD5 | 3b15f1fdd3b7341438fe079d011ed071 |
|
BLAKE2b-256 | 6125b8825674c3ecab7e30c205f0cc9d654551e77d96792c9f492349435e29d6 |
File details
Details for the file openapi_ts-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: openapi_ts-0.1.3-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3442191d48b498cb38dcc40d9130c84a718a79f0201739d7b3d739488ed09c2 |
|
MD5 | f924a72426e780a0fdab11512f29e805 |
|
BLAKE2b-256 | 431166948b26f2c2bc1599917c6ddf3e4f57d4fdeed5d03865ce374ff888d0cf |