aiohttp-swagger icon indicating copy to clipboard operation
aiohttp-swagger copied to clipboard

Static UI assets reference malformed when using sub apps

Open dnwarnock opened this issue 7 years ago • 1 comments

Swagger UI static assets are set to

<link href="/doc/swagger_static/css/typography.css" media="screen" rel="stylesheet" type="text/css">

when they should actually live at

<link href="/api/v1/doc/swagger_static/css/typography.css" media="screen" rel="stylesheet" type="text/css">

if setup_swagger is called on a sub app like:

   setup_app(v1)
    setup_swagger(
        v1,
        swagger_url='/doc',
        swagger_from_file="v1_swagger.json",
        api_base_url='/api/v1'
    )
    app = web.Application()
    app.add_subapp('/api/v1', v1)

FIX:

setup_swagger should set statics_path = '{}{}/swagger_static'.format(api_base_url,_swagger_url) if sub apps are to work as specified in the documentation

dnwarnock avatar Jun 27 '18 19:06 dnwarnock

Suggested fix: https://github.com/cr0hn/aiohttp-swagger/pull/53

dnwarnock avatar Jun 27 '18 19:06 dnwarnock