66 <b >FastOpenAPI</b > is a library for generating and integrating OpenAPI schemas using Pydantic and various frameworks.
77</p >
88
9+ <p align =" center " >
10+ This project was inspired by <a href =" https://fastapi.tiangolo.com/ " >FastAPI</a > and aims to provide a similar developer-friendly experience.
11+ </p >
12+
913<p align =" center " >
1014 <img src =" https://img.shields.io/github/license/mr-fatalyst/fastopenapi " >
1115 <img src =" https://github.com/mr-fatalyst/fastopenapi/actions/workflows/master.yml/badge.svg " >
@@ -37,6 +41,9 @@ pip install fastopenapi[sanic]
3741``` bash
3842pip install fastopenapi[starlette]
3943```
44+ ``` bash
45+ pip install fastopenapi[tornado]
46+ ```
4047
4148---
4249
@@ -62,7 +69,7 @@ pip install fastopenapi[starlette]
6269 from fastopenapi.routers import FalconRouter
6370
6471 app = falcon.asgi.App()
65- router = FalconRouter(app = app, docs_url = " /docs/ " , openapi_version = " 3.0.0 " )
72+ router = FalconRouter(app = app)
6673
6774
6875 class HelloResponse (BaseModel ):
@@ -80,7 +87,7 @@ pip install fastopenapi[starlette]
8087 ```
8188 < / details>
8289
83- - 
90+ - 
8491 < details>
8592 < summary> Click to expand the Flask Example< / summary>
8693
@@ -91,7 +98,7 @@ pip install fastopenapi[starlette]
9198 from fastopenapi.routers import FlaskRouter
9299
93100 app = Flask(__name__ )
94- router = FlaskRouter(app = app, docs_url = " /docs/ " , openapi_version = " 3.0.0 " )
101+ router = FlaskRouter(app = app)
95102
96103
97104 class HelloResponse (BaseModel ):
@@ -120,7 +127,7 @@ pip install fastopenapi[starlette]
120127 from fastopenapi.routers import QuartRouter
121128
122129 app = Quart(__name__ )
123- router = QuartRouter(app = app, docs_url = " /docs/ " , openapi_version = " 3.0.0 " )
130+ router = QuartRouter(app = app)
124131
125132
126133 class HelloResponse (BaseModel ):
@@ -149,7 +156,7 @@ pip install fastopenapi[starlette]
149156 from fastopenapi.routers import SanicRouter
150157
151158 app = Sanic(" MySanicApp" )
152- router = SanicRouter(app = app, docs_url = " /docs/ " , openapi_version = " 3.0.0 " )
159+ router = SanicRouter(app = app)
153160
154161
155162 class HelloResponse (BaseModel ):
@@ -167,7 +174,7 @@ pip install fastopenapi[starlette]
167174 ```
168175 < / details>
169176
170- - 
177+ - 
171178 < details>
172179 < summary> Click to expand the Starlette Example< / summary>
173180
@@ -179,7 +186,7 @@ pip install fastopenapi[starlette]
179186 from fastopenapi.routers import StarletteRouter
180187
181188 app = Starlette()
182- router = StarletteRouter(app = app, docs_url = " /docs/ " , openapi_version = " 3.0.0 " )
189+ router = StarletteRouter(app = app)
183190
184191
185192 class HelloResponse (BaseModel ):
@@ -196,6 +203,43 @@ pip install fastopenapi[starlette]
196203 ```
197204 < / details>
198205
206+ - 
207+ < details>
208+ < summary> Click to expand the Tornado Example< / summary>
209+
210+ ```python
211+ import asyncio
212+
213+ from pydantic import BaseModel
214+ from tornado.web import Application
215+
216+ from fastopenapi.routers.tornado import TornadoRouter
217+
218+ app = Application()
219+
220+ router = TornadoRouter(app = app)
221+
222+
223+ class HelloResponse (BaseModel ):
224+ message: str
225+
226+
227+ @router.get (" /hello" , tags = [" Hello" ], status_code = 200 , response_model = HelloResponse)
228+ def hello (name : str ):
229+ """ Say hello from Tornado"""
230+ return HelloResponse(message = f " Hello, { name} ! It's Tornado! " )
231+
232+
233+ async def main ():
234+ app.listen(8000 )
235+ await asyncio.Event().wait()
236+
237+
238+ if __name__ == " __main__" :
239+ asyncio.run(main())
240+ ```
241+ < / details>
242+
199243# ## Step 2. Run the server
200244
201245Launch the application:
@@ -206,16 +250,21 @@ python main.py
206250
207251Once launched, the documentation will be available at:
208252
253+ Swagger UI:
254+ ```
255+ http://127.0.0.1:8000/docs
209256```
210- http://127.0.0.1:8000/docs/
257+ ReDoc UI:
258+ ```
259+ http://127.0.0.1:8000/redoc
211260```
212261
213262---
214263
215264## ⚙️ Features
216265- ** Generate OpenAPI schemas** with Pydantic v2.
217266- ** Data validation** using Pydantic models.
218- - ** Supports multiple frameworks:** Falcon, Flask, Quart, Sanic, Starlette.
267+ - ** Supports multiple frameworks:** Falcon, Flask, Quart, Sanic, Starlette, Tornado .
219268- ** Proxy routing provides FastAPI-style routing**
220269
221270---
@@ -232,6 +281,12 @@ Examples of integration and detailed usage for each framework are available in t
232281
233282---
234283
284+ ## 📊 Quick & Dirty Benchmarks
285+
286+ Fast but not perfect benchmarks. Check the [ ` benchmarks ` ] ( https://github.com/mr-fatalyst/fastopenapi/tree/master/benchmarks ) directory for details.
287+
288+ ---
289+
235290## ✅ Development Recommendations
236291
237292- Use Pydantic models for strict typing and data validation.
0 commit comments