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

RESTAPI: Handle resolve params which return a list of elements #482

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

francescomucio
Copy link
Contributor

Tell us what you do here

I modified the method that builds the path for resolve params

Short description

I introduced an internal method (to_list()) to convert the value returned by the parent resource to a Python list:

  • in case the parent resource returns a valid N-elements list, it is split into a N-element list
  • in case the parent resource returns a single value (or better something which is not a list), the value is put in a list with a single element.

Then process_parent_data_item() is returning not a single path but a list of paths, then paginate_dependent_resource needs to yield values from all the paths in the list.

Additional Context

This is a fairy common use case for APIs returning multiple elements from a search endpoint

@burnash burnash self-assigned this May 30, 2024
@burnash burnash added the enhancement New feature or request label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Planned
Development

Successfully merging this pull request may close these issues.

2 participants