From 0837873f55da53b56bf028ca866ef94cab4934fc Mon Sep 17 00:00:00 2001 From: Nour Chawich Date: Thu, 30 Aug 2018 15:46:07 +0200 Subject: [PATCH] Add missing overrides to `swagger_auto_schema` (#194) Add missing `operation_summary` and `deprecated` to `swagger_auto_schema` decorator data. The previous PR missed adding these to extra overrides. - Added tests - Updated reference.yaml Refs #149, #173. Closes #194, #198. --- src/drf_yasg/utils.py | 2 ++ testproj/articles/views.py | 3 ++- tests/reference.yaml | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/drf_yasg/utils.py b/src/drf_yasg/utils.py index 0177e0b..25c1140 100644 --- a/src/drf_yasg/utils.py +++ b/src/drf_yasg/utils.py @@ -107,6 +107,8 @@ def swagger_auto_schema(method=None, methods=None, auto_schema=unset, request_bo 'query_serializer': query_serializer, 'manual_parameters': manual_parameters, 'operation_id': operation_id, + 'operation_summary': operation_summary, + 'deprecated': deprecated, 'operation_description': operation_description, 'security': security, 'responses': responses, diff --git a/testproj/articles/views.py b/testproj/articles/views.py index 9d91983..22b6401 100644 --- a/testproj/articles/views.py +++ b/testproj/articles/views.py @@ -137,7 +137,8 @@ class ArticleViewSet(viewsets.ModelViewSet): """update method docstring""" return super(ArticleViewSet, self).update(request, *args, **kwargs) - @swagger_auto_schema(operation_description="partial_update description override", responses={404: 'slug not found'}) + @swagger_auto_schema(operation_description="partial_update description override", responses={404: 'slug not found'}, + operation_summary='partial_update summary', deprecated=True) def partial_update(self, request, *args, **kwargs): """partial_update method docstring""" return super(ArticleViewSet, self).partial_update(request, *args, **kwargs) diff --git a/tests/reference.yaml b/tests/reference.yaml index 18da22d..e559b39 100644 --- a/tests/reference.yaml +++ b/tests/reference.yaml @@ -151,6 +151,7 @@ paths: - articles patch: operationId: articles_partial_update + summary: partial_update summary description: partial_update description override parameters: - name: data @@ -167,6 +168,7 @@ paths: description: slug not found tags: - articles + deprecated: true delete: operationId: articles_delete description: destroy method docstring