@@ -25,17 +25,17 @@ You would use custom scalars when you want to describe more meaningful behavior
2525To use this library put the following into your gradle config
2626
2727``` java
28- implementation ' com.graphql-java:graphql-java-extended-scalars:20.0'
28+ implementation ' com.graphql-java:graphql-java-extended-scalars:20.0'
2929```
3030
3131or the following into your Maven config
3232
3333``` xml
34- <dependency >
35- <groupId >com.graphql-java</groupId >
36- <artifactId >graphql-java-extended-scalars</artifactId >
37- <version >20.0</version >
38- </dependency >
34+ <dependency >
35+ <groupId >com.graphql-java</groupId >
36+ <artifactId >graphql-java-extended-scalars</artifactId >
37+ <version >20.0</version >
38+ </dependency >
3939```
4040
4141> Note:
@@ -51,19 +51,19 @@ It's currently available from Maven Central.
5151Register the scalar with ` graphql-java `
5252
5353``` java
54- RuntimeWiring . newRuntimeWiring(). scalar(ExtendedScalars . DateTime )
54+ RuntimeWiring . newRuntimeWiring(). scalar(ExtendedScalars . DateTime )
5555```
5656
5757Or if using [ Spring for GraphQL] ( https://docs.spring.io/spring-graphql/docs/current/reference/html/ ) , register the scalar with ` RuntimeWiringConfigurer `
5858
5959``` java
60- @Configuration
61- public class GraphQlConfig {
62- @Bean
63- public RuntimeWiringConfigurer runtimeWiringConfigurer () {
64- return wiringBuilder - > wiringBuilder. scalar(ExtendedScalars . DateTime );
65- }
60+ @Configuration
61+ public class GraphQlConfig {
62+ @Bean
63+ public RuntimeWiringConfigurer runtimeWiringConfigurer () {
64+ return wiringBuilder - > wiringBuilder. scalar(ExtendedScalars . DateTime );
6665 }
66+ }
6767```
6868
6969And use the scalar in your schema
@@ -91,11 +91,9 @@ more semantically meaningful name for that scalar type.
9191For example , you would build it like this :
9292
9393```java
94-
95- AliasedScalar socialMediaLink = ExtendedScalars .newAliasedScalar ("SocialMediaLink" )
96- .aliasedScalar (Scalars.GraphQLString)
97- .build ()
98-
94+ AliasedScalar socialMediaLink = ExtendedScalars .newAliasedScalar ("SocialMediaLink" )
95+ .aliasedScalar (Scalars.GraphQLString)
96+ .build ()
9997```
10098
10199And use it in a SDL schema like this :
@@ -109,12 +107,12 @@ type Customer {
109107
110108## Date & Time Scalars
111109
112- | Scalar Name | Scalar Definition | Description |
113- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114- | `DateTime ` | <pre lang ="graphql" >scalar DateTime @specifiedBy (url : " https://scalars.graphql.org/andimarek/date-time.html" )</pre lang = "graphql" > | An RFC -3339 compliant date time scalar that accepts string values like `1996-12-19T16 :39:57-08:00` and produces `java .time .OffsetDateTime ` objects at runtime . |
115- | `Time ` | <pre lang ="graphql" >scalar Time @specifiedBy (url : " https://tools.ietf.org/html/rfc3339" )</pre > | An RFC -3339 compliant time scalar that accepts string values like `16:39:57-08:00` and produces `java .time .OffsetTime ` objects at runtime |
116- | `LocalTime ` | <pre lang ="graphql" >scalar LocalTime </pre > | 24-hour clock time string in the format `hh :mm :ss .sss ` or `hh :mm :ss ` if partial seconds is zero and produces `java .time .LocalTime ` objects at runtime . |
117- | `Date ` | <pre lang ="graphql" >scalar Date @specifiedBy (url : " https://tools.ietf.org/html/rfc3339" )</pre > | An RFC -3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java .time .LocalDate ` objects at runtime |
110+ | Scalar Name | Scalar Definition | Description |
111+ | ----------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
112+ | `DateTime ` | <pre lang ="graphql" >scalar DateTime @specifiedBy (url : " https://scalars.graphql.org/andimarek/date-time.html" )</pre > | An RFC -3339 compliant date time scalar that accepts string values like `1996-12-19T16 :39:57-08:00` and produces `java .time .OffsetDateTime ` objects at runtime . |
113+ | `Time ` | <pre lang ="graphql" >scalar Time @specifiedBy (url : " https://tools.ietf.org/html/rfc3339" )</pre > | An RFC -3339 compliant time scalar that accepts string values like `16:39:57-08:00` and produces `java .time .OffsetTime ` objects at runtime |
114+ | `LocalTime ` | <pre lang ="graphql" >scalar LocalTime </pre > | 24-hour clock time string in the format `hh :mm :ss .sss ` or `hh :mm :ss ` if partial seconds is zero and produces `java .time .LocalTime ` objects at runtime . |
115+ | `Date ` | <pre lang ="graphql" >scalar Date @specifiedBy (url : " https://tools.ietf.org/html/rfc3339" )</pre > | An RFC -3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java .time .LocalDate ` objects at runtime |
118116
119117An example declaration in SDL might be :
120118
0 commit comments