Prepare for 1.1.0 (#30)

* refactor the view inspection process to be more modular and allow recursive customization
* add operation_id argument to @swagger_auto_
* add inspections for min/max validators
* add support for URLPathVersioning and NamespaceVersioning
* integrate with djangorestframework-camel-case
* fix bugs, improve tests and documentation
This commit is contained in:
Cristi Vîjdea
2017-12-26 22:50:59 +01:00
committed by GitHub
parent 73adc49b2c
commit c89f96fcb0
52 changed files with 2167 additions and 854 deletions
+49
View File
@@ -128,3 +128,52 @@ USE_TZ = True
STATIC_URL = '/static/'
TEST_RUNNER = 'testproj.runner.PytestTestRunner'
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'pipe_separated': {
'format': '%(asctime)s | %(levelname)s | %(name)s | %(message)s'
}
},
'handlers': {
'console_log': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'stream': 'ext://sys.stdout',
'formatter': 'pipe_separated',
},
},
'loggers': {
'drf_yasg': {
'handlers': ['console_log'],
'level': 'DEBUG',
'propagate': False,
},
'django': {
'handlers': ['console_log'],
'level': 'DEBUG',
'propagate': False,
},
'django.db.backends': {
'handlers': ['console_log'],
'level': 'INFO',
'propagate': False,
},
'django.template': {
'handlers': ['console_log'],
'level': 'INFO',
'propagate': False,
},
'swagger_spec_validator': {
'handlers': ['console_log'],
'level': 'INFO',
'propagate': False,
}
},
'root': {
'handlers': ['console_log'],
'level': 'INFO',
}
}
+7 -7
View File
@@ -6,7 +6,7 @@ from rest_framework.decorators import api_view
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
schema_view = get_schema_view(
SchemaView = get_schema_view(
openapi.Info(
title="Snippets API",
default_version='v1',
@@ -27,12 +27,12 @@ def plain_view(request):
urlpatterns = [
url(r'^swagger(?P<format>.json|.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'),
url(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
url(r'^cached/swagger(?P<format>.json|.yaml)$', schema_view.without_ui(cache_timeout=None), name='schema-json'),
url(r'^cached/swagger/$', schema_view.with_ui('swagger', cache_timeout=None), name='schema-swagger-ui'),
url(r'^cached/redoc/$', schema_view.with_ui('redoc', cache_timeout=None), name='schema-redoc'),
url(r'^swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
url(r'^swagger/$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
url(r'^redoc/$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
url(r'^cached/swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=None), name='cschema-json'),
url(r'^cached/swagger/$', SchemaView.with_ui('swagger', cache_timeout=None), name='cschema-swagger-ui'),
url(r'^cached/redoc/$', SchemaView.with_ui('redoc', cache_timeout=None), name='cschema-redoc'),
url(r'^admin/', admin.site.urls),
url(r'^snippets/', include('snippets.urls')),