Skip to main content

helm_schema_core/
provider_schema_use.rs

1use crate::{MergeLayersUse, ResourceRef, SplitSegmentUse, ValueKind, YamlPath};
2
3/// Contract fact that needs a Kubernetes resource schema lookup.
4#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
5pub struct ProviderSchemaUse {
6    /// Canonical values path whose runtime value reaches the provider slot.
7    pub value_path: String,
8    /// Structural path of the slot in the rendered Kubernetes resource.
9    pub path: YamlPath,
10    /// How the value contributes to rendered YAML at the slot.
11    pub kind: ValueKind,
12    /// Whether Go template rendering stringifies the source before the
13    /// completed YAML document reparses it.
14    pub stringified: bool,
15    /// Resource whose schema owns the slot.
16    pub resource: ResourceRef,
17    /// Whether the value is the collection directly ranged by the template.
18    pub is_self_range_collection: bool,
19    /// Whether this particular render skips or substitutes a null source.
20    ///
21    /// This stays per-use because another render of the same values path may
22    /// emit null directly; aggregating the two loses which provider slot can
23    /// justify a source-presence requirement.
24    pub source_null_tolerant: bool,
25    /// Literal member keys the template writes beside the splice in the
26    /// same mapping; the slot schema's `required` must not re-demand them.
27    pub template_supplied_member_keys: std::collections::BTreeSet<String>,
28    /// Set when the rendered text is one separator-delimited segment of the
29    /// source string; the slot schema constrains that segment only.
30    pub split_segment: Option<SplitSegmentUse>,
31    /// Set when the value renders as one layer of an ordered `merge`: a
32    /// shadowed layer's members reach the slot only where every earlier
33    /// layer lacks them.
34    pub merge_layers: Option<MergeLayersUse>,
35    /// Set when the rendered text is the collection's RANGE KEY rather than
36    /// its value: a string-only slot then excludes the integer keys of a
37    /// non-empty list lane.
38    pub range_key: bool,
39    /// Set when the rendered text is a Sprig `quote`/`squote` of the value:
40    /// the transform SKIPS nil operands, so a missing or null source
41    /// renders an explicit YAML null into the slot. Typing still abstains
42    /// (any input quotes); only provider-required presence claims may read
43    /// this flag.
44    pub nil_omitting: bool,
45    /// Literal member keys a guard-scoped `omit` may remove from the
46    /// rendered map before the sink reads it: the slot's whole-payload
47    /// typing must exclude them, and each key's member typing is re-added
48    /// only under its RETAIN guards (empty means never).
49    pub omitted_members: std::collections::BTreeMap<String, Vec<crate::ConditionalGuard>>,
50    /// Decoded conditions gating the render this use rides. Synthesized
51    /// merge-layer arms must carry them: without the gates a dormant state
52    /// (KPS's `defaultRules.create: false`) would still be typed by the
53    /// layer arms even though nothing renders.
54    pub outer_guards: Vec<crate::ConditionalGuard>,
55}