Skip to content

Commit 41ca330

Browse files
Allow deprecation of input values (#525)
Co-authored-by: Ivan Goncharov <[email protected]>
1 parent a3084aa commit 41ca330

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

spec/Section 3 -- Type System.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,7 +1904,7 @@ must *not* be queried if either the `@skip` condition is true *or* the
19041904
```graphql
19051905
directive @deprecated(
19061906
reason: String = "No longer supported"
1907-
) on FIELD_DEFINITION | ENUM_VALUE
1907+
) on FIELD_DEFINITION | ENUM_VALUE | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
19081908
```
19091909

19101910
The `@deprecated` directive is used within the type system definition language
@@ -1915,11 +1915,16 @@ Deprecations include a reason for why it is deprecated, which is formatted using
19151915
Markdown syntax (as specified by [CommonMark](https://commonmark.org/)).
19161916

19171917
In this example type definition, `oldField` is deprecated in favor of
1918-
using `newField`.
1918+
using `newField` and `oldArg` is deprecated in favor of using `newArg`.
19191919

19201920
```graphql example
19211921
type ExampleType {
19221922
newField: String
19231923
oldField: String @deprecated(reason: "Use `newField`.")
1924+
1925+
existingField(
1926+
newArg: String,
1927+
oldArg: String @deprecated(reason: "Use `newArg`.")
1928+
): String
19241929
}
19251930
```

spec/Section 4 -- Introspection.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ type __Type {
143143
enumValues(includeDeprecated: Boolean = false): [__EnumValue!]
144144

145145
# should be non-null for INPUT_OBJECT only, must be null for the others
146-
inputFields: [__InputValue!]
146+
inputFields(includeDeprecated: Boolean = false): [__InputValue!]
147147

148148
# should be non-null for NON_NULL and LIST only, must be null for the others
149149
ofType: __Type
@@ -152,7 +152,7 @@ type __Type {
152152
type __Field {
153153
name: String!
154154
description: String
155-
args: [__InputValue!]!
155+
args(includeDeprecated: Boolean = false): [__InputValue!]!
156156
type: __Type!
157157
isDeprecated: Boolean!
158158
deprecationReason: String
@@ -163,6 +163,8 @@ type __InputValue {
163163
description: String
164164
type: __Type!
165165
defaultValue: String
166+
isDeprecated: Boolean!
167+
deprecationReason: String
166168
}
167169

168170
type __EnumValue {
@@ -336,6 +338,8 @@ Fields
336338
* `name` must return a String.
337339
* `description` may return a String or {null}.
338340
* `inputFields`: a list of `InputValue`.
341+
* Accepts the argument `includeDeprecated` which defaults to {false}. If
342+
{true}, deprecated fields are also returned.
339343
* All other fields must return {null}.
340344

341345

@@ -375,6 +379,8 @@ Fields
375379
* `description` may return a String or {null}
376380
* `args` returns a List of `__InputValue` representing the arguments this
377381
field accepts.
382+
* Accepts the argument `includeDeprecated` which defaults to {false}. If
383+
{true}, deprecated arguments are also returned.
378384
* `type` must return a `__Type` that represents the type of value returned by
379385
this field.
380386
* `isDeprecated` returns {true} if this field should no longer be used,
@@ -396,6 +402,9 @@ Fields
396402
* `defaultValue` may return a String encoding (using the GraphQL language) of the
397403
default value used by this input value in the condition a value is not
398404
provided at runtime. If this input value has no default value, returns {null}.
405+
* `isDeprecated` returns {true} if this field or argument should no longer be used,
406+
otherwise {false}.
407+
* `deprecationReason` optionally provides a reason why this input field or argument is deprecated.
399408

400409
### The __EnumValue Type
401410

@@ -421,5 +430,7 @@ Fields
421430
locations this directive may be placed.
422431
* `args` returns a List of `__InputValue` representing the arguments this
423432
directive accepts.
433+
* Accepts the argument `includeDeprecated` which defaults to {false}. If
434+
{true}, deprecated arguments are also returned.
424435
* `isRepeatable` must return a Boolean that indicates if the directive may be
425436
used repeatedly at a single location.

0 commit comments

Comments
 (0)