Browse Source

add drj-yasg

pull/2465/head
Leandro Roberto 6 years ago
parent
commit
003b96b371
  1. 9
      requirements/requirements.txt
  2. 29
      sapl/api/urls.py
  3. 3
      sapl/settings.py
  4. 8
      setup.py

9
requirements/requirements.txt

@ -14,7 +14,7 @@ django-speedinfo==1.4.0
django-extensions==2.1.4
django-image-cropping==1.2
django-webpack-loader==0.6.0
django-rest-swagger==2.2.0
drf-yasg==1.13.0
easy-thumbnails==2.5
python-decouple==3.1
psycopg2-binary==2.7.6.1
@ -31,11 +31,4 @@ pysolr==3.6.0
whoosh==2.7.4
git+git://github.com/interlegis/trml2pdf.git
#git+git://github.com/jasperlittle/django-rest-framework-docs
git+git://github.com/interlegis/django-admin-bootstrapped
#django-compressor==2.2
#django-bootstrap3==11.0.0
#django-bower==5.2.0
#django-sass-processor==0.7.2
#libsass==0.17.0

29
sapl/api/urls.py

@ -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)),

3
sapl/settings.py

@ -81,7 +81,8 @@ INSTALLED_APPS = (
'crispy_forms',
'floppyforms',
'rest_framework_swagger',
'drf_yasg',
#'rest_framework_swagger',
'rest_framework',
'django_filters',

8
setup.py

@ -25,6 +25,7 @@ install_requires = [
'django-extensions==2.1.4',
'django-image-cropping==1.2.0',
'django-webpack-loader==0.6.0',
'drf-yasg==1.13.0',
'easy-thumbnails==2.5',
'python-decouple==3.1',
'psycopg2-binary==2.7.6.1',
@ -41,14 +42,7 @@ install_requires = [
'whoosh==2.7.4',
# 'git+git://github.com/interlegis/trml2pdf.git',
# 'git+git://github.com/jasperlittle/django-rest-framework-docs',
# 'git+git://github.com/interlegis/django-admin-bootstrapped',
#'django-compressor==2.2',
#'django-bootstrap3==11.0.0',
#'django-bower==5.2.0',
#'django-sass-processor==0.7.2',
#'libsass==0.17.0',
]
setup(
name='interlegis-sapl',

Loading…
Cancel
Save