A single validation or parse diagnostic.
Severities follow OKF's permissive consumption model: warnings never
invalidate a bundle; only :error diagnostics make a bundle non-conformant.
Fields
| Field | Type | Description |
|---|---|---|
severity | severity/0 | :error, :warning, or :info. |
code | atom() | Machine-readable code, e.g. :broken_internal_link, :missing_type. |
message | String.t() | Human-readable explanation. |
path | String.t() | nil | Bundle-relative file path when applicable, e.g. "tables/customers.md". |
meta | map() | Extra structured context (target id, field name, underlying reason, …). |
Examples
%ExOKF.Diagnostic{
severity: :warning,
code: :broken_internal_link,
message: "broken internal link to tables/legacy",
path: "tables/customers.md",
meta: %{concept_id: "tables/legacy", target: "/tables/legacy.md"}
}
%ExOKF.Diagnostic{
severity: :error,
code: :missing_type,
message: "missing required type field",
path: "metrics/revenue.md",
meta: %{}
}
Summary
Types
@type severity() :: :error | :warning | :info
Diagnostic severity.
:error— conformance failure (missing type, unparseable frontmatter, …):warning— soft guidance (broken links, missing recommended fields, …):info— informational notes that never affect conformance
@type t() :: %ExOKF.Diagnostic{ code: atom(), message: String.t(), meta: map(), path: String.t() | nil, severity: severity() }
A single diagnostic entry.
See the module documentation for field meanings and examples.
Functions
Formats a diagnostic as a human-readable line.
Parameters
diagnostic(t/0) — entry to format
Examples
iex> ExOKF.Diagnostic.format(%ExOKF.Diagnostic{
...> severity: :warning,
...> code: :broken_internal_link,
...> message: "broken internal link",
...> path: "a.md"
...> })
"warning: broken internal link (a.md)"