Skip to content

Conversation

@meetghodasara-crest
Copy link

Support of default_pagination_limit and max_pagination_limit parameters for manifest and objects get endpoints to avoid errors because of large response size.

Copy link
Contributor

@eric-eclecticiq eric-eclecticiq left a comment

Choose a reason for hiding this comment

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

Thank you for this change, it is indeed a good idea to put a default limit to prevent large response.

However, to merge it, I would ask you to add tests on top of cleaning the format mentioned in the other comment.

)
def manifest_handler(self, api_root_id, collection_id_or_alias):
filter_params = validate_list_filter_params(request.args, self.persistence.api)
filter_params["limit"] = self.config.get("max_pagination_limit") if filter_params.get("limit", self.config.get("max_pagination_limit")) > self.config.get("max_pagination_limit") else filter_params.get("limit", self.config.get("default_pagination_limit"))
Copy link
Contributor

Choose a reason for hiding this comment

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

As a single line, this is not very readable and probably not compatible with the linter.

Also, it is used multiple times, you may move it to a dedicated method.

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