@Arg undefined in @FieldResolver #1158
-
Following various examples, it seems @arg from parent query, is not getting passed to @FieldResolver. If i'm trying to access @arg in the @FieldResolver, it won't run the query and returns an error: "[GraphQL error]: Message: Field "distanceToProvider" argument "location" of type "[Int!]!" is required, but it was not provided." It works fine in the parent query, if I remove @arg from @FieldResolver
Here is the generated model
Am I doing it correct? Or is there an alternative to get @Arg/@Args in the fieldresolver? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Because that's how GraphQL was designed. Fields have own arguments and should never rely on arguments of the parent query because they are independent and field resolver can be executed as a part of other query. |
Beta Was this translation helpful? Give feedback.
Because that's how GraphQL was designed. Fields have own arguments and should never rely on arguments of the parent query because they are independent and field resolver can be executed as a part of other query.