@@ -25,17 +25,17 @@ You would use custom scalars when you want to describe more meaningful behavior
25
25
To use this library put the following into your gradle config
26
26
27
27
``` java
28
- implementation ' com.graphql-java:graphql-java-extended-scalars:20.0'
28
+ implementation ' com.graphql-java:graphql-java-extended-scalars:20.0'
29
29
```
30
30
31
31
or the following into your Maven config
32
32
33
33
``` 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 >
39
39
```
40
40
41
41
> Note:
@@ -51,19 +51,19 @@ It's currently available from Maven Central.
51
51
Register the scalar with ` graphql-java `
52
52
53
53
``` java
54
- RuntimeWiring . newRuntimeWiring(). scalar(ExtendedScalars . DateTime )
54
+ RuntimeWiring . newRuntimeWiring(). scalar(ExtendedScalars . DateTime )
55
55
```
56
56
57
57
Or if using [ Spring for GraphQL] ( https://docs.spring.io/spring-graphql/docs/current/reference/html/ ) , register the scalar with ` RuntimeWiringConfigurer `
58
58
59
59
``` 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 );
66
65
}
66
+ }
67
67
```
68
68
69
69
And use the scalar in your schema
@@ -91,11 +91,9 @@ more semantically meaningful name for that scalar type.
91
91
For example , you would build it like this :
92
92
93
93
```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 ()
99
97
```
100
98
101
99
And use it in a SDL schema like this :
@@ -109,12 +107,12 @@ type Customer {
109
107
110
108
## Date & Time Scalars
111
109
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 |
118
116
119
117
An example declaration in SDL might be :
120
118
0 commit comments