1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
use std::path::PathBuf;
/// Errors produced while loading charts, analyzing templates, and emitting schemas.
#[derive(Debug, thiserror::Error)]
pub enum CliError {
/// Virtual-filesystem operation failed.
#[error("vfs error: {0}")]
Vfs(#[from] vfs::VfsError),
/// Operating-system I/O operation failed.
#[error("io error: {0}")]
Io(#[from] std::io::Error),
/// YAML input could not be decoded.
#[error("yaml error: {0}")]
Yaml(#[from] serde_yaml::Error),
/// JSON input or output could not be decoded or encoded.
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
/// Helm template source could not be parsed.
#[error("template parse error: {0}")]
TemplateParse(#[from] helm_schema_ast::ParseError),
/// Chart discovery found no analyzable charts.
#[error("no charts discovered")]
NoChartsDiscovered,
/// A discovered subchart path has no usable chart name.
#[error("subchart name missing for {path}")]
SubchartNameMissing {
/// Path of the unnamed subchart.
path: String,
},
/// An archive does not contain a chart manifest.
#[error("no Chart.yaml found in archive {archive}")]
NoChartYamlInArchive {
/// Path or identifier of the archive.
archive: String,
},
/// The output directory could not be created.
#[error("failed to create output directory {path}")]
CreateOutputDir {
/// Directory creation target.
path: PathBuf,
/// Underlying filesystem failure.
#[source]
source: std::io::Error,
},
/// A generated schema could not be written.
#[error("failed to write output {path}")]
WriteOutput {
/// Output file that could not be written.
path: PathBuf,
/// Underlying filesystem failure.
#[source]
source: std::io::Error,
},
/// Wraps any failure surfaced by the `jsonschema` / `referencing`
/// full-inlining pass: file-not-found, JSON parse error, malformed
/// URI, pointer-to-nowhere, missing anchor, etc. The wrapped variant
/// carries the structured cause so callers can pattern-match on the
/// underlying problem (e.g. `Unretrievable { uri, source }` vs
/// `PointerToNowhere { pointer }`) rather than parsing a string.
#[error("$ref resolution failed: {0}")]
Referencing(#[from] jsonschema::ReferencingError),
/// A self-contained schema could not be produced from external references.
#[error("$ref bundling failed: {0}")]
RefBundling(String),
/// A local filesystem path cannot be represented as a file URI.
#[error("filesystem path cannot be represented as a file URI: {path}")]
InvalidFileUriPath {
/// Filesystem path that could not be encoded.
path: PathBuf,
},
/// A file URI cannot be represented as a local filesystem path.
#[error("file URI cannot be represented as a local filesystem path: {uri}")]
InvalidFileUri {
/// File URI that could not be decoded.
uri: String,
},
/// One loaded document exceeded the configured byte budget.
#[error("load budget exceeded for {subject} (limit {limit_bytes} bytes)")]
LoadBudgetExceeded {
/// Document or archive member being loaded.
subject: String,
/// Maximum permitted byte count.
limit_bytes: usize,
},
/// An archive or directory exceeded the configured entry budget.
#[error("load budget exceeded for {subject} (limit {limit_entries} entries)")]
LoadEntryBudgetExceeded {
/// Archive or directory being enumerated.
subject: String,
/// Maximum permitted entry count.
limit_entries: usize,
},
/// An archive member would escape its extraction root.
#[error("unsafe archive entry path {entry_path} in {archive}")]
UnsafeArchiveEntryPath {
/// Archive containing the unsafe member.
archive: String,
/// Untrusted member path rejected by validation.
entry_path: String,
},
/// Mutually-exclusive CLI flags or otherwise-invalid combination
/// detected after `clap` parsing succeeded.
#[error("invalid CLI options: {0}")]
CliValidation(String),
}
/// Result returned by the schema engine's public operations.
pub type EngineResult<T> = std::result::Result<T, CliError>;