mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
Improve pagination openapi schema
* add all properties on pagination class schemas to `required` attribute This helps the client code generators can add necessary validations/enable null-safe implementations.
This commit is contained in:
parent
070c32f4a6
commit
513fdb2e75
|
@ -253,6 +253,12 @@ class PageNumberPagination(BasePagination):
|
|||
},
|
||||
'results': schema,
|
||||
},
|
||||
'required': [
|
||||
'count',
|
||||
'next',
|
||||
'previous',
|
||||
'results',
|
||||
],
|
||||
}
|
||||
|
||||
def get_page_size(self, request):
|
||||
|
@ -426,6 +432,12 @@ class LimitOffsetPagination(BasePagination):
|
|||
},
|
||||
'results': schema,
|
||||
},
|
||||
'required': [
|
||||
'count',
|
||||
'next',
|
||||
'previous',
|
||||
'results',
|
||||
],
|
||||
}
|
||||
|
||||
def get_limit(self, request):
|
||||
|
@ -912,6 +924,11 @@ class CursorPagination(BasePagination):
|
|||
},
|
||||
'results': schema,
|
||||
},
|
||||
'required': [
|
||||
'next',
|
||||
'previous',
|
||||
'results',
|
||||
],
|
||||
}
|
||||
|
||||
def get_html_context(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user