Skip to content
Open
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
21 changes: 1 addition & 20 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 crates/mergify-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mergify-core = { path = "../mergify-core" }
jsonschema = { version = "0.46", default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_norway = "0.9"
serde_yaml_ng = "0.10"
url = "2"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions crates/mergify-config/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ pub async fn run(explicit_path: Option<&Path>, output: &mut dyn Output) -> Resul
fn load_yaml(path: &Path) -> Result<serde_json::Value, CliError> {
let text = std::fs::read_to_string(path)
.map_err(|e| CliError::Configuration(format!("cannot read {}: {e}", path.display())))?;
// Parse as YAML into serde_norway::Value, then convert to JSON
// Parse as YAML into serde_yaml_ng::Value, then convert to JSON
// so jsonschema can validate. The conversion is always lossless
// for valid Mergify configs (mappings, sequences, scalars).
let yaml_value: serde_norway::Value = serde_norway::from_str(&text)
let yaml_value: serde_yaml_ng::Value = serde_yaml_ng::from_str(&text)
.map_err(|e| CliError::Configuration(format!("Invalid YAML in {}: {e}", path.display())))?;
// Mergify configs are YAML mappings at the top level; an empty
// file deserializes to Null, which we treat as an empty mapping.
Expand Down
Loading