Metadata-Version: 2.1
Name: openapi-ts
Version: 0.1.1
Summary: Generate typescript clients for OpenAPI (e.g. FastAPI) apps, using openapi-ts
Author-email: Marcel Claramunt <marcel@moveread.com>
Project-URL: repo, https://github.com/moveread/REPO.git
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Openapi Ts

> Generate typescript clients for OpenAPI (e.g. FastAPI) apps, using openapi-ts

## Usage

Make sure you have `openapi-ts` installed:
  
```bash
npm -g i @hey-api/openapi-ts
```

```python
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` x `openapi-ts` in the [FastAPI docs](https://fastapi.tiangolo.com/advanced/generate-clients/#generate-a-typescript-client)
- For configuration and more of `openapi-ts`, see their [website](https://github.com/hey-api/openapi-ts)
