From 6ecc3e389dc3b3e13b9065fc1dd89f33a8f365da Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 05:44:40 -0400 Subject: [PATCH 01/21] docs: overhaul readme format to include Scalar Definition fragments and use @specifiedBy --- README.md | 473 ++++++++++++++++++++++++++---------------------------- 1 file changed, 230 insertions(+), 243 deletions(-) diff --git a/README.md b/README.md index 8a7466d..1f6f689 100644 --- a/README.md +++ b/README.md @@ -5,21 +5,27 @@ [![Latest Snapshot](https://img.shields.io/maven-central/v/com.graphql-java/graphql-java-extended-scalars?label=maven-central%20snapshot)](https://maven-badges.herokuapp.com/maven-central/com.graphql-java/graphql-java-extended-scalars/) [![MIT licensed](https://img.shields.io/badge/license-MIT-green)](https://github.com/graphql-java/graphql-java-extended-scalars/blob/master/LICENSE.md) +## Overview This library provides extended scalars for [graphql-java](https://github.com/graphql-java/graphql-java) -Scalars in graphql are the leaf nodes of a query, the non-compound values that can't be queried further via sub-field selections. +[GraphQL Scalars](https://spec.graphql.org/October2021/#sec-Scalars) are the leaf values in the GraphQL type system and can't be queried further via sub-field selections. -The graphql standard specifies that the `String`, `Int`, `Float`, `Boolean` and `ID` scalars must be present in a graphql type -system but after that it is up to an implementation about what custom scalars are present. +The GraphQL Specification defines `String`, `Int`, `Float`, `Boolean` and `ID` as well-defined [built-in scalars](https://spec.graphql.org/October2021/#sec-Scalars.Built-in-Scalars) that must be present in a graphql type +system. Beyond these, it is up to an implementation about what [custom scalars](https://spec.graphql.org/October2021/#sec-Scalars.Custom-Scalars) are present. + +The GraphQL Specification recommends the use of the [@specifiedBy](https://spec.graphql.org/October2021/#sec--specifiedBy) built-in schema directive to provide a scalar specification URL for specifying the behavior of custom scalar types. You would use custom scalars when you want to describe more meaningful behavior or ranges of values. +# Getting started + ## How to install + To use this library put the following into your gradle config implementation 'com.graphql-java:graphql-java-extended-scalars:20.0' - + or the following into your Maven config @@ -31,19 +37,22 @@ or the following into your Maven config > Note: > > use 19.0 or above for graphql-java 19.x and above -> +> > use 20.0 or above for graphql-java 20.x and above - It's currently available from Maven Central. ## How to use extended scalars -Register the scalar with graphql-java +Register the scalar with `graphql-java` + +```java RuntimeWiring.newRuntimeWiring().scalar(ExtendedScalars.DateTime) - +``` + Or if using [Spring for GraphQL](https://docs.spring.io/spring-graphql/docs/current/reference/html/), register the scalar with `RuntimeWiringConfigurer` +```java @Configuration public class GraphQlConfig { @Bean @@ -51,321 +60,299 @@ Or if using [Spring for GraphQL](https://docs.spring.io/spring-graphql/docs/curr return wiringBuilder -> wiringBuilder.scalar(ExtendedScalars.DateTime); } } +``` And use the scalar in your schema - - scalar DateTime - type Something { - someDateTime: DateTime - } -## DateTime Scalars +```graphql +scalar DateTime + @specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time.html") +type Something { + someDateTime: DateTime +} +``` -* `DateTime` - * 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 -* `Time` - * An RFC-3339 compliant time scalar that accepts string values like `16:39:57-08:00` and produces - `java.time.OffsetTime` objects at runtime -* `LocalTime` - * 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. -* `Date` - * An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces - `java.time.LocalDate` objects at runtime +# Custom Scalars -See [the rfc3339 spec](https://www.ietf.org/rfc/rfc3339.txt) for more details on the format. +## Alias Scalars -An example declaration in SDL might be: +| Scalar Name | Scalar Specification | Description | +| --------------- | ---------------------------------------------- | --------------------------------------------------------------------------------- | +| `AliasedScalar` |
scalar AliasedScalar
| You can create aliases for existing scalars to add more semantic meaning to them. | -```graphql +For example a link to a social media post could be representing by a `String` but the name `SocialMediaLink` is a +more semantically meaningful name for that scalar type. - type Customer { - birthDay : Date - workStartTime : Time - bornAt : DateTime - } - - type Query { - customers(bornAfter : DateTime) : [Customers] - } - -``` +For example, you would build it like this: -And example query might look like: -```graphql - - query { - customers(bornAfter : "1996-12-19T16:39:57-08:00") { - birthDay - bornAt - } - } - -``` -## ID Scalars +```java -* `UUID` - * A universally unique identifier scalar that accepts uuid values like `2423f0a0-3b81-4115-a189-18df8b35e8fc` and produces - `java.util.UUID` instances at runtime. + AliasedScalar socialMediaLink = ExtendedScalars.newAliasedScalar("SocialMediaLink") + .aliasedScalar(Scalars.GraphQLString) + .build() -## Object / JSON Scalars +``` -* `Object` - * An object scalar that accepts any object as a scalar value +And use it in a SDL schema like this : -* `JSON` - * A synonym for the `Object` scalar, it will accept any object as a scalar value - -One of the design goals of graphql, is that the type system describes the shape of the data returned. +```graphql +type Customer { + name: String + socialMediaLink: SocialMediaLink +} +``` -The `Object` / `JSON` scalars work against this some what because they can return compound values outside the type system. As such -they should be used sparingly. In general your should aim to describe the data via the graphql type system where you can and only -resort to the `Object` / `JSON` scalars in very rare circumstances. +## Date & Time Scalars -An example might be an extensible graphql system where systems can input custom metadata objects that cant be known at -schema type design time. +| Scalar Name | Scalar Definition | Description | +| ----------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `DateTime` |
scalar DateTime @specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time.html")
| 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. | +| `Time` |
scalar Time @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
| An RFC-3339 compliant time scalar that accepts string values like `16:39:57-08:00` and produces `java.time.OffsetTime` objects at runtime | +| `LocalTime` |
scalar LocalTime
| 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. | +| `Date` |
scalar Date @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
| An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java.time.LocalDate` objects at runtime | An example declaration in SDL might be: ```graphql - - type Customer { - name : String - associatedMetaData : JSON - } - - type Query { - customers(filterSyntax : JSON) : [Customers] - } - -``` +type Customer { + birthDay: Date + workStartTime: Time + bornAt: DateTime +} + +type Query { + customers(bornAfter: DateTime): [Customers] +} +``` And example query might look like: ```graphql - - query { - customers(filterSyntax : { - startSpan : "First", - matchCriteria : { - countryCode : "AU", - isoCodes : ["27B-34R", "95A-E23"], - - } - }) { - name - associatedMetaData - } - } - -``` - -Note : The `JSON` scalar is a simple alias type to the `Object` scalar because often the returned data is a blob of JSON. They are -all just objects at runtime in graphql-java terms and what network serialisation protocol is up to you. Choose whichever name you think -adds more semantic readers to your schema consumers. +query { + customers(bornAfter: "1996-12-19T16:39:57-08:00") { + birthDay + bornAt + } +} +``` + +## ID Scalars +| Scalar Name | Scalar Definition | Description | +| ----------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `UUID` |
scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122")
| A universally unique identifier scalar that accepts uuid values like `2423f0a0-3b81-4115-a189-18df8b35e8fc` and produces `java.util.UUID` instances at runtime. | ## Numeric Scalars +| Scalar Name | Scalar Definition | Description | +| ------------------ | ------------------------------------------------- | ------------------------------------------------------------- | +| `PositiveInt` |
scalar PositiveInt
| An `Int` scalar that MUST be greater than zero. | +| `NegativeInt` |
scalar NegativeInt
| An `Int` scalar that MUST be less than zero. | +| `NonPositiveInt` |
scalar NonPositiveInt
| An `Int` scalar that MUST be less than or equal to zero. | +| `NonNegativeInt` |
scalar NonNegativeInt
| An `Int` scalar that MUST be greater than or equal to zero. | +| `PositiveFloat` |
scalar PositiveFloat
| An `Float` scalar that MUST be greater than zero. | +| `NegativeFloat` |
scalar NegativeFloat
| An `Float` scalar that MUST be less than zero. | +| `NonPositiveFloat` |
scalar NonPositiveFloat
| An `Float` scalar that MUST be less than or equal to zero. | +| `NonNegativeFloat` |
scalar NonNegativeFloat
| An `Float` scalar that MUST be greater than or equal to zero. | -* `PositiveInt` - * An `Int` scalar that MUST be greater than zero -* `NegativeInt` - * An `Int` scalar that MUST be less than zero -* `NonPositiveInt` - * An `Int` scalar that MUST be less than or equal to zero -* `NonNegativeInt` - * An `Int` scalar that MUST be greater than or equal to zero -* `PositiveFloat` - * An `Float` scalar that MUST be greater than zero -* `NegativeFloat` - * An `Float` scalar that MUST be less than zero -* `NonPositiveFloat` - * An `Float` scalar that MUST be less than or equal to zero -* `NonNegativeFloat` - * An `Float` scalar that MUST be greater than or equal to zero - -The numeric scalars are derivations of the standard graphql `Int` and `Float` scalars that enforce range limits. +The numeric scalars are derivations of the standard GraphQL `Int` and `Float` scalars that enforce range limits. An example declaration in SDL might be: ```graphql - - type Customer { - name : String - currentHeight : PositiveInt - weightLossGoal : NonPositiveInt - averageWeightLoss : NegativeFloat - } - - type Query { - customers(height : PositiveInt) : [Customers] - } - -``` +type Customer { + name: String + currentHeight: PositiveInt + weightLossGoal: NonPositiveInt + averageWeightLoss: NegativeFloat +} + +type Query { + customers(height: PositiveInt): [Customers] +} +``` And example query might look like: ```graphql - - query { - customers(height : 182) { - name - height - weightLossGoal - } - } - -``` - - -## Regex Scalars - -The RegexScalar has a builder where you provide one or more regex patterns that control the acceptable values -for a new scalar. - -You name the scalar and it provides an implementation. - -For example, imagine a `phoneNumber` scalar like this : - -```java +query { + customers(height: 182) { + name + height + weightLossGoal + } +} +``` - RegexScalar phoneNumberScalar = ExtendedScalars.newRegexScalar("phoneNumber") - .addPattern(Pattern.compile("\\([0-9]*\\)[0-9]*")) - .build() +## Java Primitives -``` +| Scalar Name | Scalar Specification | Description | +| ------------------- | -------------------------------------------------- | ------------------------------------------------ | +| `GraphQLLong` |
scalar GraphQLLong
| A scalar which represents `java.lang.Long` | +| `GraphQLShort` |
scalar GraphQLShort
| A scalar which represents `java.lang.Short` | +| `GraphQLByte` |
scalar GraphQLByte
| A scalar which represents `java.lang.Byte` | +| `GraphQLBigDecimal` |
scalar GraphQLBigDecimal
| A scalar which represents `java.math.BigDecimal` | +| `GraphQLBigInteger` |
scalar GraphQLBigInteger
| A scalar which represents `java.math.BigInteger` | +| `GraphQLChar` |
scalar GraphQLChar
| A scalar which represents `java.lang.Character` | ## Locale Scalar -The Locale scalar handles [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tags via the -JDK method [Locale.forLanguageTag](https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#forLanguageTag(java.lang.String)) +| Scalar Name | Scalar Specification | Description | +| ----------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Locale` |
scalar Locale @specifiedBy(url: "https://tools.ietf.org/html/bcp47")
| The Locale scalar handles [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tags via the JDK method [Locale.forLanguageTag]() | ```graphql - - type Customer { - name : String - locale : Locale - } - - type Query { - customers(inLocale : Locale) : [Customers] - } -``` +type Customer { + name: String + locale: Locale +} + +type Query { + customers(inLocale: Locale): [Customers] +} +``` An example query to look for customers in the Romanian locale might look like: ```graphql - - query { - customers(inLocale : "ro-RO") { - name - locale - } - } - -``` +query { + customers(inLocale: "ro-RO") { + name + locale + } +} +``` + ## Country Code Scalar -The CountryCode scalar type as defined by [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). +| Scalar Name | Scalar Specification | Description | +| ------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `CountryCode` |
scalar CountryCode
| The CountryCode scalar type as defined by [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). | An example declaration in SDL might be: + ```graphql - scalar CountryCode +scalar CountryCode - type Customer { - name : String - countryCode : CountryCode - } -``` +type Customer { + name: String + countryCode: CountryCode +} +``` And example query might look like: ```graphql - query { - customers(code : "US") { - name - countryCode - } - } -``` +query { + customers(code: "US") { + name + countryCode + } +} +``` + ## Currency Scalar -A field whose value is an [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217) currency. +| Scalar Name | Scalar Specification | Description | +| ----------- | ----------------------------------------- | -------------------------------------------------------------------------------------- | +| `Currency` |
scalar Currency
| A field whose value is an [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217) currency. | An example declaration in SDL might be: + ```graphql - scalar Currency +scalar Currency - type Account { - id : String - currency : Currency - accountNumber: String - } -``` +type Account { + id: String + currency: Currency + accountNumber: String +} +``` And example query might look like: ```graphql - query { - accounts(currency : "USD") { - id - currency - accountNumber - } - } -``` +query { + accounts(currency: "USD") { + id + currency + accountNumber + } +} +``` -## Alias Scalars +## URL Scalars -You can create aliases for existing scalars to add more semantic meaning to them. +| Scalar Name | Scalar Specification | Description | +| ----------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `Url` |
scalar URL @specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt")
| An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime. | -For example a link to a social media post could be representing by a `String` but the name `SocialMediaLink` is a -more semantically meaningful name for that scalar type. +## Object / JSON Scalars -For example, you would build it like this: +| Scalar Name | Scalar Specification | Description | +| ----------- | --------------------------------------- | ------------------------------------------------------------------------------- | +| `Object` |
scalar Object
| An object scalar that accepts any object as a scalar value. | +| `JSON` |
scalar JSON
| A synonym for the `Object` scalar, it will accept any object as a scalar value. | -```java +One of the design goals of GraphQL, is that the type system describes the shape of the data returned. - AliasedScalar socialMediaLink = ExtendedScalars.newAliasedScalar("SocialMediaLink") - .aliasedScalar(Scalars.GraphQLString) - .build() +The `Object` / `JSON` scalars work against this some what because they can return compound values outside the type system. As such +they should be used sparingly. In general your should aim to describe the data via the GraphQL type system where you can and only +resort to the `Object` / `JSON` scalars in very rare circumstances. -``` +An example might be an extensible GraphQL system where systems can input custom metadata objects that cant be known at +schema type design time. -And use it in a SDL schema like this : +An example declaration in SDL might be: ```graphql +type Customer { + name: String + associatedMetaData: JSON +} + +type Query { + customers(filterSyntax: JSON): [Customers] +} +``` - type Customer { - name : String - socialMediaLink : SocialMediaLink - } +And example query might look like: +```graphql +query { + customers( + filterSyntax: { + startSpan: "First" + matchCriteria: { countryCode: "AU", isoCodes: ["27B-34R", "95A-E23"] } + } + ) { + name + associatedMetaData + } +} ``` -Note: A future version of the graphql specification may add this capability but in the meantime you can use this facility. +Note : The `JSON` scalar is a simple alias type to the `Object` scalar because often the returned data is a blob of JSON. They are +all just objects at runtime in `graphql-java` terms and what network serialization protocol is up to you. Choose whichever name you think +adds more semantic readers to your schema consumers. -## Java Primitives -* `GraphQLLong` - * A scalar which represents `java.lang.Long` -* `GraphQLShort` - * A scalar which represents `java.lang.Short` -* `GraphQLByte` - * A scalar which represents `java.lang.Byte` -* `GraphQLBigDecimal` - * A scalar which represents `java.math.BigDecimal` -* `GraphQLBigInteger` - * A scalar which represents `java.math.BigInteger` -* `GraphQLChar` - * A scalar which represents `java.lang.Character` - - -## Other Scalars - -* `Url` - * An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces - `java.net.URL` objects at runtime - +## Regex Scalars +| Scalar Name | Scalar Specification | Description | +| ------------- | -------------------- | -------------------------------------------------------------------------------- | +| `RegexScalar` | - | Allows you to build a new scalar via a builder pattern using regular expressions | + +The RegexScalar has a builder where you provide one or more regex patterns that control the acceptable values +for a new scalar. + +You name the scalar and it provides an implementation. + +For example, imagine a `phoneNumber` scalar like this : + +```java + + RegexScalar phoneNumberScalar = ExtendedScalars.newRegexScalar("phoneNumber") + .addPattern(Pattern.compile("\\([0-9]*\\)[0-9]*")) + .build() + +``` From 10be2d3ecceb232dc4b670bc0bfdc03495e5f69a Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 05:46:42 -0400 Subject: [PATCH 02/21] docs: tweak formatting --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1f6f689..0cdcffc 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,19 @@ You would use custom scalars when you want to describe more meaningful behavior To use this library put the following into your gradle config +```java implementation 'com.graphql-java:graphql-java-extended-scalars:20.0' +``` or the following into your Maven config +```xml com.graphql-java graphql-java-extended-scalars 20.0 +``` > Note: > @@ -67,6 +71,7 @@ And use the scalar in your schema ```graphql scalar DateTime @specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time.html") + type Something { someDateTime: DateTime } From 003f7ac76c4d2b97cea75e2b2c5b356321699d41 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 05:50:51 -0400 Subject: [PATCH 03/21] docs: tweak formatting --- README.md | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 0cdcffc..baaaf85 100644 --- a/README.md +++ b/README.md @@ -25,17 +25,17 @@ You would use custom scalars when you want to describe more meaningful behavior To use this library put the following into your gradle config ```java - implementation 'com.graphql-java:graphql-java-extended-scalars:20.0' +implementation 'com.graphql-java:graphql-java-extended-scalars:20.0' ``` or the following into your Maven config ```xml - - com.graphql-java - graphql-java-extended-scalars - 20.0 - + + com.graphql-java + graphql-java-extended-scalars + 20.0 + ``` > Note: @@ -51,19 +51,19 @@ It's currently available from Maven Central. Register the scalar with `graphql-java` ```java - RuntimeWiring.newRuntimeWiring().scalar(ExtendedScalars.DateTime) +RuntimeWiring.newRuntimeWiring().scalar(ExtendedScalars.DateTime) ``` Or if using [Spring for GraphQL](https://docs.spring.io/spring-graphql/docs/current/reference/html/), register the scalar with `RuntimeWiringConfigurer` ```java - @Configuration - public class GraphQlConfig { - @Bean - public RuntimeWiringConfigurer runtimeWiringConfigurer() { - return wiringBuilder -> wiringBuilder.scalar(ExtendedScalars.DateTime); - } +@Configuration +public class GraphQlConfig { + @Bean + public RuntimeWiringConfigurer runtimeWiringConfigurer() { + return wiringBuilder -> wiringBuilder.scalar(ExtendedScalars.DateTime); } +} ``` And use the scalar in your schema @@ -91,11 +91,9 @@ more semantically meaningful name for that scalar type. For example, you would build it like this: ```java - - AliasedScalar socialMediaLink = ExtendedScalars.newAliasedScalar("SocialMediaLink") - .aliasedScalar(Scalars.GraphQLString) - .build() - +AliasedScalar socialMediaLink = ExtendedScalars.newAliasedScalar("SocialMediaLink") + .aliasedScalar(Scalars.GraphQLString) + .build() ``` And use it in a SDL schema like this : @@ -109,12 +107,12 @@ type Customer { ## Date & Time Scalars -| Scalar Name | Scalar Definition | Description | -| ----------- | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `DateTime` |
scalar DateTime @specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time.html")
| 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. | -| `Time` |
scalar Time @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
| An RFC-3339 compliant time scalar that accepts string values like `16:39:57-08:00` and produces `java.time.OffsetTime` objects at runtime | -| `LocalTime` |
scalar LocalTime
| 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. | -| `Date` |
scalar Date @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
| An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java.time.LocalDate` objects at runtime | +| Scalar Name | Scalar Definition | Description | +| ----------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `DateTime` |
scalar DateTime @specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time.html")
| 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. | +| `Time` |
scalar Time @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
| An RFC-3339 compliant time scalar that accepts string values like `16:39:57-08:00` and produces `java.time.OffsetTime` objects at runtime | +| `LocalTime` |
scalar LocalTime
| 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. | +| `Date` |
scalar Date @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
| An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java.time.LocalDate` objects at runtime | An example declaration in SDL might be: From 47f8afb1a984685cee3d618e5e230b31b7eb3de4 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:07:49 -0400 Subject: [PATCH 04/21] test using table --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index baaaf85..6ba96a1 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,26 @@ query { ## URL Scalars + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
`Url` + +````graphql +scalar URL +@specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt") +``` + +An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.
+ | Scalar Name | Scalar Specification | Description | | ----------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `Url` |
scalar URL @specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt")
| An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime. | @@ -317,7 +337,7 @@ type Customer { type Query { customers(filterSyntax: JSON): [Customers] } -``` +```` And example query might look like: From 9f110cb50ab3e85379e2e2f0f6a5ff322037ddb3 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:09:11 -0400 Subject: [PATCH 05/21] test using table --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6ba96a1..f9a0888 100644 --- a/README.md +++ b/README.md @@ -294,13 +294,10 @@ query { `Url` - - -````graphql +
 scalar URL
 @specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt")
-```
-
+
 
 An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.
 
@@ -337,7 +334,7 @@ type Customer {
 type Query {
   customers(filterSyntax: JSON): [Customers]
 }
-````
+```
 
 And example query might look like:
 

From f550beb4a047f6030a49720ab6cbb92e29b9cded Mon Sep 17 00:00:00 2001
From: Adam Setch 
Date: Sun, 12 Mar 2023 06:09:43 -0400
Subject: [PATCH 06/21] test using table

---
 README.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index f9a0888..feb849e 100644
--- a/README.md
+++ b/README.md
@@ -296,7 +296,9 @@ query {
  `Url` 
 
 scalar URL
-@specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt")
+  @specifiedBy(url: 
+    "https://www.w3.org/Addressing/URL/url-spec.txt"
+  )
 
 
 An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.

From aa1f71e240145e66e69738adb86f8f0b747d2768 Mon Sep 17 00:00:00 2001
From: Adam Setch 
Date: Sun, 12 Mar 2023 06:10:44 -0400
Subject: [PATCH 07/21] test using table

---
 README.md | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md
index feb849e..faf0d8d 100644
--- a/README.md
+++ b/README.md
@@ -287,22 +287,23 @@ query {
 ## URL Scalars
 
 
-
-
-
-
-
-
-
-
-
-
+  
+    
+    
+    
+  
+  
+    
+    
+    
+  
Scalar NameScalar SpecificationDescription
`Url`
-scalar URL
-  @specifiedBy(url: 
-    "https://www.w3.org/Addressing/URL/url-spec.txt"
-  )
-
-
An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.
Scalar NameScalar SpecificationDescription
`Url` +
+      scalar URL
+        @specifiedBy(url: 
+          "https://www.w3.org/Addressing/URL/url-spec.txt"
+        )
+      
+    
An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.
| Scalar Name | Scalar Specification | Description | From 56763fd647c23109b22d3d33fc55404c7369f162 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:11:29 -0400 Subject: [PATCH 08/21] test using table --- README.md | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index faf0d8d..fbef577 100644 --- a/README.md +++ b/README.md @@ -287,23 +287,20 @@ query { ## URL Scalars - - - - - - - - - - + + + + + + + + + +
Scalar NameScalar SpecificationDescription
`Url` -
-      scalar URL
-        @specifiedBy(url: 
-          "https://www.w3.org/Addressing/URL/url-spec.txt"
-        )
-      
-    
An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.
Scalar NameScalar SpecificationDescription
`Url`
+scalar URL
+@specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt")
+
+
An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.
| Scalar Name | Scalar Specification | Description | From da511cf8d85b7de26a7133b145f8e0c66e6271f8 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:12:17 -0400 Subject: [PATCH 09/21] test using table --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fbef577..d9af3ac 100644 --- a/README.md +++ b/README.md @@ -293,10 +293,12 @@ query { Description - `Url` +
Url
 scalar URL
-@specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt")
+  @specifiedBy(url: 
+    "https://www.w3.org/Addressing/URL/url-spec.txt"
+  )
 
An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime. From 233c670cb6551f01da45e0b8ba6df87fb28aa5f8 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:35:48 -0400 Subject: [PATCH 10/21] replace md tables with html, so we can control the code blocks --- README.md | 293 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 240 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index d9af3ac..b5c0e87 100644 --- a/README.md +++ b/README.md @@ -81,9 +81,20 @@ type Something { ## Alias Scalars -| Scalar Name | Scalar Specification | Description | -| --------------- | ---------------------------------------------- | --------------------------------------------------------------------------------- | -| `AliasedScalar` |
scalar AliasedScalar
| You can create aliases for existing scalars to add more semantic meaning to them. | + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
AliasedScalar
+scalar AliasedScalar
+
You can create aliases for existing scalars to add more semantic meaning to them.
For example a link to a social media post could be representing by a `String` but the name `SocialMediaLink` is a more semantically meaningful name for that scalar type. @@ -107,12 +118,49 @@ type Customer { ## Date & Time Scalars -| Scalar Name | Scalar Definition | Description | -| ----------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `DateTime` |
scalar DateTime @specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time.html")
| 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. | -| `Time` |
scalar Time @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
| An RFC-3339 compliant time scalar that accepts string values like `16:39:57-08:00` and produces `java.time.OffsetTime` objects at runtime | -| `LocalTime` |
scalar LocalTime
| 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. | -| `Date` |
scalar Date @specifiedBy(url: "https://tools.ietf.org/html/rfc3339")
| An RFC-3339 compliant date scalar that accepts string values like `1996-12-19` and produces `java.time.LocalDate` objects at runtime | + + + + + + + + + + + + + + + + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
DateTime
+scalar DateTime
+  @specifiedBy(url: 
+    "https://scalars.graphql.org/andimarek/date-time.html"
+  )
+
A 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.
Date
+scalar Date
+  @specifiedBy(url: 
+    ["https://tools.ietf.org/html/rfc3339](https://tools.ietf.org/html/rfc3339)"
+  )
A RFC-3339 compliant date scalar that accepts string values like 1996-12-19 and produces java.time.LocalDate objects at runtime.
Time
+scalar Time
+  @specifiedBy(url: 
+    "https://tools.ietf.org/html/rfc3339"
+  )
+
A RFC-3339 compliant time scalar that accepts string values like 16:39:57-08:00 and produces java.time.OffsetTime objects at runtime.
LocalTime
+scalar LocalTime
+
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.
An example declaration in SDL might be: @@ -141,22 +189,73 @@ query { ## ID Scalars -| Scalar Name | Scalar Definition | Description | -| ----------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `UUID` |
scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122")
| A universally unique identifier scalar that accepts uuid values like `2423f0a0-3b81-4115-a189-18df8b35e8fc` and produces `java.util.UUID` instances at runtime. | + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
UUID
+scalar UUID
+  @specifiedBy(url: 
+    "https://tools.ietf.org/html/rfc4122"
+  )
+
A universally unique identifier scalar that accepts uuid values like `2423f0a0-3b81-4115-a189-18df8b35e8fc` and produces `java.util.UUID` instances at runtime.
## Numeric Scalars -| Scalar Name | Scalar Definition | Description | -| ------------------ | ------------------------------------------------- | ------------------------------------------------------------- | -| `PositiveInt` |
scalar PositiveInt
| An `Int` scalar that MUST be greater than zero. | -| `NegativeInt` |
scalar NegativeInt
| An `Int` scalar that MUST be less than zero. | -| `NonPositiveInt` |
scalar NonPositiveInt
| An `Int` scalar that MUST be less than or equal to zero. | -| `NonNegativeInt` |
scalar NonNegativeInt
| An `Int` scalar that MUST be greater than or equal to zero. | -| `PositiveFloat` |
scalar PositiveFloat
| An `Float` scalar that MUST be greater than zero. | -| `NegativeFloat` |
scalar NegativeFloat
| An `Float` scalar that MUST be less than zero. | -| `NonPositiveFloat` |
scalar NonPositiveFloat
| An `Float` scalar that MUST be less than or equal to zero. | -| `NonNegativeFloat` |
scalar NonNegativeFloat
| An `Float` scalar that MUST be greater than or equal to zero. | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
PositiveInt
scalar PositiveInt
An Int scalar that MUST be greater than zero.
NegativeInt
scalar NegativeInt
An Int scalar that MUST be less than zero.
NonPositiveInt
scalar NonPositiveInt
An Int scalar that MUST be less than or equal to zero.
NonNegativeInt
scalar NonNegativeInt
An Int scalar that MUST be greater than or equal to zero.
PositiveFloat
scalar PositiveFloat
An Float scalar that MUST be greater than zero.
NegativeFloat
scalar NegativeFloat
An Float scalar that MUST be less than zero.
NonPositiveFloat
scalar NonPositiveFloat
An Float scalar that MUST be less than or equal to zero.
NonNegativeFloat
scalar NonNegativeFloat
An Float scalar that MUST be greater than or equal to zero.
The numeric scalars are derivations of the standard GraphQL `Int` and `Float` scalars that enforce range limits. @@ -189,20 +288,63 @@ query { ## Java Primitives -| Scalar Name | Scalar Specification | Description | -| ------------------- | -------------------------------------------------- | ------------------------------------------------ | -| `GraphQLLong` |
scalar GraphQLLong
| A scalar which represents `java.lang.Long` | -| `GraphQLShort` |
scalar GraphQLShort
| A scalar which represents `java.lang.Short` | -| `GraphQLByte` |
scalar GraphQLByte
| A scalar which represents `java.lang.Byte` | -| `GraphQLBigDecimal` |
scalar GraphQLBigDecimal
| A scalar which represents `java.math.BigDecimal` | -| `GraphQLBigInteger` |
scalar GraphQLBigInteger
| A scalar which represents `java.math.BigInteger` | -| `GraphQLChar` |
scalar GraphQLChar
| A scalar which represents `java.lang.Character` | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
GraphQLLong
scalar GraphQLLong
A scalar which represents java.lang.Long
GraphQLShort
scalar GraphQLShort
A scalar which represents java.lang.Short
GraphQLByte
scalar GraphQLByte
A scalar which represents java.lang.Byte
GraphQLBigDecimal
scalar GraphQLBigDecimal
A scalar which represents java.lang.BigDecimal
GraphQLBigInteger
scalar GraphQLBigInteger
A scalar which represents java.lang.BigInteger
GraphQLChar
scalar GraphQLChar
A scalar which represents java.lang.Character
## Locale Scalar -| Scalar Name | Scalar Specification | Description | -| ----------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Locale` |
scalar Locale @specifiedBy(url: "https://tools.ietf.org/html/bcp47")
| The Locale scalar handles [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tags via the JDK method [Locale.forLanguageTag]() | + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
Locale
+scalar Locale
+  @specifiedBy(url: 
+    "https://tools.ietf.org/html/bcp47"
+  )
+
The Locale scalar handles IETF BCP 47 language tags via the JDK method Locale.forLanguageTag.
```graphql type Customer { @@ -228,9 +370,23 @@ query { ## Country Code Scalar -| Scalar Name | Scalar Specification | Description | -| ------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -| `CountryCode` |
scalar CountryCode
| The CountryCode scalar type as defined by [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). | + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
CountryCode
+scalar CountryCode 
+  @specifiedBy(url: 
+    "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2"
+  )
+
The CountryCode scalar type as defined by ISO 3166-1 alpha-2.
An example declaration in SDL might be: @@ -256,9 +412,23 @@ query { ## Currency Scalar -| Scalar Name | Scalar Specification | Description | -| ----------- | ----------------------------------------- | -------------------------------------------------------------------------------------- | -| `Currency` |
scalar Currency
| A field whose value is an [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217) currency. | + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
Currency
+scalar Currency
+  @specifiedBy(url: 
+    "https://en.wikipedia.org/wiki/ISO_4217"
+  )
+
A field whose value is an ISO-4217 currency.
An example declaration in SDL might be: @@ -293,28 +463,36 @@ query { Description -
Url
+Url
 scalar URL
   @specifiedBy(url: 
     "https://www.w3.org/Addressing/URL/url-spec.txt"
   )
-
- +
An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime. -| Scalar Name | Scalar Specification | Description | -| ----------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `Url` |
scalar URL @specifiedBy(url: "https://www.w3.org/Addressing/URL/url-spec.txt")
| An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime. | - ## Object / JSON Scalars -| Scalar Name | Scalar Specification | Description | -| ----------- | --------------------------------------- | ------------------------------------------------------------------------------- | -| `Object` |
scalar Object
| An object scalar that accepts any object as a scalar value. | -| `JSON` |
scalar JSON
| A synonym for the `Object` scalar, it will accept any object as a scalar value. | + + + + + + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
Object
scalar Object
An object scalar that accepts any object as a scalar value.
JSON
scalar JSON
A synonym for the `Object` scalar, it will accept any object as a scalar value.
One of the design goals of GraphQL, is that the type system describes the shape of the data returned. @@ -360,9 +538,18 @@ adds more semantic readers to your schema consumers. ## Regex Scalars -| Scalar Name | Scalar Specification | Description | -| ------------- | -------------------- | -------------------------------------------------------------------------------- | -| `RegexScalar` | - | Allows you to build a new scalar via a builder pattern using regular expressions | + + + + + + + + + + + +
Scalar NameScalar SpecificationDescription
RegexScalar
-
Allows you to build a new scalar via a builder pattern using regular expressions.
The RegexScalar has a builder where you provide one or more regex patterns that control the acceptable values for a new scalar. From 6aa5d8ed44f8d5fde85c6a75206e50bdd96a06f6 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:36:32 -0400 Subject: [PATCH 11/21] replace md tables with html, so we can control the code blocks --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5c0e87..354228c 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ scalar DateTime
 scalar Date
   @specifiedBy(url: 
-    ["https://tools.ietf.org/html/rfc3339](https://tools.ietf.org/html/rfc3339)"
+    "https://tools.ietf.org/html/rfc3339"
   )
A RFC-3339 compliant date scalar that accepts string values like 1996-12-19 and produces java.time.LocalDate objects at runtime. From 4383b21fb6da4e0f0fa73a6b46a4add7b0a25454 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:40:36 -0400 Subject: [PATCH 12/21] remove table columns to help with md rendering in github --- README.md | 56 ++++++++++--------------------------------------------- 1 file changed, 10 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 354228c..eac678f 100644 --- a/README.md +++ b/README.md @@ -120,12 +120,10 @@ type Customer { - - + - - - - @@ -191,12 +186,10 @@ query {
Scalar NameScalar SpecificationScalar Description
DateTime
 scalar DateTime
   @specifiedBy(url: 
@@ -135,7 +133,6 @@ scalar DateTime
 
A 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.
Date
 scalar Date
   @specifiedBy(url: 
@@ -144,7 +141,6 @@ scalar Date
 
A RFC-3339 compliant date scalar that accepts string values like 1996-12-19 and produces java.time.LocalDate objects at runtime.
Time
 scalar Time
   @specifiedBy(url: 
@@ -154,7 +150,6 @@ scalar Time
 
A RFC-3339 compliant time scalar that accepts string values like 16:39:57-08:00 and produces java.time.OffsetTime objects at runtime.
LocalTime
 scalar LocalTime
 
- - + - - +
Scalar NameScalar SpecificationScalar Description
UUID
 scalar UUID
   @specifiedBy(url: 
@@ -211,47 +204,38 @@ scalar UUID
 
 
-
-
+
-
-
-
-
-
-
-
-
@@ -290,37 +274,30 @@ query {
 
 
Scalar NameScalar SpecificationScalar Description
PositiveInt
scalar PositiveInt
An Int scalar that MUST be greater than zero.
NegativeInt
scalar NegativeInt
An Int scalar that MUST be less than zero.
NonPositiveInt
scalar NonPositiveInt
An Int scalar that MUST be less than or equal to zero.
NonNegativeInt
scalar NonNegativeInt
An Int scalar that MUST be greater than or equal to zero.
PositiveFloat
scalar PositiveFloat
An Float scalar that MUST be greater than zero.
NegativeFloat
scalar NegativeFloat
An Float scalar that MUST be less than zero.
NonPositiveFloat
scalar NonPositiveFloat
An Float scalar that MUST be less than or equal to zero.
NonNegativeFloat
scalar NonNegativeFloat
An Float scalar that MUST be greater than or equal to zero.
- - + - - - - - - @@ -330,12 +307,10 @@ query {
Scalar NameScalar SpecificationScalar Description
GraphQLLong
scalar GraphQLLong
A scalar which represents java.lang.Long
GraphQLShort
scalar GraphQLShort
A scalar which represents java.lang.Short
GraphQLByte
scalar GraphQLByte
A scalar which represents java.lang.Byte
GraphQLBigDecimal
scalar GraphQLBigDecimal
A scalar which represents java.lang.BigDecimal
GraphQLBigInteger
scalar GraphQLBigInteger
A scalar which represents java.lang.BigInteger
GraphQLChar
scalar GraphQLChar
A scalar which represents java.lang.Character
- - + - - +
Scalar NameScalar SpecificationScalar Description
Locale
 scalar Locale
   @specifiedBy(url: 
@@ -372,12 +347,10 @@ query {
 
 
-
-
+
-
-
+
Scalar NameScalar SpecificationScalar Description
CountryCode
 scalar CountryCode 
   @specifiedBy(url: 
@@ -414,12 +387,10 @@ query {
 
 
-
-
+
-
-
+
Scalar NameScalar SpecificationScalar Description
Currency
 scalar Currency
   @specifiedBy(url: 
@@ -458,12 +429,10 @@ query {
 
 
-
-
+
-
-
+
Scalar NameScalar SpecificationScalar Description
Url
 scalar URL
   @specifiedBy(url: 
@@ -478,17 +447,14 @@ scalar URL
 
 
-
-
+
-
-
@@ -540,12 +506,10 @@ adds more semantic readers to your schema consumers.
 
 
Scalar NameScalar SpecificationScalar Description
Object
scalar Object
An object scalar that accepts any object as a scalar value.
JSON
scalar JSON
A synonym for the `Object` scalar, it will accept any object as a scalar value.
- - + - From a8f6c4593ca1e49c5625997f562fb161d91c58ce Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:40:59 -0400 Subject: [PATCH 13/21] remove table columns to help with md rendering in github --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index eac678f..03ac557 100644 --- a/README.md +++ b/README.md @@ -83,12 +83,10 @@ type Something {
Scalar NameScalar SpecificationScalar Description
RegexScalar
-
Allows you to build a new scalar via a builder pattern using regular expressions.
- - + - From 3727cfa043eb9c75eaad373d796c66aba32df81d Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:43:33 -0400 Subject: [PATCH 14/21] remove table columns to help with md rendering in github --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 03ac557..8a70076 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ type Something {
Scalar NameScalar SpecificationScalar Description
AliasedScalar
 scalar AliasedScalar
 
- + @@ -118,7 +118,7 @@ type Customer {
ScalarScalar Definition Description
- + @@ -184,7 +184,7 @@ query {
ScalarScalar Definition Description
- + @@ -202,7 +202,7 @@ scalar UUID
ScalarScalar Definition Description
- + @@ -272,7 +272,7 @@ query {
ScalarScalar Definition Description
- + @@ -305,7 +305,7 @@ query {
ScalarScalar Definition Description
- + @@ -345,7 +345,7 @@ query {
ScalarScalar Definition Description
- + @@ -385,7 +385,7 @@ query {
ScalarScalar Definition Description
- + @@ -427,7 +427,7 @@ query {
ScalarScalar Definition Description
- + @@ -437,7 +437,7 @@ scalar URL "https://www.w3.org/Addressing/URL/url-spec.txt" ) - +
ScalarScalar Definition Description
An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces `java.net.URL` objects at runtime.An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces java.net.URL objects at runtime.
@@ -445,7 +445,7 @@ scalar URL - + @@ -454,7 +454,7 @@ scalar URL - +
ScalarScalar Definition Description
scalar JSON
A synonym for the `Object` scalar, it will accept any object as a scalar value.A synonym for the Object scalar, it will accept any object as a scalar value.
@@ -504,11 +504,11 @@ adds more semantic readers to your schema consumers. - + - +
ScalarScalar Name Description
-
RegexScalar Allows you to build a new scalar via a builder pattern using regular expressions.
From 443c90f85f2999b0d8156d02b078da0d76625120 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:48:27 -0400 Subject: [PATCH 15/21] update how to use section --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a70076..c1ac555 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,17 @@ It's currently available from Maven Central. ## How to use extended scalars +### Direct use + Register the scalar with `graphql-java` ```java RuntimeWiring.newRuntimeWiring().scalar(ExtendedScalars.DateTime) ``` -Or if using [Spring for GraphQL](https://docs.spring.io/spring-graphql/docs/current/reference/html/), register the scalar with `RuntimeWiringConfigurer` +### Spring for GraphQL + +If you are using [Spring for GraphQL](https://docs.spring.io/spring-graphql/docs/current/reference/html/), register the scalar with `RuntimeWiringConfigurer` ```java @Configuration @@ -66,7 +70,13 @@ public class GraphQlConfig { } ``` -And use the scalar in your schema +### Netflix DGS + +If you are using [Netflix DGS](https://netflix.github.io/dgs) see their [configuration documentation](https://netflix.github.io/dgs/configuration/#dgs-extended-scalars-graphql-dgs-extended-scalars) + +## How to add extended scalars to your schema + +To use a extended scalar in your schema, define the scalar like shown below for `DateTime` ```graphql scalar DateTime From 33df8dc2b67dc3511ca1444df1f90102e79681bc Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:49:51 -0400 Subject: [PATCH 16/21] update how to use section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1ac555..72a496f 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ public class GraphQlConfig { ### Netflix DGS -If you are using [Netflix DGS](https://netflix.github.io/dgs) see their [configuration documentation](https://netflix.github.io/dgs/configuration/#dgs-extended-scalars-graphql-dgs-extended-scalars) +If you are using [Netflix DGS](https://netflix.github.io/dgs), please see their [configuration documentation](https://netflix.github.io/dgs/configuration/#dgs-extended-scalars-graphql-dgs-extended-scalars) ## How to add extended scalars to your schema From 81a018286d1199f3f1958f45cfcea0a151fce3eb Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:51:45 -0400 Subject: [PATCH 17/21] update how to use section --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 72a496f..c1923a5 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,6 @@ This library provides extended scalars for [graphql-java](https://github.com/gra The GraphQL Specification defines `String`, `Int`, `Float`, `Boolean` and `ID` as well-defined [built-in scalars](https://spec.graphql.org/October2021/#sec-Scalars.Built-in-Scalars) that must be present in a graphql type system. Beyond these, it is up to an implementation about what [custom scalars](https://spec.graphql.org/October2021/#sec-Scalars.Custom-Scalars) are present. -The GraphQL Specification recommends the use of the [@specifiedBy](https://spec.graphql.org/October2021/#sec--specifiedBy) built-in schema directive to provide a scalar specification URL for specifying the behavior of custom scalar types. - You would use custom scalars when you want to describe more meaningful behavior or ranges of values. # Getting started @@ -76,6 +74,12 @@ If you are using [Netflix DGS](https://netflix.github.io/dgs), please see their ## How to add extended scalars to your schema +The GraphQL Specification recommends the use of the [@specifiedBy](https://spec.graphql.org/October2021/#sec--specifiedBy) built-in schema directive to provide a scalar specification URL for specifying the behavior of custom scalar types. + +```graphql +directive @specifiedBy(url: String!) on SCALAR +``` + To use a extended scalar in your schema, define the scalar like shown below for `DateTime` ```graphql From fa81996bc40029861b8ffc86c7adb8257a159bfc Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:53:59 -0400 Subject: [PATCH 18/21] replace backticks with code tag --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c1923a5..8e1063b 100644 --- a/README.md +++ b/README.md @@ -208,7 +208,7 @@ scalar UUID "https://tools.ietf.org/html/rfc4122" )
A universally unique identifier scalar that accepts uuid values like `2423f0a0-3b81-4115-a189-18df8b35e8fc` and produces `java.util.UUID` instances at runtime.A universally unique identifier scalar that accepts uuid values like 2423f0a0-3b81-4115-a189-18df8b35e8fc and produces java.util.UUID instances at runtime.
@@ -451,7 +451,7 @@ scalar URL "https://www.w3.org/Addressing/URL/url-spec.txt" )
An url scalar that accepts string values like `https://www.w3.org/Addressing/URL/url-spec.txt` and produces java.net.URL objects at runtime.An url scalar that accepts string values like https://www.w3.org/Addressing/URL/url-spec.txt and produces java.net.URL objects at runtime.
From b5b6921838f5b81e9f5c3752606367352019293f Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:55:36 -0400 Subject: [PATCH 19/21] update links to open in new tab --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8e1063b..836a360 100644 --- a/README.md +++ b/README.md @@ -329,7 +329,7 @@ scalar Locale "https://tools.ietf.org/html/bcp47" )
The Locale scalar handles IETF BCP 47 language tags via the JDK method Locale.forLanguageTag.The Locale scalar handles IETF BCP 47 language tags via the JDK method Locale.forLanguageTag.
@@ -369,7 +369,7 @@ scalar CountryCode "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" )
The CountryCode scalar type as defined by ISO 3166-1 alpha-2.The CountryCode scalar type as defined by ISO 3166-1 alpha-2.
@@ -409,7 +409,7 @@ scalar Currency "https://en.wikipedia.org/wiki/ISO_4217" )
A field whose value is an ISO-4217 currency.A field whose value is an ISO-4217 currency.
From c9ee1185f186d18fcf1ed709b8351ba2c1c67309 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 12 Mar 2023 06:57:07 -0400 Subject: [PATCH 20/21] Revert "update links to open in new tab" This reverts commit b5b6921838f5b81e9f5c3752606367352019293f. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 836a360..8e1063b 100644 --- a/README.md +++ b/README.md @@ -329,7 +329,7 @@ scalar Locale "https://tools.ietf.org/html/bcp47" )
-The Locale scalar handles IETF BCP 47 language tags via the JDK method Locale.forLanguageTag. +The Locale scalar handles IETF BCP 47 language tags via the JDK method Locale.forLanguageTag. @@ -369,7 +369,7 @@ scalar CountryCode "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" ) -The CountryCode scalar type as defined by ISO 3166-1 alpha-2. +The CountryCode scalar type as defined by ISO 3166-1 alpha-2. @@ -409,7 +409,7 @@ scalar Currency "https://en.wikipedia.org/wiki/ISO_4217" ) -A field whose value is an ISO-4217 currency. +A field whose value is an ISO-4217 currency. From f58d063df2464dc915a063bb450782623d7a891b Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Wed, 12 Apr 2023 06:23:45 -0400 Subject: [PATCH 21/21] docs: update link to draft graphql spec --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e1063b..ceef694 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This library provides extended scalars for [graphql-java](https://github.com/graphql-java/graphql-java) -[GraphQL Scalars](https://spec.graphql.org/October2021/#sec-Scalars) are the leaf values in the GraphQL type system and can't be queried further via sub-field selections. +[GraphQL Scalars](https://spec.graphql.org/draft/#sec-Scalars) are the primitive leaf values in the GraphQL type system and can't be queried further via sub-field selections. The GraphQL Specification defines `String`, `Int`, `Float`, `Boolean` and `ID` as well-defined [built-in scalars](https://spec.graphql.org/October2021/#sec-Scalars.Built-in-Scalars) that must be present in a graphql type system. Beyond these, it is up to an implementation about what [custom scalars](https://spec.graphql.org/October2021/#sec-Scalars.Custom-Scalars) are present.