I am having some difficulties with directives for ...
# graphql-kotlin
e
I am having some difficulties with directives for FIELD_DEFINITION. I created a custom KotlinSchemaDirectiveWiring and set up hooks. I see that the KotlinSchemaDirectiveWiring.onField is called for the annotated fields. In onField I set a wrapped datafetcher, but that doesn't seem to be used.
Are there common pitfalls, am I missing steps?
d
Can you share a repo? Without code might be hard to guess what's missing in the setup.
e
I understand that, I will isolate the code tomorrow if the problem still persists. Meanwhile I found out that setting datafetchers only works for
val
fields and not for functions
So I guess I my expectations don't align with what can be done with directives?
what I am looking for is a way to indicate required user roles per field, also when they are a function
e
ah yes, but it seems to work only if that function returns a primitive/scalar type?
d
should work regardless
e
ok, it clearly doesn't for me on version 4.2.0. I need some time to figure out what goes wrong