@@ -1650,6 +1650,21 @@ GraphQL implementations that support the type system definition language must
1650
1650
provide the ` @deprecated ` directive if representing deprecated portions of
1651
1651
the schema.
1652
1652
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
+
1653
1668
Directives must only be used in the locations they are declared to belong in.
1654
1669
In this example, a directive is defined which can be used to annotate a field:
1655
1670
@@ -1661,11 +1676,6 @@ fragment SomeFragment on SomeType {
1661
1676
}
1662
1677
```
1663
1678
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
-
1669
1679
Directive locations may be defined with an optional leading ` | ` character to aid
1670
1680
formatting when representing a longer list of possible locations:
1671
1681
0 commit comments