Implement #[derive(GraphQLInterface)] to use structs as GraphQL interfaces (#1026)

- support `#[graphql_interface]` on structs
This commit is contained in:
ilslv 2022-04-01 21:10:45 +03:00 committed by GitHub
parent 744b808b48
commit d0b56f9222
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
125 changed files with 6540 additions and 387 deletions

View file

@ -1,10 +1,8 @@
error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied
--> fail/input-object/derive_incompatible_object.rs:6:10 --> fail/input-object/derive_incompatible_object.rs:8:12
| |
6 | #[derive(juniper::GraphQLInputObject)] 8 | field: ObjectA,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA` | ^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA`
|
= note: this error originates in the derive macro `juniper::GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
--> fail/input-object/derive_incompatible_object.rs:6:10 --> fail/input-object/derive_incompatible_object.rs:6:10

View file

@ -1,7 +0,0 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/additional_non_nullable_argument.rs:14:1
|
14 | #[graphql_interface(for = ObjA)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.', $DIR/fail/interface/additional_non_nullable_argument.rs:14:1
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,5 @@
error: GraphQL interface #[graphql_interface] attribute is applicable to trait and struct definitions only
--> fail/interface/attr_wrong_item.rs:9:1
|
9 | enum Character {}
| ^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,12 @@
use juniper::{GraphQLInterface, GraphQLObject};
#[derive(GraphQLObject)]
pub struct ObjA {
test: String,
}
#[derive(GraphQLInterface)]
#[graphql(for = ObjA)]
enum Character {}
fn main() {}

View file

@ -0,0 +1,6 @@
error: GraphQL interface can only be derived on structs
--> fail/interface/derive_wrong_item.rs:9:1
|
9 | / #[graphql(for = ObjA)]
10 | | enum Character {}
| |_________________^

View file

@ -1,7 +0,0 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/interface/field_non_output_return_type.rs:8:1
|
8 | #[graphql_interface]
| ^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
|
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +0,0 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/missing_field.rs:9:1
|
9 | #[graphql_interface(for = ObjA)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/missing_field.rs:9:1
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +0,0 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/missing_field_argument.rs:14:1
|
14 | #[graphql_interface(for = ObjA)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` was expected, but not found.', $DIR/fail/interface/missing_field_argument.rs:14:1
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +0,0 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/non_subtype_return.rs:9:1
|
9 | #[graphql_interface(for = ObjA)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of interface's return object: `[String!]!` is not a subtype of `String!`.', $DIR/fail/interface/non_subtype_return.rs:9:1
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,19 @@
use juniper::{graphql_interface, graphql_object};
pub struct ObjA {
id: String,
}
#[graphql_object(impl = CharacterValue)]
impl ObjA {
fn id(&self, is_present: bool) -> &str {
is_present.then(|| self.id.as_str()).unwrap_or("missing")
}
}
#[graphql_interface(for = ObjA)]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/attr_additional_non_nullable_argument.rs:16:5
|
16 | id: String,
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.', $DIR/fail/interface/struct/attr_additional_non_nullable_argument.rs:16:5
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,8 @@
use juniper::graphql_interface;
#[graphql_interface]
struct Character {
__id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
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 GraphQLs introspection system.
--> fail/interface/struct/attr_field_double_underscored.rs:5:5
|
5 | __id: String,
| ^^^^
|
= note: https://spec.graphql.org/June2018/#sec-Schema

View file

@ -0,0 +1,13 @@
use juniper::{graphql_interface, GraphQLInputObject};
#[derive(GraphQLInputObject)]
pub struct ObjB {
id: i32,
}
#[graphql_interface]
struct Character {
id: ObjB,
}
fn main() {}

View file

@ -0,0 +1,5 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/interface/struct/attr_field_non_output_return_type.rs:10:9
|
10 | id: ObjB,
| ^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`

View file

@ -0,0 +1,11 @@
use juniper::graphql_interface;
#[graphql_interface]
struct Character {
id: String,
#[graphql(name = "id")]
id2: String,
}
fn main() {}

View file

@ -0,0 +1,12 @@
error: GraphQL interface must have a different name for each field
--> fail/interface/struct/attr_fields_duplicate.rs:4:1
|
4 | / struct Character {
5 | | id: String,
6 | |
7 | | #[graphql(name = "id")]
8 | | id2: String,
9 | | }
| |_^
|
= note: https://spec.graphql.org/June2018/#sec-Interfaces

View file

@ -0,0 +1,14 @@
use juniper::{graphql_interface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
id: String,
}
#[graphql_interface(for = [ObjA, ObjA])]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: duplicated attribute argument found
--> fail/interface/struct/attr_implementers_duplicate_pretty.rs:9:34
|
9 | #[graphql_interface(for = [ObjA, ObjA])]
| ^^^^
error[E0412]: cannot find type `CharacterValue` in this scope
--> fail/interface/struct/attr_implementers_duplicate_pretty.rs:4:18
|
4 | #[graphql(impl = CharacterValue)]
| ^^^^^^^^^^^^^^ not found in this scope

View file

@ -0,0 +1,16 @@
use juniper::{graphql_interface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
id: String,
}
type ObjAlias = ObjA;
#[graphql_interface(for = [ObjA, ObjAlias])]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,21 @@
error[E0119]: conflicting implementations of trait `std::convert::From<ObjA>` for type `CharacterValueEnum<ObjA, ObjA>`
--> fail/interface/struct/attr_implementers_duplicate_ugly.rs:11:1
|
11 | #[graphql_interface(for = [ObjA, ObjAlias])]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| first implementation here
| conflicting implementation for `CharacterValueEnum<ObjA, ObjA>`
|
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0119]: conflicting implementations of trait `<CharacterValueEnum<ObjA, ObjA> as juniper::GraphQLInterface<__S>>::mark::_::{closure#0}::MutuallyExclusive` for type `ObjA`
--> fail/interface/struct/attr_implementers_duplicate_ugly.rs:11:1
|
11 | #[graphql_interface(for = [ObjA, ObjAlias])]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| first implementation here
| conflicting implementation for `ObjA`
|
= note: this error originates in the macro `::juniper::sa::assert_type_ne_all` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,14 @@
use juniper::{graphql_interface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
test: String,
}
#[graphql_interface(for = ObjA)]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/attr_missing_field.rs:11:5
|
11 | id: String,
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/attr_missing_field.rs:11:5
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,14 @@
use juniper::{graphql_interface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
id: String,
}
#[graphql_interface]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/attr_missing_for_attr.rs:3:10
|
3 | #[derive(GraphQLObject)]
| ^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing implementer reference in interface's `for` attribute.', $DIR/fail/interface/struct/attr_missing_for_attr.rs:3:10
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -2,10 +2,12 @@ use juniper::{graphql_interface, GraphQLObject};
#[derive(GraphQLObject)] #[derive(GraphQLObject)]
pub struct ObjA { pub struct ObjA {
test: String, id: String,
} }
#[graphql_interface(for = ObjA)] #[graphql_interface(for = ObjA)]
impl ObjA {} struct Character {
id: String,
}
fn main() {} fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/attr_missing_impl_attr.rs:8:1
|
8 | #[graphql_interface(for = ObjA)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing interface reference in implementer's `impl` attribute.', $DIR/fail/interface/struct/attr_missing_impl_attr.rs:8:1
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,8 @@
use juniper::graphql_interface;
#[graphql_interface]
struct __Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
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 GraphQLs introspection system.
--> fail/interface/struct/attr_name_double_underscored.rs:4:8
|
4 | struct __Character {
| ^^^^^^^^^^^
|
= note: https://spec.graphql.org/June2018/#sec-Schema

View file

@ -0,0 +1,6 @@
use juniper::graphql_interface;
#[graphql_interface]
struct Character {}
fn main() {}

View file

@ -0,0 +1,7 @@
error: GraphQL interface must have at least one field
--> fail/interface/struct/attr_no_fields.rs:4:1
|
4 | struct Character {}
| ^^^^^^^^^^^^^^^^^^^
|
= note: https://spec.graphql.org/June2018/#sec-Interfaces

View file

@ -0,0 +1,14 @@
use juniper::{graphql_interface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
id: Vec<String>,
}
#[graphql_interface(for = ObjA)]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/attr_non_subtype_return.rs:11:5
|
11 | id: String,
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of interface's return object: `[String!]!` is not a subtype of `String!`.', $DIR/fail/interface/struct/attr_non_subtype_return.rs:11:5
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,6 @@
use juniper::graphql_interface;
#[graphql_interface]
struct Character(i32);
fn main() {}

View file

@ -0,0 +1,7 @@
error: GraphQL interface expected named struct field
--> fail/interface/struct/attr_unnamed_field.rs:4:18
|
4 | struct Character(i32);
| ^^^
|
= note: https://spec.graphql.org/June2018/#sec-Interfaces

View file

@ -0,0 +1,20 @@
use juniper::{graphql_object, GraphQLInterface};
pub struct ObjA {
id: String,
}
#[graphql_object(impl = CharacterValue)]
impl ObjA {
fn id(&self, is_present: bool) -> &str {
is_present.then(|| self.id.as_str()).unwrap_or("missing")
}
}
#[derive(GraphQLInterface)]
#[graphql(for = ObjA)]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/derive_additional_non_nullable_argument.rs:17:5
|
17 | id: String,
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.', $DIR/fail/interface/struct/derive_additional_non_nullable_argument.rs:17:5
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,8 @@
use juniper::GraphQLInterface;
#[derive(GraphQLInterface)]
struct Character {
__id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
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 GraphQLs introspection system.
--> fail/interface/struct/derive_field_double_underscored.rs:5:5
|
5 | __id: String,
| ^^^^
|
= note: https://spec.graphql.org/June2018/#sec-Schema

View file

@ -0,0 +1,13 @@
use juniper::{GraphQLInputObject, GraphQLInterface};
#[derive(GraphQLInputObject)]
pub struct ObjB {
id: i32,
}
#[derive(GraphQLInterface)]
struct Character {
id: ObjB,
}
fn main() {}

View file

@ -0,0 +1,5 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/interface/struct/derive_field_non_output_return_type.rs:10:9
|
10 | id: ObjB,
| ^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`

View file

@ -0,0 +1,11 @@
use juniper::GraphQLInterface;
#[derive(GraphQLInterface)]
struct Character {
id: String,
#[graphql(name = "id")]
id2: String,
}
fn main() {}

View file

@ -0,0 +1,12 @@
error: GraphQL interface must have a different name for each field
--> fail/interface/struct/derive_fields_duplicate.rs:4:1
|
4 | / struct Character {
5 | | id: String,
6 | |
7 | | #[graphql(name = "id")]
8 | | id2: String,
9 | | }
| |_^
|
= note: https://spec.graphql.org/June2018/#sec-Interfaces

View file

@ -0,0 +1,15 @@
use juniper::{GraphQLInterface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
id: String,
}
#[derive(GraphQLInterface)]
#[graphql(for = [ObjA, ObjA])]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: duplicated attribute argument found
--> fail/interface/struct/derive_implementers_duplicate_pretty.rs:10:24
|
10 | #[graphql(for = [ObjA, ObjA])]
| ^^^^
error[E0412]: cannot find type `CharacterValue` in this scope
--> fail/interface/struct/derive_implementers_duplicate_pretty.rs:4:18
|
4 | #[graphql(impl = CharacterValue)]
| ^^^^^^^^^^^^^^ not found in this scope

View file

@ -0,0 +1,17 @@
use juniper::{GraphQLInterface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
id: String,
}
type ObjAlias = ObjA;
#[derive(GraphQLInterface)]
#[graphql(for = [ObjA, ObjAlias])]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,21 @@
error[E0119]: conflicting implementations of trait `std::convert::From<ObjA>` for type `CharacterValueEnum<ObjA, ObjA>`
--> fail/interface/struct/derive_implementers_duplicate_ugly.rs:11:10
|
11 | #[derive(GraphQLInterface)]
| ^^^^^^^^^^^^^^^^
| |
| first implementation here
| conflicting implementation for `CharacterValueEnum<ObjA, ObjA>`
|
= note: this error originates in the derive macro `GraphQLInterface` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0119]: conflicting implementations of trait `<CharacterValueEnum<ObjA, ObjA> as juniper::GraphQLInterface<__S>>::mark::_::{closure#0}::MutuallyExclusive` for type `ObjA`
--> fail/interface/struct/derive_implementers_duplicate_ugly.rs:11:10
|
11 | #[derive(GraphQLInterface)]
| ^^^^^^^^^^^^^^^^
| |
| first implementation here
| conflicting implementation for `ObjA`
|
= note: this error originates in the macro `::juniper::sa::assert_type_ne_all` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,15 @@
use juniper::{GraphQLInterface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
test: String,
}
#[derive(GraphQLInterface)]
#[graphql(for = ObjA)]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/derive_missing_field.rs:12:5
|
12 | id: String,
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/derive_missing_field.rs:12:5
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,14 @@
use juniper::{GraphQLInterface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
id: String,
}
#[derive(GraphQLInterface)]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/derive_missing_for_attr.rs:3:10
|
3 | #[derive(GraphQLObject)]
| ^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing implementer reference in interface's `for` attribute.', $DIR/fail/interface/struct/derive_missing_for_attr.rs:3:10
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,14 @@
use juniper::{GraphQLInterface, GraphQLObject};
#[derive(GraphQLObject)]
pub struct ObjA {
id: String,
}
#[derive(GraphQLInterface)]
#[graphql(for = ObjA)]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/derive_missing_impl_attr.rs:8:10
|
8 | #[derive(GraphQLInterface)]
| ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing interface reference in implementer's `impl` attribute.', $DIR/fail/interface/struct/derive_missing_impl_attr.rs:8:10
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,8 @@
use juniper::GraphQLInterface;
#[derive(GraphQLInterface)]
struct __Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
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 GraphQLs introspection system.
--> fail/interface/struct/derive_name_double_underscored.rs:4:8
|
4 | struct __Character {
| ^^^^^^^^^^^
|
= note: https://spec.graphql.org/June2018/#sec-Schema

View file

@ -0,0 +1,6 @@
use juniper::GraphQLInterface;
#[derive(GraphQLInterface)]
struct Character {}
fn main() {}

View file

@ -0,0 +1,7 @@
error: GraphQL interface must have at least one field
--> fail/interface/struct/derive_no_fields.rs:4:1
|
4 | struct Character {}
| ^^^^^^^^^^^^^^^^^^^
|
= note: https://spec.graphql.org/June2018/#sec-Interfaces

View file

@ -0,0 +1,15 @@
use juniper::{GraphQLInterface, GraphQLObject};
#[derive(GraphQLObject)]
#[graphql(impl = CharacterValue)]
pub struct ObjA {
id: Vec<String>,
}
#[derive(GraphQLInterface)]
#[graphql(for = ObjA)]
struct Character {
id: String,
}
fn main() {}

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/struct/derive_non_subtype_return.rs:12:5
|
12 | id: String,
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of interface's return object: `[String!]!` is not a subtype of `String!`.', $DIR/fail/interface/struct/derive_non_subtype_return.rs:12:5
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,6 @@
use juniper::GraphQLInterface;
#[derive(GraphQLInterface)]
struct Character(i32);
fn main() {}

View file

@ -0,0 +1,7 @@
error: GraphQL interface expected named struct field
--> fail/interface/struct/derive_unnamed_field.rs:4:18
|
4 | struct Character(i32);
| ^^^
|
= note: https://spec.graphql.org/June2018/#sec-Interfaces

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/trait/additional_non_nullable_argument.rs:16:8
|
16 | fn id(&self) -> &str;
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.', $DIR/fail/interface/trait/additional_non_nullable_argument.rs:16:8
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,5 +1,5 @@
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 GraphQLs introspection system. 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 GraphQLs introspection system.
--> fail/interface/argument_double_underscored.rs:5:18 --> fail/interface/trait/argument_double_underscored.rs:5:18
| |
5 | fn id(&self, __num: i32) -> &str; 5 | fn id(&self, __num: i32) -> &str;
| ^^^^^ | ^^^^^

View file

@ -1,13 +1,11 @@
error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
--> fail/interface/argument_non_input_type.rs:8:1 --> fail/interface/trait/argument_non_input_type.rs:10:23
| |
8 | #[graphql_interface] 10 | fn id(&self, obj: ObjA) -> &str;
| ^^^^^^^^^^^^^^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjA` | ^^^^ the trait `IsInputType<__S>` is not implemented for `ObjA`
|
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
--> fail/interface/argument_non_input_type.rs:8:1 --> fail/interface/trait/argument_non_input_type.rs:8:1
| |
8 | #[graphql_interface] 8 | #[graphql_interface]
| ^^^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA` | ^^^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`

View file

@ -1,14 +1,14 @@
error[E0277]: the trait bound `[bool; 2]: From<[bool; 3]>` is not satisfied error[E0277]: the trait bound `[bool; 2]: From<[bool; 3]>` is not satisfied
--> fail/interface/argument_wrong_default_array.rs:3:1 --> fail/interface/trait/argument_wrong_default_array.rs:3:1
| |
3 | #[graphql_interface] 3 | #[graphql_interface]
| ^^^^^^^^^^^^^^^^^^^^ the trait `From<[bool; 3]>` is not implemented for `[bool; 2]` | ^^^^^^^^^^^^^^^^^^^^ the trait `From<[bool; 3]>` is not implemented for `[bool; 2]`
| |
= help: the following implementations were found: = help: the following implementations were found:
<&'a [ascii::ascii_char::AsciiChar] as From<&'a ascii::ascii_str::AsciiStr>> <&'a [ascii::ascii_char::AsciiChar] as From<&'a ascii::ascii_str::AsciiStr>>
<&'a [u32; 4] as From<&'a ppv_lite86::x86_64::vec128_storage>>
<&'a [u8] as From<&'a ascii::ascii_str::AsciiStr>> <&'a [u8] as From<&'a ascii::ascii_str::AsciiStr>>
<&'a mut [ascii::ascii_char::AsciiChar] as From<&'a mut ascii::ascii_str::AsciiStr>> <&'a mut [ascii::ascii_char::AsciiChar] as From<&'a mut ascii::ascii_str::AsciiStr>>
<[T; LANES] as From<Simd<T, LANES>>> and 11 others
<[bool; LANES] as From<Mask<T, LANES>>>
= note: required because of the requirements on the impl of `Into<[bool; 2]>` for `[bool; 3]` = note: required because of the requirements on the impl of `Into<[bool; 2]>` for `[bool; 3]`
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,5 +1,5 @@
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 GraphQLs introspection system. 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 GraphQLs introspection system.
--> fail/interface/field_double_underscored.rs:5:8 --> fail/interface/trait/field_double_underscored.rs:5:8
| |
5 | fn __id(&self) -> &str; 5 | fn __id(&self) -> &str;
| ^^^^ | ^^^^

View file

@ -0,0 +1,5 @@
error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
--> fail/interface/trait/field_non_output_return_type.rs:10:21
|
10 | fn id(&self) -> ObjB;
| ^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`

View file

@ -1,5 +1,5 @@
error: GraphQL interface must have a different name for each field error: GraphQL interface must have a different name for each field
--> fail/interface/fields_duplicate.rs:4:1 --> fail/interface/trait/fields_duplicate.rs:4:1
| |
4 | / trait Character { 4 | / trait Character {
5 | | fn id(&self) -> &str; 5 | | fn id(&self) -> &str;

View file

@ -1,11 +1,11 @@
error: duplicated attribute argument found error: duplicated attribute argument found
--> fail/interface/implementers_duplicate_pretty.rs:9:34 --> fail/interface/trait/implementers_duplicate_pretty.rs:9:34
| |
9 | #[graphql_interface(for = [ObjA, ObjA])] 9 | #[graphql_interface(for = [ObjA, ObjA])]
| ^^^^ | ^^^^
error[E0412]: cannot find type `CharacterValue` in this scope error[E0412]: cannot find type `CharacterValue` in this scope
--> fail/interface/implementers_duplicate_pretty.rs:4:18 --> fail/interface/trait/implementers_duplicate_pretty.rs:4:18
| |
4 | #[graphql(impl = CharacterValue)] 4 | #[graphql(impl = CharacterValue)]
| ^^^^^^^^^^^^^^ not found in this scope | ^^^^^^^^^^^^^^ not found in this scope

View file

@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `std::convert::From<ObjA>` for type `CharacterValueEnum<ObjA, ObjA>` error[E0119]: conflicting implementations of trait `std::convert::From<ObjA>` for type `CharacterValueEnum<ObjA, ObjA>`
--> fail/interface/implementers_duplicate_ugly.rs:11:1 --> fail/interface/trait/implementers_duplicate_ugly.rs:11:1
| |
11 | #[graphql_interface(for = [ObjA, ObjAlias])] 11 | #[graphql_interface(for = [ObjA, ObjAlias])]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -10,7 +10,7 @@ error[E0119]: conflicting implementations of trait `std::convert::From<ObjA>` fo
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0119]: conflicting implementations of trait `<CharacterValueEnum<ObjA, ObjA> as juniper::GraphQLInterface<__S>>::mark::_::{closure#0}::MutuallyExclusive` for type `ObjA` error[E0119]: conflicting implementations of trait `<CharacterValueEnum<ObjA, ObjA> as juniper::GraphQLInterface<__S>>::mark::_::{closure#0}::MutuallyExclusive` for type `ObjA`
--> fail/interface/implementers_duplicate_ugly.rs:11:1 --> fail/interface/trait/implementers_duplicate_ugly.rs:11:1
| |
11 | #[graphql_interface(for = [ObjA, ObjAlias])] 11 | #[graphql_interface(for = [ObjA, ObjAlias])]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -1,5 +1,5 @@
error: GraphQL interface trait method can't have default implementation error: GraphQL interface trait method can't have default implementation
--> fail/interface/method_default_impl.rs:5:26 --> fail/interface/trait/method_default_impl.rs:5:26
| |
5 | fn id(&self) -> &str { 5 | fn id(&self) -> &str {
| __________________________^ | __________________________^

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/trait/missing_field.rs:11:8
|
11 | fn id(&self) -> &str;
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/trait/missing_field.rs:11:8
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/trait/missing_field_argument.rs:16:8
|
16 | fn id(&self, is_present: bool) -> &str;
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` was expected, but not found.', $DIR/fail/interface/trait/missing_field_argument.rs:16:8
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +1,7 @@
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> fail/interface/missing_for_attr.rs:3:10 --> fail/interface/trait/missing_for_attr.rs:3:10
| |
3 | #[derive(GraphQLObject)] 3 | #[derive(GraphQLObject)]
| ^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing implementer reference in interface's `for` attribute.', $DIR/fail/interface/missing_for_attr.rs:3:10 | ^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing implementer reference in interface's `for` attribute.', $DIR/fail/interface/trait/missing_for_attr.rs:3:10
| |
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +1,7 @@
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> fail/interface/missing_impl_attr.rs:8:1 --> fail/interface/trait/missing_impl_attr.rs:8:1
| |
8 | #[graphql_interface(for = ObjA)] 8 | #[graphql_interface(for = ObjA)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing interface reference in implementer's `impl` attribute.', $DIR/fail/interface/missing_impl_attr.rs:8:1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing interface reference in implementer's `impl` attribute.', $DIR/fail/interface/trait/missing_impl_attr.rs:8:1
| |
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,5 +1,5 @@
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 GraphQLs introspection system. 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 GraphQLs introspection system.
--> fail/interface/name_double_underscored.rs:4:7 --> fail/interface/trait/name_double_underscored.rs:4:7
| |
4 | trait __Character { 4 | trait __Character {
| ^^^^^^^^^^^ | ^^^^^^^^^^^

View file

@ -1,5 +1,5 @@
error: GraphQL interface must have at least one field error: GraphQL interface must have at least one field
--> fail/interface/no_fields.rs:4:1 --> fail/interface/trait/no_fields.rs:4:1
| |
4 | trait Character {} 4 | trait Character {}
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/trait/non_subtype_return.rs:11:8
|
11 | fn id(&self) -> &str;
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of interface's return object: `[String!]!` is not a subtype of `String!`.', $DIR/fail/interface/trait/non_subtype_return.rs:11:8
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -0,0 +1,7 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/trait/wrong_argument_type.rs:16:8
|
16 | fn id(&self, is_present: bool) -> &str;
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent`: expected type `Boolean!`, found: `Int!`.', $DIR/fail/interface/trait/wrong_argument_type.rs:16:8
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +0,0 @@
error[E0080]: evaluation of constant value failed
--> fail/interface/wrong_argument_type.rs:14:1
|
14 | #[graphql_interface(for = ObjA)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent`: expected type `Boolean!`, found: `Int!`.', $DIR/fail/interface/wrong_argument_type.rs:14:1
|
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,7 +0,0 @@
error: #[graphql_interface] attribute is applicable to trait definitions only
--> fail/interface/wrong_item_enum.rs:8:1
|
8 | #[graphql_interface(for = ObjA)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)

Some files were not shown because too many files have changed in this diff Show more