pub enum ConditionalGuard {
Show 18 variants
Truthy {
path: ValuesPath,
},
With {
path: ValuesPath,
},
Eq {
path: ValuesPath,
value: GuardValue,
},
NotEq {
path: ValuesPath,
value: GuardValue,
},
Absent {
path: ValuesPath,
},
TypeIs {
path: ValuesPath,
schema_type: String,
},
MatchesPattern {
path: ValuesPath,
pattern: String,
},
IntGt {
path: ValuesPath,
bound: i64,
},
IntLt {
path: ValuesPath,
bound: i64,
},
HasKey {
path: ValuesPath,
key: String,
},
ContainsMemberEquals {
path: ValuesPath,
member: String,
value: GuardValue,
},
ContainsTruthyMember {
path: ValuesPath,
member: String,
},
ContainsEquals {
path: ValuesPath,
value: GuardValue,
},
AtMostOneMember {
path: ValuesPath,
},
MinMembers {
path: ValuesPath,
bound: i64,
},
Not(Box<ConditionalGuard>),
AllOf(Vec<ConditionalGuard>),
AnyOf(Vec<ConditionalGuard>),
}Expand description
Values-decidable guard expression that can be lowered into JSON Schema conditionals.
Variants§
Truthy
The value at path is Helm-truthy.
Fields
path: ValuesPathValues path tested for truthiness.
With
A with action selected the non-empty value at path.
Fields
path: ValuesPathValues path selected by the action.
Eq
The value at path equals a literal.
Fields
path: ValuesPathValues path compared with the literal.
value: GuardValueLiteral required at the path.
NotEq
The value at path differs from a literal.
Fields
path: ValuesPathValues path compared with the literal.
value: GuardValueLiteral excluded at the path.
Absent
The value at path is absent.
Fields
path: ValuesPathValues path whose absence selects the branch.
TypeIs
The value at path has a specific JSON Schema type.
Fields
path: ValuesPathValues path subjected to the type test.
MatchesPattern
The string at path matches a regular expression.
Fields
path: ValuesPathValues path subjected to the pattern test.
IntGt
The path’s RAW value is a JSON integer strictly greater than bound
— a sound SUBSET of the Sprig coercion (gt (int64 x) bound) it
stands in for, valid only where firing less often is safe.
Fields
path: ValuesPathValues path subjected to the integer comparison.
IntLt
The mirror of ConditionalGuard::IntGt: the path’s RAW value is a
JSON integer strictly less than bound, under the same sound-subset
contract.
Fields
path: ValuesPathValues path subjected to the integer comparison.
HasKey
The mapping at path contains the literal member key. The key is
an OPAQUE property name (it may contain dots), so it rides beside
the segmented path instead of being appended to it.
Fields
path: ValuesPathValues path expected to hold a mapping.
ContainsMemberEquals
SOME iterated item of the collection at path has member equal to
value — the document-level meaning of a range-sentinel flag
(Range(path) ∧ Eq(path.*.member, value)). Lowers to contains
over the array lane and the double-negated member quantifier over
the object lane.
Fields
path: ValuesPathValues path expected to hold the iterated collection.
value: GuardValueLiteral that at least one member must equal.
ContainsTruthyMember
SOME iterated item of the collection at path has a Helm-truthy
member — the document-level meaning of a Boolean range sentinel
(Range(path) ∧ Truthy(path.*.member)).
Fields
path: ValuesPathValues path expected to hold the iterated collection.
ContainsEquals
SOME item of the list at path deep-equals the scalar literal —
Sprig has LITERAL .Values.list. has returns false on a nil
haystack and aborts on non-lists, so the guard holds exactly for
arrays carrying the literal; lowers to contains with a const
item.
Fields
path: ValuesPathValues path expected to hold the list.
value: GuardValueLiteral that at least one list item must equal.
AtMostOneMember
The collection at path has at most one entry — the document-level
form of “every iteration of this range is the first” (an
empty-initialized dedup accumulator cannot have shadowed anything).
A sound subset: it may only scope positive-polarity evidence.
Fields
path: ValuesPathValues path expected to hold the bounded collection.
MinMembers
The value at path is a mapping with at least bound members
(gt (keys X | len) N). Exact: both polarities encode.
Fields
path: ValuesPathValues path expected to hold the mapping.
Not(Box<ConditionalGuard>)
Logical negation of a guard.
AllOf(Vec<ConditionalGuard>)
Conjunction of every enclosed guard.
AnyOf(Vec<ConditionalGuard>)
Disjunction of the enclosed guards.
Implementations§
Source§impl ConditionalGuard
impl ConditionalGuard
Sourcepub fn is_self_truthy_for(&self, target: &ValuesPath) -> bool
pub fn is_self_truthy_for(&self, target: &ValuesPath) -> bool
Reports whether this guard tests the target’s own Helm truthiness.
Sourcepub fn is_self_presence_for(&self, target: &ValuesPath) -> bool
pub fn is_self_presence_for(&self, target: &ValuesPath) -> bool
Reports whether this guard can hold only while the target path exists.
Source§impl ConditionalGuard
impl ConditionalGuard
Sourcepub fn value_paths(&self) -> BTreeSet<ValuesPath>
pub fn value_paths(&self) -> BTreeSet<ValuesPath>
Returns every values path referenced by this guard tree.
Sourcepub fn map_value_paths<F>(self, map: &mut F) -> Self
pub fn map_value_paths<F>(self, map: &mut F) -> Self
Rewrite the values paths carried by this guard (and every nested guard).
Trait Implementations§
Source§impl Clone for ConditionalGuard
impl Clone for ConditionalGuard
Source§fn clone(&self) -> ConditionalGuard
fn clone(&self) -> ConditionalGuard
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more