mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-06-08 15:43:32 +03:00
Fix: Pagination response schemas. (#9049)
This commit is contained in:
parent
66d86d0177
commit
7658ffd71d
|
@ -239,6 +239,7 @@ class PageNumberPagination(BasePagination):
|
||||||
def get_paginated_response_schema(self, schema):
|
def get_paginated_response_schema(self, schema):
|
||||||
return {
|
return {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
'required': ['count', 'results'],
|
||||||
'properties': {
|
'properties': {
|
||||||
'count': {
|
'count': {
|
||||||
'type': 'integer',
|
'type': 'integer',
|
||||||
|
@ -411,6 +412,7 @@ class LimitOffsetPagination(BasePagination):
|
||||||
def get_paginated_response_schema(self, schema):
|
def get_paginated_response_schema(self, schema):
|
||||||
return {
|
return {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
'required': ['count', 'results'],
|
||||||
'properties': {
|
'properties': {
|
||||||
'count': {
|
'count': {
|
||||||
'type': 'integer',
|
'type': 'integer',
|
||||||
|
@ -906,6 +908,7 @@ class CursorPagination(BasePagination):
|
||||||
def get_paginated_response_schema(self, schema):
|
def get_paginated_response_schema(self, schema):
|
||||||
return {
|
return {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
'required': ['results'],
|
||||||
'properties': {
|
'properties': {
|
||||||
'next': {
|
'next': {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
|
|
|
@ -274,6 +274,7 @@ class TestPageNumberPagination:
|
||||||
|
|
||||||
assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {
|
assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
'required': ['count', 'results'],
|
||||||
'properties': {
|
'properties': {
|
||||||
'count': {
|
'count': {
|
||||||
'type': 'integer',
|
'type': 'integer',
|
||||||
|
@ -585,6 +586,7 @@ class TestLimitOffset:
|
||||||
|
|
||||||
assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {
|
assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
'required': ['count', 'results'],
|
||||||
'properties': {
|
'properties': {
|
||||||
'count': {
|
'count': {
|
||||||
'type': 'integer',
|
'type': 'integer',
|
||||||
|
@ -937,6 +939,7 @@ class CursorPaginationTestsMixin:
|
||||||
|
|
||||||
assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {
|
assert self.pagination.get_paginated_response_schema(unpaginated_schema) == {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
|
'required': ['results'],
|
||||||
'properties': {
|
'properties': {
|
||||||
'next': {
|
'next': {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user