Skip to content

Repo to demonstrate GraphQL Directives with DGS Framework and Spring Boot

License

Notifications You must be signed in to change notification settings

WtfJoke/graphql-dgs-directives-demo

Repository files navigation

GraphQL DGS Directives Demo

Repo to demonstrate using directives in GraphQL with DGS Framework

Howto start

  1. Execute ./gradlew bootRun (or gradlew.bat bootRun in Windows)
  2. Open localhost:8080/graphiql
  3. Execute any query/mutation of your choice using graphiql or click on any of the sample queries below :)

Sample queries

F.A.Q

How are the directives registered?

Most directives (Range/NotBlank...) are from the library graphql-java/graphql-java-extended-validation.
They get registered with DGS in AddExtendedValidationDirectiveWiring

Why can't I find the code for Movie/Rating?

I use the DGS Codegen Plugin to automatically generate them from the defined schema during the build.

What do I need to do for a custom directive?

You need to implement the interface SchemaDirectiveWiring, register it using @DgsRuntimeWiring and implement/override the method for each directiveLocation you implement (eg onInputObjectType, onField etc...)

See StringCaseDirective as an example of a custom directive.

About

Repo to demonstrate GraphQL Directives with DGS Framework and Spring Boot

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages