pub struct ValidationContext {
pub content: String,
pub file_path: String,
pub manifest: Option<WorkspaceManifest>,
pub environment: Option<String>,
pub cli_inputs: Vec<(String, String)>,
pub addon_specs: Option<HashMap<String, Vec<(String, CommandSpecification)>>>,
pub input_refs: Vec<LocatedInputRef>,
/* private fields */
}Expand description
Shared context for validation operations
This struct contains all the data needed by various validators, reducing the need to pass multiple parameters through the validation pipeline.
Fields§
§content: StringThe content being validated
file_path: StringPath to the file being validated
manifest: Option<WorkspaceManifest>Optional workspace manifest for environment/input validation
environment: Option<String>Current environment name (e.g., “production”, “staging”)
cli_inputs: Vec<(String, String)>CLI inputs provided by the user (key-value pairs)
addon_specs: Option<HashMap<String, Vec<(String, CommandSpecification)>>>Addon specifications for validation
input_refs: Vec<LocatedInputRef>Collected input references during validation
Implementations§
Source§impl ValidationContext
impl ValidationContext
Sourcepub fn new(content: impl Into<String>, file_path: impl Into<String>) -> Self
pub fn new(content: impl Into<String>, file_path: impl Into<String>) -> Self
Create a new validation context with minimal required information
Sourcepub fn with_manifest(self, manifest: WorkspaceManifest) -> Self
pub fn with_manifest(self, manifest: WorkspaceManifest) -> Self
Set the workspace manifest
Sourcepub fn with_environment(self, environment: impl Into<String>) -> Self
pub fn with_environment(self, environment: impl Into<String>) -> Self
Set the current environment
Sourcepub fn with_cli_inputs(self, cli_inputs: Vec<(String, String)>) -> Self
pub fn with_cli_inputs(self, cli_inputs: Vec<(String, String)>) -> Self
Set CLI inputs
Sourcepub fn with_addon_specs(
self,
specs: HashMap<String, Vec<(String, CommandSpecification)>>,
) -> Self
pub fn with_addon_specs( self, specs: HashMap<String, Vec<(String, CommandSpecification)>>, ) -> Self
Set addon specifications
Sourcepub fn file_path_as_path(&self) -> &Path
pub fn file_path_as_path(&self) -> &Path
Get the file path as a Path
Sourcepub fn environment_ref(&self) -> Option<&String>
pub fn environment_ref(&self) -> Option<&String>
Get the current environment as a string reference
Sourcepub fn effective_inputs(&mut self) -> &HashMap<String, String>
pub fn effective_inputs(&mut self) -> &HashMap<String, String>
Get effective inputs (cached computation)
Sourcepub fn add_input_ref(&mut self, input_ref: LocatedInputRef)
pub fn add_input_ref(&mut self, input_ref: LocatedInputRef)
Add an input reference found during validation
Sourcepub fn load_addon_specs(
&mut self,
) -> &HashMap<String, Vec<(String, CommandSpecification)>>
pub fn load_addon_specs( &mut self, ) -> &HashMap<String, Vec<(String, CommandSpecification)>>
Load addon specifications from the registry
Trait Implementations§
Source§impl Clone for ValidationContext
impl Clone for ValidationContext
Source§fn clone(&self) -> ValidationContext
fn clone(&self) -> ValidationContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more