# `Statifier.Validator.Checks.Param`
[🔗](https://github.com/riddler/statifier-ex/blob/v2.15.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>`.

Three places hold a `%Statifier.Document.Param{}`: a `<final>`'s
`<donedata><param>` (`Statifier.Document.Donedata`), any state's
`<invoke><param>` (`Statifier.Document.Invoke`) and any `<send>`'s own
`<param>` children (`Statifier.Document.Send`), so this check walks all
three. The rule is the same for each, since spec 5.7 states it on
`<param>` rather than on whichever parent holds it, and so are the two
reasons: a host matching on `:param_no_value` or
`:param_expr_and_location` sees one vocabulary whatever the parent. A
`<send>` sits in executable content rather than on a state, so its arm
reaches every `<send>` through `Checks.Send`'s own walk (every block a
`<send>` can appear in, `<if>` and `<foreach>` bodies and `<finalize>`
included) rather than a second walker that could disagree with it.

# `check`

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

Walks every `<final>`'s `<donedata><param>`, every state's
`<invoke><param>` and every `<send>`'s `<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*
