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: