|
@ -1,7 +1,5 @@ |
|
|
from django.conf import settings |
|
|
from django.conf import settings |
|
|
from django.conf.urls import include, url |
|
|
from django.conf.urls import include, url |
|
|
from drf_yasg import openapi |
|
|
|
|
|
from drf_yasg.views import get_schema_view |
|
|
|
|
|
from rest_framework import permissions |
|
|
from rest_framework import permissions |
|
|
from rest_framework.routers import DefaultRouter |
|
|
from rest_framework.routers import DefaultRouter |
|
|
|
|
|
|
|
@ -29,26 +27,29 @@ for app, built_sets in SaplApiViewSetConstrutor._built_sets.items(): |
|
|
|
|
|
|
|
|
urlpatterns_router = router.urls |
|
|
urlpatterns_router = router.urls |
|
|
|
|
|
|
|
|
|
|
|
urlpatterns_api_doc = [] |
|
|
schema_view = get_schema_view( |
|
|
if 'drf_yasg' in settings.INSTALLED_APPS: |
|
|
openapi.Info( |
|
|
from drf_yasg import openapi |
|
|
title="Sapl API - docs", |
|
|
from drf_yasg.views import get_schema_view |
|
|
default_version='v1', |
|
|
schema_view = get_schema_view( |
|
|
description="Sapl API - Docs - Configuração Básica", |
|
|
openapi.Info( |
|
|
), |
|
|
title="Sapl API - docs", |
|
|
url=settings.SITE_URL, |
|
|
default_version='v1', |
|
|
public=True, |
|
|
description="Sapl API - Docs - Configuração Básica", |
|
|
permission_classes=(permissions.AllowAny,), |
|
|
), |
|
|
) |
|
|
url=settings.SITE_URL, |
|
|
|
|
|
public=True, |
|
|
urlpatterns_api_doc = [ |
|
|
permission_classes=(permissions.AllowAny,), |
|
|
url(r'^docs/swagger(?P<format>\.json|\.yaml)$', |
|
|
) |
|
|
schema_view.without_ui(cache_timeout=0), name='schema-json'), |
|
|
|
|
|
url(r'^docs/swagger/$', |
|
|
urlpatterns_api_doc = [ |
|
|
schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), |
|
|
url(r'^docs/swagger(?P<format>\.json|\.yaml)$', |
|
|
url(r'^docs/redoc/$', |
|
|
schema_view.without_ui(cache_timeout=0), name='schema-json'), |
|
|
schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), |
|
|
url(r'^docs/swagger/$', |
|
|
] |
|
|
schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), |
|
|
|
|
|
url(r'^docs/redoc/$', |
|
|
|
|
|
schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
# TODO: refatorar para customização da api automática |
|
|
# TODO: refatorar para customização da api automática |
|
|
deprecated_urlpatterns_api = [ |
|
|
deprecated_urlpatterns_api = [ |
|
|