mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-13 19:18:16 -06:00
Improve performance of schema views
This removes swagger validation step and adds a cache layer to the swagger schema view. On my machine, the end result is sub-second response times instead of ~10 second response times for `/api/swagger.json`.
This commit is contained in:
parent
b381bdec27
commit
dd35faf422
@ -18,6 +18,7 @@ schema_view = get_schema_view(
|
||||
license=openapi.License(name="Apache v2 License"),
|
||||
),
|
||||
validators=['flex', 'ssv'],
|
||||
validators=[],
|
||||
public=True,
|
||||
)
|
||||
|
||||
@ -50,9 +51,9 @@ _patterns = [
|
||||
url(r'^api/secrets/', include('secrets.api.urls')),
|
||||
url(r'^api/tenancy/', include('tenancy.api.urls')),
|
||||
url(r'^api/virtualization/', include('virtualization.api.urls')),
|
||||
url(r'^api/docs/$', schema_view.with_ui('swagger'), name='api_docs'),
|
||||
url(r'^api/redoc/$', schema_view.with_ui('redoc'), name='api_redocs'),
|
||||
url(r'^api/swagger(?P<format>.json|.yaml)$', schema_view.without_ui(), name='schema_swagger'),
|
||||
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'),
|
||||
|
||||
# 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