add required fields on paginator schemas

`required: [count, responses]` or `required: [responses]` added to schema returned by pagination classes
 to specify which fields are required on a paginated response so that client code generators can add necessary
 validations/enable null-safe implementations.
This commit is contained in:
Rohit Reddy Abbadi 2021-09-26 02:14:00 +05:30 committed by GitHub
parent c62e3ca764
commit 3e13be321f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,6 +253,10 @@ class PageNumberPagination(BasePagination):
},
'results': schema,
},
'required': [
'count',
'results',
],
}
def get_page_size(self, request):
@ -426,6 +430,10 @@ class LimitOffsetPagination(BasePagination):
},
'results': schema,
},
'required': [
'count',
'results',
],
}
def get_limit(self, request):
@ -911,7 +919,10 @@ class CursorPagination(BasePagination):
'nullable': True,
},
'results': schema,
},
},,
'required': [
'results',
],
}
def get_html_context(self):