(
errors: &mut Vec<String>,
warnings: &mut Vec<String>,
loc: &str,
rule: &serde_json::Value,
required: bool,
)
| 536 | } |
| 537 | |
| 538 | fn validate_graphql_rule( |
| 539 | errors: &mut Vec<String>, |
| 540 | warnings: &mut Vec<String>, |
| 541 | loc: &str, |
| 542 | rule: &serde_json::Value, |
| 543 | required: bool, |
| 544 | ) { |
| 545 | validate_graphql_operation_type( |
| 546 | errors, |
| 547 | loc, |
| 548 | rule.get("operation_type").and_then(|v| v.as_str()), |
| 549 | required, |
| 550 | ); |
| 551 | if let Some(name) = rule.get("operation_name").and_then(|v| v.as_str()) |
| 552 | && !name.is_empty() |
| 553 | && let Some(warning) = check_glob_syntax(name) |
| 554 | { |
| 555 | warnings.push(format!("{loc}.operation_name: {warning}")); |
| 556 | } |
| 557 | validate_graphql_fields(errors, warnings, loc, rule.get("fields")); |
| 558 | } |
| 559 | |
| 560 | // Validate a matcher map when it exists. Null is treated like omission because |
| 561 | // policy loading normalizes absent optional maps the same way. |
no test coverage detected