Skip to main content

validate_enum

Function validate_enum 

Source
pub fn validate_enum(values: &[Term], closed: bool, value: &Value) -> Validation
Expand description

Validate value against a controlled vocabulary — the reusable logic behind any embedder’s vocabulary-shaped constraint.

A sequence is validated element-wise, so a rule declared on a list field itself governs its items just as one declared with PathPat::each_item_of does; the most severe element result wins. Any other shape (a mapping, a number under an enum field) is left to the caller’s own backstop — fig’s reparse, typically.

A retired term warns rather than rejects: it is still a known value, so a document that already holds one stays committable.