In the docops example for this assertion, a sample policy is given with a POST request to 2 different URLs in the child assertions for each iteration of the multi valued variable. How do we use this assertion effectively in a scenario where we need to have a GET request to an URL in the child assertions since the response generated in each iteration of the child assertion will be over written by the response of the next iteration. If we need to store the response of route assertion in each iteration of the child assertion and then need to combine the responses of all iterations to return back to the client, how do we best achieve it with the help of this assertion?
- Request might contain 10 or more Part IDs. This can be stored to a multi valued context variable (Number of Part IDs in the request is not fixed with no maximum limit)
- For each Part ID that comes in the request, we need to call a back-end API and get the part details
- We need to combine the part details responses for each Part ID (from each iteration of Part ID) and build a single JSON document as response to the client.
How can we use the "Run Assertion for Each Item" assertion to execute this loop without responses of each iteration getting overwritten? Or is there any simpler way to achieve this loop without the help of this assertion?