openapi-fastapi-client

A tool to autogenerate FastApi Clients from given openapi.yaml.


Keywords
openapi, pydantic, python3, fastapi, openapi3, typer
License
MIT
Install
pip install openapi-fastapi-client==0.2.0

Documentation

Python 3.10 Python application Code style: black Imports: isort

Openapi yaml file to FastApi Client

A commandline tool to generate Api functions and their required pydantic Model Schema from an openapi.yaml of version 3

Installation

pip install openapi-fastapi-client

Usage

openapi-fastapi-client ./openapi.yaml ./my-client
openapi-fastapi-client ./openapi.yaml ./my-client --async
  • this will generate under the folder my-client following files
    • __init__.py if not exists
    • api.py here are all function calls to the external api
    • schema.py here are all pydantic Models

Arguments

  • OPENAPI_FILE [required]
  • OUTPUT_PATH [required]

Options

  • --sync All requests to the client are synchronous. default
  • --async All requests to the client are asynchronous with aiohttp.

Help

openapi-fastapi-client --help