Skip to content

Commit

Permalink
Move deprecated validation to Section 3 (#922)
Browse files Browse the repository at this point in the history
  • Loading branch information
fotoetienne authored Jan 12, 2022
1 parent ba78f00 commit d3dd6f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
8 changes: 5 additions & 3 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,8 @@ of rules must be adhered to by every Object type in a GraphQL schema.
{"\_\_"} (two underscores).
2. The argument must accept a type where {IsInputType(argumentType)}
returns {true}.
3. If argument type is Non-Null and a default value is not defined:
- The `@deprecated` directive shall not be applied to this argument.
3. An object type may declare that it implements one or more unique interfaces.
4. An object type must be a super-set of all interfaces it implements:
1. Let this object type be {objectType}.
Expand Down Expand Up @@ -1652,6 +1654,8 @@ input ExampleInputObject {
{"\_\_"} (two underscores).
3. The input field must accept a type where {IsInputType(inputFieldType)}
returns {true}.
4. If input field type is Non-Null and a default value is not defined:
- The `@deprecated` directive shall not be applied to this input field.
3. If an Input Object references itself either directly or through referenced
Input Objects, at least one of the fields in the chain of references must be
either a nullable or a List type.
Expand Down Expand Up @@ -2074,9 +2078,7 @@ type ExampleType {
```

The `@deprecated` directive must not appear on required (non-null without a
default) arguments or input object field definitions. Deprecated arguments and
fields are excluded by default in introspection, and deprecating required
arguments or input fields could create confusion for clients.
default) arguments or input object field definitions.

```graphql counter-example
type ExampleType {
Expand Down
24 changes: 0 additions & 24 deletions spec/Section 5 -- Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,6 @@ invalid.
- Let {argumentName} be the name of {argumentDefinition}.
- Let {argument} be the argument in {arguments} named {argumentName}
- {argument} must exist.
- {argument} must not be deprecated.
- Let {value} be the value of {argument}.
- {value} must not be the {null} literal.

Expand Down Expand Up @@ -784,18 +783,6 @@ fragment missingRequiredArg on Arguments {
}
```

If an argument is required (non-null without a default value), it must not be
marked as deprecated.

```graphql counter-example
type Query {
"""
This is invalid because the locale argument is both required and deprecated.
"""
myName(locale: String! @deprecated): String
}
```

## Fragments

### Fragment Declarations
Expand Down Expand Up @@ -1409,7 +1396,6 @@ For example the following document will not pass validation.
- Let {fieldName} be the name of {fieldDefinition}.
- Let {field} be the input field in {fields} named {fieldName}
- {field} must exist.
- {field} must not be deprecated.
- Let {value} be the value of {field}.
- {value} must not be the {null} literal.

Expand All @@ -1420,16 +1406,6 @@ arguments, an input object may have required fields. An input field is required
if it has a non-null type and does not have a default value. Otherwise, the
input object field is optional.

A required input object field must not be marked as deprecated.

```graphql counter-example
input Point {
x: Int!
y: Int!
z: Int! @deprecated(reason: "Northward, not upward")
}
```

## Directives

### Directives Are Defined
Expand Down

0 comments on commit d3dd6f7

Please sign in to comment.