mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
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:
parent
c62e3ca764
commit
3e13be321f
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user