Add a command line tool to generate OAS in a file

This commit is contained in:
Vincent Maillol
2020-11-01 14:35:41 +01:00
parent 236374240e
commit cda4fba4c2
10 changed files with 256 additions and 35 deletions

View File

@@ -0,0 +1,27 @@
from aiohttp import web
from aiohttp_pydantic import PydanticView
class View1(PydanticView):
async def get(self, a: int, /):
return web.json_response()
class View2(PydanticView):
async def post(self, b: int, /):
return web.json_response()
sub_app = web.Application()
sub_app.router.add_view("/route-2/{b}", View2)
app = web.Application()
app.router.add_view("/route-1/{a}", View1)
app.add_subapp("/sub-app", sub_app)
def make_app():
app = web.Application()
app.router.add_view("/route-3/{a}", View1)
return app