Exemplo n.º 1
0
def init_swagger_documentation(app):
    """Makes swagger documentation available at /api/docs for any endpoints
    marked for aiohttp_apispec documentation.
    """
    aiohttp_apispec.setup_aiohttp_apispec(app=app,
                                          title="CALDERA",
                                          version=version.get_version(),
                                          swagger_path="/api/docs",
                                          url="/api/docs/swagger.json",
                                          static_path="/static/swagger")
Exemplo n.º 2
0
def init_swagger_documentation(app):
    """Makes swagger documentation available at /api/docs for any endpoints
    marked for aiohttp_apispec documentation.
    """
    aiohttp_apispec.setup_aiohttp_apispec(app=app,
                                          title='CALDERA',
                                          version=version.get_version(),
                                          swagger_path='/api/docs',
                                          url='/api/docs/swagger.json',
                                          static_path='/static/swagger')
    app.middlewares.append(apispec_request_validation_middleware)
    app.middlewares.append(validation_middleware)
Exemplo n.º 3
0
def init_swagger_documentation(app):
    """Makes swagger documentation available at /api/docs for any endpoints
    marked for aiohttp_apispec documentation.
    """
    warnings.filterwarnings("ignore",
                            message="Multiple schemas resolved to the name")
    aiohttp_apispec.setup_aiohttp_apispec(app=app,
                                          title='CALDERA',
                                          version=version.get_version(),
                                          swagger_path='/api/docs',
                                          url='/api/docs/swagger.json',
                                          static_path='/static/swagger')
    app.middlewares.append(apispec_request_validation_middleware)
    app.middlewares.append(validation_middleware)
Exemplo n.º 4
0
    async def initialize():
        with open(Path(__file__).parents[1] / 'conf' / 'default.yml',
                  'r') as fle:
            BaseWorld.apply_config('main', yaml.safe_load(fle))
        with open(Path(__file__).parents[1] / 'conf' / 'payloads.yml',
                  'r') as fle:
            BaseWorld.apply_config('payloads', yaml.safe_load(fle))

        app_svc = AppService(web.Application(client_max_size=5120**2))
        _ = DataService()
        _ = RestService()
        _ = PlanningService()
        _ = LearningService()
        auth_svc = AuthService()
        _ = FileSvc()
        _ = EventService()
        services = app_svc.get_services()
        os.chdir(str(Path(__file__).parents[1]))

        _ = await RestApi(services).enable()
        await app_svc.register_contacts()
        await auth_svc.apply(app_svc.application, auth_svc.get_config('users'))
        await auth_svc.set_login_handlers(services)

        app_svc.register_subapp('/api/v2', make_app(svcs=services))
        aiohttp_apispec.setup_aiohttp_apispec(app=app_svc.application,
                                              title='CALDERA',
                                              version=version.get_version(),
                                              swagger_path='/api/docs',
                                              url='/api/docs/swagger.json',
                                              static_path='/static/swagger')
        app_svc.application.middlewares.append(
            apispec_request_validation_middleware)
        app_svc.application.middlewares.append(validation_middleware)

        return app_svc