Skip to content
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

Add support for pagination in OpenAPI response schemas #6867

Merged
merged 1 commit into from Sep 3, 2019

Conversation

@reupen
Copy link
Contributor

commented Aug 11, 2019

Description

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 typically 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.

Add support for pagination in OpenAPI response schemas
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.

@carltongibson carltongibson self-requested a review Aug 12, 2019

@reupen reupen marked this pull request as ready for review Aug 12, 2019

@peterfarrell

This comment has been minimized.

Copy link
Contributor

commented Aug 19, 2019

Looking forward to seeing this PR merged and released.

@carltongibson
Copy link
Collaborator

left a comment

OK, this looks good. Thanks @reupen

@carltongibson carltongibson merged commit f8c1644 into encode:master Sep 3, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@reupen reupen deleted the reupen:pagination-schema branch Sep 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.