switched strict validation from additionalProperties to unevaluatedProperties to catch conditional properties automatically in verification
This commit is contained in:
@ -95,10 +95,10 @@ fn cache_json_schema(schema_id: &str, schema: JsonB, strict: bool) -> JsonB {
|
||||
fn apply_strict_validation(schema: &mut Value) {
|
||||
match schema {
|
||||
Value::Object(map) => {
|
||||
// If this is an object type schema, add additionalProperties: false
|
||||
// If this is an object type schema, add unevaluatedProperties: false
|
||||
if let Some(Value::String(t)) = map.get("type") {
|
||||
if t == "object" && !map.contains_key("additionalProperties") {
|
||||
map.insert("additionalProperties".to_string(), Value::Bool(false));
|
||||
if t == "object" && !map.contains_key("unevaluatedProperties") && !map.contains_key("additionalProperties") {
|
||||
map.insert("unevaluatedProperties".to_string(), Value::Bool(false));
|
||||
}
|
||||
}
|
||||
// Recurse into all properties
|
||||
|
||||
Reference in New Issue
Block a user