rororo#
Implement aiohttp.web OpenAPI 3 server applications with schema first approach.
As well as bunch other utilities to build effective server applications with Python 3 & aiohttp.web.
Works on Python 3.7+
Works with aiohttp.web 3.8.1+
BSD licensed
Source, issues, and pull requests on GitHub
Quick Start#
rororo relies on valid OpenAPI 3 schema file (both JSON or YAML formats supported).
Example below, illustrates on how to handle operation hello_world
from
openapi.yaml schema file.
from pathlib import Path
from typing import List
from aiohttp import web
from rororo import (
openapi_context,
OperationTableDef,
setup_openapi,
)
operations = OperationTableDef()
@operations.register
async def hello_world(request: web.Request) -> web.Response:
with openapi_context(request) as context:
name = context.parameters.query.get("name", "world")
email = context.parameters.query.get(
"email", "world@example.com"
)
return web.json_response(
{"message": f"Hello, {name}!", "email": email}
)
def create_app(argv: List[str] = None) -> web.Application:
return setup_openapi(
web.Application(),
Path(__file__).parent / "openapi.yaml",
operations,
server_url="/api",
)
Schema First Approach#
Unlike other popular Python OpenAPI 3 solutions, such as Django REST Framework, FastAPI, flask-apispec, or aiohttp-apispec rororo requires you to provide valid OpenAPI 3 schema first. This makes rororo similar to connexion, pyramid_openapi3 and other schema first libraries.
Class Based Views#
rororo supports class based views as well. Todo-Backend example illustrates how to use class based views for OpenAPI 3 servers.
In snippet below, rororo expects that OpenAPI 3 schema contains operation ID
UserView.get
,
@operations.register
class UserView(web.View):
async def get(self) -> web.Response:
...
More Examples#
Check examples folder to see other examples on how to build aiohttp.web OpenAPI 3 server applications.
Installation#
poetry add rororo
Or using pip,
pip install rororo
License#
rororo is licensed under the terms of BSD-3-Clause License.
Contents#
- aiohttp.web OpenAPI 3 schema first server applications
- OpenAPI Errors
- Known OpenAPI limitations & issues
- Speed up rororo applications
- Setting up aiohttp.web applications
- rororo API
- Changelog
- 3.2.0 (2023-05-29)
- 3.1.0 (2022-12-26)
- 3.0.1 (2022-10-23)
- 3.0.0 (2022-08-09)
- 2.4.1 (2021-12-16)
- 2.4.0 (2021-11-06)
- 2.3.0 (2021-10-31)
- 2.2.2 (2021-05-10)
- 2.2.1 (2021-05-09)
- 2.2.0 (2021-01-05)
- 2.1.3 (2020-12-09)
- 2.1.2 (2020-11-01)
- 2.1.1 (2020-10-29)
- 2.1.0 (2020-10-25)
- 2.0.2 (2020-09-04)
- 2.0.1 (2020-07-21)
- 2.0.0 (2020-06-29)
- 1.2.1 (2019-07-08)
- 1.2.0 (2018-11-01)
- 1.1.1 (2017-10-09)
- 1.1.0 (2017-10-09)
- 1.0.0 (2017-05-14)