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

config for always returning pagination response #89

Merged
merged 2 commits into from
Jul 25, 2023

Conversation

hosie
Copy link
Contributor

@hosie hosie commented Jul 12, 2023

The structure of an array response is currently dependant on the query parameters. If count=true is specified, then the response is a pagination object wrapping the array and containing count and total. Otherwise, the response is the bare JSON array.

The bare array is nice and easy to consume but it may be undesirable in certain situations to lull the developer into expecting a bare array and suddenly realising that once the collection contains so many items, that it will be paginated and the response structure suddenly changes.

This PR proposes to give the deployer of any service using firefly-common to configure it such that the pagination response structure is always used regardless of whether pagination filter was requested or whether or not the total number of records is available.

Signed-off-by: John Hosie <john.hosie@kaleido.io>
Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @hosie - one hopefully small thing to close out on I thought of

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
@peterbroadhurst peterbroadhurst merged commit 992357b into hyperledger:main Jul 25, 2023
@peterbroadhurst peterbroadhurst deleted the always-paginate branch July 25, 2023 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants