Fix /api/swagger endpoint (available only in development mode) (#13197)

Co-authored-by: John Westcott IV <john.westcott.iv@redhat.com>
This commit is contained in:
Shane McDonald
2023-06-02 12:58:21 -04:00
committed by GitHub
parent 844666df4c
commit aafd4df288
6 changed files with 46 additions and 65 deletions

View File

@@ -167,10 +167,13 @@ urlpatterns = [
]
if MODE == 'development':
# Only include these if we are in the development environment
from awx.api.swagger import SwaggerSchemaView
urlpatterns += [re_path(r'^swagger/$', SwaggerSchemaView.as_view(), name='swagger_view')]
from awx.api.swagger import schema_view
from awx.api.urls.debug import urls as debug_urls
urlpatterns += [re_path(r'^debug/', include(debug_urls))]
urlpatterns += [
re_path(r'^swagger(?P<format>\.json|\.yaml)/$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
re_path(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
re_path(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
]