Expose FieldDefinition in ResolveInfo#522
Conversation
|
Can you explain your use case a bit? P.S. Technically it is a breaking change because of ResolveInfo constructor signature change. |
|
We are using complex nested mutations in Lighthouse, see https://lighthouse-php.com/master/eloquent/nested-mutations.html for some examples of how they are used. I am looking to implement a generalized solution for composing nested mutations. Take for example a query like this: mutation {
createPost(input: {
title: "My new Post"
author: {
connect: 123
}
}){
id
author {
name
}
}
}The |
Technically true, although i found the constructor is only used twice - within the executors. It is not marked with |
|
Is there something i can do to move this PR forward? |
|
Thanks for reminding. I just want to make sure we are on the same page. Here is what confuses me a bit: InputObjectType fields do not have resolvers. Only regular ObjectType fields do have them. So I guess you are interested in the field definition of the $fieldDef = $info->parentType->getField($info->fieldName);Or am I missing something? P.S. Also curious about your opinion on #513 (comment) (unrelated to this PR) |
Actually, i am working on implementing something like that. It is meant to allow composing resolve actions within complex, nested inputs. Your suggestion might work, but i think it is unnecessarily complicated. The field definition sits there anyways and i can not think of any reason why access to it should be limited. Let's remove that limitation and enable the more straightforward: $fieldDef = $info->fieldDefinition;That gives users the freedom to do what they need to do and enables more possible use cases, even if they are pretty fringe ones. |
|
Can you add an assertion in this test to make sure we don't accidentally revert this later when syncing again with graphql-js (which doesn't expose this data)? Then I'll merge it |
I require access to
FieldDefinition->argsin a resolver. As i see it, there is no straightforward way to access it.This PR simply adds the
FieldDefinitionobject to theResolveInfo, while keeping backwards compatibility.