-
-
Notifications
You must be signed in to change notification settings - Fork 114
Description
Discussed in #984
Originally posted by ruipliu July 22, 2022
This is to support complex use cases from client side building queries.
Now the response projections only have builder methods to add fields. But in client side there are certain business needs to dynamically build queries. The current client practice is creating the response projections and adding the fields in one time, which is hard coding. Could the plugin support getFields() in GraphQLResponseProjection for clients to access the fields in response projection after they created?
Here is an example:
Consider the [User - Order - Product] model.
- Use case 1: load 'user.orders.products.name' for each getUser query
- Use case 2: load 'user.orders.status' and 'user.orders.products.status' for each getUser query
- etc
In the client application, we might need data in
use case 1oruse case 2oruse case 1 & 2. Hence we need to write 3UserResponseProjection. If we have 10 use cases and their combinations exploded, we would prefer having aUserResponseProjectionfor each use case and combine these projections if we want to load fields in multiple use cases, which needs the fields attribute accessible.