-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic data producer directive #1238
Comments
The problem with a generic directive is that we don't have typing for type MyType {
myField(someArg: String): String @dataProducer(name: 'some_data_producer_id', args:[
{key: "entity", value: "$"},
{key: "input", value: "$someArg"},
{key: "bundle", value: "entity:node"}
])
} This would work, but there would be no coding assistance for argument names. Another idea: We could derive directives from resolver plugins. Then it could look like this: type MyType {
myField(someArg: String): String @produce__some_data_producer_id(name: 'some_data_producer_id', args:{
entity: "$",
input: "$someArg",
bundle: "entity:node"
})
} This would retain autocomplete support on everything. |
And sorry for seeing this almost two months later 🤯 |
After we have the chain of directives in #1170 , we could also implement a directive to invoke an arbitrary data producer. Then we could basically replace a lot of code in the custom schema implementation that would just use $builder->compose() to chain simple data producers.
The new directive would have two parameters:
A possible example:
type MyType {
myField(someArg: String): String @dataProducer(name: 'some_data_producer_id', args:{entity: 'fromParent', input: 'fromArgument:someArg', bundle: 'entity:node'})
}
In the directive implementation, we'd have the result:
$builder->produce('some_data_producer_id')
->map('entity', $builder->fromParent())
->map('input', $builder->fromArgument('someArg'))
->map('bundle', $builder->fromValue('entity:node')
The text was updated successfully, but these errors were encountered: