MishkaGervaz.Form.Verifiers.Helpers (MishkaGervaz v0.0.1-alpha.2)

Copy Markdown View Source

Shared helpers for MishkaGervaz.Form.Verifiers.*.

Removes duplication of the Spark.Error.DslError wrap and the fetch-then-filter-by-struct boilerplate that recurs across every verifier.

Mirrors MishkaGervaz.Table.Transformers.Helpers in spirit — small, composable, no behaviour-specific logic.

See sibling verifier modules: MishkaGervaz.Form.Verifiers.ValidateIdentity, MishkaGervaz.Form.Verifiers.ValidateSource, MishkaGervaz.Form.Verifiers.ValidateFields, MishkaGervaz.Form.Verifiers.ValidateGroups, MishkaGervaz.Form.Verifiers.ValidateUploads, MishkaGervaz.Form.Verifiers.ValidateChrome, MishkaGervaz.Form.Verifiers.ValidateSteps, MishkaGervaz.Form.Verifiers.ValidatePreloads.

Summary

Functions

Wraps a Spark.Error.DslError as {:error, exception}.

Fetches entities at path and keeps only those of struct_type.

Functions

dsl_error(module, path, message)

@spec dsl_error(module(), [atom()], String.t()) :: {:error, Spark.Error.DslError.t()}

Wraps a Spark.Error.DslError as {:error, exception}.

entities_of(dsl_state, path, struct_type)

@spec entities_of(Spark.Dsl.t(), [atom()], module()) :: [struct()]

Fetches entities at path and keeps only those of struct_type.

Always returns a list; safely unwraps Spark's nil/list-of-lists shapes.