-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- remove support for `#[graphql_interface(dyn)]` - describe all interface trait methods with type's fields or impl block instead of `#[graphql_interface]` attribute on `impl Trait` - forbid default impls on non-skipped trait methods - support additional nullable arguments on implementer - support returning sub-type on implementer
- Loading branch information
Showing
82 changed files
with
3,375 additions
and
5,935 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
integration_tests/codegen_fail/fail/interface/additional_non_nullable_argument.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)] | ||
trait Character { | ||
fn id(&self) -> &str; | ||
} | ||
|
||
fn main() {} |
7 changes: 7 additions & 0 deletions
7
integration_tests/codegen_fail/fail/interface/additional_non_nullable_argument.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
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) |
15 changes: 2 additions & 13 deletions
15
integration_tests/codegen_fail/fail/interface/argument_double_underscored.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
use juniper::{graphql_interface, GraphQLObject}; | ||
|
||
#[derive(GraphQLObject)] | ||
#[graphql(impl = CharacterValue)] | ||
pub struct ObjA { | ||
test: String, | ||
} | ||
use juniper::graphql_interface; | ||
|
||
#[graphql_interface] | ||
impl Character for ObjA {} | ||
|
||
#[graphql_interface(for = ObjA)] | ||
trait Character { | ||
fn id(&self, __num: i32) -> &str { | ||
"funA" | ||
} | ||
fn id(&self, __num: i32) -> &str; | ||
} | ||
|
||
fn main() {} |
22 changes: 5 additions & 17 deletions
22
integration_tests/codegen_fail/fail/interface/argument_double_underscored.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +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 GraphQL’s introspection system. | ||
--> fail/interface/argument_double_underscored.rs:14:18 | ||
| | ||
14 | fn id(&self, __num: i32) -> &str { | ||
| ^^^^^ | ||
| | ||
= note: https://spec.graphql.org/June2018/#sec-Schema | ||
|
||
error[E0412]: cannot find type `CharacterValue` in this scope | ||
--> fail/interface/argument_double_underscored.rs:4:18 | ||
--> fail/interface/argument_double_underscored.rs:5:18 | ||
| | ||
4 | #[graphql(impl = CharacterValue)] | ||
| ^^^^^^^^^^^^^^ not found in this scope | ||
|
||
error[E0405]: cannot find trait `Character` in this scope | ||
--> fail/interface/argument_double_underscored.rs:10:6 | ||
| | ||
10 | impl Character for ObjA {} | ||
| ^^^^^^^^^ not found in this scope | ||
5 | fn id(&self, __num: i32) -> &str; | ||
| ^^^^^ | ||
| | ||
= note: https://spec.graphql.org/June2018/#sec-Schema |
Oops, something went wrong.