StatifierUI.Fixtures.Source behaviour (StatifierUI v0.1.0)

Copy Markdown View Source

Behaviour for a host-application module that supplies fixture data.

A host implements scenarios/0 and example_events/0; StatifierUI.Fixtures.from_source/1 calls both and routes the results through the same validation new/1 applies to a JSON sidecar, so the two delivery paths in ADR-0003 converge on one struct.

use StatifierUI.Fixtures.Source injects empty defaults for both callbacks, so a host that only has scenarios (or only events) can implement just the one it has.

Summary

Types

A named example event payload, as example_events/0 returns it.

A named example datamodel, as scenarios/0 returns it.

Callbacks

Example event payloads: an event name mapped to a sample _event.data value.

Named example datamodels: a scenario name mapped to a complete example datamodel for that situation.

Types

example_events()

@type example_events() :: %{optional(String.t()) => term()}

A named example event payload, as example_events/0 returns it.

scenarios()

@type scenarios() :: %{optional(String.t()) => map()}

A named example datamodel, as scenarios/0 returns it.

Callbacks

example_events()

@callback example_events() :: example_events()

Example event payloads: an event name mapped to a sample _event.data value.

scenarios()

@callback scenarios() :: scenarios()

Named example datamodels: a scenario name mapped to a complete example datamodel for that situation.