Skip to content

Commit d0b56f9

Browse files
authored
Implement #[derive(GraphQLInterface)] to use structs as GraphQL interfaces (#1026)
- support `#[graphql_interface]` on structs
1 parent 744b808 commit d0b56f9

File tree

125 files changed

+6537
-384
lines changed

Some content is hidden

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

125 files changed

+6537
-384
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
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`
2+
--> fail/input-object/derive_incompatible_object.rs:8:12
63
|
7-
= note: this error originates in the derive macro `juniper::GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
4+
8 | field: ObjectA,
5+
| ^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA`
86

97
error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
108
--> fail/input-object/derive_incompatible_object.rs:6:10

integration_tests/codegen_fail/fail/interface/additional_non_nullable_argument.stderr

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error: GraphQL interface #[graphql_interface] attribute is applicable to trait and struct definitions only
2+
--> fail/interface/attr_wrong_item.rs:9:1
3+
|
4+
9 | enum Character {}
5+
| ^^^^^^^^^^^^^^^^^
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use juniper::{GraphQLInterface, GraphQLObject};
2+
3+
#[derive(GraphQLObject)]
4+
pub struct ObjA {
5+
test: String,
6+
}
7+
8+
#[derive(GraphQLInterface)]
9+
#[graphql(for = ObjA)]
10+
enum Character {}
11+
12+
fn main() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
error: GraphQL interface can only be derived on structs
2+
--> fail/interface/derive_wrong_item.rs:9:1
3+
|
4+
9 | / #[graphql(for = ObjA)]
5+
10 | | enum Character {}
6+
| |_________________^

integration_tests/codegen_fail/fail/interface/field_non_output_return_type.stderr

Lines changed: 0 additions & 7 deletions
This file was deleted.

integration_tests/codegen_fail/fail/interface/missing_field.stderr

Lines changed: 0 additions & 7 deletions
This file was deleted.

integration_tests/codegen_fail/fail/interface/missing_field_argument.stderr

Lines changed: 0 additions & 7 deletions
This file was deleted.

integration_tests/codegen_fail/fail/interface/non_subtype_return.stderr

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)