Skip to content

Commit 0e1f9b8

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

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

spec/Section 3 -- Type System.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,7 @@ condition is false.
20472047
```graphql
20482048
directive @deprecated(
20492049
reason: String = "No longer supported"
2050-
) on FIELD_DEFINITION | ENUM_VALUE
2050+
) on FIELD_DEFINITION | ENUM_VALUE | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
20512051
```
20522052

20532053
The `@deprecated` _built-in directive_ is used within the type system definition
@@ -2058,12 +2058,17 @@ Deprecations include a reason for why it is deprecated, which is formatted using
20582058
Markdown syntax (as specified by [CommonMark](https://commonmark.org/)).
20592059

20602060
In this example type definition, `oldField` is deprecated in favor of using
2061-
`newField`.
2061+
`newField` and `oldArg` is deprecated in favor of using `newArg`.
20622062

20632063
```graphql example
20642064
type ExampleType {
20652065
newField: String
20662066
oldField: String @deprecated(reason: "Use `newField`.")
2067+
2068+
existingField(
2069+
newArg: String
2070+
oldArg: String @deprecated(reason: "Use `newArg`.")
2071+
): String
20672072
}
20682073
```
20692074

spec/Section 4 -- Introspection.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ type __Type {
145145
# must be non-null for ENUM, otherwise null.
146146
enumValues(includeDeprecated: Boolean = false): [__EnumValue!]
147147
# must be non-null for INPUT_OBJECT, otherwise null.
148-
inputFields: [__InputValue!]
148+
inputFields(includeDeprecated: Boolean = false): [__InputValue!]
149149
# must be non-null for NON_NULL and LIST, otherwise null.
150150
ofType: __Type
151151
# may be non-null for custom SCALAR, otherwise null.
@@ -166,7 +166,7 @@ enum __TypeKind {
166166
type __Field {
167167
name: String!
168168
description: String
169-
args: [__InputValue!]!
169+
args(includeDeprecated: Boolean = false): [__InputValue!]!
170170
type: __Type!
171171
isDeprecated: Boolean!
172172
deprecationReason: String
@@ -177,6 +177,8 @@ type __InputValue {
177177
description: String
178178
type: __Type!
179179
defaultValue: String
180+
isDeprecated: Boolean!
181+
deprecationReason: String
180182
}
181183

182184
type __EnumValue {
@@ -367,6 +369,8 @@ Fields\:
367369
- `name` must return a String.
368370
- `description` may return a String or {null}.
369371
- `inputFields` must return the set of input fields as a list of `__InputValue`.
372+
- Accepts the argument `includeDeprecated` which defaults to {false}. If
373+
{true}, deprecated fields are also returned.
370374
- All other fields must return {null}.
371375

372376
**List**
@@ -412,6 +416,8 @@ Fields\:
412416
- `description` may return a String or {null}
413417
- `args` returns a List of `__InputValue` representing the arguments this field
414418
accepts.
419+
- Accepts the argument `includeDeprecated` which defaults to {false}. If
420+
{true}, deprecated arguments are also returned.
415421
- `type` must return a `__Type` that represents the type of value returned by
416422
this field.
417423
- `isDeprecated` returns {true} if this field should no longer be used,
@@ -432,6 +438,10 @@ Fields\:
432438
- `defaultValue` may return a String encoding (using the GraphQL language) of
433439
the default value used by this input value in the condition a value is not
434440
provided at runtime. If this input value has no default value, returns {null}.
441+
- `isDeprecated` returns {true} if this field or argument should no longer be
442+
used, otherwise {false}.
443+
- `deprecationReason` optionally provides a reason why this input field or
444+
argument is deprecated.
435445

436446
### The \_\_EnumValue Type
437447

@@ -483,5 +493,7 @@ Fields\:
483493
locations this directive may be placed.
484494
- `args` returns a List of `__InputValue` representing the arguments this
485495
directive accepts.
496+
- Accepts the argument `includeDeprecated` which defaults to {false}. If
497+
{true}, deprecated arguments are also returned.
486498
- `isRepeatable` must return a Boolean that indicates if the directive may be
487499
used repeatedly at a single location.

0 commit comments

Comments
 (0)