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    /// Resource whose schema owns the slot.
13    pub resource: ResourceRef,
14    /// Whether the value is the collection directly ranged by the template.
15    pub is_self_range_collection: bool,
16    /// Literal member keys the template writes beside the splice in the
17    /// same mapping; the slot schema's `required` must not re-demand them.
18    pub template_supplied_member_keys: std::collections::BTreeSet<String>,
19    /// Set when the rendered text is one separator-delimited segment of the
20    /// source string; the slot schema constrains that segment only.
21    pub split_segment: Option<SplitSegmentUse>,
22    /// Set when the value renders as one layer of an ordered `merge`: a
23    /// shadowed layer's members reach the slot only where every earlier
24    /// layer lacks them.
25    pub merge_layers: Option<MergeLayersUse>,
26    /// Set when the rendered text is the collection's RANGE KEY rather than
27    /// its value: a string-only slot then excludes the integer keys of a
28    /// non-empty list lane.
29    pub range_key: bool,
30    /// Set when the rendered text is a Sprig `quote`/`squote` of the value:
31    /// the transform SKIPS nil operands, so a missing or null source
32    /// renders an explicit YAML null into the slot. Typing still abstains
33    /// (any input quotes); only provider-required presence claims may read
34    /// this flag.
35    pub nil_omitting: bool,
36    /// Literal member keys a guard-scoped `omit` may remove from the
37    /// rendered map before the sink reads it: the slot's whole-payload
38    /// typing must exclude them, and each key's member typing is re-added
39    /// only under its RETAIN guards (empty means never).
40    pub omitted_members: std::collections::BTreeMap<String, Vec<crate::ConditionalGuard>>,
41    /// Decoded conditions gating the render this use rides. Synthesized
42    /// merge-layer arms must carry them: without the gates a dormant state
43    /// (KPS's `defaultRules.create: false`) would still be typed by the
44    /// layer arms even though nothing renders.
45    pub outer_guards: Vec<crate::ConditionalGuard>,
46}