From b109d4c847d5b2851e235238e4ad9b913a0d4e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=20V=C3=AEjdea?= Date: Sun, 9 Sep 2018 23:11:10 +0300 Subject: [PATCH] Fix bad test for no_body --- testproj/articles/views.py | 3 ++- testproj/users/views.py | 2 +- tests/reference.yaml | 9 ++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/testproj/articles/views.py b/testproj/articles/views.py index 22b6401..944c33c 100644 --- a/testproj/articles/views.py +++ b/testproj/articles/views.py @@ -15,7 +15,7 @@ from articles.models import Article from drf_yasg import openapi from drf_yasg.app_settings import swagger_settings from drf_yasg.inspectors import CoreAPICompatInspector, FieldInspector, NotHandled, SwaggerAutoSchema -from drf_yasg.utils import swagger_auto_schema +from drf_yasg.utils import no_body, swagger_auto_schema class DjangoFilterDescriptionInspector(CoreAPICompatInspector): @@ -133,6 +133,7 @@ class ArticleViewSet(viewsets.ModelViewSet): """ pass + @swagger_auto_schema(request_body=no_body, operation_id='no_body_test') def update(self, request, *args, **kwargs): """update method docstring""" return super(ArticleViewSet, self).update(request, *args, **kwargs) diff --git a/testproj/users/views.py b/testproj/users/views.py index 738a5ed..a031fcf 100644 --- a/testproj/users/views.py +++ b/testproj/users/views.py @@ -36,7 +36,7 @@ class UserList(APIView): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) - @swagger_auto_schema(request_body=no_body, operation_id="users_dummy", operation_description="dummy operation") + @swagger_auto_schema(operation_id="users_dummy", operation_description="dummy operation") def patch(self, request): pass diff --git a/tests/reference.yaml b/tests/reference.yaml index e559b39..207220e 100644 --- a/tests/reference.yaml +++ b/tests/reference.yaml @@ -134,14 +134,9 @@ paths: tags: - articles put: - operationId: articles_update + operationId: no_body_test description: update method docstring - parameters: - - name: data - in: body - required: true - schema: - $ref: '#/definitions/Article' + parameters: [] responses: '200': description: ''