# `Expresso.Presenter.Schema.Check`
[🔗](https://github.com/rellen/expresso/blob/main/lib/expresso/presenter/schema/check.ex#L1)

Makes sure that a JSON value agrees with a form of `Expresso.Presenter.Schema`

`check/2` examines a decoded JSON value with the same forms as the decoders
of `assets/src/schema.ts`. `Expresso.Presenter.Verifier` uses it for the
values of a definition, and the tests use it for each value that the
renderer writes. An error holds the path of the value, such as
`$.modes[2].keys`, and the form that the value does not agree with.

A pattern has the meaning of a JavaScript regular expression: `$` matches
only at the end of the string, and not in front of a last newline.

# `check`

```elixir
@spec check(term(), atom() | Expresso.Presenter.Schema.type()) ::
  :ok | {:error, String.t()}
```

Make sure that a decoded JSON value agrees with a form, or with the form of a name

    iex> Expresso.Presenter.Schema.Check.check("12", {:string, "^[0-9]*$"})
    :ok

    iex> Expresso.Presenter.Schema.Check.check("12\n", {:string, "^[0-9]*$"})
    {:error, ~s($: expected {:string, "^[0-9]*$"})}

---

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