Open oneandonlyonebutyou opened 5 years ago
You can always deploy your own swagger-ui instance instead of using the bundled one.
Unfortunately no, there is no simple way to plug that into the bundled one.
Thanks for fast response. (means a lot) I would love to contribute soon ..
@joseph-vedadi this is a bit hacky, but what you could do is:
drf-yasg.html
):
{% extends "drf-yasg/swagger-ui.html" %}
{% block extra_scripts %}
{% endblock %}
2. change your `urls.py`:
from drf_yasg.views import SwaggerUIRenderer, get_schema_view
SwaggerUIRenderer.template = 'drf-yasg.html' # monkey-patching is bad :(
schema_view = get_schema_view( openapi.Info( title="My API", default_version='1.0.0', description="My API" ) )
Monkey patching shouldn't be necessary, the template can be overridden using the standard Django mechanism - place it at the same path drf-yasg/swagger-ui.html
in the templates
directory of an app.
The app should come before drf-yasg
in INSTALLED_APPS
.
@axnsan12 iirc in that case {% extends "drf-yasg/swagger-ui.html" %}
will fail because it'll become cyclic dependency
I wonder how I could add configs to the swagger settings. Thanks. something like this :
https://github.com/swagger-api/swagger-ui/issues/3229