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 hashes)
Built Distribution
Close
Hashes for openapi_ts-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3442191d48b498cb38dcc40d9130c84a718a79f0201739d7b3d739488ed09c2 |
|
MD5 | f924a72426e780a0fdab11512f29e805 |
|
BLAKE2b-256 | 431166948b26f2c2bc1599917c6ddf3e4f57d4fdeed5d03865ce374ff888d0cf |