mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-13 19:18:16 -06:00
Use the same OpenAPI document for all schema views
Improves consistency and makes better use of schema caching.
This commit is contained in:
parent
b93a0cc722
commit
2abfdc90a8
@ -6,6 +6,7 @@ import warnings
|
||||
|
||||
from django.contrib.messages import constants as messages
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
# Django 2.1 requires Python 3.5+
|
||||
if sys.version_info < (3, 5):
|
||||
@ -330,6 +331,11 @@ SWAGGER_SETTINGS = {
|
||||
'VALIDATOR_URL': None,
|
||||
'DEFAULT_INFO': 'netbox.urls.swagger_info',
|
||||
'DEFAULT_MODEL_DEPTH': 0,
|
||||
'SPEC_URL': reverse_lazy('schema_swagger', kwargs={'format': '.yaml'}),
|
||||
}
|
||||
|
||||
REDOC_SETTINGS = {
|
||||
'SPEC_URL': reverse_lazy('schema_swagger', kwargs={'format': '.yaml'}),
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ _patterns = [
|
||||
url(r'^api/virtualization/', include('virtualization.api.urls')),
|
||||
url(r'^api/docs/$', schema_view.with_ui('swagger', cache_timeout=600), name='api_docs'),
|
||||
url(r'^api/redoc/$', schema_view.with_ui('redoc', cache_timeout=600), name='api_redocs'),
|
||||
url(r'^api/swagger(?P<format>.json|.yaml)$', schema_view.without_ui(cache_timeout=600), name='schema_swagger'),
|
||||
url(r'^api/swagger(?P<format>.yaml)$', schema_view.without_ui(cache_timeout=600), name='schema_swagger'),
|
||||
|
||||
# Serving static media in Django to pipe it through LoginRequiredMiddleware
|
||||
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
|
||||
|
Loading…
Reference in New Issue
Block a user