https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
e

edwinRNDR

09/06/2021, 7:00 PM
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

Dariusz Kuc

09/06/2021, 7:39 PM
Can you share a repo? Without code might be hard to guess what's missing in the setup.
e

edwinRNDR

09/06/2021, 7:47 PM
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

edwinRNDR

09/07/2021, 4:47 AM
ah yes, but it seems to work only if that function returns a primitive/scalar type?
d

Dariusz Kuc

09/07/2021, 1:08 PM
should work regardless
e

edwinRNDR

09/09/2021, 7:51 AM
ok, it clearly doesn't for me on version 4.2.0. I need some time to figure out what goes wrong
3 Views