Skip to main content

validate_policy

Function validate_policy 

Source
async fn validate_policy(
    __arg0: State<Arc<SharedState>>,
    __arg1: Json<Value>,
) -> impl IntoResponse
Expand description

POST /api/policies/validate — validates + compiles a policy against the live supernodes, plugin configs and stores, without persisting it. Body is the policy definition itself ({"nodes": [...], "edges": [...], ...}); a name is optional and, if absent, is not saved anywhere. Mirrors the MCP validate_policy tool so a human in the UI and an agent driving the gateway see the same verdict.

Response: {"valid": bool, "errors": [...], "buffering": [...]}. A policy that forces one or more upstreams to buffer instead of stream is still validbuffering is informational, not an error. Each entry names the blocked upstream and the node responsible: {"upstream": "up", "blocked_by": "rw", "node_type": "response-rewrite"}.