-
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
- Loading branch information
Showing
29 changed files
with
211 additions
and
63 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use juniper::graphql_interface; | ||
|
||
#[graphql_interface] | ||
trait Character { | ||
fn id(&self) -> &str; | ||
|
||
#[graphql(ignore)] | ||
fn id2(&self) -> &str { | ||
self.self.id() | ||
} | ||
} | ||
|
||
fn main() {} |
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,22 @@ | ||
error: #[graphql_interface] attribute is applicable to trait and struct definitions only | ||
--> fail/interface/trait/wrong_syntax.rs:3:1 | ||
| | ||
3 | #[graphql_interface] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: cannot find attribute `graphql` in this scope | ||
--> fail/interface/trait/wrong_syntax.rs:7:7 | ||
| | ||
7 | #[graphql(ignore)] | ||
| ^^^^^^^ | ||
|
||
error[E0609]: no field `self` on type `&Self` | ||
--> fail/interface/trait/wrong_syntax.rs:9:14 | ||
| | ||
4 | trait Character { | ||
| --------------- type parameter 'Self' declared here | ||
... | ||
9 | self.self.id() | ||
| ^^^^ |
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
11 changes: 5 additions & 6 deletions
11
tests/codegen/fail/object/attr_field_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,7 +1,6 @@ | ||
error: #[graphql_object] attribute is applicable to non-trait `impl` blocks only | ||
--> fail/object/attr_field_double_underscored.rs:5:1 | ||
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. | ||
· note: https://spec.graphql.org/October2021#sec-Schema | ||
--> fail/object/attr_field_double_underscored.rs:7:8 | ||
| | ||
5 | #[graphql_object] | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
7 | fn __id(&self) -> &str { | ||
| ^^^^ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use juniper::graphql_object; | ||
|
||
struct MyObject { | ||
my_field: i32, | ||
} | ||
|
||
#[graphql_object] | ||
impl MyObject { | ||
fn my_field(&self) -> i32 { | ||
self.self.my_field | ||
} | ||
} | ||
|
||
fn main() {} |
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,15 @@ | ||
error: #[graphql_object] attribute is applicable to non-trait `impl` blocks only | ||
--> fail/object/attr_wrong_syntax.rs:7:1 | ||
| | ||
7 | #[graphql_object] | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0609]: no field `self` on type `&MyObject` | ||
--> fail/object/attr_wrong_syntax.rs:10:14 | ||
| | ||
10 | self.self.my_field | ||
| ^^^^ unknown field | ||
| | ||
= note: available fields are: `my_field` |
7 changes: 4 additions & 3 deletions
7
tests/codegen/fail/subscription/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
4 changes: 2 additions & 2 deletions
4
tests/codegen/fail/subscription/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,6 +1,6 @@ | ||
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. | ||
· note: https://spec.graphql.org/October2021#sec-Schema | ||
--> fail/subscription/argument_double_underscored.rs:11:24 | ||
--> fail/subscription/argument_double_underscored.rs:12:24 | ||
| | ||
11 | async fn id(&self, __num: i32) -> Stream<'static, &'static str> { | ||
12 | async fn id(&self, __num: i32) -> BoxStream<'static, &'static str> { | ||
| ^^^^^ |
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
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
13 changes: 6 additions & 7 deletions
13
tests/codegen/fail/subscription/field_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,7 +1,6 @@ | ||
error: #[graphql_subscription] attribute is applicable to non-trait `impl` blocks only | ||
--> fail/subscription/field_double_underscored.rs:9:1 | ||
| | ||
9 | #[graphql_subscription] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `graphql_subscription` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
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. | ||
· note: https://spec.graphql.org/October2021#sec-Schema | ||
--> fail/subscription/field_double_underscored.rs:12:14 | ||
| | ||
12 | async fn __id() -> BoxStream<'static, &'static str> { | ||
| ^^^^ |
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
Oops, something went wrong.