Skip to content

Commit f504da6

Browse files
authored
Fix juniper_codegen_tests assertions (#1007)
1 parent 847d09f commit f504da6

File tree

58 files changed

+281
-343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+281
-343
lines changed
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
error: GraphQL enum expects at least one field
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Enums
4-
52
--> fail/enum/derive_no_fields.rs:2:1
63
|
74
2 | pub enum Test {}
8-
| ^^^
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Enums

integration_tests/codegen_fail/fail/input-object/derive_incompatible_object.stderr

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied
2-
--> fail/input-object/derive_incompatible_object.rs:6:10
3-
|
4-
6 | #[derive(juniper::GraphQLInputObject)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA`
6-
|
7-
note: required by `juniper::marker::IsInputType::mark`
8-
--> $WORKSPACE/juniper/src/types/marker.rs
9-
|
10-
| fn mark() {}
11-
| ^^^^^^^^^
12-
= note: this error originates in the derive macro `juniper::GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
2+
--> fail/input-object/derive_incompatible_object.rs:6:10
3+
|
4+
6 | #[derive(juniper::GraphQLInputObject)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA`
6+
|
7+
= note: this error originates in the derive macro `juniper::GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
8+
9+
error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
10+
--> fail/input-object/derive_incompatible_object.rs:6:10
11+
|
12+
6 | #[derive(juniper::GraphQLInputObject)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjectA`
14+
|
15+
note: required by a bound in `Registry::<'r, S>::arg`
16+
--> $WORKSPACE/juniper/src/executor/mod.rs
17+
|
18+
| T: GraphQLType<S> + FromInputValue<S>,
19+
| ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg`
20+
= note: this error originates in the derive macro `juniper::GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
1321

1422
error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
1523
--> fail/input-object/derive_incompatible_object.rs:6:10
@@ -19,19 +27,6 @@ error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
1927
|
2028
= note: this error originates in the derive macro `juniper::GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
2129

22-
error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
23-
--> fail/input-object/derive_incompatible_object.rs:6:10
24-
|
25-
6 | #[derive(juniper::GraphQLInputObject)]
26-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjectA`
27-
|
28-
note: required by `from_input_value`
29-
--> $WORKSPACE/juniper/src/ast.rs
30-
|
31-
| fn from_input_value(v: &InputValue<S>) -> Result<Self, Self::Error>;
32-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33-
= note: this error originates in the derive macro `juniper::GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
34-
3530
error[E0599]: no method named `to_input_value` found for struct `ObjectA` in the current scope
3631
--> fail/input-object/derive_incompatible_object.rs:6:10
3732
|
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
error: GraphQL input object expects at least one field
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Input-Objects
4-
52
--> fail/input-object/derive_no_fields.rs:2:1
63
|
74
2 | struct Object {}
8-
| ^^^^^^
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Input-Objects
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQL’s introspection system.
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Schema
4-
52
--> fail/input-object/derive_no_underscore.rs:3:15
63
|
74
3 | #[graphql(name = "__test")]
85
| ^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Schema
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
error: GraphQL input object does not allow fields with the same name
2-
3-
= help: There is at least one other field with the same name `test`, possibly renamed via the #[graphql] attribute
4-
= note: https://spec.graphql.org/June2018/#sec-Input-Objects
5-
62
--> fail/input-object/derive_unique_name.rs:4:5
73
|
8-
4 | #[graphql(name = "test")]
9-
| ^
4+
4 | / #[graphql(name = "test")]
5+
5 | | test2: String,
6+
| |_________________^
7+
|
8+
= help: There is at least one other field with the same name `test`, possibly renamed via the #[graphql] attribute
9+
= note: https://spec.graphql.org/June2018/#sec-Input-Objects
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQL’s introspection system.
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Schema
4-
5-
--> $DIR/argument_double_underscored.rs:14:18
2+
--> fail/interface/argument_double_underscored.rs:14:18
63
|
74
14 | fn id(&self, __num: i32) -> &str {
85
| ^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Schema
98

109
error[E0412]: cannot find type `CharacterValue` in this scope
11-
--> $DIR/argument_double_underscored.rs:4:18
10+
--> fail/interface/argument_double_underscored.rs:4:18
1211
|
1312
4 | #[graphql(impl = CharacterValue)]
1413
| ^^^^^^^^^^^^^^ not found in this scope
1514

1615
error[E0405]: cannot find trait `Character` in this scope
17-
--> $DIR/argument_double_underscored.rs:10:6
16+
--> fail/interface/argument_double_underscored.rs:10:6
1817
|
1918
10 | impl Character for ObjA {}
2019
| ^^^^^^^^^ not found in this scope

integration_tests/codegen_fail/fail/interface/argument_non_input_type.stderr

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
2-
--> fail/interface/argument_non_input_type.rs:16:1
3-
|
4-
16 | #[graphql_interface(for = ObjA)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjA`
6-
|
7-
note: required by `juniper::marker::IsInputType::mark`
8-
--> $WORKSPACE/juniper/src/types/marker.rs
9-
|
10-
| fn mark() {}
11-
| ^^^^^^^^^
12-
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
2+
--> fail/interface/argument_non_input_type.rs:16:1
3+
|
4+
16 | #[graphql_interface(for = ObjA)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjA`
6+
|
7+
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
8+
9+
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
10+
--> fail/interface/argument_non_input_type.rs:16:1
11+
|
12+
16 | #[graphql_interface(for = ObjA)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
14+
|
15+
note: required by a bound in `Registry::<'r, S>::arg`
16+
--> $WORKSPACE/juniper/src/executor/mod.rs
17+
|
18+
| T: GraphQLType<S> + FromInputValue<S>,
19+
| ^^^^^^^^^^^^^^^^^ required by this bound in `Registry::<'r, S>::arg`
20+
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
1321

1422
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
1523
--> fail/interface/argument_non_input_type.rs:16:1
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
error[E0277]: the trait bound `[bool; 2]: From<[bool; 3]>` is not satisfied
2-
--> $DIR/argument_wrong_default_array.rs:12:1
2+
--> fail/interface/argument_wrong_default_array.rs:12:1
33
|
44
12 | #[graphql_interface(for = ObjA)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<[bool; 3]>` is not implemented for `[bool; 2]`
66
|
77
= help: the following implementations were found:
8-
<&'a [ascii::ascii_char::AsciiChar] as From<&'a ascii::ascii_str::AsciiStr>>
9-
<&'a [u8] as From<&'a ascii::ascii_str::AsciiStr>>
10-
<&'a mut [ascii::ascii_char::AsciiChar] as From<&'a mut ascii::ascii_str::AsciiStr>>
8+
<[T; LANES] as From<Simd<T, LANES>>>
9+
<[bool; LANES] as From<Mask<T, LANES>>>
1110
= note: required because of the requirements on the impl of `Into<[bool; 2]>` for `[bool; 3]`
1211
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
error: GraphQL interface trait method `as_obja` conflicts with the external downcast function `downcast_obja` declared on the trait to downcast into the implementer type `ObjA`
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Interfaces
4-
= note: use `#[graphql(ignore)]` attribute argument to ignore this trait method for interface implementers downcasting
5-
6-
--> $DIR/downcast_method_conflicts_with_external_downcast_fn.rs:26:5
2+
--> fail/interface/downcast_method_conflicts_with_external_downcast_fn.rs:26:5
73
|
84
26 | fn as_obja(&self) -> Option<&ObjA>;
9-
| ^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Interfaces
8+
= note: use `#[graphql(ignore)]` attribute argument to ignore this trait method for interface implementers downcasting
109

1110
error[E0412]: cannot find type `CharacterValue` in this scope
12-
--> $DIR/downcast_method_conflicts_with_external_downcast_fn.rs:4:18
11+
--> fail/interface/downcast_method_conflicts_with_external_downcast_fn.rs:4:18
1312
|
1413
4 | #[graphql(impl = CharacterValue)]
1514
| ^^^^^^^^^^^^^^ not found in this scope
1615

1716
error[E0405]: cannot find trait `Character` in this scope
18-
--> $DIR/downcast_method_conflicts_with_external_downcast_fn.rs:10:6
17+
--> fail/interface/downcast_method_conflicts_with_external_downcast_fn.rs:10:6
1918
|
2019
10 | impl Character for ObjA {
2120
| ^^^^^^^^^ not found in this scope
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
error: GraphQL interface expects trait method to accept `&self` only and, optionally, `&Context`
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Interfaces
4-
5-
--> $DIR/downcast_method_wrong_input_args.rs:10:10
2+
--> fail/interface/downcast_method_wrong_input_args.rs:10:10
63
|
74
10 | fn a(&self, ctx: &(), rand: u8) -> Option<&Human> {
8-
| ^
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Interfaces
98

109
error[E0412]: cannot find type `CharacterValue` in this scope
11-
--> $DIR/downcast_method_wrong_input_args.rs:16:18
10+
--> fail/interface/downcast_method_wrong_input_args.rs:16:18
1211
|
1312
16 | #[graphql(impl = CharacterValue)]
1413
| ^^^^^^^^^^^^^^ not found in this scope
1514

1615
error[E0405]: cannot find trait `Character` in this scope
17-
--> $DIR/downcast_method_wrong_input_args.rs:22:6
16+
--> fail/interface/downcast_method_wrong_input_args.rs:22:6
1817
|
1918
22 | impl Character for Human {}
2019
| ^^^^^^^^^ not found in this scope

integration_tests/codegen_fail/fail/interface/downcast_method_wrong_return_type.stderr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
error: GraphQL interface expects trait method return type to be `Option<&ImplementerType>` only
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Interfaces
4-
52
--> fail/interface/downcast_method_wrong_return_type.rs:10:40
63
|
74
10 | fn a(&self, ctx: &(), rand: u8) -> &Human {
8-
| ^
5+
| ^^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Interfaces
98

109
error[E0412]: cannot find type `CharacterValue` in this scope
1110
--> fail/interface/downcast_method_wrong_return_type.rs:16:18

integration_tests/codegen_fail/fail/interface/field_double_underscored.stderr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQL’s introspection system.
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Schema
4-
52
--> fail/interface/field_double_underscored.rs:14:8
63
|
74
14 | fn __id(&self) -> &str {
85
| ^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Schema
98

109
error[E0412]: cannot find type `CharacterValue` in this scope
1110
--> fail/interface/field_double_underscored.rs:4:18
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
2-
--> fail/interface/field_non_output_return_type.rs:17:1
3-
|
4-
17 | #[graphql_interface(for = ObjA)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
6-
|
7-
note: required by `juniper::marker::IsOutputType::mark`
8-
--> $WORKSPACE/juniper/src/types/marker.rs
9-
|
10-
| fn mark() {}
11-
| ^^^^^^^^^
12-
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
2+
--> fail/interface/field_non_output_return_type.rs:17:1
3+
|
4+
17 | #[graphql_interface(for = ObjA)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
6+
|
7+
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)

integration_tests/codegen_fail/fail/interface/fields_duplicate.stderr

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
error: GraphQL interface must have a different name for each field
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Interfaces
4-
52
--> fail/interface/fields_duplicate.rs:13:1
63
|
7-
13 | trait Character {
8-
| ^^^^^
4+
13 | / trait Character {
5+
14 | | fn id(&self) -> &str {
6+
15 | | "funA"
7+
16 | | }
8+
... |
9+
21 | | }
10+
22 | | }
11+
| |_^
12+
|
13+
= note: https://spec.graphql.org/June2018/#sec-Interfaces
914

1015
error[E0412]: cannot find type `CharacterValue` in this scope
1116
--> fail/interface/fields_duplicate.rs:4:18

integration_tests/codegen_fail/fail/interface/implementer_non_object_type.stderr

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,12 @@ error[E0277]: the trait bound `ObjA: GraphQLObject<__S>` is not satisfied
44
15 | #[graphql_interface(for = ObjA)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `GraphQLObject<__S>` is not implemented for `ObjA`
66
|
7-
note: required by `juniper::GraphQLObject::mark`
8-
--> $WORKSPACE/juniper/src/types/marker.rs
9-
|
10-
| fn mark() {}
11-
| ^^^^^^^^^
127
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
138

149
error[E0277]: the trait bound `ObjA: IsOutputType<__S>` is not satisfied
15-
--> fail/interface/implementer_non_object_type.rs:15:1
16-
|
17-
15 | #[graphql_interface(for = ObjA)]
18-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjA`
19-
|
20-
note: required by `juniper::marker::IsOutputType::mark`
21-
--> $WORKSPACE/juniper/src/types/marker.rs
22-
|
23-
| fn mark() {}
24-
| ^^^^^^^^^
25-
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
10+
--> fail/interface/implementer_non_object_type.rs:15:1
11+
|
12+
15 | #[graphql_interface(for = ObjA)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjA`
14+
|
15+
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQL’s introspection system.
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Schema
4-
5-
--> $DIR/name_double_underscored.rs:4:7
2+
--> fail/interface/name_double_underscored.rs:4:7
63
|
74
4 | trait __Character {
85
| ^^^^^^^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Schema
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
error: GraphQL interface must have at least one field
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Interfaces
4-
5-
--> $DIR/no_fields.rs:13:1
2+
--> fail/interface/no_fields.rs:13:1
63
|
74
13 | trait Character {}
8-
| ^^^^^
5+
| ^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Interfaces
98

109
error[E0412]: cannot find type `CharacterValue` in this scope
11-
--> $DIR/no_fields.rs:4:18
10+
--> fail/interface/no_fields.rs:4:18
1211
|
1312
4 | #[graphql(impl = CharacterValue)]
1413
| ^^^^^^^^^^^^^^ not found in this scope
1514

1615
error[E0405]: cannot find trait `Character` in this scope
17-
--> $DIR/no_fields.rs:10:6
16+
--> fail/interface/no_fields.rs:10:6
1817
|
1918
10 | impl Character for ObjA {}
2019
| ^^^^^^^^^ not found in this scope
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
error: All types and directives defined within a schema must not have a name which begins with `__` (two underscores), as this is used exclusively by GraphQL’s introspection system.
2-
3-
= note: https://spec.graphql.org/June2018/#sec-Schema
4-
52
--> fail/object/argument_double_underscored.rs:7:18
63
|
74
7 | fn id(&self, __num: i32) -> &str {
85
| ^^^^^
6+
|
7+
= note: https://spec.graphql.org/June2018/#sec-Schema

0 commit comments

Comments
 (0)