Skip to content

Commit bce8020

Browse files
tinnouleebyron
andcommitted
[RFC] Add note recommending directive names to be namespaced (#657)
* Add note recommending directive names to be namespaced * move to type system section * Expand note and include example about current rfcs * Add link to custom directives sub-section from language section Co-authored-by: Lee Byron <[email protected]>
1 parent 57f2894 commit bce8020

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

spec/Section 2 -- Language.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,9 @@ Directives can be used to describe additional information for types, fields, fra
10931093
and operations.
10941094

10951095
As future versions of GraphQL adopt new configurable execution capabilities,
1096-
they may be exposed via directives.
1096+
they may be exposed via directives. GraphQL services and tools may also provide
1097+
additional [custom directives](#sec-Type-System.Directives.Custom-Directives)
1098+
beyond those described here.
10971099

10981100
**Directive order is significant**
10991101

spec/Section 3 -- Type System.md

Lines changed: 15 additions & 0 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

0 commit comments

Comments
 (0)