Skip to content

Add Spring for GraphQL instructions #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 {
Expand Down