Skip to content

Commit 1c36071

Browse files
chore(docs): Update README files.
1 parent 9a1c2cc commit 1c36071

File tree

3 files changed

+51
-6
lines changed

3 files changed

+51
-6
lines changed

README.rst

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
rororo
33
======
44

5-
.. image:: https://img.shields.io/circleci/project/github/playpauseandstop/rororo/master.svg
5+
.. image:: https://img.shields.io/circleci/project/github/playpauseandstop/rororo/feature-openapi.svg
66
:target: https://circleci.com/gh/playpauseandstop/rororo
77
:alt: CircleCI
88

@@ -18,7 +18,7 @@ rororo
1818
:target: https://github.com/playpauseandstop/rororo/blob/master/LICENSE
1919
:alt: BSD License
2020

21-
.. image:: https://coveralls.io/repos/playpauseandstop/rororo/badge.svg?branch=master&service=github
21+
.. image:: https://coveralls.io/repos/playpauseandstop/rororo/badge.svg?branch=feature-openapi&service=github
2222
:target: https://coveralls.io/github/playpauseandstop/rororo
2323
:alt: Coverage
2424

@@ -33,7 +33,51 @@ applications.
3333
As well as bunch other utilities to build effective web applications with
3434
Python 3 & ``aiohttp.web``.
3535

36-
* Works on Python 3.5+
36+
* Works on Python 3.6+
3737
* BSD licensed
3838
* Source, issues, and pull requests `on GitHub
3939
<https://github.com/playpauseandstop/rororo>`_
40+
41+
Quick Start
42+
===========
43+
44+
``rororo`` relies on valid OpenAPI schema file (both JSON or YAML formats
45+
supported).
46+
47+
Example below, illustrates on how to handle operation ``hello_world`` from
48+
`openapi.yaml <https://github.com/playpauseandstop/rororo/blob/feature-openapi/tests/openapi.yaml>`_
49+
schema file.
50+
51+
.. code-block:: python
52+
53+
from pathlib import Path
54+
55+
from aiohttp import web
56+
57+
from rororo import openapi_context, OperationTableDef, setup_openapi
58+
59+
60+
operations = OperationTableDef()
61+
62+
63+
@operations.register
64+
async def hello_world(request: web.Request) -> web.Response:
65+
with openapi_context(request) as context:
66+
name = context.parameters.query.get("name", "world")
67+
return web.json_response({"message": f"Hello, {name}!"})
68+
69+
70+
def create_app(argv: List[str] = None) -> web.Application:
71+
app = web.Application()
72+
setup_openapi(
73+
app,
74+
Path(__file__).parent / "openapi.yaml",
75+
operations,
76+
route_prefix="/api"
77+
)
78+
return app
79+
80+
Check
81+
`examples <https://github.com/playpauseandstop/rororo/tree/feature-openapi/examples>`_
82+
folder to see other examples on how to use OpenAPI 3 schemas with aiohttp.web
83+
applications.

examples/petstore/README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ Pet Store
33
=========
44

55
``aiohttp.web`` application to cover official OpenAPI 3
6-
`petstore-expanded.yaml <>`_ schema.
6+
`petstore-expanded.yaml <https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore-expanded.yaml>`_
7+
schema.
78

89
Usage
910
=====
1011

1112
.. code-block:: python
1213
13-
python -m aiohttp.web app:create_app
14+
python -m aiohttp.web petstore.app:create_app

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'name': 'rororo',
1515
'version': '2.0.0a0',
1616
'description': 'OpenAPI 3 schema support for aiohttp.web applications.',
17-
'long_description': '======\nrororo\n======\n\n.. image:: https://img.shields.io/circleci/project/github/playpauseandstop/rororo/master.svg\n :target: https://circleci.com/gh/playpauseandstop/rororo\n :alt: CircleCI\n\n.. image:: https://img.shields.io/pypi/v/rororo.svg\n :target: https://pypi.org/project/rororo/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/pyversions/rororo.svg\n :target: https://pypi.org/project/rororo/\n :alt: Python versions\n\n.. image:: https://img.shields.io/pypi/l/rororo.svg\n :target: https://github.com/playpauseandstop/rororo/blob/master/LICENSE\n :alt: BSD License\n\n.. image:: https://coveralls.io/repos/playpauseandstop/rororo/badge.svg?branch=master&service=github\n :target: https://coveralls.io/github/playpauseandstop/rororo\n :alt: Coverage\n\n.. image:: https://readthedocs.org/projects/rororo/badge/?version=latest\n :target: https://rororo.readthedocs.io/\n :alt: Documentation\n\n`OpenAPI 3 <https://spec.openapis.org/oas/v3.0.2>`_ schema support\nfor `aiohttp.web <https://aiohttp.readthedocs.io/en/stable/web.html>`_\napplications.\n\nAs well as bunch other utilities to build effective web applications with\nPython 3 & ``aiohttp.web``.\n\n* Works on Python 3.5+\n* BSD licensed\n* Source, issues, and pull requests `on GitHub\n <https://github.com/playpauseandstop/rororo>`_\n',
17+
'long_description': '======\nrororo\n======\n\n.. image:: https://img.shields.io/circleci/project/github/playpauseandstop/rororo/feature-openapi.svg\n :target: https://circleci.com/gh/playpauseandstop/rororo\n :alt: CircleCI\n\n.. image:: https://img.shields.io/pypi/v/rororo.svg\n :target: https://pypi.org/project/rororo/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/pyversions/rororo.svg\n :target: https://pypi.org/project/rororo/\n :alt: Python versions\n\n.. image:: https://img.shields.io/pypi/l/rororo.svg\n :target: https://github.com/playpauseandstop/rororo/blob/master/LICENSE\n :alt: BSD License\n\n.. image:: https://coveralls.io/repos/playpauseandstop/rororo/badge.svg?branch=feature-openapi&service=github\n :target: https://coveralls.io/github/playpauseandstop/rororo\n :alt: Coverage\n\n.. image:: https://readthedocs.org/projects/rororo/badge/?version=latest\n :target: https://rororo.readthedocs.io/\n :alt: Documentation\n\n`OpenAPI 3 <https://spec.openapis.org/oas/v3.0.2>`_ schema support\nfor `aiohttp.web <https://aiohttp.readthedocs.io/en/stable/web.html>`_\napplications.\n\nAs well as bunch other utilities to build effective web applications with\nPython 3 & ``aiohttp.web``.\n\n* Works on Python 3.6+\n* BSD licensed\n* Source, issues, and pull requests `on GitHub\n <https://github.com/playpauseandstop/rororo>`_\n\nQuick Start\n===========\n\n``rororo`` relies on valid OpenAPI schema file (both JSON or YAML formats\nsupported).\n\nExample below, illustrates on how to handle operation ``hello_world`` from\n`openapi.yaml <https://github.com/playpauseandstop/rororo/blob/feature-openapi/tests/openapi.yaml>`_\nschema file.\n\n.. code-block:: python\n\n from pathlib import Path\n\n from aiohttp import web\n\n from rororo import openapi_context, OperationTableDef, setup_openapi\n\n\n operations = OperationTableDef()\n\n\n @operations.register\n async def hello_world(request: web.Request) -> web.Response:\n with openapi_context(request) as context:\n name = context.parameters.query.get("name", "world")\n return web.json_response({"message": f"Hello, {name}!"})\n\n\n def create_app(argv: List[str] = None) -> web.Application:\n app = web.Application()\n setup_openapi(\n app,\n Path(__file__).parent / "openapi.yaml",\n operations,\n route_prefix="/api"\n )\n return app\n\nCheck\n`examples <https://github.com/playpauseandstop/rororo/tree/feature-openapi/examples>`_\nfolder to see other examples on how to use OpenAPI 3 schemas with aiohttp.web\napplications.\n',
1818
'author': 'Igor Davydenko',
1919
'author_email': 'iam@igordavydenko.com',
2020
'url': 'https://igordavydenko.com/projects.html#rororo',

0 commit comments

Comments
 (0)