-
Notifications
You must be signed in to change notification settings - Fork 66
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 2.9 (#417)
- Loading branch information
1 parent
28e1065
commit b9af10d
Showing
10 changed files
with
415 additions
and
1 deletion.
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
136 changes: 136 additions & 0 deletions
136
graphql-java-support/src/main/resources/definitions_fed2_9.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,136 @@ | ||
# | ||
# 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 | ||
|
||
# | ||
# federation-v2.8 | ||
# | ||
|
||
scalar ContextFieldValue | ||
|
||
directive @context(name: String!) repeatable on INTERFACE | OBJECT | UNION | ||
|
||
directive @fromContext(field: ContextFieldValue) on ARGUMENT_DEFINITION | ||
|
||
# | ||
# federation-v2.9 | ||
# | ||
|
||
directive @cost(weight: Int!) on | ||
ARGUMENT_DEFINITION | ||
| ENUM | ||
| FIELD_DEFINITION | ||
| INPUT_FIELD_DEFINITION | ||
| OBJECT | ||
| SCALAR | ||
|
||
directive @listSize( | ||
assumedSize: Int, | ||
slicingArguments: [String!], | ||
sizedFields: [String!], | ||
requireOneSlicingArgument: Boolean = true | ||
) 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
20 changes: 20 additions & 0 deletions
20
graphql-java-support/src/test/resources/schemas/cost/schema.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,20 @@ | ||
extend schema | ||
@link( | ||
url: "https://specs.apollo.dev/federation/v2.9" | ||
import: ["@cost", "@key", "@listSize"] | ||
) | ||
|
||
type Product @key(fields: "id") { | ||
id: ID! | ||
name: String! | ||
child: Child! @cost(weight: 5) | ||
} | ||
|
||
type Child @key(fields: "id") { | ||
id: ID! | ||
details(productName: String): [String!] @listSize(assumedSize: 10) | ||
} | ||
|
||
type Query { | ||
product(id: ID!): Product | ||
} |
81 changes: 81 additions & 0 deletions
81
graphql-java-support/src/test/resources/schemas/cost/schema_federated.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,81 @@ | ||
schema @link(import : ["@cost", "@key", "@listSize"], url : "https://specs.apollo.dev/federation/v2.9"){ | ||
query: Query | ||
} | ||
|
||
directive @cost(weight: Int!) on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | ENUM | INPUT_FIELD_DEFINITION | ||
|
||
directive @federation__authenticated on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM | ||
|
||
directive @federation__composeDirective(name: String!) repeatable on SCHEMA | ||
|
||
directive @federation__context(name: String!) repeatable on OBJECT | INTERFACE | UNION | ||
|
||
directive @federation__extends on OBJECT | INTERFACE | ||
|
||
directive @federation__external on OBJECT | FIELD_DEFINITION | ||
|
||
directive @federation__fromContext(field: federation__ContextFieldValue) on ARGUMENT_DEFINITION | ||
|
||
directive @federation__interfaceObject on OBJECT | ||
|
||
directive @federation__override(from: String!, label: String) on FIELD_DEFINITION | ||
|
||
directive @federation__policy(policies: [[federation__Policy!]!]!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM | ||
|
||
directive @federation__provides(fields: federation__FieldSet!) on FIELD_DEFINITION | ||
|
||
directive @federation__requires(fields: federation__FieldSet!) on FIELD_DEFINITION | ||
|
||
directive @federation__requiresScopes(scopes: [[federation__Scope!]!]!) on SCALAR | OBJECT | FIELD_DEFINITION | INTERFACE | ENUM | ||
|
||
directive @federation__shareable repeatable on OBJECT | FIELD_DEFINITION | ||
|
||
directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | ||
|
||
directive @key(fields: federation__FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE | ||
|
||
directive @link(as: String, for: link__Purpose, import: [link__Import], url: String!) repeatable on SCHEMA | ||
|
||
directive @listSize(assumedSize: Int, requireOneSlicingArgument: Boolean = true, sizedFields: [String!], slicingArguments: [String!]) on FIELD_DEFINITION | ||
|
||
directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | ||
|
||
union _Entity = Child | Product | ||
|
||
type Child @key(fields : "id", resolvable : true) { | ||
details(productName: String): [String!] @listSize(assumedSize : 10, requireOneSlicingArgument : true) | ||
id: ID! | ||
} | ||
|
||
type Product @key(fields : "id", resolvable : true) { | ||
child: Child! @cost(weight : 5) | ||
id: ID! | ||
name: String! | ||
} | ||
|
||
type Query { | ||
_entities(representations: [_Any!]!): [_Entity]! | ||
_service: _Service! | ||
product(id: ID!): Product | ||
} | ||
|
||
type _Service { | ||
sdl: String! | ||
} | ||
|
||
enum link__Purpose { | ||
EXECUTION | ||
SECURITY | ||
} | ||
|
||
scalar _Any | ||
|
||
scalar federation__ContextFieldValue | ||
|
||
scalar federation__FieldSet | ||
|
||
scalar federation__Policy | ||
|
||
scalar federation__Scope | ||
|
||
scalar link__Import |
Oops, something went wrong.