You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case where I use local resolvers to proxy and then enrich/transform other server side fields.
An example would be a field implementing the Relay Connections spec. My Local Resolver first fetches the server side data using client.query against a Relay spec compliant server field, after which it will do some combo of client side filtering/sorting/aggregation.
This "upstream" GQL call can return a combo of usable data and errors. E.g. if some of the list items - AKA edges - couldn't be resolved, we received path specific errors for those and data fields for the rest.
The local resolver ideally should return the processed data for the data fields it did receive, while also return (transformed) errors for the missing upstream edges.
Currently this is not possible with local resolvers since they can only have two resolution states: 1) success if the resolver returns or 2) error if it throws.
I have a use case where I use local resolvers to proxy and then enrich/transform other server side fields.
An example would be a field implementing the Relay Connections spec. My Local Resolver first fetches the server side data using
client.query
against a Relay spec compliant server field, after which it will do some combo of client side filtering/sorting/aggregation.This "upstream" GQL call can return a combo of usable data and errors. E.g. if some of the list items - AKA
edges
- couldn't be resolved, we received path specific errors for those and data fields for the rest.The local resolver ideally should return the processed data for the data fields it did receive, while also return (transformed) errors for the missing upstream edges.
Currently this is not possible with local resolvers since they can only have two resolution states: 1) success if the resolver returns or 2) error if it throws.
What I had in mind is something like the
DataFetcherResult
from GraphQL Java, which allows one to return both data and errors together: https://www.graphql-java.com/documentation/execution#returning-data-and-errorsThe text was updated successfully, but these errors were encountered: