Skip to content
Playground(another site)

bynk.boundary.structural_mismatch

Error Data crossing a context boundary did not match the expected shape.

A value that crosses a context boundary, as an argument to a consumed context's service or as its result, is matched by shape, not by name. So where both contexts declare a Box, the two must have the same shape, or the value is not a Box on the other side. Give them the same fields, or rename one so the names stop meeting. A type both sides need can live in a commons that each uses.

Example

shop.bynk
context shop
type Box = { weight: Int }
service weigh {
on call(b: Box) -> Effect[Int] by Caller { … }
}
// depot.bynk
context depot
consumes shop
type Box = { label: String }
shop.weigh(Box { label: "a" }) // ✗ a `depot` `Box` is not shaped like `shop`'s
type Box = { weight: Int }
shop.weigh(Box { weight: 3 }) // ✓ the same shape on both sides

In the Book

See also

  • Every code in its category, Boundaries, on the diagnostic index.
  • bynk explain bynk.boundary.structural_mismatch shows the same from the installed toolchain, without a network.