Explorar o código

Closes #6423: Cache rendered REST API specifications

jeremystretch %!s(int64=4) %!d(string=hai) anos
pai
achega
257c0afdb5
Modificáronse 2 ficheiros con 5 adicións e 4 borrados
  1. 1 0
      docs/release-notes/version-3.0.md
  2. 4 4
      netbox/netbox/urls.py

+ 1 - 0
docs/release-notes/version-3.0.md

@@ -4,6 +4,7 @@
 
 ### Enhancements
 
+* [#6423](https://github.com/netbox-community/netbox/issues/6423) - Cache rendered REST API specifications
 * [#7387](https://github.com/netbox-community/netbox/issues/7387) - Enable arbitrary ordering of custom scripts
 
 ### Bug Fixes

+ 4 - 4
netbox/netbox/urls.py

@@ -17,7 +17,7 @@ from .admin import admin_site
 
 openapi_info = openapi.Info(
     title="NetBox API",
-    default_version='v2',
+    default_version='v3',
     description="API to access NetBox",
     terms_of_service="https://github.com/netbox-community/netbox",
     license=openapi.License(name="Apache v2 License"),
@@ -59,9 +59,9 @@ _patterns = [
     path('api/users/', include('users.api.urls')),
     path('api/virtualization/', include('virtualization.api.urls')),
     path('api/status/', StatusView.as_view(), name='api-status'),
-    path('api/docs/', schema_view.with_ui('swagger'), name='api_docs'),
-    path('api/redoc/', schema_view.with_ui('redoc'), name='api_redocs'),
-    re_path(r'^api/swagger(?P<format>.json|.yaml)$', schema_view.without_ui(), name='schema_swagger'),
+    path('api/docs/', schema_view.with_ui('swagger', cache_timeout=86400), name='api_docs'),
+    path('api/redoc/', schema_view.with_ui('redoc', cache_timeout=86400), name='api_redocs'),
+    re_path(r'^api/swagger(?P<format>.json|.yaml)$', schema_view.without_ui(cache_timeout=86400), name='schema_swagger'),
 
     # GraphQL
     path('graphql/', csrf_exempt(GraphQLView.as_view(graphiql=True, schema=schema)), name='graphql'),