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 1 or use case 2 or use case 1 & 2. Hence we need to write 3 UserResponseProjection. If we have 10 use cases and their combinations exploded, we would prefer having a UserResponseProjection for each use case and combine these projections if we want to load fields in multiple use cases, which needs the fields attribute accessible.
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()inGraphQLResponseProjectionfor clients to access thefieldsin response projection after they created?