From e182ab65eacfe4a9655bb220ea8d55f29bd761ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=20V=C3=AEjdea?= Date: Wed, 19 Dec 2018 19:34:40 +0200 Subject: [PATCH] Add x-nullable to paginator response fields Closes #263. --- src/drf_yasg/inspectors/query.py | 4 ++-- tests/reference.yaml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/drf_yasg/inspectors/query.py b/src/drf_yasg/inspectors/query.py index f367c94..d6527a6 100644 --- a/src/drf_yasg/inspectors/query.py +++ b/src/drf_yasg/inspectors/query.py @@ -71,8 +71,8 @@ class DjangoRestResponsePagination(PaginatorInspector): type=openapi.TYPE_OBJECT, properties=OrderedDict(( ('count', openapi.Schema(type=openapi.TYPE_INTEGER) if has_count else None), - ('next', openapi.Schema(type=openapi.TYPE_STRING, format=openapi.FORMAT_URI)), - ('previous', openapi.Schema(type=openapi.TYPE_STRING, format=openapi.FORMAT_URI)), + ('next', openapi.Schema(type=openapi.TYPE_STRING, format=openapi.FORMAT_URI, x_nullable=True)), + ('previous', openapi.Schema(type=openapi.TYPE_STRING, format=openapi.FORMAT_URI, x_nullable=True)), ('results', response_schema), )), required=['results'] diff --git a/tests/reference.yaml b/tests/reference.yaml index 38fac41..c5ab990 100644 --- a/tests/reference.yaml +++ b/tests/reference.yaml @@ -75,9 +75,11 @@ paths: next: type: string format: uri + x-nullable: true previous: type: string format: uri + x-nullable: true results: type: array items: