MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / validate_graphql_rule

Function validate_graphql_rule

crates/openshell-supervisor-network/src/l7/mod.rs:538–558  ·  view source on GitHub ↗
(
    errors: &mut Vec<String>,
    warnings: &mut Vec<String>,
    loc: &str,
    rule: &serde_json::Value,
    required: bool,
)

Source from the content-addressed store, hash-verified

536}
537
538fn 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.

Callers 1

validate_l7_policiesFunction · 0.85

Calls 7

check_glob_syntaxFunction · 0.85
validate_graphql_fieldsFunction · 0.85
pushMethod · 0.80
getMethod · 0.45
as_strMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected