|
|
@ -1,7 +1,9 @@ |
|
|
|
from django.conf import settings |
|
|
|
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.routers import DefaultRouter |
|
|
|
|
|
|
|
from rest_framework_swagger.views import get_swagger_view |
|
|
|
|
|
|
|
from sapl.api.views import (AutoresPossiveisListView, AutoresProvaveisListView, |
|
|
@ -11,6 +13,7 @@ from sapl.api.views import (AutoresPossiveisListView, AutoresProvaveisListView, |
|
|
|
|
|
|
|
from .apps import AppConfig |
|
|
|
|
|
|
|
|
|
|
|
app_name = AppConfig.name |
|
|
|
|
|
|
|
|
|
|
@ -26,9 +29,8 @@ for app, built_sets in SaplSetViews.items(): |
|
|
|
|
|
|
|
urlpatterns_router = router.urls |
|
|
|
|
|
|
|
|
|
|
|
# TODO: refatorar para customização da api automática |
|
|
|
urlpatterns_api = [ |
|
|
|
|
|
|
|
url(r'^autor/provaveis', |
|
|
|
AutoresProvaveisListView.as_view(), name='autores_provaveis_list'), |
|
|
|
url(r'^autor/possiveis', |
|
|
@ -38,13 +40,28 @@ urlpatterns_api = [ |
|
|
|
|
|
|
|
url(r'^model/(?P<content_type>\d+)/(?P<pk>\d*)$', |
|
|
|
ModelChoiceView.as_view(), name='model_list'), |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
schema_view = get_swagger_view(title='Pastebin API') |
|
|
|
schema_view = get_schema_view( |
|
|
|
openapi.Info( |
|
|
|
title="Sapl API - docs", |
|
|
|
default_version='v1', |
|
|
|
description="Sapl API - Docs - Configuração Básica", |
|
|
|
), |
|
|
|
public=True, |
|
|
|
permission_classes=(permissions.AllowAny,), |
|
|
|
) |
|
|
|
|
|
|
|
urlpatterns_api += [ |
|
|
|
url(r'^docs', schema_view), ] |
|
|
|
url(r'^docs/swagger(?P<format>\.json|\.yaml)$', |
|
|
|
schema_view.without_ui(cache_timeout=0), name='schema-json'), |
|
|
|
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'), |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
urlpatterns = [ |
|
|
|
url(r'^api/', include(urlpatterns_api)), |
|
|
|