Name | aiohttp-apiset JSON |
Version |
0.9.16
JSON |
| download |
home_page | None |
Summary | Build routes using swagger specification |
upload_time | 2023-06-19 08:22:22 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.5.3 |
license | None |
keywords |
aiohttp
apiset
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
aiohttp-apiset
==============
.. image:: https://github.com/aamalev/aiohttp_apiset/workflows/Tests/badge.svg
:target: https://github.com/aamalev/aiohttp_apiset/actions?query=workflow%3ATests
.. image:: https://codecov.io/gh/aamalev/aiohttp_apiset/branch/master/graph/badge.svg
:target: https://codecov.io/gh/aamalev/aiohttp_apiset
:alt: Coverage
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json
:target: https://github.com/charliermarsh/ruff
:alt: Code style: ruff
.. image:: https://img.shields.io/pypi/v/aiohttp_apiset.svg
:target: https://pypi.python.org/pypi/aiohttp_apiset
.. image:: https://readthedocs.org/projects/aiohttp-apiset/badge/?version=latest
:target: http://aiohttp-apiset.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://img.shields.io/pypi/dm/aiohttp-apiset.svg
:target: https://pypi.org/project/aiohttp-apiset
.. image:: https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg
:alt: Hatch project
:target: https://github.com/pypa/hatch
Package to build routes and validate request using swagger specification 2.0.
Features
--------
- Building of the routing from specification swagger
- Using inclusions other specifications with concatenate url
- Optional output of the resulting specification and view embed `swagger-ui <https://github.com/swagger-api/swagger-ui>`_
- Advanced router with TreeResource
- Extract specify parameters from request and validate with jsonschema
- Serialize data as response with middleware
Usecase
-------
Package aiohttp_apiset allows supports several strategies:
- The foreign specification. When the specification
is made and maintained by another team.
- The specification in the code. When the fragments of specification
are placed in the docstrings.
- Mixed strategy. When routing are located in the specification files
and operations are described in the docstrings.
Example
-------
.. code-block:: python
async def handler(request, pet_id):
"""
---
tags: [Pet]
description: Info about pet
parameters:
- name: pet_id
in: path
type: integer
minimum: 0
responses:
200:
description: OK
400:
description: Validation error
404:
description: Not found
"""
pet = await db.pets.find(pet_id)
if not pet:
return {'status': 404, 'msg': 'Not Found'}
return {
'pet': pet, # dict serialized inside jsonify
}
def main():
router = SwaggerRouter(
swagger_ui='/swagger/',
version_ui=2,
)
router.add_get('/pets/{pet_id}', handler=handler)
app = web.Application(
router=router,
middlewares=[jsonify],
)
web.run_app(app)
Is now available in the swagger-ui to the address http://localhost:8080/swagger/.
Available both branch swagger-ui. For use branch 3.x visit http://localhost:8080/swagger/?version=3
Examples: `examples <https://github.com/aamalev/aiohttp_apiset/tree/master/examples>`_
Development
-----------
Check code:
.. code-block:: shell
hatch run lint:all
Format code:
.. code-block:: shell
hatch run lint:fmt
Run tests:
.. code-block:: shell
hatch run pytest
Run tests with coverage:
.. code-block:: shell
hatch run cov
Raw data
{
"_id": null,
"home_page": null,
"name": "aiohttp-apiset",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.5.3",
"maintainer_email": null,
"keywords": "aiohttp,apiset",
"author": null,
"author_email": "Alexander Malev <malev@somedev.ru>",
"download_url": "https://files.pythonhosted.org/packages/aa/d0/1ab31722f7123ba37f2abb4bb75e126b43d3d869380e05cabe794b2d85c5/aiohttp_apiset-0.9.16.tar.gz",
"platform": null,
"description": "aiohttp-apiset\n==============\n\n.. image:: https://github.com/aamalev/aiohttp_apiset/workflows/Tests/badge.svg\n :target: https://github.com/aamalev/aiohttp_apiset/actions?query=workflow%3ATests\n\n.. image:: https://codecov.io/gh/aamalev/aiohttp_apiset/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/aamalev/aiohttp_apiset\n :alt: Coverage\n\n.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json\n :target: https://github.com/charliermarsh/ruff\n :alt: Code style: ruff\n\n.. image:: https://img.shields.io/pypi/v/aiohttp_apiset.svg\n :target: https://pypi.python.org/pypi/aiohttp_apiset\n\n.. image:: https://readthedocs.org/projects/aiohttp-apiset/badge/?version=latest\n :target: http://aiohttp-apiset.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/dm/aiohttp-apiset.svg\n :target: https://pypi.org/project/aiohttp-apiset\n\n.. image:: https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg\n :alt: Hatch project\n :target: https://github.com/pypa/hatch\n\nPackage to build routes and validate request using swagger specification 2.0.\n\nFeatures\n--------\n\n- Building of the routing from specification swagger\n- Using inclusions other specifications with concatenate url\n- Optional output of the resulting specification and view embed `swagger-ui <https://github.com/swagger-api/swagger-ui>`_\n- Advanced router with TreeResource\n- Extract specify parameters from request and validate with jsonschema\n- Serialize data as response with middleware\n\nUsecase\n-------\n\nPackage aiohttp_apiset allows supports several strategies:\n\n- The foreign specification. When the specification\n is made and maintained by another team.\n- The specification in the code. When the fragments of specification\n are placed in the docstrings.\n- Mixed strategy. When routing are located in the specification files\n and operations are described in the docstrings.\n\nExample\n-------\n\n.. code-block:: python\n\n async def handler(request, pet_id):\n \"\"\"\n ---\n tags: [Pet]\n description: Info about pet\n parameters:\n - name: pet_id\n in: path\n type: integer\n minimum: 0\n responses:\n 200:\n description: OK\n 400:\n description: Validation error\n 404:\n description: Not found\n \"\"\"\n pet = await db.pets.find(pet_id)\n\n if not pet:\n return {'status': 404, 'msg': 'Not Found'}\n\n return {\n 'pet': pet, # dict serialized inside jsonify\n }\n\n\n def main():\n router = SwaggerRouter(\n swagger_ui='/swagger/',\n version_ui=2,\n )\n router.add_get('/pets/{pet_id}', handler=handler)\n\n app = web.Application(\n router=router,\n middlewares=[jsonify],\n )\n\n web.run_app(app)\n\nIs now available in the swagger-ui to the address http://localhost:8080/swagger/.\nAvailable both branch swagger-ui. For use branch 3.x visit http://localhost:8080/swagger/?version=3\n\n\nExamples: `examples <https://github.com/aamalev/aiohttp_apiset/tree/master/examples>`_\n\n\n\nDevelopment\n-----------\n\nCheck code:\n\n.. code-block:: shell\n\n hatch run lint:all\n\n\nFormat code:\n\n.. code-block:: shell\n\n hatch run lint:fmt\n\n\nRun tests:\n\n.. code-block:: shell\n\n hatch run pytest\n\n\nRun tests with coverage:\n\n.. code-block:: shell\n\n hatch run cov\n",
"bugtrack_url": null,
"license": null,
"summary": "Build routes using swagger specification",
"version": "0.9.16",
"project_urls": {
"Documentation": "http://aiohttp-apiset.readthedocs.io/en/latest/?badge=latest",
"Homepage": "https://github.com/aamalev/aiohttp_apiset/",
"Issues": "https://github.com/aamalev/aiohttp-apiset/issues",
"Source": "https://github.com/aamalev/aiohttp-apiset"
},
"split_keywords": [
"aiohttp",
"apiset"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f94444ce0191a47fb655af12b4e30723cadd47abad0eac1e53a343689404c022",
"md5": "dc4df103483445d933f323ddf92c2630",
"sha256": "5d743e945906d527a96590f66fe1e2cb7070920607edcfc573fe6372281d97f6"
},
"downloads": -1,
"filename": "aiohttp_apiset-0.9.16-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dc4df103483445d933f323ddf92c2630",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5.3",
"size": 8719089,
"upload_time": "2023-06-19T08:22:15",
"upload_time_iso_8601": "2023-06-19T08:22:15.947441Z",
"url": "https://files.pythonhosted.org/packages/f9/44/44ce0191a47fb655af12b4e30723cadd47abad0eac1e53a343689404c022/aiohttp_apiset-0.9.16-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "aad01ab31722f7123ba37f2abb4bb75e126b43d3d869380e05cabe794b2d85c5",
"md5": "73fd007d570df4899bd8961d31d394ab",
"sha256": "fa8b8d09e36813e1aaea581a9e8364a44f1a25f1ca9c63b5b420d51789a03e60"
},
"downloads": -1,
"filename": "aiohttp_apiset-0.9.16.tar.gz",
"has_sig": false,
"md5_digest": "73fd007d570df4899bd8961d31d394ab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5.3",
"size": 8626121,
"upload_time": "2023-06-19T08:22:22",
"upload_time_iso_8601": "2023-06-19T08:22:22.866975Z",
"url": "https://files.pythonhosted.org/packages/aa/d0/1ab31722f7123ba37f2abb4bb75e126b43d3d869380e05cabe794b2d85c5/aiohttp_apiset-0.9.16.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-19 08:22:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aamalev",
"github_project": "aiohttp_apiset",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiohttp-apiset"
}