Skip to content

Commit 26c6b2c

Browse files
authored
[docs] Update custom-scalars with specified by (#7831)
Add links to the `@specifiedBy` directive
1 parent 7e7b83c commit 26c6b2c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/source/schema/custom-scalars.mdx

+8-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ scalar MyCustomScalar
1616

1717
You can now use `MyCustomScalar` in your schema anywhere you can use a default scalar (e.g., as the type of an object field, input type field, or argument).
1818

19-
However, Apollo Server still needs to know how to interact with values of this new scalar type.
19+
### Including scalar specification
20+
Updated in the [October 2021 version of the GraphQL spec](https://spec.graphql.org/October2021/#sec--specifiedBy), you can include a `@specifiedBy` directive as metadata for schema consumers to understand what format the scalar is using. This directive does not provide automatic validation, but can provide useful context for humans reading the schema.
21+
22+
```graphql
23+
scalar MyCustomScalar @specifiedBy(url: "https://specs.example.com/rfc111")
24+
```
25+
26+
However, Apollo Server still needs to know how to interact with and generate values of this new scalar type.
2027

2128
## Defining custom scalar logic
2229

0 commit comments

Comments
 (0)