Feature: ability to attach custom attributes to field definitions.
Hey, I'm writing custom Executor, optimized for my needs (basically I need per coordinate cache) - so my idea is to attach custom cache resolver which will be called prior original one to check from cache. The issue is that it's very hard to do that - because I need to fork basically whole lib - it would be awesome if it's possible to attach custom attributes to field definition so I can check them later in my custom Executor.
Or even better - if we can incorporate that cache into ReferenceExecutor ?
What do you think?
it would be awesome if it's possible to attach custom attributes to field definition
You can, the array $config passed in \GraphQL\Type\Definition\FieldDefinition::__construct is stored in a public property unchanged.
I don't really understand what else you are describing.
Its fine, but there are 2 issues
- That array is not transferred during SchemaExtend - everything else besided known props for the graphql are lost.
- The config itself is strongly typed with specific keys - so phpstan will complain that custom indexes doesn't exists.
Perhaps you can propose a pull request to fix 1.? And in regards to 2., strong typing won't be possible either way - you can ignore PHPStan errors though.