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:

  • the policy has a listener node (entry) and a client node (exit);
  • every edge endpoint references an existing node;
  • each input port has at most one incoming edge, except inputs of client and error-handler nodes, which accept multiple;
  • 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.

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