You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Surfaced during the #877 browser smoke-test (PR #908).
The Rule schema declares conditions as a union type (array or null). When the visual condition builder serialises a non-empty condition tree as a JSON object (e.g. {"and": [{"var": ["user.email"]}]}) and PUTs it, OR's validation rejects it with HTTP 400 — the schema only accepts array or null at that path, not an object.
Repro
Create a rule via the openconnector UI (/rules → Add)
Use the visual condition builder to add a single var leaf
Save → PUT returns 400 {"error":"Validation failed: conditions must be array or null"}
Root cause
JsonLogic's canonical shape is a top-level object ({op: [...args]}), not an array. The schema typing is wrong.
Fix options
Change conditions type to object or object | null to match JsonLogic shape (preferred)
Wrap the visual builder's output in an array at the frontend level ([{and: [...]}]) — but then backend evaluators need updating to unwrap
Option 1 is the right model. The backend already expects JsonLogic shape per jwadhams/json-logic-php's API.
Scope
Schema migration in OR's openconnector register (the rule schema definition lives in lib/Repair/InitializeRegister.php or similar). Test that existing rules with null conditions stay null; existing rules with already-wrapped-in-array conditions get unwrapped or stay wrapped (backend tolerates both).
Surfaced during the #877 browser smoke-test (PR #908).
The Rule schema declares
conditionsas a union type (arrayornull). When the visual condition builder serialises a non-empty condition tree as a JSON object (e.g.{"and": [{"var": ["user.email"]}]}) and PUTs it, OR's validation rejects it with HTTP 400 — the schema only accepts array or null at that path, not an object.Repro
varleaf{"error":"Validation failed: conditions must be array or null"}Root cause
JsonLogic's canonical shape is a top-level object (
{op: [...args]}), not an array. The schema typing is wrong.Fix options
conditionstype toobjectorobject | nullto match JsonLogic shape (preferred)[{and: [...]}]) — but then backend evaluators need updating to unwrapOption 1 is the right model. The backend already expects JsonLogic shape per
jwadhams/json-logic-php's API.Scope
Schema migration in OR's openconnector register (the rule schema definition lives in
lib/Repair/InitializeRegister.phpor similar). Test that existing rules with null conditions stay null; existing rules with already-wrapped-in-array conditions get unwrapped or stay wrapped (backend tolerates both).