Skip to content

Commit 86cecd9

Browse files
committed
Include deprecated directive
1 parent d80608c commit 86cecd9

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

spec/Section 3 -- Type System.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,9 +895,15 @@ engine supports.
895895

896896
GraphQL implementations should provide the `@skip` and `@include` directives.
897897

898+
GraphQL implementations that support the type system language must provide the
899+
`@deprecated` directive when representing deprecated portions of the schema.
898900

899901
### @skip
900902

903+
```graphql
904+
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
905+
```
906+
901907
The `@skip` directive may be provided for fields, fragment spreads, and
902908
inline fragments, and allows for conditional exclusion during execution as
903909
described by the if argument.
@@ -914,6 +920,10 @@ query myQuery($someTest: Boolean) {
914920

915921
### @include
916922

923+
```graphql
924+
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
925+
```
926+
917927
The `@include` directive may be provided for fields, fragment spreads, and
918928
inline fragments, and allows for conditional inclusion during execution as
919929
described by the if argument.
@@ -935,6 +945,31 @@ must *not* be queried if either the `@skip` condition is true *or* the
935945
`@include` condition is false.
936946

937947

948+
### @deprecated
949+
950+
```graphql
951+
directive @deprecated(
952+
reason: String = "No longer supported"
953+
) on FIELD_DEFINITION | ENUM_VALUE
954+
```
955+
956+
The `@deprecated` directive is used within the type system language to indicate deprecated portions of the schema, such as deprecated fields on a type or
957+
deprecated enum values.
958+
959+
Deprecations include a reason for why it is deprecated, which can include
960+
markdown formatting.
961+
962+
In this example type definition, `oldField` is deprecated in favor of
963+
using `newField`.
964+
965+
```graphql
966+
type ExampleType {
967+
newField: String
968+
oldField: String @deprecated(reason: "Use `newField`.")
969+
}
970+
```
971+
972+
938973
## Initial types
939974

940975
A GraphQL schema includes types, indicating where query and mutation

0 commit comments

Comments
 (0)