-
Notifications
You must be signed in to change notification settings - Fork 264
Open
Description
Issue Description
Hi,
I'm trying to understand how @external
works with arguments. It seems there's a bug when a supergraph is being composed from subgraphs that:
- Have an object type with shared field
- This field has an argument with non-scalar type (list or input object) and a default value
- The field is marked
@external
in at least one subgraph
Example
# subgraph1.graphql
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3",
import: [
"@shareable",
]
)
input IntWrapper {
value: Int
}
type Foo {
good(x: Int = 1): Int @shareable
bad1(x: IntWrapper = {value: 1}): Int @shareable
bad2(x: [Int] = [1]): Int @shareable
}
type Query {
foo: Int
}
# subgraph2.graphql
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.3",
import: [
"@external",
"@requires",
]
)
input IntWrapper {
value: Int
}
type Foo {
good(x: Int = 1): Int @external
bad1(x: IntWrapper = {value: 1}): Int @external
bad2(x: [Int] = [1]): Int @external
foo: Int @requires(fields: "good(x: 123)")
bar: Int @requires(fields: "bad1(x: {value: 123})")
baz: Int @requires(fields: "bad2(x: [123])")
}
I try to compose these files using rover supergraph compose
with the following config:
subgraphs:
subgraph1:
routing_url: http://localhost:4000
schema:
file: ./subgraph1.graphql
subgraph2:
routing_url: http://localhost:4001
schema:
file: ./subgraph2.graphql
The composition fails with UNKNOWN: Should not have been called for x: IntWrapper = {value: 1}
.
- If
bad1
andbar
are removed from subgraph2, it fails withUNKNOWN: Should not have been called for x: [Int] = [1]
. - If
bad2
andbaz
are also removed, the composition succeeds (does not seem to reproduce with scalar fields). - If default values for
bad1
andbad2
are removed in all subgraphs, the composition also succeeds.
I've searched for error text and it seems that the error is an assertion failure from this line.
Link to Reproduction
None (I've only tried composing supergraphs with rover)
Reproduction Steps
No response
Metadata
Metadata
Assignees
Labels
No labels