Using personLoader in listPersonResolver Root Resolver Service
The following steps allow the listPersonResolver root resolver service to use the personLoader loader service for the query in the example.
1. To fetch the data for a list of people (for multiple ids), invoke the pub.graphql:loadMany service in the listPersonResolver root resolver service.
2. Prepare the listPersonResolver root resolver service inputs. This helps you to map the root resolver service input to the input of pub.graphql:loadMany service. The input of the root resolver is a list of ids however, the input of pub.graphql:loadMany service is a list of keys. Also, id is one of the fields in the keys document. Therefore, it is important to process the inputs. Perform the following to prepare the root resolver inputs:
a. Insert a LOOP step to loop over the list of ids of people.
b. Create a keyDocs document list and map it to the keys field of the pub.graphql:loadMany service. This maps the ids of people to the input of the pub.graphql:loadMany service.
c. Name the loaderName as personLoader. d. Save the service.