# `Artefact.Validator`
[🔗](https://github.com/diffo-dev/artefactory/blob/v0.2.0/lib/artefact/validator.ex#L4)

Validates `%Artefact{}` structs against the structural rules
documented in `Artefact`.

Public predicates and validators are surfaced through `Artefact`
itself via `defdelegate`; this module is the implementation home.

An artefact is *valid* when:

  * its uuid is a valid UUIDv7
  * `:title`, `:description`, `:base_label` are each `nil` or a string
  * `:graph` is `%Artefact.Graph{}` with list `:nodes` and `:relationships`
  * every node has a non-empty string `:id`, a UUIDv7 `:uuid`, a list
    of string `:labels`, and a map `:properties`
  * every relationship has a non-empty string `:id`, a non-empty
    string `:type`, `:from_id` and `:to_id` referring to extant
    nodes, and a map `:properties`
  * node uuids, node ids and relationship ids are unique within the
    graph

# `is_artefact?`

Returns `true` when `value` is an `%Artefact{}` struct.

# `is_valid?`

Returns `true` when `value` is a valid artefact.

# `validate`

Validate an artefact. Returns `:ok` or `{:error, %Artefact.Error.Invalid{reasons: [...]}}`.

`:reasons` is a list of human-readable strings, one per rule
violation, in source order.

# `validate!`

Validate an artefact. Returns `:ok` or raises `Artefact.Error.Invalid`
with the collected reasons.

---

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