From 2033eaeaf06a01246b4288e98650fdf2eb78a7dd Mon Sep 17 00:00:00 2001 From: dondonz <13839920+dondonz@users.noreply.github.com> Date: Sun, 24 Jul 2022 10:46:10 +1000 Subject: [PATCH] Add Spring for GraphQL instructions --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50f3624..4cdf341 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,10 @@ system but after that it is up to an implementation about what custom scalars ar You would use custom scalars when you want to describe more meaningful behavior or ranges of values. +## How to install To use this library put the following into your gradle config - compile 'com.graphql-java:graphql-java-extended-scalars:18.1' + implementation 'com.graphql-java:graphql-java-extended-scalars:18.1' or the following into your Maven config @@ -41,11 +42,22 @@ or the following into your Maven config It's currently available from Maven Central. -Then register the scalar with graphql-java +## How to use extended scalars +Register the scalar with graphql-java RuntimeWiring.newRuntimeWiring().scalar(ExtendedScalars.DateTime) -And use it in your schema +Or if using [Spring for GraphQL](https://docs.spring.io/spring-graphql/docs/current/reference/html/), register the scalar with `RuntimeWiringConfigurer` + + @Configuration + public class GraphQlConfig { + @Bean + public RuntimeWiringConfigurer runtimeWiringConfigurer() { + return wiringBuilder -> wiringBuilder.scalar(ExtendedScalars.DateTime); + } + } + +And use the scalar in your schema scalar DateTime type Something {