One thing that's wrong with a rule.

path points at the spot in the tree (a mix of property names and array indices, ['rules', 0, 'rule'] means root.rules[0].rule). code is a short tag for routing on the failure type, message is the explanation you'd show a person.

Hierarchy

  • RuleValidationIssue

Properties

Properties

code: string & {} | "unknown-ref" | "args-mismatch" | "cycle" | "missing-slot" | "args-on-saved-rule"

Short machine-readable tag for the kind of issue. Useful when something more than message is needed, for example, branching a UI on the failure type.

Documented values:

  • unknown-ref, a ref points at an id that is neither a registered primitive nor a known saved rule.
  • args-mismatch, the args on a ref don't match what the primitive expects. Only emitted by implementations that can introspect a primitive's args (e.g. via a separate schema mechanism). The contract does not require args validation.
  • cycle, saved rules reference each other in a loop.
  • missing-slot, the primitive reads a slot the caller didn't list in available.
  • args-on-saved-rule, a ref to a saved rule carries args, which are ignored. Flagged so the author can clean it up.

The list is open: implementations may emit codes not listed here, and future releases may add new ones. If a code is unfamiliar, fall back to message.

message: string

Human-readable description.

path: (string | number)[]

Where in the rule tree the issue is, property names and array indices in order. Empty when the issue applies to the rule as a whole.