Skip to content

Commit

Permalink
Async graphql 7 (#34)
Browse files Browse the repository at this point in the history
* update to latest

* fix snapshots

* fix tests in docs

---------

Co-authored-by: Haaroon Yousaf <[email protected]>
  • Loading branch information
smmoosavi and Haaroon authored May 30, 2024
1 parent 8c2ad68 commit 34dcfc6
Show file tree
Hide file tree
Showing 44 changed files with 648 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["network-programming"]

[dependencies]
fnv = "1"
async-graphql = { version= "6.0.9", features = ["dynamic-schema"] }
async-graphql = { version= "7.0.5", features = ["dynamic-schema"] }
dynamic-graphql-derive = { path = "./derive", version = "0.8.1" }

[dev-dependencies]
Expand Down
24 changes: 24 additions & 0 deletions derive/tests/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ fn test_app() {
other: Foo!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -87,6 +91,10 @@ fn test_app_with_generic() {
other: Foo!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -129,6 +137,10 @@ fn test_app_with_lifetime() {
other: Foo!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -187,6 +199,10 @@ fn test_app_with_generic_and_lifetime() {
other: Foo!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -233,6 +249,10 @@ fn test_nested_app() {
bar: Bar!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -276,6 +296,10 @@ mod test_in_mod {
foo: Foo!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down
20 changes: 20 additions & 0 deletions derive/tests/expand_object/args_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ fn test_schema() {
unusedArg(name: String!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -115,6 +119,10 @@ fn test_schema_with_ctx() {
withCtxArg(ctx: String!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -159,6 +167,10 @@ fn test_schema_rename_args() {
withFieldRename(the_name: String!, foo: String!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -201,6 +213,10 @@ fn test_schema_with_arg_ref() {
withStr(name: String!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -247,6 +263,10 @@ fn test_schema_with_arg_option() {
withOptionRef(name: String): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down
24 changes: 24 additions & 0 deletions derive/tests/expand_object/expand_object_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ fn test_schema() {
theExample: Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -139,6 +143,10 @@ fn test_schema_with_rename() {
other: Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -195,6 +203,10 @@ fn test_schema_with_skip() {
theExample: Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -252,6 +264,10 @@ fn test_schema_with_deprecation() {
old: Example! @deprecated(reason: "this is the old one")
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -305,6 +321,10 @@ fn test_schema_with_description() {
theExample: Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -499,6 +519,10 @@ async fn test_auto_register() {
example(input: ExampleInput): Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down
12 changes: 12 additions & 0 deletions derive/tests/expand_object/generic_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ fn test_schema_with_generic() {
bar: Bar!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand All @@ -183,6 +187,10 @@ fn test_schema_with_generic() {
bar: Bar!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -216,6 +224,10 @@ fn test_schema_with_generic() {
bar: Bar!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down
4 changes: 4 additions & 0 deletions derive/tests/expand_object/reuse_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ async fn test_base_list() {
fooList: FooList!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down
24 changes: 24 additions & 0 deletions derive/tests/gql_enum/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ async fn test_schema() {
byExample(example: Example!): Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -176,6 +180,10 @@ async fn test_rename() {
byExample(example: Other!): Other!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -269,6 +277,10 @@ async fn test_type_name() {
byExample(example: Other!): Other!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -357,6 +369,10 @@ async fn test_deprecation() {
byExample(example: Example!): Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -411,6 +427,10 @@ async fn test_doc() {
byExample(example: Example!): Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -483,6 +503,10 @@ mod in_mod {
byExample(example: Example!): Example!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down
28 changes: 28 additions & 0 deletions derive/tests/input_object/list_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ async fn test_maybe_undefined() {
example(input: ExampleInput!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -130,6 +134,10 @@ async fn test_option() {
example(input: ExampleInput): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -208,6 +216,10 @@ async fn test_unset() {
example(input: ExampleInput!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -290,6 +302,10 @@ async fn test_list() {
example(input: ExampleInput!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -366,6 +382,10 @@ async fn test_optional_list() {
example(input: ExampleInput!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -453,6 +473,10 @@ async fn test_optional_items() {
example(input: ExampleInput!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down Expand Up @@ -533,6 +557,10 @@ async fn test_optional_items_and_value() {
example(input: ExampleInput!): String!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
schema {
query: Query
}
Expand Down
Loading

0 comments on commit 34dcfc6

Please sign in to comment.