Skip to content

Commit d3dd6f7

Browse files
authored
Move deprecated validation to Section 3 (#922)
1 parent ba78f00 commit d3dd6f7

2 files changed

Lines changed: 5 additions & 27 deletions

File tree

spec/Section 3 -- Type System.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,8 @@ of rules must be adhered to by every Object type in a GraphQL schema.
879879
{"\_\_"} (two underscores).
880880
2. The argument must accept a type where {IsInputType(argumentType)}
881881
returns {true}.
882+
3. If argument type is Non-Null and a default value is not defined:
883+
- The `@deprecated` directive shall not be applied to this argument.
882884
3. An object type may declare that it implements one or more unique interfaces.
883885
4. An object type must be a super-set of all interfaces it implements:
884886
1. Let this object type be {objectType}.
@@ -1652,6 +1654,8 @@ input ExampleInputObject {
16521654
{"\_\_"} (two underscores).
16531655
3. The input field must accept a type where {IsInputType(inputFieldType)}
16541656
returns {true}.
1657+
4. If input field type is Non-Null and a default value is not defined:
1658+
- The `@deprecated` directive shall not be applied to this input field.
16551659
3. If an Input Object references itself either directly or through referenced
16561660
Input Objects, at least one of the fields in the chain of references must be
16571661
either a nullable or a List type.
@@ -2074,9 +2078,7 @@ type ExampleType {
20742078
```
20752079

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

20812083
```graphql counter-example
20822084
type ExampleType {

spec/Section 5 -- Validation.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,6 @@ invalid.
736736
- Let {argumentName} be the name of {argumentDefinition}.
737737
- Let {argument} be the argument in {arguments} named {argumentName}
738738
- {argument} must exist.
739-
- {argument} must not be deprecated.
740739
- Let {value} be the value of {argument}.
741740
- {value} must not be the {null} literal.
742741

@@ -784,18 +783,6 @@ fragment missingRequiredArg on Arguments {
784783
}
785784
```
786785

787-
If an argument is required (non-null without a default value), it must not be
788-
marked as deprecated.
789-
790-
```graphql counter-example
791-
type Query {
792-
"""
793-
This is invalid because the locale argument is both required and deprecated.
794-
"""
795-
myName(locale: String! @deprecated): String
796-
}
797-
```
798-
799786
## Fragments
800787

801788
### Fragment Declarations
@@ -1409,7 +1396,6 @@ For example the following document will not pass validation.
14091396
- Let {fieldName} be the name of {fieldDefinition}.
14101397
- Let {field} be the input field in {fields} named {fieldName}
14111398
- {field} must exist.
1412-
- {field} must not be deprecated.
14131399
- Let {value} be the value of {field}.
14141400
- {value} must not be the {null} literal.
14151401

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

1423-
A required input object field must not be marked as deprecated.
1424-
1425-
```graphql counter-example
1426-
input Point {
1427-
x: Int!
1428-
y: Int!
1429-
z: Int! @deprecated(reason: "Northward, not upward")
1430-
}
1431-
```
1432-
14331409
## Directives
14341410

14351411
### Directives Are Defined

0 commit comments

Comments
 (0)