-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How should work @external
exactly
#127
Comments
In Fed 2, the external directive is used to refer to fields where a subgraph needs to reference a type or field but the subgraph itself does not have a resolver for it (or the gateway should assume it doesn't) OR it may only have a resolver for it in a conditional path Example with requires, type Location @key(fields: "id") {
id: ID!
overallRating: Float @requires(fields: "foo { a }")
foo: Foo @external
}
type Foo {
a: String @external
b: String @external
} Example with provides, always external unless going through type Product @key(fields: "id") {
id: ID!
name: String! @external
inStock: Boolean!
}
type Query {
outOfStockProducts: [Product!]! @provides(fields: "name")
discontinuedProducts: [Product!]!
} Example of key, allowed but not need in Fed 2 type Product @key(fields: "id") @key(fields: "upc") {
id: ID! @external
upc: String! @external
name: String
} |
I think part of the problem is that
In a V2 subgraph, In a V1 subgraph, at least when composed with a system that supports V2, basically any field can be defined I can provide examples to illustrate these points if wanted/required. |
@smyrick I believe what you said is only true of entity extensions:
While it's allowed, choosing to definekey fields as # subgraph A
extend schema @link(url: "https://specs.apollo.dev/federation/v2.5", import: ["@external", "@key"])
type Query {
products: [Product!]!
}
type Product @key(fields: "id") @key(fields: "upc") {
id: ID! @external
upc: String! @external
name: String!
} # subgraph B
extend schema @link(url: "https://specs.apollo.dev/federation/v2.5", import: ["@key"])
type Product @key(fields: "id") @key(fields: "upc") {
id: ID!
upc: String!
stock: Int!
} Errors:
|
We need to answer the following questions:
@external
in other federated systems (e.g. apollo federation v1 & v2)The text was updated successfully, but these errors were encountered: