Skip to content

FelixTheC/openapi-fastapi-client

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages