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
Usually in the resolver you receive ResolveInfo $info and thanks to \GraphQL\Type\Definition\ResolveInfo::getFieldSelection you can get a simply representation of the requested structure:
If that helps, this is what I'm using, it will return an array of field information that has the same format as the one returned by ResolveInfo::getFieldSelection but for inner fields having arguments an extra _args key is added to the array of inner fields:
Example query:
Usually in the resolver you receive
ResolveInfo $info
and thanks to\GraphQL\Type\Definition\ResolveInfo::getFieldSelection
you can get a simply representation of the requested structure:But to write efficient resolvers it may be necessary to look ahead when resolving
outer
to know what input args apply toinner
, not just the fields.I've helped myself with copying and modifying `foldSelectionSet` so it returns a structure which contains input args too:
It gets the job done but doesn't feel exactly right.
Are there any recommendations and best practices to achieve this?
The text was updated successfully, but these errors were encountered: