Skip to content

How to add a Directive? #166

Closed
Closed
@crumhorn

Description

@crumhorn

In the documentation for graphql-java, they use RuntimeWiring to create a directive as:

wiring.directive("directiveName", new SchemaDirectiveWiringImpl())

The only way I see how to add a directive here is to create the GraphQlSchema object and then do a:

GraphQLSchema newSchema = GraphQLSchema.newSchema(justCreatedSchema).additionalDirective(new SchemaDirectiveWiringImpl()).build();

However, in that code, they don't take a SchemaDirectiveWiring interface as an argument, but a GraphQLDirective class, which seems to have zero possibility to actually convert an object from A to B as the data passed to it and methods available are just lacking. Also, if I go that route, my overridden methods don't actually get called anyway, no matter what I set.

So, is there a way to add a directive somehow or am I out of luck? I don't mind merging graphql-tools and graphql-java in some way when creating the schema but I can't seem to find a way to get my directive in there using graphql-java-tools (and I really don't want to use the normal way of declaring every data fetcher etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions