-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination properties missing in list responses in OpenAPI schemas #6846
Labels
Comments
Yes, good. AutoSchema could check if a pagination class was defined. (Then we can see what might need adding to the pagination classes.) Fancy working on a PR? In the meantime I think a subclass (that Just Knows) will be required. |
reupen
changed the title
Pagination properties missing in responses in OpenAPI schemas
Pagination properties missing in list responses in OpenAPI schemas
Jul 29, 2019
Yes, why not. I'd probably do it in these steps:
|
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Jul 30, 2019
This is the first part of encode#6846. Previously, the response schema for list views was an object representing a single item. However, list views return a list of items, and hence it should be an array. Further work will need to be done to support how pagination classes further modify list responses. There should be no change for views not determined to be list views.
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Jul 30, 2019
This is the first part of encode#6846. Previously, the response schema for list views was an object representing a single item. However, list views return a list of items, and hence it should be an array. Further work will need to be done to support how pagination classes modify list responses. There should be no change for views not determined to be list views.
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Jul 30, 2019
This is the first part of encode#6846. Previously, the response schema for list views was an object representing a single item. However, list views return a list of items, and hence it should be an array. Further work will need to be done to support how pagination classes modify list responses. There should be no change for views not determined to be list views.
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Jul 30, 2019
This is the first part of encode#6846. Previously, the response schema for list views was an object representing a single item. However, list views return a list of items, and hence it should be an array. Further work will need to be done to support how pagination classes modify list responses. There should be no change for views not determined to be list views.
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Jul 30, 2019
This is the first part of encode#6846. Previously, the response schema for list views was an object representing a single item. However, list views return a list of items, and hence it should be an array. Further work will need to be done to support how pagination classes modify list responses. There should be no change for views not determined to be list views.
carltongibson
pushed a commit
that referenced
this issue
Aug 7, 2019
This is the first part of #6846. Previously, the response schema for list views was an object representing a single item. However, list views return a list of items, and hence it should be an array. Further work will need to be done to support how pagination classes modify list responses. There should be no change for views not determined to be list views.
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Aug 11, 2019
Refs encode#6846 This provides a way for pagination classes to add pagination properties (`count`, `next`, `results` etc.) to OpenAPI response schemas. A new method `get_paginated_response_schema()` has been added to `BasePagination`. This method is intended to mirror `get_paginated_response()` (which takes a `list` and wraps it in a `dict`). Hence, `get_paginated_response_schema()` takes an unpaginated response schema (of type `array`) and wraps that with a schema object of type `object` containing the relevant properties that the paginator adds to responses. The default implementation of `BasePagination.get_paginated_response_schema()` simply passes the schema through unmodified, for backwards compatibility.
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Aug 11, 2019
Refs encode#6846 This provides a way for pagination classes to add pagination properties (`count`, `next`, `results` etc.) to OpenAPI response schemas. A new method `get_paginated_response_schema()` has been added to `BasePagination`. This method is intended to mirror `get_paginated_response()` (which takes a `list` and wraps it in a `dict`). Hence, `get_paginated_response_schema()` takes an unpaginated response schema (of type `array`) and wraps that with a schema object of type `object` containing the relevant properties that the pagination class adds to responses. The default implementation of `BasePagination.get_paginated_response_schema()` simply passes the schema through unmodified, for backwards compatibility.
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Aug 11, 2019
Refs encode#6846 This provides a way for pagination classes to add pagination properties (`count`, `next`, `results` etc.) to OpenAPI response schemas. A new method `get_paginated_response_schema()` has been added to `BasePagination`. This method is intended to mirror `get_paginated_response()` (which takes a `list` and wraps it in a `dict`). Hence, `get_paginated_response_schema()` takes an unpaginated response schema (of type `array`) and wraps that with a schema object of type `object` containing the relevant properties that the pagination class adds to responses. The default implementation of `BasePagination.get_paginated_response_schema()` simply passes the schema through unmodified, for backwards compatibility.
reupen
added a commit
to reupen/django-rest-framework
that referenced
this issue
Aug 11, 2019
Refs encode#6846 This provides a way for pagination classes to add pagination properties (`count`, `next`, `results` etc.) to OpenAPI response schemas. A new method `get_paginated_response_schema()` has been added to `BasePagination`. This method is intended to mirror `get_paginated_response()` (which takes a `list` and wraps it in a `dict`). Hence, `get_paginated_response_schema()` takes an unpaginated response schema (of type `array`) and wraps that with a schema object of type `object` containing the relevant properties that the pagination class adds to responses. The default implementation of `BasePagination.get_paginated_response_schema()` simply passes the schema through unmodified, for backwards compatibility.
carltongibson
pushed a commit
that referenced
this issue
Sep 3, 2019
Refs #6846 This provides a way for pagination classes to add pagination properties (`count`, `next`, `results` etc.) to OpenAPI response schemas. A new method `get_paginated_response_schema()` has been added to `BasePagination`. This method is intended to mirror `get_paginated_response()` (which takes a `list` and wraps it in a `dict`). Hence, `get_paginated_response_schema()` takes an unpaginated response schema (of type `array`) and wraps that with a schema object of type `object` containing the relevant properties that the pagination class adds to responses. The default implementation of `BasePagination.get_paginated_response_schema()` simply passes the schema through unmodified, for backwards compatibility.
This is now resolved. Thanks @reupen! |
pchiquet
pushed a commit
to pchiquet/django-rest-framework
that referenced
this issue
Nov 17, 2020
This is the first part of encode#6846. Previously, the response schema for list views was an object representing a single item. However, list views return a list of items, and hence it should be an array. Further work will need to be done to support how pagination classes modify list responses. There should be no change for views not determined to be list views.
pchiquet
pushed a commit
to pchiquet/django-rest-framework
that referenced
this issue
Nov 17, 2020
Refs encode#6846 This provides a way for pagination classes to add pagination properties (`count`, `next`, `results` etc.) to OpenAPI response schemas. A new method `get_paginated_response_schema()` has been added to `BasePagination`. This method is intended to mirror `get_paginated_response()` (which takes a `list` and wraps it in a `dict`). Hence, `get_paginated_response_schema()` takes an unpaginated response schema (of type `array`) and wraps that with a schema object of type `object` containing the relevant properties that the pagination class adds to responses. The default implementation of `BasePagination.get_paginated_response_schema()` simply passes the schema through unmodified, for backwards compatibility.
sigvef
pushed a commit
to sigvef/django-rest-framework
that referenced
this issue
Dec 3, 2022
This is the first part of encode#6846. Previously, the response schema for list views was an object representing a single item. However, list views return a list of items, and hence it should be an array. Further work will need to be done to support how pagination classes modify list responses. There should be no change for views not determined to be list views.
sigvef
pushed a commit
to sigvef/django-rest-framework
that referenced
this issue
Dec 3, 2022
Refs encode#6846 This provides a way for pagination classes to add pagination properties (`count`, `next`, `results` etc.) to OpenAPI response schemas. A new method `get_paginated_response_schema()` has been added to `BasePagination`. This method is intended to mirror `get_paginated_response()` (which takes a `list` and wraps it in a `dict`). Hence, `get_paginated_response_schema()` takes an unpaginated response schema (of type `array`) and wraps that with a schema object of type `object` containing the relevant properties that the pagination class adds to responses. The default implementation of `BasePagination.get_paginated_response_schema()` simply passes the schema through unmodified, for backwards compatibility.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
master
branch of Django REST framework.Steps to reproduce
LimitOffsetPagination
Expected behavior
count
,next
,previous
andresults
for LimitOffsetPaginationActual behavior
AutoSchema
about what its responses look like.)(Additionally, if no pagination class is specified, the response schema should be an array rather than an object.)
The text was updated successfully, but these errors were encountered: