# `Statifier.Validator.Checks.Param`
[🔗](https://github.com/riddler/statifier-ex/blob/v2.0.0/lib/statifier/validator/checks/param.ex#L1)

Spec 5.7: "A conformant SCXML document MUST specify either the 'expr'
attribute of `<param>` or the 'location' attribute, but MUST NOT specify
both." Reports `{:param_expr_and_location, name}` when both are present
and `{:param_no_value, name}` when neither is, both at the `<param>`
element's own `location`.

`lib/statifier/document/param.ex` makes `expr` and `param_location` both
nilable and representable at once precisely so this check can report the
shape rather than lowering refusing to build it - the same division of
labour `Checks.Content` has with `<content>`.

Two places today hold a `%Statifier.Document.Param{}`: a `<final>`'s
`<donedata><param>` (`Statifier.Document.Donedata`) and any state's
`<invoke><param>` (`Statifier.Document.Invoke`), so this check walks both.
When `<send>` gains a `<param>` child, this walk grows a third arm; the
rule itself is unchanged, since spec 5.7 states it on `<param>` rather than
on whichever parent holds it.

# `check`

```elixir
@spec check(
  document :: Statifier.Document.t(),
  context :: Statifier.Validator.Context.t()
) :: [
  Statifier.Validator.Error.t()
]
```

Walks every `<final>`'s `<donedata><param>` and every state's
`<invoke><param>` in the document and returns a `:param_expr_and_location`
or `:param_no_value` error for each one whose `expr` and `location`
attributes violate spec 5.7's exactly-one rule. Returns `[]` when every
`<param>` in the document specifies exactly one.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
