Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 119 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ clap-verbosity-flag = "=3.0.4"
clap_complete = "=4.6.9"
clap_complete_nushell = "=4.6.2"
fuzzy-matcher = "=0.3.7"
jsonschema = "=0.30.0"
jsonschema = "=0.50.1"
open = "=5.4.1"
os_info = "=3.15.0"
requestty = { version = "=0.6.3", features = ["macros", "termion"] }
Expand Down
25 changes: 11 additions & 14 deletions src/commands/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use serde_json::Value;

use super::BlueBuildCommand;

mod location;
mod evaluation;
mod schema_validator;
mod yaml_span;

Expand All @@ -41,6 +41,7 @@ pub struct ValidateCommand {
/// validation of the recipe.
#[arg(short, long)]
#[builder(default)]
#[cfg(not(feature = "v1_0_0"))]
pub all_errors: bool,

#[clap(skip)]
Expand All @@ -64,6 +65,11 @@ impl BlueBuildCommand for ValidateCommand {
bail!("File {recipe_path_display} must exist");
}

#[cfg(not(feature = "v1_0_0"))]
if self.all_errors {
log::warn!("--all-errors is deprecated and no longer does anything");
}

ASYNC_RUNTIME
.block_on(self.setup_validators())
.wrap_err("Failed to setup validators")?;
Expand All @@ -78,6 +84,7 @@ impl BlueBuildCommand for ValidateCommand {
)?;
let main_err = format!("Recipe {recipe_path_display} failed to validate");

#[cfg(not(feature = "v1_0_0"))]
if self.all_errors {
return Err(miette!("{errors}").context(main_err));
}
Expand All @@ -104,21 +111,11 @@ impl BlueBuildCommand for ValidateCommand {
impl ValidateCommand {
async fn setup_validators(&mut self) -> Result<(), Report> {
let (rv, sv, mv, mslv) = tokio::try_join!(
SchemaValidator::builder()
.url(RECIPE_V1_SCHEMA_URL)
.all_errors(self.all_errors)
.build(),
SchemaValidator::builder()
.url(STAGE_V1_SCHEMA_URL)
.all_errors(self.all_errors)
.build(),
SchemaValidator::builder()
.url(MODULE_V1_SCHEMA_URL)
.all_errors(self.all_errors)
.build(),
SchemaValidator::builder().url(RECIPE_V1_SCHEMA_URL).build(),
SchemaValidator::builder().url(STAGE_V1_SCHEMA_URL).build(),
SchemaValidator::builder().url(MODULE_V1_SCHEMA_URL).build(),
SchemaValidator::builder()
.url(MODULE_STAGE_LIST_V1_SCHEMA_URL)
.all_errors(self.all_errors)
.build(),
)?;
self.recipe_validator = Some(rv);
Expand Down
Loading
Loading