Beispiel #1
0
def test_ui():
    swagger_ui = specs.SwaggerUI()
    swagger_ui.get_index_page('/path')
    swagger_ui.get_static_folder()

    swagger_ui = specs.ReDoc()
    swagger_ui.get_index_page('/path')
    swagger_ui.get_static_folder()

    swagger_ui = specs.RapiDoc()
    swagger_ui.get_index_page('/path')
    swagger_ui.get_static_folder()
Beispiel #2
0
jsonrpc_app = AuthenticatedJsonRPC(
    '/api/v1',
    json_encoder=JSONEncoder,
    spec=specs.OpenAPI(
        info=specs.Info(version="1.0.0", title="User storage"),
        servers=[
            specs.Server(url='http://127.0.0.1:8080', ),
        ],
        security_schemes=dict(basicAuth=specs.SecurityScheme(
            type=specs.SecuritySchemeType.HTTP,
            scheme='basic',
        ), ),
        security=[
            dict(basicAuth=[]),
        ],
        schema_extractors=[
            extractors.docstring.DocstringSchemaExtractor(),
            extractors.pydantic.PydanticSchemaExtractor(),
        ],
        ui=specs.SwaggerUI(),
        # ui=specs.RapiDoc(),
        # ui=specs.ReDoc(),
    ),
)
jsonrpc_app.dispatcher.add_methods(methods)
app.add_subapp('/myapp', jsonrpc_app.app)

if __name__ == "__main__":
    web.run_app(app, host='localhost', port=8080)