Validate a matcher map when it exists. Null is treated like omission because policy loading normalizes absent optional maps the same way.
(
errors: &mut Vec<String>,
warnings: &mut Vec<String>,
loc: &str,
value: Option<&serde_json::Value>,
)
| 560 | // Validate a matcher map when it exists. Null is treated like omission because |
| 561 | // policy loading normalizes absent optional maps the same way. |
| 562 | fn validate_matcher_map( |
| 563 | errors: &mut Vec<String>, |
| 564 | warnings: &mut Vec<String>, |
| 565 | loc: &str, |
| 566 | value: Option<&serde_json::Value>, |
| 567 | ) { |
| 568 | let Some(value) = value.filter(|v| !v.is_null()) else { |
| 569 | return; |
| 570 | }; |
| 571 | let Some(obj) = value.as_object() else { |
| 572 | errors.push(format!("{loc}: expected map of matchers")); |
| 573 | return; |
| 574 | }; |
| 575 | |
| 576 | for (key, matcher) in obj { |
| 577 | validate_matcher_value(errors, warnings, &format!("{loc}.{key}"), matcher); |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | // Validate one matcher leaf. Objects must use the explicit matcher keys. |
| 582 | fn validate_matcher_value( |
no test coverage detected