forked from graphql-python/graphene-federation
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for federation v2.7
- Loading branch information
Showing
63 changed files
with
316 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_1.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_annotation_corner_cases/test_annotate_object_with_meta_name_2.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_1.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_annotation_corner_cases/test_annotated_field_also_used_in_filter_2.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_annotation_corner_cases/test_camel_case_field_name_1.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_annotation_corner_cases/test_camel_case_field_name_2.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_1.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../test_annotation_corner_cases/test_camel_case_field_name_without_auto_camelcase_2.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_annotation_corner_cases/test_similar_field_name_1.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_annotation_corner_cases/test_similar_field_name_2.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_key/test_compound_primary_key_with_depth_1.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/gql/test_key/test_compound_primary_key_with_depth_2.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.