diff --git a/Cargo.toml b/Cargo.toml index f21b1b3..63abc27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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] diff --git a/derive/tests/app.rs b/derive/tests/app.rs index 62b6656..629a66b 100644 --- a/derive/tests/app.rs +++ b/derive/tests/app.rs @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } diff --git a/derive/tests/expand_object/args_tests.rs b/derive/tests/expand_object/args_tests.rs index 023d769..0aae6c0 100644 --- a/derive/tests/expand_object/args_tests.rs +++ b/derive/tests/expand_object/args_tests.rs @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } diff --git a/derive/tests/expand_object/expand_object_tests.rs b/derive/tests/expand_object/expand_object_tests.rs index 7ea2bab..ba69728 100644 --- a/derive/tests/expand_object/expand_object_tests.rs +++ b/derive/tests/expand_object/expand_object_tests.rs @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } diff --git a/derive/tests/expand_object/generic_tests.rs b/derive/tests/expand_object/generic_tests.rs index 12810ac..4244ed7 100644 --- a/derive/tests/expand_object/generic_tests.rs +++ b/derive/tests/expand_object/generic_tests.rs @@ -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 } @@ -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 } @@ -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 } diff --git a/derive/tests/expand_object/reuse_tests.rs b/derive/tests/expand_object/reuse_tests.rs index 1f79732..9aea788 100644 --- a/derive/tests/expand_object/reuse_tests.rs +++ b/derive/tests/expand_object/reuse_tests.rs @@ -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 } diff --git a/derive/tests/gql_enum/tests.rs b/derive/tests/gql_enum/tests.rs index a0563d8..d721ea1 100644 --- a/derive/tests/gql_enum/tests.rs +++ b/derive/tests/gql_enum/tests.rs @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } diff --git a/derive/tests/input_object/list_tests.rs b/derive/tests/input_object/list_tests.rs index 260d85e..6ca4831 100644 --- a/derive/tests/input_object/list_tests.rs +++ b/derive/tests/input_object/list_tests.rs @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } @@ -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 } diff --git a/derive/tests/input_object/tests.rs b/derive/tests/input_object/tests.rs index 22bf20a..ffedbe3 100644 --- a/derive/tests/input_object/tests.rs +++ b/derive/tests/input_object/tests.rs @@ -72,6 +72,10 @@ async fn test_schema() { 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 } @@ -127,6 +131,10 @@ async fn test_schema_with_rename() { example(input: OtherInput!): String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -186,6 +194,10 @@ async fn test_schema_with_type_name() { example(input: OtherInput!): String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -242,6 +254,10 @@ async fn test_schema_with_skip() { 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 } @@ -302,6 +318,10 @@ fn test_schema_with_doc() { 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 } @@ -342,6 +362,10 @@ async fn test_rename_fields() { 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 } @@ -414,6 +438,10 @@ async fn test_auto_register() { 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 } @@ -492,6 +520,10 @@ mod in_mod { 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 } diff --git a/derive/tests/input_object/type_tests.rs b/derive/tests/input_object/type_tests.rs index 446856b..a37fea3 100644 --- a/derive/tests/input_object/type_tests.rs +++ b/derive/tests/input_object/type_tests.rs @@ -70,6 +70,10 @@ async fn test_types() { 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 } @@ -173,6 +177,10 @@ async fn test_object_type() { 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 } @@ -226,6 +234,10 @@ async fn test_number() { example(input: ExampleInput!): Int! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/interface/as_value_tests.rs b/derive/tests/interface/as_value_tests.rs index a0f538b..e80b5f7 100644 --- a/derive/tests/interface/as_value_tests.rs +++ b/derive/tests/interface/as_value_tests.rs @@ -60,6 +60,10 @@ async fn interface_as_output_value_for_simple_object_with_implement() { node: Node! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -139,6 +143,10 @@ async fn interface_as_output_value_for_simple_object_with_mark_with() { node: Node! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -225,6 +233,10 @@ async fn interface_as_output_value_for_resolved_object_with_implement() { node: Node! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -308,6 +320,10 @@ async fn interface_as_output_value_for_resolved_object_with_mark_with() { node: Node! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/interface/async_test.rs b/derive/tests/interface/async_test.rs index 56dd722..d3526d7 100644 --- a/derive/tests/interface/async_test.rs +++ b/derive/tests/interface/async_test.rs @@ -66,6 +66,10 @@ async fn test_async_trait() { 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 } diff --git a/derive/tests/interface/implementation_tests.rs b/derive/tests/interface/implementation_tests.rs index 18d1e99..77cf080 100644 --- a/derive/tests/interface/implementation_tests.rs +++ b/derive/tests/interface/implementation_tests.rs @@ -44,6 +44,10 @@ fn test_schema_simple_object_mark_with() { foo: FooNode! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -97,6 +101,10 @@ fn test_schema_simple_object_with_implement() { foo: FooNode! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -176,6 +184,10 @@ fn test_schema_resolved_object_mark_with() { foo: FooNode! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -232,6 +244,10 @@ fn test_schema_resolved_object_with_implement() { foo: FooNode! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/interface/interface_tests.rs b/derive/tests/interface/interface_tests.rs index 38ae25c..f5e39a1 100644 --- a/derive/tests/interface/interface_tests.rs +++ b/derive/tests/interface/interface_tests.rs @@ -60,6 +60,10 @@ fn test_schema() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -96,6 +100,10 @@ fn test_schema_with_name() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -164,6 +172,10 @@ fn test_schema_with_type_name() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -203,6 +215,10 @@ fn test_schema_with_rename() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -245,6 +261,10 @@ fn test_schema_description() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -284,6 +304,10 @@ fn test_schema_with_deprecation() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -321,6 +345,10 @@ fn test_schema_with_skip() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -379,6 +407,10 @@ async fn test_auto_register() { getFoo: Foo! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -453,6 +485,10 @@ async fn test_auto_register_instance() { getFoo: Foo! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -545,6 +581,10 @@ mod in_mod { bar: Node! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/interface/list_tests.rs b/derive/tests/interface/list_tests.rs index 1c66569..7efc574 100644 --- a/derive/tests/interface/list_tests.rs +++ b/derive/tests/interface/list_tests.rs @@ -61,6 +61,10 @@ async fn test_interface_as_optional_value() { node: Node } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -167,6 +171,10 @@ async fn test_interface_as_list_value() { nodes: [Node!]! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/interface/output_types_tests.rs b/derive/tests/interface/output_types_tests.rs index 2bd3c70..7cedd6d 100644 --- a/derive/tests/interface/output_types_tests.rs +++ b/derive/tests/interface/output_types_tests.rs @@ -82,6 +82,10 @@ async fn interface_string_ref_types() { node: Node! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -204,6 +208,10 @@ async fn interface_object_ref_types() { baz: Baz! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/mutation/mutation_tests.rs b/derive/tests/mutation/mutation_tests.rs index 8aada9d..8f69f18 100644 --- a/derive/tests/mutation/mutation_tests.rs +++ b/derive/tests/mutation/mutation_tests.rs @@ -89,6 +89,10 @@ fn test_schema() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: MutationRoot @@ -133,6 +137,10 @@ fn test_schema_with_rename() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: Mutation @@ -183,6 +191,10 @@ fn test_schema_with_type_name() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: Mutation @@ -230,6 +242,10 @@ fn test_schema_with_doc() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: MutationRoot @@ -360,6 +376,10 @@ async fn test_auto_register() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: MutationRoot diff --git a/derive/tests/readme.rs b/derive/tests/readme.rs index e3b0792..5636103 100644 --- a/derive/tests/readme.rs +++ b/derive/tests/readme.rs @@ -64,6 +64,8 @@ type Query { } +directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT +directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT schema { query: Query } diff --git a/derive/tests/registry.rs b/derive/tests/registry.rs index 742702b..3f3c6cc 100644 --- a/derive/tests/registry.rs +++ b/derive/tests/registry.rs @@ -58,6 +58,10 @@ async fn test_app() { 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 } @@ -108,6 +112,10 @@ async fn test_apply() { 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 } @@ -193,6 +201,10 @@ async fn define_custom_type() { 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 } diff --git a/derive/tests/resolved_object/resolved_object_args_tests.rs b/derive/tests/resolved_object/resolved_object_args_tests.rs index 3b2444c..2ddf5a1 100644 --- a/derive/tests/resolved_object/resolved_object_args_tests.rs +++ b/derive/tests/resolved_object/resolved_object_args_tests.rs @@ -50,6 +50,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 } @@ -101,6 +105,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 } @@ -137,6 +145,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 } @@ -171,6 +183,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 } @@ -209,6 +225,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 } @@ -635,6 +655,10 @@ async fn test_query_numbers() { byU8(name: Int!): String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/resolved_object/resolved_object_list_args_tests.rs b/derive/tests/resolved_object/resolved_object_list_args_tests.rs index d47fd8b..3d04704 100644 --- a/derive/tests/resolved_object/resolved_object_list_args_tests.rs +++ b/derive/tests/resolved_object/resolved_object_list_args_tests.rs @@ -34,6 +34,10 @@ async fn test_schema() { helloWithRef(names: [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 } @@ -98,6 +102,10 @@ async fn test_schema_optional_arg() { helloWithOptionalArgRef(names: [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 } @@ -179,6 +187,10 @@ async fn test_schema_optional_item() { helloWithOptionalItemRef(names: [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 } @@ -250,6 +262,10 @@ async fn test_schema_optional_item_and_arg() { helloWithOptionalItemAndArgRef(names: [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 } diff --git a/derive/tests/resolved_object/resolved_object_list_tests.rs b/derive/tests/resolved_object/resolved_object_list_tests.rs index 167eb5b..f143768 100644 --- a/derive/tests/resolved_object/resolved_object_list_tests.rs +++ b/derive/tests/resolved_object/resolved_object_list_tests.rs @@ -44,6 +44,10 @@ async fn test_list() { refItems: [String!]! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -133,6 +137,10 @@ async fn test_list_object() { refItems: [Item!]! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -208,6 +216,10 @@ async fn test_optional_list() { newMaybeListOfStrings: [String!] } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -280,6 +292,10 @@ async fn test_list_of_optional() { listOfMaybeStringsRef: [String]! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -341,6 +357,10 @@ async fn test_optional_list_of_optional() { newMaybeListOfMaybeStrings: [String] } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/resolved_object/resolved_object_result_tests.rs b/derive/tests/resolved_object/resolved_object_result_tests.rs index ad91fd7..3f99dc7 100644 --- a/derive/tests/resolved_object/resolved_object_result_tests.rs +++ b/derive/tests/resolved_object/resolved_object_result_tests.rs @@ -41,6 +41,10 @@ fn test_schema() { maybeString: String } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/resolved_object/resolved_object_tests.rs b/derive/tests/resolved_object/resolved_object_tests.rs index af012e3..a80e88e 100644 --- a/derive/tests/resolved_object/resolved_object_tests.rs +++ b/derive/tests/resolved_object/resolved_object_tests.rs @@ -57,6 +57,10 @@ fn test_schema() { theString: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -89,6 +93,10 @@ fn test_schema_with_rename() { other: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Other } @@ -125,6 +133,10 @@ fn test_schema_with_type_name() { theString: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Other } @@ -160,6 +172,10 @@ fn test_schema_with_skip() { 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 } @@ -200,6 +216,10 @@ async fn test_query() { other: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -264,6 +284,10 @@ fn test_schema_with_doc() { 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 } @@ -300,6 +324,10 @@ fn test_schema_with_deprecation() { withReason: String! @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 } @@ -332,6 +360,10 @@ fn test_rename_fields() { the_string: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: TheQuery } @@ -372,6 +404,10 @@ async fn test_async_query() { other: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -455,6 +491,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 } @@ -519,6 +559,10 @@ mod in_mod { theString: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/resolved_object/resolved_object_type_tests.rs b/derive/tests/resolved_object/resolved_object_type_tests.rs index 1fcf600..876ddcd 100644 --- a/derive/tests/resolved_object/resolved_object_type_tests.rs +++ b/derive/tests/resolved_object/resolved_object_type_tests.rs @@ -109,6 +109,10 @@ async fn test_types() { bool: Boolean! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -265,6 +269,10 @@ async fn test_optional_types() { bool: Boolean } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -404,6 +412,10 @@ async fn test_object_output() { newFoo: Foo! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/resolved_object/resolved_object_with_generics_tests.rs b/derive/tests/resolved_object/resolved_object_with_generics_tests.rs index 04bc4da..f151766 100644 --- a/derive/tests/resolved_object/resolved_object_with_generics_tests.rs +++ b/derive/tests/resolved_object/resolved_object_with_generics_tests.rs @@ -46,6 +46,10 @@ async fn test_query_static_generic() { greet(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 } @@ -101,6 +105,10 @@ async fn test_query_generic_with_self() { greet(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 } @@ -163,6 +171,10 @@ async fn test_query_graphql_generic() { theG: Foo! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/resolved_object/reuse_tests.rs b/derive/tests/resolved_object/reuse_tests.rs index a4917e1..c3920b8 100644 --- a/derive/tests/resolved_object/reuse_tests.rs +++ b/derive/tests/resolved_object/reuse_tests.rs @@ -110,6 +110,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 } diff --git a/derive/tests/scalar/json_tests.rs b/derive/tests/scalar/json_tests.rs index 663de73..696aee1 100644 --- a/derive/tests/scalar/json_tests.rs +++ b/derive/tests/scalar/json_tests.rs @@ -28,6 +28,10 @@ async fn json_input_output() { value(value: JsonValue!): JsonValue! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -88,6 +92,10 @@ async fn json_object_test() { value(value: JsonObject!): JsonObject! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -155,6 +163,10 @@ async fn json_key_value() { value(value: KeyValue!): KeyValue! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/scalar/scalar_tests.rs b/derive/tests/scalar/scalar_tests.rs index 4ad7815..09eaaba 100644 --- a/derive/tests/scalar/scalar_tests.rs +++ b/derive/tests/scalar/scalar_tests.rs @@ -88,6 +88,10 @@ fn test_schema() { value: MyString! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -135,6 +139,10 @@ fn test_schema_scalar_as_input() { value(value: MyString!): String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -178,6 +186,10 @@ fn test_schema_with_rename() { value: OtherString! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -227,6 +239,10 @@ fn test_schema_with_type_name() { value: OtherString! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -273,6 +289,10 @@ fn test_schema_with_doc() { value: MyString! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/schema_data/node_data.rs b/derive/tests/schema_data/node_data.rs index cef3209..f7b1c1f 100644 --- a/derive/tests/schema_data/node_data.rs +++ b/derive/tests/schema_data/node_data.rs @@ -149,6 +149,10 @@ async fn test() { node(id: String!): Node } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/schema_data/node_data_auto.rs b/derive/tests/schema_data/node_data_auto.rs index d4a74dc..287b7aa 100644 --- a/derive/tests/schema_data/node_data_auto.rs +++ b/derive/tests/schema_data/node_data_auto.rs @@ -153,6 +153,10 @@ async fn test() { node(id: String!): Node } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/schema_data/prepare_data.rs b/derive/tests/schema_data/prepare_data.rs index 13105bb..553329e 100644 --- a/derive/tests/schema_data/prepare_data.rs +++ b/derive/tests/schema_data/prepare_data.rs @@ -145,6 +145,10 @@ async fn test() { 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 } diff --git a/derive/tests/simple_object/list_tests.rs b/derive/tests/simple_object/list_tests.rs index 2f2c875..b17af88 100644 --- a/derive/tests/simple_object/list_tests.rs +++ b/derive/tests/simple_object/list_tests.rs @@ -25,6 +25,10 @@ async fn test_list() { strings: [String!]! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -72,6 +76,10 @@ async fn test_optional_list() { maybeListOfStrings: [String!] } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -124,6 +132,10 @@ async fn test_list_of_optional() { listOfMaybeStrings: [String]! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -167,6 +179,10 @@ async fn test_optional_list_of_optional() { maybeListOfMaybeStrings: [String] } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/simple_object/object_tests.rs b/derive/tests/simple_object/object_tests.rs index 53b05a4..673a357 100644 --- a/derive/tests/simple_object/object_tests.rs +++ b/derive/tests/simple_object/object_tests.rs @@ -62,6 +62,10 @@ fn test_schema() { 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 } @@ -87,6 +91,10 @@ fn test_schema_with_rename() { string: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Other } @@ -119,6 +127,10 @@ fn test_schema_with_type_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: Other } @@ -146,6 +158,10 @@ fn test_schema_with_skip() { 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 } @@ -172,6 +188,10 @@ fn test_schema_with_rename_field() { other: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -224,6 +244,10 @@ async fn test_optional() { maybeString: String } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -278,6 +302,10 @@ fn test_schema_with_doc() { 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 } @@ -307,6 +335,10 @@ fn test_schema_with_deprecation() { withReason: String! @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 } @@ -333,6 +365,10 @@ fn test_rename_fields() { the_string: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: TheQuery } @@ -386,6 +422,10 @@ async fn test_auto_register() { 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 } diff --git a/derive/tests/simple_object/type_tests.rs b/derive/tests/simple_object/type_tests.rs index f501798..7453878 100644 --- a/derive/tests/simple_object/type_tests.rs +++ b/derive/tests/simple_object/type_tests.rs @@ -55,6 +55,10 @@ async fn test_types() { bool: Boolean! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -159,6 +163,10 @@ async fn test_optional_types() { bool: Boolean } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -285,6 +293,10 @@ async fn test_object_output() { 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 } diff --git a/derive/tests/simple_object/with_generics_tests.rs b/derive/tests/simple_object/with_generics_tests.rs index c17aa50..d0c9807 100644 --- a/derive/tests/simple_object/with_generics_tests.rs +++ b/derive/tests/simple_object/with_generics_tests.rs @@ -44,6 +44,10 @@ async fn test_query_simple_generic() { field: Foo! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -136,6 +140,10 @@ async fn test_query_generic_with_type_name() { bar: BoxBar! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/subscription.rs b/derive/tests/subscription.rs index 455dd63..8cf7726 100644 --- a/derive/tests/subscription.rs +++ b/derive/tests/subscription.rs @@ -53,6 +53,10 @@ async fn test_schema() { foo: String! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query subscription: Subscription diff --git a/derive/tests/union/union_tests.rs b/derive/tests/union/union_tests.rs index e34c5a0..eca70c3 100644 --- a/derive/tests/union/union_tests.rs +++ b/derive/tests/union/union_tests.rs @@ -111,6 +111,10 @@ fn test_schema() { pet: Animal! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -168,6 +172,10 @@ fn test_schema_with_rename() { pet: Other! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -231,6 +239,10 @@ fn test_schema_with_type_name() { pet: Other! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -292,6 +304,10 @@ fn test_schema_with_doc() { pet: Other! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -493,6 +509,10 @@ async fn test_auto_register() { pet: Animal! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -567,6 +587,10 @@ mod in_mod { pet: Animal! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/union/with_generic_tests.rs b/derive/tests/union/with_generic_tests.rs index 7edc9b8..f62e983 100644 --- a/derive/tests/union/with_generic_tests.rs +++ b/derive/tests/union/with_generic_tests.rs @@ -115,6 +115,10 @@ async fn test_query_simple_generic() { box: FooBar! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/union/with_interface.rs b/derive/tests/union/with_interface.rs index 51e2b9d..47d0d15 100644 --- a/derive/tests/union/with_interface.rs +++ b/derive/tests/union/with_interface.rs @@ -78,6 +78,10 @@ async fn test_query() { length: Int! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/derive/tests/upload/upload_tests.rs b/derive/tests/upload/upload_tests.rs index 127cd99..bf62810 100644 --- a/derive/tests/upload/upload_tests.rs +++ b/derive/tests/upload/upload_tests.rs @@ -75,6 +75,10 @@ async fn test_arg() { scalar Upload + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: MutationRoot @@ -156,6 +160,10 @@ async fn test_input_object() { file: Upload! } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: MutationRoot @@ -231,6 +239,10 @@ async fn test_arg_optional() { scalar Upload + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: MutationRoot @@ -324,6 +336,10 @@ async fn test_input_object_optional() { file: Upload } + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query mutation: MutationRoot diff --git a/src/docs/interface.md b/src/docs/interface.md index 8270d20..7f6735f 100644 --- a/src/docs/interface.md +++ b/src/docs/interface.md @@ -168,6 +168,10 @@ type Query { character(id: String!): Character } +directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + +directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/src/docs/resolved-object-fields.md b/src/docs/resolved-object-fields.md index ba2eb36..c413f06 100644 --- a/src/docs/resolved-object-fields.md +++ b/src/docs/resolved-object-fields.md @@ -113,6 +113,10 @@ type Query { 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 } @@ -174,6 +178,10 @@ type RootQuery { fourth_field(theArg: Int!, other_arg: Int!): Int! } +directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + +directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: RootQuery } @@ -239,6 +247,10 @@ type Query { fourthField: Int! } +directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + +directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } @@ -309,6 +321,10 @@ type Query { withSelf(arg: Int!): Int! } +directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + +directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } diff --git a/src/docs/simple-object.md b/src/docs/simple-object.md index fd7ca57..8fb0e5b 100644 --- a/src/docs/simple-object.md +++ b/src/docs/simple-object.md @@ -80,6 +80,10 @@ type Query { 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 } @@ -118,6 +122,10 @@ type RootQuery { MyField: String! } +directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + +directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: RootQuery } @@ -170,9 +178,13 @@ type Query { myField: String! } +directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + +directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + schema { query: Query } "# ); -``` \ No newline at end of file +```