Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 2.07 KB

README.md

File metadata and controls

31 lines (19 loc) · 2.07 KB

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.