Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d2dc09cb3c | |||
| 36992072ca | |||
| aa90723703 | |||
| 301511bebc | |||
| c0f37f6ec1 | |||
| 5e684549a1 | |||
| 322971f3e7 | |||
| 6dd8ded05d | |||
| 7270154828 |
@@ -159,3 +159,5 @@ com_crashlytics_export_strings.xml
|
|||||||
crashlytics.properties
|
crashlytics.properties
|
||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
fabric.properties
|
fabric.properties
|
||||||
|
|
||||||
|
\.pytest_cache/
|
||||||
|
|||||||
Generated
+1
@@ -16,6 +16,7 @@
|
|||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/testproj" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/testproj" isTestSource="false" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/docs/_build" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.6 (drf-yasg)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.6 (drf-yasg)" jdkType="Python SDK" />
|
||||||
|
|||||||
+2
-1
@@ -10,11 +10,12 @@
|
|||||||
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="ourVersions">
|
<option name="ourVersions">
|
||||||
<value>
|
<value>
|
||||||
<list size="4">
|
<list size="5">
|
||||||
<item index="0" class="java.lang.String" itemvalue="2.7" />
|
<item index="0" class="java.lang.String" itemvalue="2.7" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="3.4" />
|
<item index="1" class="java.lang.String" itemvalue="3.4" />
|
||||||
<item index="2" class="java.lang.String" itemvalue="3.5" />
|
<item index="2" class="java.lang.String" itemvalue="3.5" />
|
||||||
<item index="3" class="java.lang.String" itemvalue="3.6" />
|
<item index="3" class="java.lang.String" itemvalue="3.6" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="3.7" />
|
||||||
</list>
|
</list>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
Generated
+3
@@ -70,4 +70,7 @@
|
|||||||
</LinkMapSettings>
|
</LinkMapSettings>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (drf-yasg)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (drf-yasg)" project-jdk-type="Python SDK" />
|
||||||
|
<component name="PythonCompatibilityInspectionAdvertiser">
|
||||||
|
<option name="version" value="3" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -9,6 +9,7 @@ python:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
- DRF=3.7
|
- DRF=3.7
|
||||||
|
- DRF=3.8
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ Generate **real** Swagger/OpenAPI 2.0 specifications from a Django Rest Framewor
|
|||||||
|
|
||||||
Compatible with
|
Compatible with
|
||||||
|
|
||||||
- **Django Rest Framework**: 3.7.7
|
- **Django Rest Framework**: 3.7.7, 3.8.x
|
||||||
- **Django**: 1.11.x, 2.0.x
|
- **Django**: 1.11.x, 2.0.x
|
||||||
- **Python**: 2.7, 3.4, 3.5, 3.6
|
- **Python**: 2.7, 3.4, 3.5, 3.6
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,17 @@ Changelog
|
|||||||
#########
|
#########
|
||||||
|
|
||||||
|
|
||||||
|
*********
|
||||||
|
**1.6.2**
|
||||||
|
*********
|
||||||
|
|
||||||
|
*Release date: Apr 25, 2018*
|
||||||
|
|
||||||
|
- **IMPROVED:** updated ``swagger-ui`` to version 3.13.6
|
||||||
|
- **IMPROVED:** switched ``ReDoc`` to version 2.0.0-alpha.17 (was 1.21.2); fixes :issue:`107`
|
||||||
|
- **FIXED:** made documentation ordering of parameters stable for urls with multiple parameters (:issue:`105`, :pr:`106`)
|
||||||
|
- **FIXED:** fixed crash when using a model ``ChoiceField`` of unknown child type
|
||||||
|
|
||||||
*********
|
*********
|
||||||
**1.6.1**
|
**1.6.1**
|
||||||
*********
|
*********
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ Where you can use the :func:`@swagger_auto_schema <.swagger_auto_schema>` decora
|
|||||||
|
|
||||||
* for ``ViewSet``, ``GenericViewSet``, ``ModelViewSet``, because each viewset corresponds to multiple **paths**, you have
|
* for ``ViewSet``, ``GenericViewSet``, ``ModelViewSet``, because each viewset corresponds to multiple **paths**, you have
|
||||||
to decorate the *action methods*, i.e. ``list``, ``create``, ``retrieve``, etc. |br|
|
to decorate the *action methods*, i.e. ``list``, ``create``, ``retrieve``, etc. |br|
|
||||||
Additionally, ``@list_route``\ s or ``@detail_route``\ s defined on the viewset, like function based api views, can
|
Additionally, ``@action``\ s, `@list_route``\ s or ``@detail_route``\ s defined on the viewset, like function based
|
||||||
respond to multiple HTTP methods and thus have multiple operations that must be decorated separately:
|
api views, can respond to multiple HTTP methods and thus have multiple operations that must be decorated separately:
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
@@ -96,13 +96,13 @@ Where you can use the :func:`@swagger_auto_schema <.swagger_auto_schema>` decora
|
|||||||
class ArticleViewSet(viewsets.ModelViewSet):
|
class ArticleViewSet(viewsets.ModelViewSet):
|
||||||
# method or 'methods' can be skipped because the list_route only handles a single method (GET)
|
# method or 'methods' can be skipped because the list_route only handles a single method (GET)
|
||||||
@swagger_auto_schema(operation_description='GET /articles/today/')
|
@swagger_auto_schema(operation_description='GET /articles/today/')
|
||||||
@list_route(methods=['get'])
|
@action(detail=False, methods=['get'])
|
||||||
def today(self, request):
|
def today(self, request):
|
||||||
...
|
...
|
||||||
|
|
||||||
@swagger_auto_schema(method='get', operation_description="GET /articles/{id}/image/")
|
@swagger_auto_schema(method='get', operation_description="GET /articles/{id}/image/")
|
||||||
@swagger_auto_schema(method='post', operation_description="POST /articles/{id}/image/")
|
@swagger_auto_schema(method='post', operation_description="POST /articles/{id}/image/")
|
||||||
@detail_route(methods=['get', 'post'], parser_classes=(MultiPartParser,))
|
@action(detail=True, methods=['get', 'post'], parser_classes=(MultiPartParser,))
|
||||||
def image(self, request, id=None):
|
def image(self, request, id=None):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -190,8 +190,8 @@ OPERATIONS_SORTER
|
|||||||
Sorting order for the operation list of each tag.
|
Sorting order for the operation list of each tag.
|
||||||
|
|
||||||
* :python:`None`: show in the order returned by the server
|
* :python:`None`: show in the order returned by the server
|
||||||
* :python:`alpha`: sort alphabetically by path
|
* :python:`'alpha'`: sort alphabetically by path
|
||||||
* :python:`method`: sort by HTTP method
|
* :python:`'method'`: sort by HTTP method
|
||||||
|
|
||||||
**Default**: :python:`None` |br|
|
**Default**: :python:`None` |br|
|
||||||
*Maps to parameter*: ``operationsSorter``
|
*Maps to parameter*: ``operationsSorter``
|
||||||
@@ -202,7 +202,7 @@ TAGS_SORTER
|
|||||||
Sorting order for tagged operation groups.
|
Sorting order for tagged operation groups.
|
||||||
|
|
||||||
* :python:`None`: Swagger UI default ordering
|
* :python:`None`: Swagger UI default ordering
|
||||||
* :python:`alpha`: sort alphabetically
|
* :python:`'alpha'`: sort alphabetically
|
||||||
|
|
||||||
**Default**: :python:`None` |br|
|
**Default**: :python:`None` |br|
|
||||||
*Maps to parameter*: ``tagsSorter``
|
*Maps to parameter*: ``tagsSorter``
|
||||||
@@ -212,9 +212,9 @@ DOC_EXPANSION
|
|||||||
|
|
||||||
Controls the default expansion setting for the operations and tags.
|
Controls the default expansion setting for the operations and tags.
|
||||||
|
|
||||||
* :python:`None`: everything is collapsed
|
* :python:`'none'`: everything is collapsed
|
||||||
* :python:`list`: only tags are expanded
|
* :python:`'list'`: only tags are expanded
|
||||||
* :python:`full`: all operations are expanded
|
* :python:`'full'`: all operations are expanded
|
||||||
|
|
||||||
**Default**: :python:`'list'` |br|
|
**Default**: :python:`'list'` |br|
|
||||||
*Maps to parameter*: ``docExpansion``
|
*Maps to parameter*: ``docExpansion``
|
||||||
@@ -240,8 +240,8 @@ DEFAULT_MODEL_RENDERING
|
|||||||
|
|
||||||
Controls whether operations show the model structure or the example value by default.
|
Controls whether operations show the model structure or the example value by default.
|
||||||
|
|
||||||
* :python:`model`: show the model fields by default
|
* :python:`'model'`: show the model fields by default
|
||||||
* :python:`example`: show the example value by default
|
* :python:`'example'`: show the example value by default
|
||||||
|
|
||||||
**Default**: :python:`'model'` |br|
|
**Default**: :python:`'model'` |br|
|
||||||
*Maps to parameter*: ``defaultModelRendering``
|
*Maps to parameter*: ``defaultModelRendering``
|
||||||
|
|||||||
Generated
+2258
-152
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "drf-yasg",
|
"name": "drf-yasg",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"redoc": "^1.21.2",
|
"redoc": "^2.0.0-alpha.17",
|
||||||
"swagger-ui-dist": "^3.13.0"
|
"swagger-ui-dist": "^3.13.6"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# requirements for building and running tox
|
# requirements for building and running tox
|
||||||
tox>=2.9.1
|
tox>=2.9.1,<3.0.0
|
||||||
detox>=0.11
|
detox>=0.11
|
||||||
|
|
||||||
-r setup.txt
|
-r setup.txt
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ class OpenAPISchemaGenerator(object):
|
|||||||
queryset = getattr(view_cls, 'queryset', None)
|
queryset = getattr(view_cls, 'queryset', None)
|
||||||
model = getattr(getattr(view_cls, 'queryset', None), 'model', None)
|
model = getattr(getattr(view_cls, 'queryset', None), 'model', None)
|
||||||
|
|
||||||
for variable in uritemplate.variables(path):
|
for variable in sorted(uritemplate.variables(path)):
|
||||||
model, model_field = get_queryset_field(queryset, variable)
|
model, model_field = get_queryset_field(queryset, variable)
|
||||||
attrs = get_basic_type_info(model_field) or {'type': openapi.TYPE_STRING}
|
attrs = get_basic_type_info(model_field) or {'type': openapi.TYPE_STRING}
|
||||||
if getattr(view_cls, 'lookup_field', None) == variable and attrs['type'] == openapi.TYPE_STRING:
|
if getattr(view_cls, 'lookup_field', None) == variable and attrs['type'] == openapi.TYPE_STRING:
|
||||||
|
|||||||
@@ -410,7 +410,9 @@ class ChoiceFieldInspector(FieldInspector):
|
|||||||
model = getattr(getattr(serializer, 'Meta'), 'model')
|
model = getattr(getattr(serializer, 'Meta'), 'model')
|
||||||
model_field = get_model_field(model, field.source)
|
model_field = get_model_field(model, field.source)
|
||||||
if model_field:
|
if model_field:
|
||||||
enum_type = get_basic_type_info(model_field).get('type', enum_type)
|
model_type = get_basic_type_info(model_field)
|
||||||
|
if model_type:
|
||||||
|
enum_type = model_type.get('type', enum_type)
|
||||||
|
|
||||||
if isinstance(field, serializers.MultipleChoiceField):
|
if isinstance(field, serializers.MultipleChoiceField):
|
||||||
return SwaggerType(
|
return SwaggerType(
|
||||||
|
|||||||
+136
-3
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -114,7 +114,7 @@ def swagger_auto_schema(method=None, methods=None, auto_schema=unset, request_bo
|
|||||||
# no overrides to set, no use in doing more work
|
# no overrides to set, no use in doing more work
|
||||||
return
|
return
|
||||||
|
|
||||||
# if the method is a detail_route or list_route, it will have a bind_to_methods attribute
|
# if the method is an @action, it will have a bind_to_methods attribute
|
||||||
bind_to_methods = getattr(view_method, 'bind_to_methods', [])
|
bind_to_methods = getattr(view_method, 'bind_to_methods', [])
|
||||||
# if the method is actually a function based view (@api_view), it will have a 'cls' attribute
|
# if the method is actually a function based view (@api_view), it will have a 'cls' attribute
|
||||||
view_cls = getattr(view_method, 'cls', None)
|
view_cls = getattr(view_method, 'cls', None)
|
||||||
@@ -126,7 +126,7 @@ def swagger_auto_schema(method=None, methods=None, auto_schema=unset, request_bo
|
|||||||
_methods = methods
|
_methods = methods
|
||||||
if methods or method:
|
if methods or method:
|
||||||
assert available_methods or http_method_names, "`method` or `methods` can only be specified " \
|
assert available_methods or http_method_names, "`method` or `methods` can only be specified " \
|
||||||
"on @detail_route or @api_view views"
|
"on @action or @api_view views"
|
||||||
assert bool(methods) != bool(method), "specify either method or methods"
|
assert bool(methods) != bool(method), "specify either method or methods"
|
||||||
assert not isinstance(methods, str), "`methods` expects to receive a list of methods;" \
|
assert not isinstance(methods, str), "`methods` expects to receive a list of methods;" \
|
||||||
" use `method` for a single argument"
|
" use `method` for a single argument"
|
||||||
@@ -138,13 +138,13 @@ def swagger_auto_schema(method=None, methods=None, auto_schema=unset, request_bo
|
|||||||
assert not any(mth in existing_data for mth in _methods), "http method defined multiple times"
|
assert not any(mth in existing_data for mth in _methods), "http method defined multiple times"
|
||||||
|
|
||||||
if available_methods:
|
if available_methods:
|
||||||
# detail_route, list_route or api_view
|
# action or api_view
|
||||||
assert bool(http_method_names) != bool(bind_to_methods), "this should never happen"
|
assert bool(http_method_names) != bool(bind_to_methods), "this should never happen"
|
||||||
|
|
||||||
if len(available_methods) > 1:
|
if len(available_methods) > 1:
|
||||||
assert _methods, \
|
assert _methods, \
|
||||||
"on multi-method api_view, detail_route or list_route, you must specify swagger_auto_schema on " \
|
"on multi-method api_view, action, detail_route or list_route, you must specify " \
|
||||||
"a per-method basis using one of the `method` or `methods` arguments"
|
"swagger_auto_schema on a per-method basis using one of the `method` or `methods` arguments"
|
||||||
else:
|
else:
|
||||||
# for a single-method view we assume that single method as the decorator target
|
# for a single-method view we assume that single method as the decorator target
|
||||||
_methods = _methods or available_methods
|
_methods = _methods or available_methods
|
||||||
@@ -156,8 +156,9 @@ def swagger_auto_schema(method=None, methods=None, auto_schema=unset, request_bo
|
|||||||
view_method._swagger_auto_schema = existing_data
|
view_method._swagger_auto_schema = existing_data
|
||||||
else:
|
else:
|
||||||
assert not _methods, \
|
assert not _methods, \
|
||||||
"the methods argument should only be specified when decorating a detail_route or list_route; you " \
|
"the methods argument should only be specified when decorating an action, detail_route or " \
|
||||||
"should also ensure that you put the swagger_auto_schema decorator AFTER (above) the _route decorator"
|
"list_route; you should also ensure that you put the swagger_auto_schema decorator " \
|
||||||
|
"AFTER (above) the _route decorator"
|
||||||
assert not existing_data, "swagger_auto_schema applied twice to method"
|
assert not existing_data, "swagger_auto_schema applied twice to method"
|
||||||
view_method._swagger_auto_schema = data
|
view_method._swagger_auto_schema = data
|
||||||
|
|
||||||
@@ -183,7 +184,7 @@ def is_list_view(path, method, view):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
if action in ('retrieve', 'update', 'partial_update', 'destroy') or detail is True or suffix == 'Instance':
|
if action in ('retrieve', 'update', 'partial_update', 'destroy') or detail is True or suffix == 'Instance':
|
||||||
# a detail_route is surely not a list route
|
# a detail action is surely not a list route
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# for GenericAPIView, if it's a detail view it can't also be a list view
|
# for GenericAPIView, if it's a detail view it can't also be a list view
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import datetime
|
|||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django_filters.rest_framework import DjangoFilterBackend
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
from rest_framework import viewsets
|
from rest_framework import viewsets
|
||||||
|
# noinspection PyDeprecation
|
||||||
from rest_framework.decorators import detail_route, list_route
|
from rest_framework.decorators import detail_route, list_route
|
||||||
from rest_framework.filters import OrderingFilter
|
from rest_framework.filters import OrderingFilter
|
||||||
from rest_framework.pagination import LimitOffsetPagination
|
from rest_framework.pagination import LimitOffsetPagination
|
||||||
@@ -89,6 +90,30 @@ class ArticleViewSet(viewsets.ModelViewSet):
|
|||||||
|
|
||||||
swagger_schema = NoTitleAutoSchema
|
swagger_schema = NoTitleAutoSchema
|
||||||
|
|
||||||
|
try:
|
||||||
|
from rest_framework.decorators import action
|
||||||
|
|
||||||
|
@swagger_auto_schema(auto_schema=NoPagingAutoSchema, filter_inspectors=[DjangoFilterDescriptionInspector])
|
||||||
|
@action(detail=False, methods=['get'])
|
||||||
|
def today(self, request):
|
||||||
|
today_min = datetime.datetime.combine(datetime.date.today(), datetime.time.min)
|
||||||
|
today_max = datetime.datetime.combine(datetime.date.today(), datetime.time.max)
|
||||||
|
articles = self.get_queryset().filter(date_created__range=(today_min, today_max)).all()
|
||||||
|
serializer = self.serializer_class(articles, many=True)
|
||||||
|
return Response(serializer.data)
|
||||||
|
|
||||||
|
@swagger_auto_schema(method='get', operation_description="image GET description override")
|
||||||
|
@swagger_auto_schema(method='post', request_body=serializers.ImageUploadSerializer)
|
||||||
|
@action(detail=True, methods=['get', 'post'], parser_classes=(MultiPartParser,))
|
||||||
|
def image(self, request, slug=None):
|
||||||
|
"""
|
||||||
|
image method docstring
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
except ImportError:
|
||||||
|
action = None
|
||||||
|
|
||||||
|
# noinspection PyDeprecation
|
||||||
@swagger_auto_schema(auto_schema=NoPagingAutoSchema, filter_inspectors=[DjangoFilterDescriptionInspector])
|
@swagger_auto_schema(auto_schema=NoPagingAutoSchema, filter_inspectors=[DjangoFilterDescriptionInspector])
|
||||||
@list_route(methods=['get'])
|
@list_route(methods=['get'])
|
||||||
def today(self, request):
|
def today(self, request):
|
||||||
@@ -98,6 +123,7 @@ class ArticleViewSet(viewsets.ModelViewSet):
|
|||||||
serializer = self.serializer_class(articles, many=True)
|
serializer = self.serializer_class(articles, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
||||||
|
# noinspection PyDeprecation
|
||||||
@swagger_auto_schema(method='get', operation_description="image GET description override")
|
@swagger_auto_schema(method='get', operation_description="image GET description override")
|
||||||
@swagger_auto_schema(method='post', request_body=serializers.ImageUploadSerializer)
|
@swagger_auto_schema(method='post', request_body=serializers.ImageUploadSerializer)
|
||||||
@detail_route(methods=['get', 'post'], parser_classes=(MultiPartParser,))
|
@detail_route(methods=['get', 'post'], parser_classes=(MultiPartParser,))
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
from django.conf.urls import url
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
|
|
||||||
from todo import views
|
from todo import views
|
||||||
@@ -8,3 +9,8 @@ router.register(r'another', views.TodoAnotherViewSet)
|
|||||||
router.register(r'yetanother', views.TodoYetAnotherViewSet)
|
router.register(r'yetanother', views.TodoYetAnotherViewSet)
|
||||||
|
|
||||||
urlpatterns = router.urls
|
urlpatterns = router.urls
|
||||||
|
|
||||||
|
urlpatterns += [
|
||||||
|
url(r'^(?P<todo_id>\d+)/yetanother/(?P<yetanother_id>\d+)/$',
|
||||||
|
views.NestedTodoView.as_view(),),
|
||||||
|
]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from rest_framework import viewsets
|
from rest_framework import viewsets
|
||||||
|
from rest_framework.generics import RetrieveAPIView
|
||||||
|
|
||||||
from .models import Todo, TodoAnother, TodoYetAnother
|
from .models import Todo, TodoAnother, TodoYetAnother
|
||||||
from .serializer import TodoAnotherSerializer, TodoSerializer, TodoYetAnotherSerializer
|
from .serializer import TodoAnotherSerializer, TodoSerializer, TodoYetAnotherSerializer
|
||||||
@@ -20,3 +21,7 @@ class TodoAnotherViewSet(viewsets.ReadOnlyModelViewSet):
|
|||||||
class TodoYetAnotherViewSet(viewsets.ReadOnlyModelViewSet):
|
class TodoYetAnotherViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
queryset = TodoYetAnother.objects.all()
|
queryset = TodoYetAnother.objects.all()
|
||||||
serializer_class = TodoYetAnotherSerializer
|
serializer_class = TodoYetAnotherSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class NestedTodoView(RetrieveAPIView):
|
||||||
|
serializer_class = TodoYetAnotherSerializer
|
||||||
|
|||||||
@@ -546,6 +546,27 @@ paths:
|
|||||||
description: A unique integer value identifying this todo.
|
description: A unique integer value identifying this todo.
|
||||||
required: true
|
required: true
|
||||||
type: integer
|
type: integer
|
||||||
|
/todo/{todo_id}/yetanother/{yetanother_id}/:
|
||||||
|
get:
|
||||||
|
operationId: todo_yetanother_read
|
||||||
|
description: ''
|
||||||
|
parameters: []
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: ''
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/TodoYetAnother'
|
||||||
|
tags:
|
||||||
|
- todo
|
||||||
|
parameters:
|
||||||
|
- name: todo_id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- name: yetanother_id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
/users/:
|
/users/:
|
||||||
get:
|
get:
|
||||||
operationId: users_list
|
operationId: users_list
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist =
|
envlist =
|
||||||
py27-django111-drf37,
|
py27-django111-drf37,
|
||||||
py{34,35,36}-django{111,20}-drf37,
|
py{34,35,36}-django{111,20}-drf{37,38},
|
||||||
py36-django20-drfmaster,
|
py36-django20-drfmaster,
|
||||||
lint, docs
|
lint, docs
|
||||||
|
|
||||||
[travis:env]
|
[travis:env]
|
||||||
DRF =
|
DRF =
|
||||||
3.7: drf37
|
3.7: drf37
|
||||||
|
3.8: drf38
|
||||||
master: drfmaster
|
master: drfmaster
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
@@ -16,6 +17,7 @@ deps =
|
|||||||
django20: Django>=2.0,<2.1
|
django20: Django>=2.0,<2.1
|
||||||
|
|
||||||
drf37: djangorestframework>=3.7.7,<3.8
|
drf37: djangorestframework>=3.7.7,<3.8
|
||||||
|
drf38: djangorestframework>=3.8.0,<3.9
|
||||||
|
|
||||||
# test with the latest build of django-rest-framework to get early warning of compatibility issues
|
# test with the latest build of django-rest-framework to get early warning of compatibility issues
|
||||||
drfmaster: https://github.com/encode/django-rest-framework/archive/master.tar.gz
|
drfmaster: https://github.com/encode/django-rest-framework/archive/master.tar.gz
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
set -ev
|
set -ev
|
||||||
npm update
|
npm update
|
||||||
|
|
||||||
cp node_modules/redoc/dist/redoc.min.js src/drf_yasg/static/drf-yasg/redoc/
|
cp node_modules/redoc/bundles/redoc.standalone.js src/drf_yasg/static/drf-yasg/redoc/redoc.min.js
|
||||||
cp -r node_modules/swagger-ui-dist src/drf_yasg/static/drf-yasg/
|
cp -r node_modules/swagger-ui-dist src/drf_yasg/static/drf-yasg/
|
||||||
pushd src/drf_yasg/static/drf-yasg/swagger-ui-dist/ >/dev/null
|
pushd src/drf_yasg/static/drf-yasg/swagger-ui-dist/ >/dev/null
|
||||||
rm -f package.json .npmignore README.md
|
rm -f package.json .npmignore README.md
|
||||||
|
|||||||
Reference in New Issue
Block a user