-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
3d56722
commit 1c3671c
Showing
7 changed files
with
264 additions
and
102 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
17 changes: 17 additions & 0 deletions
17
...a/com/apollographql/federation/graphqljava/exceptions/UnsupportedLinkImportException.java
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,17 @@ | ||
package com.apollographql.federation.graphqljava.exceptions; | ||
|
||
import graphql.language.Value; | ||
|
||
/** | ||
* Exception thrown when processing invalid `@link` import definitions. | ||
* | ||
* <p>Unsupported imports: - specifying object import without specifying String name - specifying | ||
* object rename that is not a String - attempting to import definition that is not a String nor an | ||
* object definition | ||
*/ | ||
public class UnsupportedLinkImportException extends RuntimeException { | ||
|
||
public UnsupportedLinkImportException(Value importedDefinition) { | ||
super("Unsupported import: " + importedDefinition); | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
graphql-java-support/src/test/resources/schemas/renamedImports.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,33 @@ | ||
extend schema | ||
@link(url: "https://specs.apollo.dev/federation/v2.0", | ||
import: [{ name: "@key", as: "@myKey" }, { name: "@shareable" }, "@provides", "@external", "@tag", "@extends", "@override", "@inaccessible"]) | ||
|
||
type Product @myKey(fields: "id") @myKey(fields: "sku package") @myKey(fields: "sku variation { id }") { | ||
id: ID! | ||
sku: String | ||
package: String | ||
variation: ProductVariation | ||
dimensions: ProductDimension | ||
createdBy: User @provides(fields: "totalProductsCreated") | ||
notes: String @tag(name: "internal") | ||
} | ||
|
||
type ProductVariation { | ||
id: ID! | ||
} | ||
|
||
type ProductDimension @shareable { | ||
size: String | ||
weight: Float | ||
unit: String @inaccessible | ||
} | ||
|
||
type Query { | ||
product(id: ID!): Product | ||
} | ||
|
||
type User @myKey(fields: "email") { | ||
email: ID! | ||
name: String @shareable @override(from: "users") | ||
totalProductsCreated: Int @external | ||
} |
62 changes: 62 additions & 0 deletions
62
graphql-java-support/src/test/resources/schemas/renamedImports_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,62 @@ | ||
schema @link(import : [{name : "@key", as : "@myKey"}, {name : "@shareable"}, "@provides", "@external", "@tag", "@extends", "@override", "@inaccessible"], url : "https://specs.apollo.dev/federation/v2.0"){ | ||
query: Query | ||
} | ||
|
||
directive @extends on OBJECT | INTERFACE | ||
|
||
directive @external on OBJECT | FIELD_DEFINITION | ||
|
||
directive @federation__requires(fields: federation__FieldSet!) on FIELD_DEFINITION | ||
|
||
directive @inaccessible on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | ||
|
||
directive @link(as: String, import: [link__Import], url: String!) repeatable on SCHEMA | ||
|
||
directive @myKey(fields: federation__FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE | ||
|
||
directive @override(from: String!) on FIELD_DEFINITION | ||
|
||
directive @provides(fields: federation__FieldSet!) on FIELD_DEFINITION | ||
|
||
directive @shareable on OBJECT | FIELD_DEFINITION | ||
|
||
directive @tag(name: String!) repeatable on SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | ||
|
||
type Product @myKey(fields : "id", resolvable : true) @myKey(fields : "sku package", resolvable : true) @myKey(fields : "sku variation { id }", resolvable : true) { | ||
createdBy: User @provides(fields : "totalProductsCreated") | ||
dimensions: ProductDimension | ||
id: ID! | ||
notes: String @tag(name : "internal") | ||
package: String | ||
sku: String | ||
variation: ProductVariation | ||
} | ||
|
||
type ProductDimension @shareable { | ||
size: String | ||
unit: String @inaccessible | ||
weight: Float | ||
} | ||
|
||
type ProductVariation { | ||
id: ID! | ||
} | ||
|
||
type Query { | ||
_service: _Service! | ||
product(id: ID!): Product | ||
} | ||
|
||
type User @myKey(fields : "email", resolvable : true) { | ||
email: ID! | ||
name: String @override(from : "users") @shareable | ||
totalProductsCreated: Int @external | ||
} | ||
|
||
type _Service { | ||
sdl: String! | ||
} | ||
|
||
scalar federation__FieldSet | ||
|
||
scalar link__Import |
12 changes: 12 additions & 0 deletions
12
graphql-java-support/src/test/resources/schemas/schemaImport.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,12 @@ | ||
schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key"]) { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
foo(id: ID!): Foo | ||
} | ||
|
||
type Foo @key(fields: "id") { | ||
id: ID! | ||
name: String! | ||
} |
Oops, something went wrong.