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.
- Loading branch information
Showing
152 changed files
with
3,131 additions
and
2,307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,32 @@ | ||
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!) 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 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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!) 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: [[Scope!]!]!) on | ||
FIELD_DEFINITION | ||
| OBJECT | ||
| INTERFACE | ||
| SCALAR | ||
| ENUM | ||
scalar 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
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!) 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: [[Scope!]!]!) on | ||
FIELD_DEFINITION | ||
| OBJECT | ||
| INTERFACE | ||
| SCALAR | ||
| ENUM | ||
directive @policy(policies: [[federation__Policy!]!]!) on | ||
| FIELD_DEFINITION | ||
| OBJECT | ||
| INTERFACE | ||
| SCALAR | ||
| ENUM | ||
scalar federation__Policy | ||
scalar 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,49 @@ | ||
from graphql import GraphQLDirective | ||
|
||
from .v1_0 import get_directives as get_directives_v1_0 | ||
from .v2_0 import get_directives as get_directives_v2_0 | ||
from .v2_1 import get_directives as get_directives_v2_1 | ||
from .v2_2 import get_directives as get_directives_v2_2 | ||
from .v2_3 import get_directives as get_directives_v2_3 | ||
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 .version import FederationVersion | ||
|
||
LATEST_VERSION = FederationVersion.VERSION_2_6 | ||
|
||
|
||
def get_directives_based_on_version( | ||
federation_version: FederationVersion, | ||
) -> dict[str, GraphQLDirective]: | ||
if federation_version == FederationVersion.VERSION_1_0: | ||
return get_directives_v1_0() | ||
if federation_version == FederationVersion.VERSION_2_0: | ||
return get_directives_v2_0() | ||
if federation_version == FederationVersion.VERSION_2_1: | ||
return get_directives_v2_1() | ||
if federation_version == FederationVersion.VERSION_2_2: | ||
return get_directives_v2_2() | ||
if federation_version == FederationVersion.VERSION_2_3: | ||
return get_directives_v2_3() | ||
if federation_version == FederationVersion.VERSION_2_4: | ||
return get_directives_v2_4() | ||
if federation_version == FederationVersion.VERSION_2_5: | ||
return get_directives_v2_5() | ||
if federation_version == FederationVersion.VERSION_2_6: | ||
return get_directives_v2_6() | ||
|
||
return get_directives_v2_6() | ||
|
||
|
||
def get_directive_from_name( | ||
directive_name: str, federation_version: FederationVersion | ||
) -> GraphQLDirective: | ||
directive = get_directives_based_on_version(federation_version).get( | ||
directive_name, None | ||
) | ||
if directive is None: | ||
raise ValueError( | ||
f"@{directive_name} not supported on federation version {federation_version}" | ||
) | ||
return directive |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,8 @@ | ||
from graphql import GraphQLDirective | ||
|
||
from .v2_3 import get_directives as get_directives_v2_3 | ||
|
||
|
||
# No Change, Added Subscription Support | ||
def get_directives() -> dict[str, GraphQLDirective]: | ||
return get_directives_v2_3() |
Oops, something went wrong.