pub enum FieldConstraint {
Tier1 {
phrase: String,
args: Value,
span: Span,
},
ProseRule {
text: String,
span: Span,
},
ValidateWith {
name: String,
span: Span,
},
}Expand description
A single field-level validation constraint attached to a type field.
Parsed from the Constraint Mini-Language (see
docs/superpowers/specs/2026-04-18-epa-constraint-language-design.md).
Variants§
Tier1
A structured (Tier-1) constraint like matches /^[A-Z0-9]+$/ or
at_least_items 3. phrase is the canonical phrase name (e.g.
"matches") — the key the ConstraintRegistry uses to look up the
handler. args is a handler-specific JSON payload (for matches this
is {"pattern": "<regex>"}).
ProseRule
An unrecognized Tier-2 prose rule, e.g.
"must be a valid ticker symbol". Rendered verbatim into the prompt
in Tier-1 prose form; never enforced at runtime.
ValidateWith
A validate_with: <ident> custom-validator hook. name is the
validator’s canonical identifier — resolved against the
validation::validator_registry::VALIDATORS registry at
analysis time (emits AKRIBES-E-VALIDATE-WITH-UNKNOWN on misses) and
dispatched at task-end (failures surface as
AKRIBES-E-VALIDATE-WITH-FAIL corrective retries).
Implementations§
Trait Implementations§
Source§impl Clone for FieldConstraint
impl Clone for FieldConstraint
Source§fn clone(&self) -> FieldConstraint
fn clone(&self) -> FieldConstraint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more