Skip to content

Compostion and checks don't flag unresolvable types #2227

@YassineElbouchaibi

Description

@YassineElbouchaibi

Component(s)

composition

Component version

The one included in the upstream components versions below.

wgc version

0.93.2

controlplane version

0.163.0

router version

0.252.1

What happened?

Description

Compositions and Checks don't flag nor fail on cases where a type is unresolvable. Here is an example of what I mean:

Products Subgraph

type Product @key(fields: "sku") {
   sku: String!
   price: Float
   displayName: String
   ...
}

Carts Subgraph

type Cart {
   id: String!
   cartRows: [CartRow!]!
}

type CartRow {
   id: String!
   qty: Int
   product: Product
   ...
}

type Product @key(fields: "sku", resolvable: false) {
   sku: String! @external
}

In the example above, the Carts subgraph definition of Product is clearly wrong as Product is unresolvable and yet none of it's fields are provided as they are all marked as external.

Currently the composition and checks don't flag it and later the router fails with an internal error:

validation failed: internal: astvalidation selection set on path query.Cart.cartRows.product is empty\n\t* printOperation: validation failed: external: Cannot query field \"sku\" on type \"Query\".

The expected behavior would be for this to be caught at check and publish time through composition failure.

Metadata

Metadata

Assignees

Labels

confirmed bugThe issue was replicated/determined to be a bug.internally-reviewedThe issue has been reviewed internally.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions