Skip to main content

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 x openapi-ts in 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openapi_ts-0.1.4-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

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

Hashes for openapi_ts-0.1.4.tar.gz
Algorithm Hash digest
SHA256 75940f184173de3c67c05c41e4a4f10ec03ddee5c79b8f46168cfdb572b3e149
MD5 1278faf1e529656b170dcfb6b11d635c
BLAKE2b-256 bdf858162aa03e81a2655b8dfb5900902f453853884351a1846371a0e6c319ac

See more details on using hashes here.

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

Hashes for openapi_ts-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7a6e755943ee1e42bd102715402154ddc0325941901db1e36a27de670589ee21
MD5 2fef26c089d44d315411c8a0624d12cc
BLAKE2b-256 1373127dd9df9cb2df5228f1494f961e6b4f7735903f1dc7c84f2b7cf7cacee9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page