Skip to content

Commit 6d3cdb7

Browse files
committed
Expand note and include example about current rfcs
1 parent 66bb860 commit 6d3cdb7

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

spec/Section 3 -- Type System.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,21 @@ GraphQL implementations that support the type system definition language must
16501650
provide the `@deprecated` directive if representing deprecated portions of
16511651
the schema.
16521652

1653+
**Custom Directives**
1654+
1655+
GraphQL services and client tooling may provide additional directives beyond
1656+
those defined in this document. Directives are the preferred way to extend
1657+
GraphQL with custom or experimental behavior.
1658+
1659+
Note: When defining a directive, it is recommended to prefix the directive's
1660+
name to make its scope of usage clear and to prevent a collision with directives
1661+
which may be specified by future versions of this document (which will not
1662+
include `_` in their name). For example, a custom directive used by Facebook's
1663+
GraphQL service should be named `@fb_auth` instead of `@auth`. This is
1664+
especially recommended for proposed additions to this specification which can
1665+
change during the [RFC process](https://github.com/graphql/graphql-spec/blob/master/CONTRIBUTING.md).
1666+
For example an work in progress version of `@live` should be named `@rfc_live`.
1667+
16531668
Directives must only be used in the locations they are declared to belong in.
16541669
In this example, a directive is defined which can be used to annotate a field:
16551670

@@ -1661,11 +1676,6 @@ fragment SomeFragment on SomeType {
16611676
}
16621677
```
16631678

1664-
Note: When defining a directive, it is recommended to namespace the directive name
1665-
to prevent name collisions with directives added in future versions of the specification.
1666-
For example, `@fb_auth` directive would represent an authentication directive
1667-
with the prefix `fb` as namespace.
1668-
16691679
Directive locations may be defined with an optional leading `|` character to aid
16701680
formatting when representing a longer list of possible locations:
16711681

0 commit comments

Comments
 (0)