Custom directives #69
Replies: 3 comments 9 replies
-
I found solution partly based on another post: @DgsComponent @OverRide |
Beta Was this translation helpful? Give feedback.
-
It's actually simpler than that! hello: String @mydirective(message: "hello")
directive @mydirective(message: String) on FIELD_DEFINITION @DgsData(parentType = "query", field = "hello")
public String hello(DataFetchingEnvironment dfe) {
GraphQLDirective mydirective = dfe.getFieldDefinition().getDirective("mydirective");
String message = mydirective.getArgument("message").getValue();
return message;
} |
Beta Was this translation helpful? Give feedback.
-
I also created a sample repo to demonstrate using directives (provided by graphql-java/graphql-java-extended-validation) of and wire it using DGS. Feel free to check it out and make comments: |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying to write some custom directives using DGS.
As i didn't find anything regarding this topic in DGS docu, I tried to implement it like graphql-java suggests.
Create custom runtimeWiring bean with added class which implements SchemaDirectiveWiring.
But this wiring is not taken account. Any advices how it should be approached in DGS?
Beta Was this translation helpful? Give feedback.
All reactions