Build routes using swagger specification
Project description
aiohttp_apiset
Package to build routes using swagger specification.
Extends specification with directives $include, $view and $handler.
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
Advanced router with TreeResource
Extract specify parameters from request and validate with jsonschema
Serialize data as response with middleware
Usecase
$handler
Handler:
from aiohttp import web
async def handler(request):
return web.json_response(
{'test': 'Hello'}
)
Swagger spec:
swagger: '2.0'
basePath: /api/1
paths:
/hello:
get:
$handler: mymodule.handler
summary: and other not required for working route
Equal:
app.router.add_route(
'GET',
'/api/1/hello',
handler,
name='mymodule.handler')
Setup to application
Create router:
from aiohttp_apiset import SwaggerRouter
router = SwaggerRouter(
'data/root.yaml',
search_dirs=['routes'])
Setup to application:
router.setup(app)
or use as router:
Application(router=router)
History
0.2.3 (2016-11-05)
Added compatibility with aiohttp >= 1.1
Added safe decode form and json
Fixed extract body
0.2.2 (2016-10-28)
Fixed convertation from match_info
0.2.1 (2016-10-27)
Output conversion parameter errors in response
Fix validation
0.2.0 (2016-10-26)
0.1.13 (2016-05-02)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.