Skip to content

Commit 261df09

Browse files
smitt04IvanGoncharov
authored andcommitted
Allow deprecation of input values (#525)
Co-authored-by: Ivan Goncharov <[email protected]>
1 parent 086bb1f commit 261df09

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
@@ -2032,7 +2032,7 @@ must *not* be queried if either the `@skip` condition is true *or* the
20322032
```graphql
20332033
directive @deprecated(
20342034
reason: String = "No longer supported"
2035-
) on FIELD_DEFINITION | ENUM_VALUE
2035+
) on FIELD_DEFINITION | ENUM_VALUE | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
20362036
```
20372037

20382038
The `@deprecated` directive is used within the type system definition language
@@ -2043,12 +2043,17 @@ Deprecations include a reason for why it is deprecated, which is formatted using
20432043
Markdown syntax (as specified by [CommonMark](https://commonmark.org/)).
20442044

20452045
In this example type definition, `oldField` is deprecated in favor of
2046-
using `newField`.
2046+
using `newField` and `oldArg` is deprecated in favor of using `newArg`.
20472047

20482048
```graphql example
20492049
type ExampleType {
20502050
newField: String
20512051
oldField: String @deprecated(reason: "Use `newField`.")
2052+
2053+
existingField(
2054+
newArg: String,
2055+
oldArg: String @deprecated(reason: "Use `newArg`.")
2056+
): String
20522057
}
20532058
```
20542059

spec/Section 4 -- Introspection.md

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

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

153153
# should be non-null for NON_NULL and LIST only, must be null for the others
154154
ofType: __Type
@@ -160,7 +160,7 @@ type __Type {
160160
type __Field {
161161
name: String!
162162
description: String
163-
args: [__InputValue!]!
163+
args(includeDeprecated: Boolean = false): [__InputValue!]!
164164
type: __Type!
165165
isDeprecated: Boolean!
166166
deprecationReason: String
@@ -171,6 +171,8 @@ type __InputValue {
171171
description: String
172172
type: __Type!
173173
defaultValue: String
174+
isDeprecated: Boolean!
175+
deprecationReason: String
174176
}
175177

176178
type __EnumValue {
@@ -347,6 +349,8 @@ Fields
347349
* `name` must return a String.
348350
* `description` may return a String or {null}.
349351
* `inputFields`: a list of `InputValue`.
352+
* Accepts the argument `includeDeprecated` which defaults to {false}. If
353+
{true}, deprecated fields are also returned.
350354
* All other fields must return {null}.
351355

352356

@@ -393,6 +397,8 @@ Fields
393397
* `description` may return a String or {null}
394398
* `args` returns a List of `__InputValue` representing the arguments this
395399
field accepts.
400+
* Accepts the argument `includeDeprecated` which defaults to {false}. If
401+
{true}, deprecated arguments are also returned.
396402
* `type` must return a `__Type` that represents the type of value returned by
397403
this field.
398404
* `isDeprecated` returns {true} if this field should no longer be used,
@@ -414,6 +420,9 @@ Fields
414420
* `defaultValue` may return a String encoding (using the GraphQL language) of the
415421
default value used by this input value in the condition a value is not
416422
provided at runtime. If this input value has no default value, returns {null}.
423+
* `isDeprecated` returns {true} if this field or argument should no longer be used,
424+
otherwise {false}.
425+
* `deprecationReason` optionally provides a reason why this input field or argument is deprecated.
417426

418427
### The __EnumValue Type
419428

@@ -439,5 +448,7 @@ Fields
439448
locations this directive may be placed.
440449
* `args` returns a List of `__InputValue` representing the arguments this
441450
directive accepts.
451+
* Accepts the argument `includeDeprecated` which defaults to {false}. If
452+
{true}, deprecated arguments are also returned.
442453
* `isRepeatable` must return a Boolean that indicates if the directive may be
443454
used repeatedly at a single location.

0 commit comments

Comments
 (0)