Skip to main content

validate_policy

Function validate_policy 

Source
pub fn validate_policy(policy: &PolicyConfig) -> Result<(), Vec<String>>
Expand description

Validates a policy’s node graph structure, collecting all violations.

Enforced rules:

  • no two nodes share an id;
  • the policy has a listener node (entry) and a client node (exit);
  • every edge endpoint references an existing node;
  • no orphan nodes (a node with neither incoming nor outgoing edges; being named as the policy-level error_handler counts as connected);
  • error_handler, if set, references an existing node that is not a type: supernode instance (expansion removes instance nodes, so a catch-all pointed at one would dangle at request time).

Returns Ok(()) when valid, otherwise Err with one message per violation (validation does not stop at the first error).