Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow deprecation of input values #525

Merged
merged 1 commit into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ must *not* be queried if either the `@skip` condition is true *or* the
```graphql
directive @deprecated(
reason: String = "No longer supported"
) on FIELD_DEFINITION | ENUM_VALUE
) on FIELD_DEFINITION | ENUM_VALUE | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
```

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

In this example type definition, `oldField` is deprecated in favor of
using `newField`.
using `newField` and `oldArg` is deprecated in favor of using `newArg`.

```graphql example
type ExampleType {
newField: String
oldField: String @deprecated(reason: "Use `newField`.")

existingField(
newArg: String,
oldArg: String @deprecated(reason: "Use `newArg`.")
): String
}
```
smitt04 marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 13 additions & 2 deletions spec/Section 4 -- Introspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ type __Type {
enumValues(includeDeprecated: Boolean = false): [__EnumValue!]

# should be non-null for INPUT_OBJECT only, must be null for the others
inputFields: [__InputValue!]
inputFields(includeDeprecated: Boolean = false): [__InputValue!]
smitt04 marked this conversation as resolved.
Show resolved Hide resolved

# should be non-null for NON_NULL and LIST only, must be null for the others
ofType: __Type
Expand All @@ -152,7 +152,7 @@ type __Type {
type __Field {
name: String!
description: String
args: [__InputValue!]!
args(includeDeprecated: Boolean = false): [__InputValue!]!
type: __Type!
isDeprecated: Boolean!
deprecationReason: String
Expand All @@ -163,6 +163,8 @@ type __InputValue {
description: String
type: __Type!
defaultValue: String
isDeprecated: Boolean!
deprecationReason: String
}

type __EnumValue {
Expand Down Expand Up @@ -335,6 +337,8 @@ Fields
* `name` must return a String.
* `description` may return a String or {null}.
* `inputFields`: a list of `InputValue`.
* Accepts the argument `includeDeprecated` which defaults to {false}. If
{true}, deprecated fields are also returned.
* All other fields must return {null}.


Expand Down Expand Up @@ -374,6 +378,8 @@ Fields
* `description` may return a String or {null}
* `args` returns a List of `__InputValue` representing the arguments this
field accepts.
* Accepts the argument `includeDeprecated` which defaults to {false}. If
{true}, deprecated arguments are also returned.
* `type` must return a `__Type` that represents the type of value returned by
this field.
* `isDeprecated` returns {true} if this field should no longer be used,
Expand All @@ -395,6 +401,9 @@ Fields
* `defaultValue` may return a String encoding (using the GraphQL language) of the
default value used by this input value in the condition a value is not
provided at runtime. If this input value has no default value, returns {null}.
* `isDeprecated` returns {true} if this field or argument should no longer be used,
otherwise {false}.
* `deprecationReason` optionally provides a reason why this input field or argument is deprecated.

### The __EnumValue Type

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