From 99904a6b30fec798e2418281ef2916176915c22e Mon Sep 17 00:00:00 2001 From: M Aswin Kishore <60577077+mak626@users.noreply.github.com> Date: Sat, 9 Mar 2024 01:05:15 +0530 Subject: [PATCH] feat: add support for federation v2.7 --- README.md | 10 ++-- federation_spec/federation-v2.7.graphql | 52 +++++++++++++++++++ .../apollo_versions/__init__.py | 13 +++-- graphene_federation/apollo_versions/v2_7.py | 24 +++++++++ .../apollo_versions/version.py | 1 + graphene_federation/directives/override.py | 3 +- ...t_annotate_object_with_meta_name_1.graphql | 2 +- ...t_annotate_object_with_meta_name_2.graphql | 2 +- ...otated_field_also_used_in_filter_1.graphql | 2 +- ...otated_field_also_used_in_filter_2.graphql | 2 +- .../test_camel_case_field_name_1.graphql | 2 +- .../test_camel_case_field_name_2.graphql | 2 +- ...ield_name_without_auto_camelcase_1.graphql | 2 +- ...ield_name_without_auto_camelcase_2.graphql | 2 +- .../test_similar_field_name_1.graphql | 2 +- .../test_similar_field_name_2.graphql | 2 +- .../test_custom_enum_1.graphql | 2 +- .../test_custom_enum_2.graphql | 2 +- .../test_inaccessible_1.graphql | 2 +- .../test_inaccessible_2.graphql | 2 +- .../test_inaccessible_union_1.graphql | 2 +- .../test_inaccessible_union_2.graphql | 2 +- .../test_compound_primary_key_1.graphql | 2 +- .../test_compound_primary_key_2.graphql | 2 +- ..._compound_primary_key_with_depth_1.graphql | 2 +- ..._compound_primary_key_with_depth_2.graphql | 2 +- .../gql/test_key/test_multiple_keys_1.graphql | 2 +- .../gql/test_key/test_multiple_keys_2.graphql | 2 +- .../gql/test_override/test_override_1.graphql | 28 ++++++++++ .../gql/test_override/test_override_2.graphql | 23 ++++++++ .../gql/test_provides/test_provides_1.graphql | 2 +- .../gql/test_provides/test_provides_2.graphql | 2 +- .../test_provides_multiple_fields_1.graphql | 2 +- .../test_provides_multiple_fields_2.graphql | 2 +- ...provides_multiple_fields_as_list_1.graphql | 2 +- ...provides_multiple_fields_as_list_2.graphql | 2 +- .../test_requires_multiple_fields_1.graphql | 2 +- .../test_requires_multiple_fields_2.graphql | 2 +- ...requires_multiple_fields_as_list_1.graphql | 2 +- ...requires_multiple_fields_as_list_2.graphql | 2 +- .../test_requires_with_input_1.graphql | 2 +- .../test_requires_with_input_2.graphql | 2 +- .../test_scalar/test_custom_scalar_1.graphql | 2 +- .../test_scalar/test_custom_scalar_2.graphql | 2 +- .../test_chat_schema_1.graphql | 2 +- .../test_chat_schema_2.graphql | 2 +- .../test_user_schema_1.graphql | 2 +- .../test_user_schema_2.graphql | 2 +- .../test_shareable/test_shareable_1.graphql | 2 +- .../test_shareable/test_shareable_2.graphql | 2 +- tests/test_annotation_corner_cases.py | 15 ++++++ tests/test_annotation_corner_cases_v1.py | 3 ++ tests/test_custom_enum.py | 3 ++ tests/test_inaccessible.py | 6 +++ tests/test_key.py | 10 ++++ tests/test_key_v1.py | 3 ++ tests/test_override.py | 48 +++++++++++++++++ tests/test_provides.py | 9 ++++ tests/test_provides_v1.py | 9 ++++ tests/test_requires.py | 12 ++--- tests/test_requires_v1.py | 9 ++++ tests/test_scalar.py | 7 ++- tests/test_shareable.py | 3 ++ 63 files changed, 316 insertions(+), 59 deletions(-) create mode 100644 federation_spec/federation-v2.7.graphql create mode 100644 graphene_federation/apollo_versions/v2_7.py create mode 100644 tests/gql/test_override/test_override_1.graphql create mode 100644 tests/gql/test_override/test_override_2.graphql create mode 100644 tests/test_override.py diff --git a/README.md b/README.md index 009a2c0..0bf6504 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,14 @@ If you need to use a version compatible with `graphene` v2 I recommend using the - [x] v2.2 - [x] v2.3 - [x] v2.4 -- [x] v2.5 `STABLE_VERSION` . Rover dev supports only upto v2.5 -- [x] v2.6 `LATEST_VERSION` +- [x] v2.5 +- [x] v2.6 `STABLE_VERSION` . Rover dev supports only upto v2.6 +- [x] v2.7 `LATEST_VERSION` All directives could be easily integrated with the help of [graphene-directives](https://github.com/strollby/graphene-directives). Now every directive's values are validated at run time itself by [graphene-directives](https://github.com/strollby/graphene-directives). -### Directives (v2.6) +### Directives (v2.7) ```graphql directive @composeDirective(name: String!) repeatable on SCHEMA @@ -62,7 +63,7 @@ directive @inaccessible on | INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION directive @interfaceObject on OBJECT -directive @override(from: String!) on FIELD_DEFINITION +directive @override(from: String!, label: String) on FIELD_DEFINITION directive @provides(fields: FieldSet!) on FIELD_DEFINITION directive @requires(fields: FieldSet!) on FIELD_DEFINITION directive @shareable repeatable on FIELD_DEFINITION | OBJECT @@ -98,7 +99,6 @@ directive @policy(policies: [[federation__Policy!]!]!) on scalar federation__Policy scalar federation__Scope scalar FieldSet - ``` Read about directives in [official documentation](https://www.apollographql.com/docs/federation/federated-types/federated-directives) diff --git a/federation_spec/federation-v2.7.graphql b/federation_spec/federation-v2.7.graphql new file mode 100644 index 0000000..39e27f6 --- /dev/null +++ b/federation_spec/federation-v2.7.graphql @@ -0,0 +1,52 @@ +directive @composeDirective(name: String!) repeatable on SCHEMA +directive @extends on OBJECT | INTERFACE +directive @external on OBJECT | FIELD_DEFINITION +directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE +directive @inaccessible on + | FIELD_DEFINITION + | OBJECT + | INTERFACE + | UNION + | ENUM + | ENUM_VALUE + | SCALAR + | INPUT_OBJECT + | INPUT_FIELD_DEFINITION + | ARGUMENT_DEFINITION +directive @interfaceObject on OBJECT +directive @override(from: String!, label: String) on FIELD_DEFINITION +directive @provides(fields: FieldSet!) on FIELD_DEFINITION +directive @requires(fields: FieldSet!) on FIELD_DEFINITION +directive @shareable repeatable on FIELD_DEFINITION | OBJECT +directive @tag(name: String!) repeatable on + | FIELD_DEFINITION + | INTERFACE + | OBJECT + | UNION + | ARGUMENT_DEFINITION + | SCALAR + | ENUM + | ENUM_VALUE + | INPUT_OBJECT + | INPUT_FIELD_DEFINITION +directive @authenticated on + FIELD_DEFINITION + | OBJECT + | INTERFACE + | SCALAR + | ENUM +directive @requiresScopes(scopes: [[federation__Scope!]!]!) on + FIELD_DEFINITION + | OBJECT + | INTERFACE + | SCALAR + | ENUM +directive @policy(policies: [[federation__Policy!]!]!) on + | FIELD_DEFINITION + | OBJECT + | INTERFACE + | SCALAR + | ENUM +scalar federation__Policy +scalar federation__Scope +scalar FieldSet diff --git a/graphene_federation/apollo_versions/__init__.py b/graphene_federation/apollo_versions/__init__.py index becdc7b..46e398f 100644 --- a/graphene_federation/apollo_versions/__init__.py +++ b/graphene_federation/apollo_versions/__init__.py @@ -8,10 +8,13 @@ from .v2_4 import get_directives as get_directives_v2_4 from .v2_5 import get_directives as get_directives_v2_5 from .v2_6 import get_directives as get_directives_v2_6 +from .v2_7 import get_directives as get_directives_v2_7 from .version import FederationVersion -LATEST_VERSION = FederationVersion.VERSION_2_6 -STABLE_VERSION = FederationVersion.VERSION_2_5 +LATEST_VERSION = FederationVersion.VERSION_2_7 + +# Stable version is determined with the latest version that rover cli supports +STABLE_VERSION = FederationVersion.VERSION_2_6 def get_directives_based_on_version( @@ -20,7 +23,7 @@ def get_directives_based_on_version( """ Returns a dictionary of [directive_name, directive] for the specified federation version - If no match is found for the specified federation version, latest is taken + If no match is found for the specified federation version, the latest is taken """ if federation_version == FederationVersion.VERSION_1_0: return get_directives_v1_0() @@ -38,8 +41,10 @@ def get_directives_based_on_version( return get_directives_v2_5() if federation_version == FederationVersion.VERSION_2_6: return get_directives_v2_6() + if federation_version == FederationVersion.VERSION_2_7: + return get_directives_v2_7() - return get_directives_v2_6() + return get_directives_v2_7() def get_directive_from_name( diff --git a/graphene_federation/apollo_versions/v2_7.py b/graphene_federation/apollo_versions/v2_7.py new file mode 100644 index 0000000..6714bab --- /dev/null +++ b/graphene_federation/apollo_versions/v2_7.py @@ -0,0 +1,24 @@ +from graphene_directives import CustomDirective, DirectiveLocation +from graphql import GraphQLArgument, GraphQLDirective, GraphQLNonNull, GraphQLString + +from .v2_6 import get_directives as get_directives_v2_6 + +override_directive = CustomDirective( + name="override", + locations=[ + DirectiveLocation.FIELD_DEFINITION, + ], + args={ + "from": GraphQLArgument(GraphQLNonNull(GraphQLString)), + "label": GraphQLArgument(GraphQLString), + }, + description="Federation @override directive", + add_definition_to_schema=False, +) + + +# @override Change, Added label argument +def get_directives() -> dict[str, GraphQLDirective]: + directives = get_directives_v2_6() + directives.update({directive.name: directive for directive in [override_directive]}) + return directives diff --git a/graphene_federation/apollo_versions/version.py b/graphene_federation/apollo_versions/version.py index ce2c0e7..fc01edb 100644 --- a/graphene_federation/apollo_versions/version.py +++ b/graphene_federation/apollo_versions/version.py @@ -10,3 +10,4 @@ class FederationVersion(Enum): VERSION_2_4 = "2.4" VERSION_2_5 = "2.5" VERSION_2_6 = "2.6" + VERSION_2_7 = "2.7" diff --git a/graphene_federation/directives/override.py b/graphene_federation/directives/override.py index 2f5a406..ce33447 100644 --- a/graphene_federation/directives/override.py +++ b/graphene_federation/directives/override.py @@ -13,6 +13,7 @@ def override( graphene_type, from_: str, + label: str = None, *, federation_version: FederationVersion = LATEST_VERSION, ) -> Callable: @@ -40,7 +41,7 @@ def wrapper(field_or_type): ] ) ) - return decorator(field=field_or_type, **{"from": from_}) + return decorator(field=field_or_type, **{"from": from_, "label": label}) if graphene_type: return wrapper(graphene_type) diff --git a/tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_1.graphql b/tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_1.graphql index 7dc8a97..b89ff4a 100644 --- a/tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_1.graphql +++ b/tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key"]) type Query { a: Banana diff --git a/tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_2.graphql b/tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_2.graphql index c4e3a4d..562cbf8 100644 --- a/tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_2.graphql +++ b/tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key"]) type Query { a: Banana diff --git a/tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_1.graphql b/tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_1.graphql index a8c4bac..b1c768d 100644 --- a/tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_1.graphql +++ b/tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key"]) type Query { a: A diff --git a/tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_2.graphql b/tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_2.graphql index 094efb9..a19de00 100644 --- a/tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_2.graphql +++ b/tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key"]) type Query { a: A diff --git a/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_1.graphql b/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_1.graphql index 5c17726..53b2a74 100644 --- a/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_1.graphql +++ b/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@requires"]) type Query { camel: Camel diff --git a/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_2.graphql b/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_2.graphql index d0cd54f..f57b03e 100644 --- a/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_2.graphql +++ b/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@requires"]) type Query { camel: Camel diff --git a/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_1.graphql b/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_1.graphql index d4a7c57..45dddc2 100644 --- a/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_1.graphql +++ b/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@requires"]) type Query { camel: Camel diff --git a/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_2.graphql b/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_2.graphql index 16b37c1..8edc83c 100644 --- a/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_2.graphql +++ b/tests/gql/test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@requires"]) type Query { camel: Camel diff --git a/tests/gql/test_annotation_corner_cases/test_similar_field_name_1.graphql b/tests/gql/test_annotation_corner_cases/test_similar_field_name_1.graphql index c4b3f67..c02d8d3 100644 --- a/tests/gql/test_annotation_corner_cases/test_similar_field_name_1.graphql +++ b/tests/gql/test_annotation_corner_cases/test_similar_field_name_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key"]) schema { query: ChatQuery diff --git a/tests/gql/test_annotation_corner_cases/test_similar_field_name_2.graphql b/tests/gql/test_annotation_corner_cases/test_similar_field_name_2.graphql index f4cfea2..0bc8d56 100644 --- a/tests/gql/test_annotation_corner_cases/test_similar_field_name_2.graphql +++ b/tests/gql/test_annotation_corner_cases/test_similar_field_name_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key"]) schema { query: ChatQuery diff --git a/tests/gql/test_custom_enum/test_custom_enum_1.graphql b/tests/gql/test_custom_enum/test_custom_enum_1.graphql index 1e84768..dc39872 100644 --- a/tests/gql/test_custom_enum/test_custom_enum_1.graphql +++ b/tests/gql/test_custom_enum/test_custom_enum_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@shareable"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@inaccessible", "@shareable"]) type TestCustomEnum @shareable { testShareableScalar: Episode @shareable diff --git a/tests/gql/test_custom_enum/test_custom_enum_2.graphql b/tests/gql/test_custom_enum/test_custom_enum_2.graphql index 791a0e8..e9f3d2e 100644 --- a/tests/gql/test_custom_enum/test_custom_enum_2.graphql +++ b/tests/gql/test_custom_enum/test_custom_enum_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@shareable"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@inaccessible", "@shareable"]) type TestCustomEnum @shareable { testShareableScalar: Episode @shareable diff --git a/tests/gql/test_inaccessible/test_inaccessible_1.graphql b/tests/gql/test_inaccessible/test_inaccessible_1.graphql index 4cf7915..adbf745 100644 --- a/tests/gql/test_inaccessible/test_inaccessible_1.graphql +++ b/tests/gql/test_inaccessible/test_inaccessible_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@inaccessible"]) type Position @inaccessible { x: Int! diff --git a/tests/gql/test_inaccessible/test_inaccessible_2.graphql b/tests/gql/test_inaccessible/test_inaccessible_2.graphql index eb973d7..9bd20e8 100644 --- a/tests/gql/test_inaccessible/test_inaccessible_2.graphql +++ b/tests/gql/test_inaccessible/test_inaccessible_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@inaccessible"]) type Position @inaccessible { x: Int! diff --git a/tests/gql/test_inaccessible/test_inaccessible_union_1.graphql b/tests/gql/test_inaccessible/test_inaccessible_union_1.graphql index 462e4f0..eb0927d 100644 --- a/tests/gql/test_inaccessible/test_inaccessible_union_1.graphql +++ b/tests/gql/test_inaccessible/test_inaccessible_union_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@inaccessible"]) union SearchResult @inaccessible = Human | Droid | Starship diff --git a/tests/gql/test_inaccessible/test_inaccessible_union_2.graphql b/tests/gql/test_inaccessible/test_inaccessible_union_2.graphql index d3b2645..a9403a5 100644 --- a/tests/gql/test_inaccessible/test_inaccessible_union_2.graphql +++ b/tests/gql/test_inaccessible/test_inaccessible_union_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@inaccessible"]) union SearchResult @inaccessible = Human | Droid | Starship diff --git a/tests/gql/test_key/test_compound_primary_key_1.graphql b/tests/gql/test_key/test_compound_primary_key_1.graphql index a1c644c..3bcc601 100644 --- a/tests/gql/test_key/test_compound_primary_key_1.graphql +++ b/tests/gql/test_key/test_compound_primary_key_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@key"]) type Query { user: User diff --git a/tests/gql/test_key/test_compound_primary_key_2.graphql b/tests/gql/test_key/test_compound_primary_key_2.graphql index ac94857..3c48134 100644 --- a/tests/gql/test_key/test_compound_primary_key_2.graphql +++ b/tests/gql/test_key/test_compound_primary_key_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@key"]) type Query { user: User diff --git a/tests/gql/test_key/test_compound_primary_key_with_depth_1.graphql b/tests/gql/test_key/test_compound_primary_key_with_depth_1.graphql index fc3ad3e..c8dfebd 100644 --- a/tests/gql/test_key/test_compound_primary_key_with_depth_1.graphql +++ b/tests/gql/test_key/test_compound_primary_key_with_depth_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@key"]) type Query { user: User diff --git a/tests/gql/test_key/test_compound_primary_key_with_depth_2.graphql b/tests/gql/test_key/test_compound_primary_key_with_depth_2.graphql index 2275a7d..54430d3 100644 --- a/tests/gql/test_key/test_compound_primary_key_with_depth_2.graphql +++ b/tests/gql/test_key/test_compound_primary_key_with_depth_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@key"]) type Query { user: User diff --git a/tests/gql/test_key/test_multiple_keys_1.graphql b/tests/gql/test_key/test_multiple_keys_1.graphql index cc813bd..9e1d066 100644 --- a/tests/gql/test_key/test_multiple_keys_1.graphql +++ b/tests/gql/test_key/test_multiple_keys_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@key"]) type Query { user: User diff --git a/tests/gql/test_key/test_multiple_keys_2.graphql b/tests/gql/test_key/test_multiple_keys_2.graphql index e1bf5cd..815b80c 100644 --- a/tests/gql/test_key/test_multiple_keys_2.graphql +++ b/tests/gql/test_key/test_multiple_keys_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@key"]) type Query { user: User diff --git a/tests/gql/test_override/test_override_1.graphql b/tests/gql/test_override/test_override_1.graphql new file mode 100644 index 0000000..86554c8 --- /dev/null +++ b/tests/gql/test_override/test_override_1.graphql @@ -0,0 +1,28 @@ +extend schema + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@override"]) + +type Query { + product: Product + _service: _Service! +} + +type Product { + sku: ID @override(from: "subgraph-1") + size: Int @override(from: "subgraph-2") + weight: Int @override(from: "subgraph-3", label: "Test label") +} + +type _Service { + sdl: String +} + +""" +A string-serialized scalar represents a set of fields that's passed to a federated directive, such as @key, @requires, or @provides +""" +scalar FieldSet + +"""This string-serialized scalar represents a JWT scope""" +scalar federation__Scope + +"""This string-serialized scalar represents an authorization policy.""" +scalar federation__Policy \ No newline at end of file diff --git a/tests/gql/test_override/test_override_2.graphql b/tests/gql/test_override/test_override_2.graphql new file mode 100644 index 0000000..3d717b6 --- /dev/null +++ b/tests/gql/test_override/test_override_2.graphql @@ -0,0 +1,23 @@ +extend schema + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@override"]) + +type Query { + product: Product +} + +type Product { + sku: ID @override(from: "subgraph-1") + size: Int @override(from: "subgraph-2") + weight: Int @override(from: "subgraph-3", label: "Test label") +} + +""" +A string-serialized scalar represents a set of fields that's passed to a federated directive, such as @key, @requires, or @provides +""" +scalar FieldSet + +"""This string-serialized scalar represents a JWT scope""" +scalar federation__Scope + +"""This string-serialized scalar represents an authorization policy.""" +scalar federation__Policy \ No newline at end of file diff --git a/tests/gql/test_provides/test_provides_1.graphql b/tests/gql/test_provides/test_provides_1.graphql index 28c11f0..aa03470 100644 --- a/tests/gql/test_provides/test_provides_1.graphql +++ b/tests/gql/test_provides/test_provides_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@external", "@key", "@provides"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@external", "@key", "@provides"]) type Query { inStockCount: InStockCount diff --git a/tests/gql/test_provides/test_provides_2.graphql b/tests/gql/test_provides/test_provides_2.graphql index a91ca1a..a18d895 100644 --- a/tests/gql/test_provides/test_provides_2.graphql +++ b/tests/gql/test_provides/test_provides_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@external", "@key", "@provides"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@external", "@key", "@provides"]) type Query { inStockCount: InStockCount diff --git a/tests/gql/test_provides/test_provides_multiple_fields_1.graphql b/tests/gql/test_provides/test_provides_multiple_fields_1.graphql index 4904725..85dad3c 100644 --- a/tests/gql/test_provides/test_provides_multiple_fields_1.graphql +++ b/tests/gql/test_provides/test_provides_multiple_fields_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@external", "@key", "@provides"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@external", "@key", "@provides"]) type Query { inStockCount: InStockCount diff --git a/tests/gql/test_provides/test_provides_multiple_fields_2.graphql b/tests/gql/test_provides/test_provides_multiple_fields_2.graphql index a2721ff..a5f1511 100644 --- a/tests/gql/test_provides/test_provides_multiple_fields_2.graphql +++ b/tests/gql/test_provides/test_provides_multiple_fields_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@external", "@key", "@provides"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@external", "@key", "@provides"]) type Query { inStockCount: InStockCount diff --git a/tests/gql/test_provides/test_provides_multiple_fields_as_list_1.graphql b/tests/gql/test_provides/test_provides_multiple_fields_as_list_1.graphql index 8ee489d..83672e2 100644 --- a/tests/gql/test_provides/test_provides_multiple_fields_as_list_1.graphql +++ b/tests/gql/test_provides/test_provides_multiple_fields_as_list_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@provides"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@provides"]) type Query { inStockCount: InStockCount diff --git a/tests/gql/test_provides/test_provides_multiple_fields_as_list_2.graphql b/tests/gql/test_provides/test_provides_multiple_fields_as_list_2.graphql index b64e8cf..ff687af 100644 --- a/tests/gql/test_provides/test_provides_multiple_fields_as_list_2.graphql +++ b/tests/gql/test_provides/test_provides_multiple_fields_as_list_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@provides"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@provides"]) type Query { inStockCount: InStockCount diff --git a/tests/gql/test_requires/test_requires_multiple_fields_1.graphql b/tests/gql/test_requires/test_requires_multiple_fields_1.graphql index ba14d2e..d408da1 100644 --- a/tests/gql/test_requires/test_requires_multiple_fields_1.graphql +++ b/tests/gql/test_requires/test_requires_multiple_fields_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@requires"]) type Query { product: Product diff --git a/tests/gql/test_requires/test_requires_multiple_fields_2.graphql b/tests/gql/test_requires/test_requires_multiple_fields_2.graphql index 2bd6903..7ff53e0 100644 --- a/tests/gql/test_requires/test_requires_multiple_fields_2.graphql +++ b/tests/gql/test_requires/test_requires_multiple_fields_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@requires"]) type Query { product: Product diff --git a/tests/gql/test_requires/test_requires_multiple_fields_as_list_1.graphql b/tests/gql/test_requires/test_requires_multiple_fields_as_list_1.graphql index ba14d2e..d408da1 100644 --- a/tests/gql/test_requires/test_requires_multiple_fields_as_list_1.graphql +++ b/tests/gql/test_requires/test_requires_multiple_fields_as_list_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@requires"]) type Query { product: Product diff --git a/tests/gql/test_requires/test_requires_multiple_fields_as_list_2.graphql b/tests/gql/test_requires/test_requires_multiple_fields_as_list_2.graphql index 2bd6903..7ff53e0 100644 --- a/tests/gql/test_requires/test_requires_multiple_fields_as_list_2.graphql +++ b/tests/gql/test_requires/test_requires_multiple_fields_as_list_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@requires"]) type Query { product: Product diff --git a/tests/gql/test_requires/test_requires_with_input_1.graphql b/tests/gql/test_requires/test_requires_with_input_1.graphql index 267db9d..a898ef2 100644 --- a/tests/gql/test_requires/test_requires_with_input_1.graphql +++ b/tests/gql/test_requires/test_requires_with_input_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@requires"]) type Query { acme: Acme diff --git a/tests/gql/test_requires/test_requires_with_input_2.graphql b/tests/gql/test_requires/test_requires_with_input_2.graphql index d3365ab..2f4d703 100644 --- a/tests/gql/test_requires/test_requires_with_input_2.graphql +++ b/tests/gql/test_requires/test_requires_with_input_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key", "@requires"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key", "@requires"]) type Query { acme: Acme diff --git a/tests/gql/test_scalar/test_custom_scalar_1.graphql b/tests/gql/test_scalar/test_custom_scalar_1.graphql index c6fc25a..e1607ae 100644 --- a/tests/gql/test_scalar/test_custom_scalar_1.graphql +++ b/tests/gql/test_scalar/test_custom_scalar_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@shareable"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@inaccessible", "@shareable"]) type TestScalar @shareable { testShareableScalar(x: AddressScalar): String @shareable diff --git a/tests/gql/test_scalar/test_custom_scalar_2.graphql b/tests/gql/test_scalar/test_custom_scalar_2.graphql index d7e968e..da23193 100644 --- a/tests/gql/test_scalar/test_custom_scalar_2.graphql +++ b/tests/gql/test_scalar/test_custom_scalar_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@inaccessible", "@shareable"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@inaccessible", "@shareable"]) type TestScalar @shareable { testShareableScalar(x: AddressScalar): String @shareable diff --git a/tests/gql/test_schema_annotation/test_chat_schema_1.graphql b/tests/gql/test_schema_annotation/test_chat_schema_1.graphql index 4776a75..c1ba222 100644 --- a/tests/gql/test_schema_annotation/test_chat_schema_1.graphql +++ b/tests/gql/test_schema_annotation/test_chat_schema_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key"]) schema { query: ChatQuery diff --git a/tests/gql/test_schema_annotation/test_chat_schema_2.graphql b/tests/gql/test_schema_annotation/test_chat_schema_2.graphql index 7a25553..2ea0c63 100644 --- a/tests/gql/test_schema_annotation/test_chat_schema_2.graphql +++ b/tests/gql/test_schema_annotation/test_chat_schema_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@extends", "@external", "@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@extends", "@external", "@key"]) schema { query: ChatQuery diff --git a/tests/gql/test_schema_annotation/test_user_schema_1.graphql b/tests/gql/test_schema_annotation/test_user_schema_1.graphql index b72f0ce..3f80e75 100644 --- a/tests/gql/test_schema_annotation/test_user_schema_1.graphql +++ b/tests/gql/test_schema_annotation/test_user_schema_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@key"]) schema { query: UserQuery diff --git a/tests/gql/test_schema_annotation/test_user_schema_2.graphql b/tests/gql/test_schema_annotation/test_user_schema_2.graphql index 6778830..e20f2cc 100644 --- a/tests/gql/test_schema_annotation/test_user_schema_2.graphql +++ b/tests/gql/test_schema_annotation/test_user_schema_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@key"]) schema { query: UserQuery diff --git a/tests/gql/test_shareable/test_shareable_1.graphql b/tests/gql/test_shareable/test_shareable_1.graphql index d9003c9..417c965 100644 --- a/tests/gql/test_shareable/test_shareable_1.graphql +++ b/tests/gql/test_shareable/test_shareable_1.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@shareable"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@shareable"]) type Position @shareable { x: Int! diff --git a/tests/gql/test_shareable/test_shareable_2.graphql b/tests/gql/test_shareable/test_shareable_2.graphql index af8ffc2..5e585f5 100644 --- a/tests/gql/test_shareable/test_shareable_2.graphql +++ b/tests/gql/test_shareable/test_shareable_2.graphql @@ -1,5 +1,5 @@ extend schema - @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@shareable"]) + @link(url: "https://specs.apollo.dev/federation/v2.7", import: ["@shareable"]) type Position @shareable { x: Int! diff --git a/tests/test_annotation_corner_cases.py b/tests/test_annotation_corner_cases.py index 87ca6fc..276cae5 100644 --- a/tests/test_annotation_corner_cases.py +++ b/tests/test_annotation_corner_cases.py @@ -38,6 +38,9 @@ class ChatQuery(ObjectType): schema = build_schema(query=ChatQuery, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -60,6 +63,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -83,6 +89,9 @@ class Query(ObjectType): query=Query, auto_camelcase=False, federation_version=LATEST_VERSION ) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -107,6 +116,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -132,5 +144,8 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_annotation_corner_cases_v1.py b/tests/test_annotation_corner_cases_v1.py index 4dc25ed..70c0e0f 100644 --- a/tests/test_annotation_corner_cases_v1.py +++ b/tests/test_annotation_corner_cases_v1.py @@ -40,6 +40,9 @@ class ChatQuery(ObjectType): query=ChatQuery, federation_version=FederationVersion.VERSION_1_0 ) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_custom_enum.py b/tests/test_custom_enum.py index 357a04b..867b4cd 100644 --- a/tests/test_custom_enum.py +++ b/tests/test_custom_enum.py @@ -32,5 +32,8 @@ class Query(ObjectType): query=Query, federation_version=LATEST_VERSION, types=(TestCustomEnum,) ) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_inaccessible.py b/tests/test_inaccessible.py index 302693b..f3d485f 100644 --- a/tests/test_inaccessible.py +++ b/tests/test_inaccessible.py @@ -43,6 +43,9 @@ class Query(ObjectType): query=Query, federation_version=LATEST_VERSION, types=(Position,) ) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -75,5 +78,8 @@ class Query(ObjectType): query=Query, federation_version=LATEST_VERSION, types=(SearchResult,) ) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_key.py b/tests/test_key.py index 5d1df8c..affab19 100644 --- a/tests/test_key.py +++ b/tests/test_key.py @@ -21,6 +21,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -54,6 +57,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -76,6 +82,10 @@ class Query(ObjectType): user = Field(User) schema = build_schema(query=Query, federation_version=LATEST_VERSION) + + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_key_v1.py b/tests/test_key_v1.py index 9708a88..ca8363b 100644 --- a/tests/test_key_v1.py +++ b/tests/test_key_v1.py @@ -21,6 +21,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=FederationVersion.VERSION_1_0) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_override.py b/tests/test_override.py new file mode 100644 index 0000000..e16baf8 --- /dev/null +++ b/tests/test_override.py @@ -0,0 +1,48 @@ +from pathlib import Path + +import pytest +from graphene import Field, ID, ObjectType, String +from graphene import Int +from graphene_directives import DirectiveValidationError + +from graphene_federation import LATEST_VERSION, build_schema +from graphene_federation import override +from tests.util import file_handlers, sdl_query + +save_file, open_file = file_handlers(Path(__file__)) + + +def test_chain_requires_failure(): + """ + Check that we can't nest call the override method on a field. + """ + with pytest.raises(DirectiveValidationError) as err: + + class A(ObjectType): + something = override( + override(String(), from_="subgraph-1"), from_="subgraph-2" + ) + + assert "@override is not repeatable" in str(err.value) + + +def test_override(): + """ + Check that requires can take more than one field as input. + """ + + class Product(ObjectType): + sku = override(ID(), from_="subgraph-1") + size = override(Int(), from_="subgraph-2") + weight = override(Int(), from_="subgraph-3", label="Test label") + + class Query(ObjectType): + product = Field(Product) + + schema = build_schema(query=Query, federation_version=LATEST_VERSION) + + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + + assert open_file("1") == str(schema) + assert open_file("2") == sdl_query(schema) diff --git a/tests/test_provides.py b/tests/test_provides.py index 6804de5..7a23687 100644 --- a/tests/test_provides.py +++ b/tests/test_provides.py @@ -30,6 +30,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -54,6 +57,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -79,5 +85,8 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_provides_v1.py b/tests/test_provides_v1.py index ed50119..c58f8f5 100644 --- a/tests/test_provides_v1.py +++ b/tests/test_provides_v1.py @@ -30,6 +30,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=FederationVersion.VERSION_1_0) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -54,6 +57,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=FederationVersion.VERSION_1_0) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -79,5 +85,8 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=FederationVersion.VERSION_1_0) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_requires.py b/tests/test_requires.py index dfb5077..daa8190 100644 --- a/tests/test_requires.py +++ b/tests/test_requires.py @@ -43,8 +43,8 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) - save_file(str(schema), "1") - save_file(sdl_query(schema), "2") + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -68,8 +68,8 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) - save_file(str(schema), "1") - save_file(sdl_query(schema), "2") + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -92,8 +92,8 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=LATEST_VERSION) - save_file(str(schema), "1") - save_file(sdl_query(schema), "2") + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_requires_v1.py b/tests/test_requires_v1.py index ece474f..2c1722e 100644 --- a/tests/test_requires_v1.py +++ b/tests/test_requires_v1.py @@ -43,6 +43,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=FederationVersion.VERSION_1_0) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -65,6 +68,9 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=FederationVersion.VERSION_1_0) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) @@ -86,5 +92,8 @@ class Query(ObjectType): schema = build_schema(query=Query, federation_version=FederationVersion.VERSION_1_0) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_scalar.py b/tests/test_scalar.py index f296c7c..88df382 100644 --- a/tests/test_scalar.py +++ b/tests/test_scalar.py @@ -36,7 +36,12 @@ class Query(ObjectType): test = String(x=AddressScalar()) test2 = graphene.List(AddressScalar, required=True) - schema = build_schema(query=Query, federation_version=LATEST_VERSION, types=(TestScalar,)) + schema = build_schema( + query=Query, federation_version=LATEST_VERSION, types=(TestScalar,) + ) + + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema) diff --git a/tests/test_shareable.py b/tests/test_shareable.py index 5eebe39..4eaefa0 100644 --- a/tests/test_shareable.py +++ b/tests/test_shareable.py @@ -52,6 +52,9 @@ class Query(ObjectType): query=Query, federation_version=LATEST_VERSION, types=(Position,) ) + # save_file(str(schema), "1") + # save_file(sdl_query(schema), "2") + assert open_file("1") == str(schema) assert open_file("2") == sdl_query(schema)