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
8/// Inputs and analysis policy for generating one chart schema.
9#[derive(Debug, Clone)]
10pub struct GenerateOptions {
11    /// Virtual-filesystem directory containing `Chart.yaml`.
12    pub chart_dir: VfsPath,
13    /// Whether templates under the chart's test directories are analyzed.
14    pub include_tests: bool,
15    /// Whether dependency values are exposed beneath their subchart keys.
16    pub include_subchart_values: bool,
17    /// Additional values files applied after the chart defaults.
18    pub values_files: Vec<PathBuf>,
19    /// Whether the optional required-property heuristic runs.
20    pub infer_required: bool,
21    /// Kubernetes and CRD schema-provider policy.
22    pub provider: ProviderOptions,
23}
24
25/// Provider-resolved values contract prior to heuristic required-inference
26/// and output-pipeline emission transforms.
27///
28/// The resolved contract contains facts inferred from templates, helpers,
29/// composed values defaults/descriptions, and provider schemas. The later
30/// `GeneratedSchema` stage is reserved for additional synthesized mutations
31/// like the optional `--infer-required` heuristic.
32#[derive(Debug, Clone)]
33pub struct ResolvedContract {
34    /// JSON Schema lowered from structural contract evidence.
35    pub schema: Value,
36    /// Values prefixes owned by discovered subcharts.
37    pub subchart_value_prefixes: Vec<Vec<String>>,
38}
39
40/// Final schema and subchart metadata after optional generation transforms.
41#[derive(Debug, Clone)]
42pub struct GeneratedSchema {
43    /// Final generated JSON Schema.
44    pub schema: Value,
45    /// Values prefixes owned by discovered subcharts.
46    pub subchart_value_prefixes: Vec<Vec<String>>,
47}