Summary
A by-id lookup field returning a multitable interface compiles without
warnings, but at runtime the @nodeId argument turns out to be bound to ONE
implementing type — ids of the other implementations are rejected.
type Query {
applikasjon(id: ID! @nodeId): Applikasjon
}
interface Applikasjon implements Node { … }
type FeideApplikasjon implements Applikasjon & Node
@table(name: "feide_applikasjon") @node(typeId: "20012", keyColumns: ["SUBJEKT_ID"]) { … }
type MaskinportenApplikasjon implements Applikasjon & Node
@table(name: "maskinporten_applikasjon") @node(typeId: "20013", keyColumns: ["SUBJEKT_ID"]) { … }
type MaskinbrukerApplikasjon implements Applikasjon & Node
@table(name: "maskinbruker_applikasjon") @node(typeId: "20011", keyColumns: ["SUBJEKT_ID"]) { … }
Querying with a MaskinbrukerApplikasjon-id:
{ applikasjon(id: "MjAwMTE6LTE2") { __typename navn } }
{"data":{"applikasjon":null},"errors":[{"message":"Invalid node id \"MjAwMTE6LTE2\"
for this argument: decodes to type \"20011\", expected a FeideApplikasjon id", …}]}
The implicit binding appears to pick one implementing type (here
FeideApplikasjon); only that type's ids work.
Expected behaviour
Since the node-id itself carries the typeId, a lookup returning the interface
could dispatch to the matching implementation's table (same information the
generated internal node-resolver uses). Alternatively, if interface-returning
@nodeId lookups are unsupported, an author-error at generate time — the
silent single-type binding compiles clean and fails only at runtime, per-id.
Workaround
One lookup query per implementing type
(feideApplikasjon(id: ID! @nodeId(typeName: "FeideApplikasjon")) etc.);
callers pick the query from the id's typeId prefix, or use the supergraph-level
node(id) where the node-subgraph is composed.
Version: 10.0.0-RC30
Summary
A by-id lookup field returning a multitable interface compiles without
warnings, but at runtime the
@nodeIdargument turns out to be bound to ONEimplementing type — ids of the other implementations are rejected.
Querying with a MaskinbrukerApplikasjon-id:
{"data":{"applikasjon":null},"errors":[{"message":"Invalid node id \"MjAwMTE6LTE2\" for this argument: decodes to type \"20011\", expected a FeideApplikasjon id", …}]}The implicit binding appears to pick one implementing type (here
FeideApplikasjon); only that type's ids work.
Expected behaviour
Since the node-id itself carries the typeId, a lookup returning the interface
could dispatch to the matching implementation's table (same information the
generated internal node-resolver uses). Alternatively, if interface-returning
@nodeIdlookups are unsupported, an author-error at generate time — thesilent single-type binding compiles clean and fails only at runtime, per-id.
Workaround
One lookup query per implementing type
(
feideApplikasjon(id: ID! @nodeId(typeName: "FeideApplikasjon"))etc.);callers pick the query from the id's typeId prefix, or use the supergraph-level
node(id)where the node-subgraph is composed.Version:
10.0.0-RC30