-
Notifications
You must be signed in to change notification settings - Fork 65
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 fed v2.6 and v2.7 (#377)
* federation v2.6 - new `@policy` directive, see [docs](https://www.apollographql.com/docs/federation/federated-types/federated-directives#policy) for details ```graphql directive @Policy(policies: [[federation__Policy!]!]!) on | FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM scalar Policy ``` * federation v2.7 - update to `@override` definition (new `label` argument), see [docs](https://www.apollographql.com/docs/federation/federated-types/federated-directives#progressive-override) for details ```graphql directive @OverRide(from: String!, label: String) on FIELD_DEFINITION ``` --------- Co-authored-by: Trevor Scheer <trevor.scheer@gmail.com>
- Loading branch information
1 parent
4b750b8
commit 42dcf10
Showing
13 changed files
with
461 additions
and
27 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
102 changes: 102 additions & 0 deletions
102
graphql-java-support/src/main/resources/definitions_fed2_6.graphqls
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,102 @@ | ||
# | ||
# https://specs.apollo.dev/federation/v2.0/federation-v2.0.graphql | ||
# | ||
|
||
directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE | ||
directive @requires(fields: FieldSet!) on FIELD_DEFINITION | ||
directive @provides(fields: FieldSet!) on FIELD_DEFINITION | ||
directive @external on OBJECT | FIELD_DEFINITION | ||
directive @extends on OBJECT | INTERFACE | ||
directive @override(from: String!) on FIELD_DEFINITION | ||
directive @inaccessible on | ||
| FIELD_DEFINITION | ||
| OBJECT | ||
| INTERFACE | ||
| UNION | ||
| ENUM | ||
| ENUM_VALUE | ||
| SCALAR | ||
| INPUT_OBJECT | ||
| INPUT_FIELD_DEFINITION | ||
| ARGUMENT_DEFINITION | ||
directive @tag(name: String!) repeatable on | ||
| FIELD_DEFINITION | ||
| INTERFACE | ||
| OBJECT | ||
| UNION | ||
| ARGUMENT_DEFINITION | ||
| SCALAR | ||
| ENUM | ||
| ENUM_VALUE | ||
| INPUT_OBJECT | ||
| INPUT_FIELD_DEFINITION | ||
scalar FieldSet | ||
|
||
# | ||
# https://specs.apollo.dev/link/v1.0/link-v1.0.graphql | ||
# | ||
|
||
directive @link( | ||
url: String!, | ||
as: String, | ||
import: [Import], | ||
for: Purpose) | ||
repeatable on SCHEMA | ||
|
||
scalar Import | ||
|
||
enum Purpose { | ||
SECURITY | ||
EXECUTION | ||
} | ||
|
||
# | ||
# federation-v2.1 | ||
# | ||
|
||
directive @composeDirective(name: String!) repeatable on SCHEMA | ||
|
||
# | ||
# federation-v2.2 | ||
# | ||
|
||
directive @shareable repeatable on FIELD_DEFINITION | OBJECT | ||
|
||
# | ||
# federation-v2.3 | ||
# | ||
|
||
directive @interfaceObject on OBJECT | ||
|
||
# | ||
# federation-v2.5 | ||
# | ||
|
||
directive @authenticated on | ||
ENUM | ||
| FIELD_DEFINITION | ||
| INTERFACE | ||
| OBJECT | ||
| SCALAR | ||
|
||
directive @requiresScopes(scopes: [[Scope!]!]!) on | ||
ENUM | ||
| FIELD_DEFINITION | ||
| INTERFACE | ||
| OBJECT | ||
| SCALAR | ||
|
||
scalar Scope | ||
|
||
# | ||
# federation-v2.6 | ||
# | ||
|
||
directive @policy(policies: [[Policy!]!]!) on | ||
ENUM | ||
| FIELD_DEFINITION | ||
| INTERFACE | ||
| OBJECT | ||
| SCALAR | ||
|
||
scalar Policy |
107 changes: 107 additions & 0 deletions
107
graphql-java-support/src/main/resources/definitions_fed2_7.graphqls
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,107 @@ | ||
# | ||
# https://specs.apollo.dev/federation/v2.0/federation-v2.0.graphql | ||
# | ||
|
||
directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE | ||
directive @requires(fields: FieldSet!) on FIELD_DEFINITION | ||
directive @provides(fields: FieldSet!) on FIELD_DEFINITION | ||
directive @external on OBJECT | FIELD_DEFINITION | ||
directive @extends on OBJECT | INTERFACE | ||
directive @inaccessible on | ||
| FIELD_DEFINITION | ||
| OBJECT | ||
| INTERFACE | ||
| UNION | ||
| ENUM | ||
| ENUM_VALUE | ||
| SCALAR | ||
| INPUT_OBJECT | ||
| INPUT_FIELD_DEFINITION | ||
| ARGUMENT_DEFINITION | ||
directive @tag(name: String!) repeatable on | ||
| FIELD_DEFINITION | ||
| INTERFACE | ||
| OBJECT | ||
| UNION | ||
| ARGUMENT_DEFINITION | ||
| SCALAR | ||
| ENUM | ||
| ENUM_VALUE | ||
| INPUT_OBJECT | ||
| INPUT_FIELD_DEFINITION | ||
scalar FieldSet | ||
|
||
# | ||
# https://specs.apollo.dev/link/v1.0/link-v1.0.graphql | ||
# | ||
|
||
directive @link( | ||
url: String!, | ||
as: String, | ||
import: [Import], | ||
for: Purpose) | ||
repeatable on SCHEMA | ||
|
||
scalar Import | ||
|
||
enum Purpose { | ||
SECURITY | ||
EXECUTION | ||
} | ||
|
||
# | ||
# federation-v2.1 | ||
# | ||
|
||
directive @composeDirective(name: String!) repeatable on SCHEMA | ||
|
||
# | ||
# federation-v2.2 | ||
# | ||
|
||
directive @shareable repeatable on FIELD_DEFINITION | OBJECT | ||
|
||
# | ||
# federation-v2.3 | ||
# | ||
|
||
directive @interfaceObject on OBJECT | ||
|
||
# | ||
# federation-v2.5 | ||
# | ||
|
||
directive @authenticated on | ||
ENUM | ||
| FIELD_DEFINITION | ||
| INTERFACE | ||
| OBJECT | ||
| SCALAR | ||
|
||
directive @requiresScopes(scopes: [[Scope!]!]!) on | ||
ENUM | ||
| FIELD_DEFINITION | ||
| INTERFACE | ||
| OBJECT | ||
| SCALAR | ||
|
||
scalar Scope | ||
|
||
# | ||
# federation-v2.6 | ||
# | ||
|
||
directive @policy(policies: [[Policy!]!]!) on | ||
ENUM | ||
| FIELD_DEFINITION | ||
| INTERFACE | ||
| OBJECT | ||
| SCALAR | ||
|
||
scalar Policy | ||
|
||
# | ||
# federation-v2.7 | ||
# | ||
|
||
directive @override(from: String!, label: String) on FIELD_DEFINITION |
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
11 changes: 11 additions & 0 deletions
11
graphql-java-support/src/test/resources/schemas/policy.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extend schema @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key", "@policy", "Policy", "FieldSet"]) | ||
|
||
type Product @key(fields: "id") { | ||
id: ID! | ||
name: String! | ||
supplier: String @policy(policies: [["policyA"]]) | ||
} | ||
|
||
type Query { | ||
product(id: ID!): Product | ||
} |
11 changes: 11 additions & 0 deletions
11
graphql-java-support/src/test/resources/schemas/policyUnsupportedSpecVersion.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@policy", "Policy", "FieldSet"]) | ||
|
||
type Product @key(fields: "id") { | ||
id: ID! | ||
name: String! | ||
supplier: String @policy(policies: [["policy"]]) | ||
} | ||
|
||
type Query { | ||
product(id: ID!): Product | ||
} |
Oops, something went wrong.