You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- allow `#[graphql(deprecated)]` and `#[deprecated]` attributes on struct fields in `#[derive(GraphQLInputObject)]` macro
- allow `#[graphql(deprecated)]` attribute on method arguments in `#[graphql_object]` and `#[graphql_interface]` macros
- allow `@deprecated` directive on arguments and input object fields
- add `__InputValue.isDeprecated` and `__InputValue.deprecationReason` fields
- add `includeDeprecated` argument to `__Type.inputFields`, `__Field.args` and `__Directive.args` fields
- make `includeDeprecated` argument of `__Type.fields`, `__Type.enumValues`, `__Type.inputFields`, `__Field.args` and `__Directive.args` fields non-`Null` (graphql/graphql-spec#1142)
- add `schema::meta::Argument::deprecation_status` field
- make `@deprecated(reason:)` argument non-`Null` (graphql/graphql-spec#1040)
Additionally:
- add `__Type.isOneOf` field (graphql/graphql-spec#825)
- add `SCHEMA`, `OBJECT`, `ARGUMENT_DEFINITION`, `INTERFACE`, `UNION`, `ENUM`, `INPUT_OBJECT` and `INPUT_FIELD_DEFINITION` values to `__DirectiveLocation` enum
- update canonical introspection query to 16.11.0 version of GraphQL.js
- fix incorrect `__Type.specifiedByUrl` field name to `__Type.specifiedByURL`
- fix missing `@specifiedBy(url:)` directive in SDL generated by `RootNode::as_sdl()` and `RootNode::as_document()` methods
Copy file name to clipboardExpand all lines: book/src/types/enums.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,7 @@ enum Episode {
75
75
76
76
### Documentation and deprecation
77
77
78
-
Just like when [defining GraphQL objects](objects/index.md#documentation), the [GraphQL enum][0] type and its values could be [documented][4] and [deprecated][5] via `#[graphql(description = "...")]` and `#[graphql(deprecated = "...")]`/[`#[deprecated]`][13] attributes:
78
+
Just like when [defining GraphQL objects](objects/index.md#documentation), the [GraphQL enum][0] type and its values could be [documented][4] and [deprecated][9] via `#[graphql(description = "...")]` and `#[graphql(deprecated = "...")]`/[`#[deprecated]`][13] attributes:
79
79
```rust
80
80
# externcrate juniper;
81
81
# usejuniper::GraphQLEnum;
@@ -105,7 +105,7 @@ enum StarWarsEpisode {
105
105
#
106
106
# fnmain() {}
107
107
```
108
-
> **NOTE**: Only [GraphQL object][6]/[interface][7]fieldsand [GraphQL enum][0] values can be [deprecated][5].
108
+
> **NOTE**: Only [GraphQL object][6]/[interface][7]/[input object][8]fields, [arguments][5]and [GraphQL enum][0] values can be [deprecated][9].
Copy file name to clipboardExpand all lines: book/src/types/input_objects.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,9 +84,9 @@ struct Person {
84
84
> **TIP**: Supported policies are: `SCREAMING_SNAKE_CASE`, `camelCase` and `none` (disables any renaming).
85
85
86
86
87
-
### Documentation
87
+
### Documentation and deprecation
88
88
89
-
Similarly, [GraphQL descriptions][7] may be provided by either using [Rust doc comments][6] or with the `#[graphql(description = "...")]` attribute:
89
+
Similarly, [GraphQL input fields][1] may also be [documented][7] and [deprecated][9] via `#[graphql(description = "...")]` and `#[graphql(deprecated = "...")]`/[`#[deprecated]`][13] attributes:
90
90
```rust
91
91
# externcrate juniper;
92
92
# usejuniper::GraphQLInputObject;
@@ -102,12 +102,20 @@ struct Person {
102
102
103
103
/// This doc comment is visible in both Rust API docs and GraphQL schema
104
104
/// descriptions.
105
+
// Only `Null`able input fields or non-`Null` input fields with default values
106
+
// can be deprecated.
107
+
#[graphql(default, deprecated ="Just because.")]
105
108
age:i32,
109
+
110
+
// If no explicit deprecation reason is provided,
111
+
// then the default "No longer supported" one is used.
112
+
#[deprecated]
113
+
another:Option<f64>, // has no description in GraphQL schema
106
114
}
107
115
#
108
116
# fnmain() {}
109
117
```
110
-
> **NOTE**: As of [October 2021 GraphQL specification][spec], [GraphQL input object][0]'s fields **cannot be**[deprecated][9].
118
+
> **NOTE**: Only [GraphQL input object][0]/[object][8]/[interface][11] fields, [arguments][5] and [GraphQL enum][10] values can be [deprecated][9].
Copy file name to clipboardExpand all lines: book/src/types/interfaces.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -317,7 +317,7 @@ trait Person {
317
317
318
318
### Documentation and deprecation
319
319
320
-
Similarly, [GraphQL fields][4] of [interfaces][0] may also be [documented][7] and [deprecated][9] via `#[graphql(description = "...")]` and `#[graphql(deprecated = "...")]`/[`#[deprecated]`][13] attributes:
320
+
Similarly, [GraphQL fields][4](and their [arguments][5]) of [interfaces][0] may also be [documented][7] and [deprecated][9] via `#[graphql(description = "...")]` and `#[graphql(deprecated = "...")]`/[`#[deprecated]`][13] attributes:
321
321
```rust
322
322
# externcrate juniper;
323
323
# usejuniper::graphql_interface;
@@ -340,16 +340,24 @@ trait Person {
340
340
/// This doc comment is visible in both Rust API docs and GraphQL schema
341
341
/// descriptions.
342
342
#[graphql(deprecated ="Just because.")]
343
-
fndeprecated_graphql() ->bool;
343
+
fndeprecated_graphql(
344
+
// Only `Null`able arguments or non-`Null` arguments with default values
Copy file name to clipboardExpand all lines: book/src/types/objects/complex_fields.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,7 +116,7 @@ impl Person {
116
116
117
117
### Documentation and deprecation
118
118
119
-
Similarly, [GraphQL fields][4] may also be [documented][7] and [deprecated][9] via `#[graphql(description = "...")]` and `#[graphql(deprecated = "...")]`/[`#[deprecated]`][13] attributes:
119
+
Similarly, [GraphQL fields][4](and their [arguments][5]) may also be [documented][7] and [deprecated][9] via `#[graphql(description = "...")]` and `#[graphql(deprecated = "...")]`/[`#[deprecated]`][13] attributes:
120
120
```rust
121
121
# externcrate juniper;
122
122
# usejuniper::graphql_object;
@@ -145,20 +145,28 @@ impl Person {
145
145
/// This doc comment is visible in both Rust API docs and GraphQL schema
146
146
/// descriptions.
147
147
#[graphql(deprecated ="Just because.")]
148
-
fndeprecated_graphql() ->bool {
148
+
fndeprecated_graphql(
149
+
// Only `Null`able arguments or non-`Null` arguments with default values
Copy file name to clipboardExpand all lines: book/src/types/objects/error/field.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,11 +37,11 @@ impl Example {
37
37
# fnmain() {}
38
38
```
39
39
40
-
[`FieldResult<T>`][21] is an alias for [`Result<T, FieldError>`][22], which is the [error type][1] all fallible [fields][6] must return. By using the [`?` operator][14], any type that implements the [`Display` trait][15] (which most of the error types out there do) can be automatically converted into a [`FieldError`][22].
40
+
[`FieldResult<T>`][21] is an alias for [`Result<T, FieldError>`][22], which is the [error type][1] all fallible [fields][6] must return. By using the [`?` operator][14], any type that implements the [`Display` trait][19] (which most of the error types out there do) can be automatically converted into a [`FieldError`][22].
41
41
42
42
> **TIP**: If a custom conversion into a [`FieldError`][22] is needed (to [fill up `extensions`][2], for example), the [`IntoFieldError` trait][23] should be implemented.
43
43
44
-
> **NOTE**: [`FieldError`][22]s are [GraphQL field errors][1] and are [not visible][9] in a [GraphQL schema][8] in any way.
44
+
> **NOTE**: [`FieldError`][22]s are [GraphQL field errors][1] and are [not visible][15] in a [GraphQL schema][8] in any way.
45
45
46
46
47
47
@@ -172,12 +172,12 @@ And the specified structured error information will be included into the [error'
Copy file name to clipboardExpand all lines: book/src/types/objects/index.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ This creates a [GraphQL object][0] type called `Person`, with two fields: `name`
34
34
35
35
### Documentation
36
36
37
-
We should take advantage of the fact that [GraphQL] is [self-documenting][5] and add descriptions to the defined [GraphQL object][0] type and its fields. [Juniper] will automatically use associated [Rust doc comments][6] as [GraphQL descriptions][7]:
37
+
We should take advantage of the fact that [GraphQL] is [self-documenting][15] and add descriptions to the defined [GraphQL object][0] type and its fields. [Juniper] will automatically use associated [Rust doc comments][6] as [GraphQL descriptions][7]:
38
38
```rust
39
39
# externcrate juniper;
40
40
# usejuniper::GraphQLObject;
@@ -145,7 +145,7 @@ struct Person {
145
145
#
146
146
# fnmain() {}
147
147
```
148
-
> **NOTE**: Only [GraphQL object][0]/[interface][11]fields and [GraphQL enum][10] values can be [deprecated][9].
148
+
> **NOTE**: Only [GraphQL object][0]/[interface][11]/[input object][8]fields, [arguments][5] and [GraphQL enum][10] values can be [deprecated][9].
149
149
150
150
151
151
### Ignoring
@@ -216,7 +216,7 @@ Because `Person` is a valid [GraphQL] type, we can have a `Vec<Person>` in a [st
- Made `includeDeprecated` argument of `__Type.fields`, `__Type.enumValues`, `__Type.inputFields`, `__Field.args` and `__Directive.args` fields non-`Null`. ([#1348], [graphql/graphql-spec#1142])
17
+
- Made `@deprecated(reason:)` argument non-`Null`. ([#1348], [graphql/graphql-spec#1040])
- Canonical introspection query to [16.11.0 version of GraphQL.js](https://github.com/graphql/graphql-js/blob/v16.11.0/src/utilities/getIntrospectionQuery.ts#L75). ([#1348])
36
+
37
+
### Fixed
38
+
39
+
- Incorrect `__Type.specifiedByUrl` field to `__Type.specifiedByURL`. ([#1348])
40
+
- Missing `@specifiedBy(url:)` directive in [SDL] generated by `RootNode::as_sdl()` and `RootNode::as_document()` methods. ([#1348])
0 commit comments