Skip to content

Commit afc0a35

Browse files
dondonzbenjie
andauthored
Add links to contributed custom scalar specs at scalars.graphql.org (#1009)
Adds how to contribute custom scalar specs, links to spec templates, and adds examples following the launch of https://scalars.graphql.org Co-authored-by: Benjie <benjie@jemjie.com>
1 parent 4e93488 commit afc0a35

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spec/Section 3 -- Type System.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,17 @@ conform to its described rules.
434434
```graphql example
435435
scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122")
436436
scalar URL @specifiedBy(url: "https://tools.ietf.org/html/rfc3986")
437+
scalar DateTime
438+
@specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time")
437439
```
438440

439441
Custom *scalar specification URL*s should provide a single, stable format to
440442
avoid ambiguity. If the linked specification is in flux, the service should link
441443
to a fixed version rather than to a resource which might change.
442444

445+
Note: Some community-maintained custom scalar specifications are hosted at
446+
[scalars.graphql.org](https://scalars.graphql.org/).
447+
443448
Custom *scalar specification URL*s should not be changed once defined. Doing so
444449
would likely disrupt tooling or could introduce breaking changes within the
445450
linked specification's contents.
@@ -448,7 +453,9 @@ Built-in scalar types must not provide a _scalar specification URL_ as they are
448453
specified by this document.
449454

450455
Note: Custom scalars should also summarize the specified format and provide
451-
examples in their description.
456+
examples in their description; see the GraphQL scalars
457+
[implementation guide](https://scalars.graphql.org/implementation-guide) for
458+
more guidance.
452459

453460
**Result Coercion and Serialization**
454461

@@ -2145,6 +2152,9 @@ behavior of [custom scalar types](#sec-Scalars.Custom-Scalars). The URL should
21452152
point to a human-readable specification of the data format, serialization, and
21462153
coercion rules. It must not appear on built-in scalar types.
21472154

2155+
Note: Details on implementing a GraphQL scalar specification can be found in the
2156+
[scalars.graphql.org implementation guide](https://scalars.graphql.org/implementation-guide).
2157+
21482158
In this example, a custom scalar type for `UUID` is defined with a URL pointing
21492159
to the relevant IETF specification.
21502160

0 commit comments

Comments
 (0)