You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used to use fastapi to develop python web apps. Now I'm interested in robyn.
I want to access swagger ui docs page in local environment which means no internet access.
In fastapi, I can define self-custom swagger ui html method as below:
def swagger_monkey_patch(*args, **kwargs):
"""
Wrap the function which is generating the HTML for the /docs endpoint and
overwrite the default values for the swagger js and css.
"""
return get_swagger_ui_html(
*args, **kwargs,
swagger_js_url="/static/swagger-ui-bundle.js",
swagger_css_url="/static/swagger-ui.css",
swagger_favicon_url="/static/favicon.png"
)
I used to use fastapi to develop python web apps. Now I'm interested in robyn.
I want to access swagger ui docs page in local environment which means no internet access.
In fastapi, I can define self-custom swagger ui html method as below:
def swagger_monkey_patch(*args, **kwargs):
"""
Wrap the function which is generating the HTML for the /docs endpoint and
overwrite the default values for the swagger js and css.
"""
return get_swagger_ui_html(
*args, **kwargs,
swagger_js_url="/static/swagger-ui-bundle.js",
swagger_css_url="/static/swagger-ui.css",
swagger_favicon_url="/static/favicon.png"
)
Actual monkey patch
applications.get_swagger_ui_html = swagger_monkey_patch
mount local swagger-ui files
app.mount('/static', StaticFiles(directory="./static/swagger-ui"), name='static')
if name == "main":
import uvicorn
While this app is running, I can access swagger-ui docs page on 127.0.0.1:9080/docs without internet access.
However, I don't see any patch method I can define to use local resource files.
Could someone please tell me how to localize swagger ui docs?
The text was updated successfully, but these errors were encountered: