# `Mix.Statifier.Corpus.Authored`
[🔗](https://github.com/riddler/statifier-ex/blob/v2.6.0/lib/mix/statifier/corpus/authored.ex#L1)

Reads the conformance cases this repository authors itself, the
`statifier` suite (ADR-0070 decision 5), from `conformance/cases/`.

Each case is two files in one directory per spec group:

    conformance/cases/<spec>/<name>.scxml   the SCXML document
    conformance/cases/<spec>/<name>.json    what the case expects

The JSON file holds exactly the case fields a person writes -
`description`, `initial_configuration`, `steps` and, optionally, `host` -
in the shapes `conformance/schema/case.json` gives them. Everything else a
corpus case carries is derived, so it cannot drift: `id` is
`statifier/<spec>/<name>`, `suite` is `statifier`, `spec` is the directory,
`conformance` is `null`, `source` is the `.scxml` file's text, and
`required_features` is what the feature detector finds in it.

The emitter runs every case it reads before it writes
`conformance/corpus/statifier.json`, and `--check` re-derives that file
from these files. No `conformance/cases/` directory means no authored
case.

# `read`

```elixir
@spec read(root :: Path.t()) :: {:ok, [map()]} | {:error, String.t()}
```

Reads every authored case under `root`'s `conformance/cases/`, sorted by
id. Refuses, naming the file, a case whose JSON is invalid or carries a
field outside the written ones, a `.json` or `.scxml` file without its
partner, a file outside a spec directory, and a name the case id pattern
does not allow.

---

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