Skip to main content

Build routes using swagger specification

Project description

Package to build routes using swagger specification.

Extends specification with directives $include, $view and $handler.

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

To setup route to use in application:

from aiohttp_apiset import SwaggerRouter

router = SwaggerRouter(
    'data/root.yaml',
    search_dirs=['routes'])
router.setup(app)

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.

Source Distribution

aiohttp_apiset-0.1.13.tar.gz (7.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page