Skip to content

An example project for generating an FastAPI Python server from an OpenApi file.

Notifications You must be signed in to change notification settings

GeorgeDimi/FastAPI_OpenAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI_OpenAPI

An example project for generating a FastAPI Python server from an OpenApi file.

Install requirements

For generating the server from the OpenApi file we will need a generator. Here we use the fastapi-code-generator

pip install fastapi-code-generator

To run the application we will use the Uvicorn package:

pip install unicorn

And for the Server we will need the fastAPI package:

pip install fastapi

Generate Server

To generate the server simply use the following command:

fastapi-codegen --input .\open_api\pet_shop_api.json --output app

After this you will found all the generated files (main.py and models.py) under the app folder.

Run Server

To run the server just run:

cd app
uvicorn main:app --reload

About

An example project for generating an FastAPI Python server from an OpenApi file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages