Skip to main content

Module validate

Module validate 

Source
Expand description

Reusable field validation for sector plugins.

Validator is a fluent collector: each require_* / optional_* method records a PluginFieldError when a check fails and is chainable, so a plugin’s validate_input reads as a declarative list of field constraints. Validator::finish reports all failures at once rather than stopping at the first — better for surfacing form errors to a manufacturer.

The free functions num and str_of are convenience readers for calculate_metrics bodies, and threshold_status is the shared “measured value at or under threshold” classification they compare against.

Structs§

Validator
Fluent per-field validator. See module docs.

Functions§

num
Read a finite number field (ignores absent/non-numeric/NaN/inf).
str_of
Read a string field.
threshold_status
Classify a measured value against a compliance threshold: Compliant if present and at or under threshold, NonCompliant otherwise (including when value is absent — a missing measurement is not assumed compliant).