jspg error refactoring checkpoint
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::validator::context::ValidationContext;
|
||||
use crate::validator::error::ValidationError;
|
||||
use crate::validator::result::ValidationResult;
|
||||
@ -27,7 +29,9 @@ impl<'a> ValidationContext<'a> {
|
||||
if !result.evaluated_keys.contains(key) && !self.overrides.contains(key) {
|
||||
result.errors.push(ValidationError {
|
||||
code: "STRICT_PROPERTY_VIOLATION".to_string(),
|
||||
message: format!("Unexpected property '{}'", key),
|
||||
values: Some(HashMap::from([
|
||||
("property_name".to_string(), key.to_string()),
|
||||
])),
|
||||
path: self.join_path(key),
|
||||
});
|
||||
}
|
||||
@ -47,7 +51,9 @@ impl<'a> ValidationContext<'a> {
|
||||
}
|
||||
result.errors.push(ValidationError {
|
||||
code: "STRICT_ITEM_VIOLATION".to_string(),
|
||||
message: format!("Unexpected item at index {}", i),
|
||||
values: Some(HashMap::from([
|
||||
("index".to_string(), i.to_string()),
|
||||
])),
|
||||
path: item_path,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user