ExOKF.Validator (ex_okf v0.1.0)

Copy Markdown View Source

Validates an OKF bundle against the v0.1 conformance criteria (OKF §9).

Returns rich diagnostics. Warnings (broken links, missing recommended fields, etc.) never cause rejection — only :error diagnostics mark a bundle as non-conformant.

Summary

Functions

Returns true when the bundle has no error-severity diagnostics.

Validates bundle, returning {status, diagnostics}.

Functions

conformant?(bundle)

@spec conformant?(ExOKF.Bundle.t()) :: boolean()

Returns true when the bundle has no error-severity diagnostics.

Equivalent to match?({:ok, _}, validate(bundle)).

Parameters

  • bundle (ExOKF.Bundle.t()) — loaded OKF bundle

Examples

iex> ExOKF.Validator.conformant?(ExOKF.TestSupport.minimal_bundle())
true

validate(bundle)

@spec validate(ExOKF.Bundle.t()) :: {:ok | :error, ExOKF.Diagnostics.t()}

Validates bundle, returning {status, diagnostics}.

status is :ok when there are no error-severity diagnostics, otherwise :error. Warnings alone still yield :ok.

Parameters

  • bundle (ExOKF.Bundle.t()) — loaded OKF bundle

Returns

  • {:ok, ExOKF.Diagnostics.t()} — conformant (warnings allowed)
  • {:error, ExOKF.Diagnostics.t()} — one or more :error diagnostics

Examples

iex> bundle = ExOKF.TestSupport.sample_bundle()
iex> {:ok, diags} = ExOKF.Validator.validate(bundle)
iex> ExOKF.Diagnostics.errors?(diags)
false