Skip to main content

helm_schema/generation/
options.rs

1use std::path::PathBuf;
2
3use serde_json::Value;
4use vfs::VfsPath;
5
6use crate::provider_builder::ProviderOptions;
7
8pub use helm_schema_gen::{
9    ConditionalAnchors, EmissionClassKind, EmissionPolicy, EmissionPolicyDelta, EmissionReport,
10    EmissionSelection, InvalidEmissionPolicy, ResolvedEmissionPolicy, SchemaProfile,
11};
12
13/// Inputs and analysis policy for generating one chart schema.
14#[derive(Debug, Clone)]
15pub struct GenerateOptions {
16    /// Virtual-filesystem directory containing `Chart.yaml`.
17    pub chart_dir: VfsPath,
18    /// Whether templates under the chart's test directories are analyzed.
19    pub include_tests: bool,
20    /// Whether dependency values are exposed beneath their subchart keys.
21    pub include_subchart_values: bool,
22    /// Additional values files applied after the chart defaults.
23    pub values_files: Vec<PathBuf>,
24    /// Whether the optional required-property heuristic runs.
25    pub infer_required: bool,
26    /// Amount of analyzed contract evidence emitted into the schema.
27    pub emission: EmissionSelection,
28    /// Kubernetes and CRD schema-provider policy.
29    pub provider: ProviderOptions,
30}
31
32/// Provider-resolved values contract prior to heuristic required-inference
33/// and output-pipeline emission transforms.
34///
35/// The resolved contract contains facts inferred from templates, helpers,
36/// composed values defaults/descriptions, and provider schemas. The later
37/// `GeneratedSchema` stage is reserved for additional synthesized mutations
38/// like the optional `--infer-required` heuristic.
39#[derive(Debug, Clone)]
40pub struct ResolvedContract {
41    /// JSON Schema lowered from structural contract evidence.
42    pub schema: Value,
43    /// Fact and carrier accounting from schema emission.
44    pub emission_report: EmissionReport,
45}
46
47/// Final schema after optional generation transforms.
48#[derive(Debug, Clone)]
49pub struct GeneratedSchema {
50    /// Final generated JSON Schema.
51    pub schema: Value,
52    /// Fact and carrier accounting from schema emission.
53    pub emission_report: EmissionReport,
54}