Skip to content

Commit aace4b1

Browse files
committed
Include deprecated directive
1 parent 6dac159 commit aace4b1

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
@@ -971,9 +971,15 @@ engine supports.
971971

972972
GraphQL implementations should provide the `@skip` and `@include` directives.
973973

974+
GraphQL implementations that support the type system language must provide the
975+
`@deprecated` directive when representing deprecated portions of the schema.
974976

975977
### @skip
976978

979+
```graphql
980+
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
981+
```
982+
977983
The `@skip` directive may be provided for fields, fragment spreads, and
978984
inline fragments, and allows for conditional exclusion during execution as
979985
described by the if argument.
@@ -990,6 +996,10 @@ query myQuery($someTest: Boolean) {
990996

991997
### @include
992998

999+
```graphql
1000+
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
1001+
```
1002+
9931003
The `@include` directive may be provided for fields, fragment spreads, and
9941004
inline fragments, and allows for conditional inclusion during execution as
9951005
described by the if argument.
@@ -1011,6 +1021,31 @@ must *not* be queried if either the `@skip` condition is true *or* the
10111021
`@include` condition is false.
10121022

10131023

1024+
### @deprecated
1025+
1026+
```graphql
1027+
directive @deprecated(
1028+
reason: String = "No longer supported"
1029+
) on FIELD_DEFINITION | ENUM_VALUE
1030+
```
1031+
1032+
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
1033+
deprecated enum values.
1034+
1035+
Deprecations include a reason for why it is deprecated, which can include
1036+
markdown formatting.
1037+
1038+
In this example type definition, `oldField` is deprecated in favor of
1039+
using `newField`.
1040+
1041+
```graphql
1042+
type ExampleType {
1043+
newField: String
1044+
oldField: String @deprecated(reason: "Use `newField`.")
1045+
}
1046+
```
1047+
1048+
10141049
## Initial types
10151050

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

0 commit comments

Comments
 (0)