-
Notifications
You must be signed in to change notification settings - Fork 212
Closed
Labels
Description
Objective
Add JSON Schema oneOf constraints to prevent mutually exclusive fields from being specified together.
Context
Currently, the schema allows users to specify both branches and branches-ignore, or both paths and paths-ignore, which the compiler correctly rejects. Users only discover this error at compile time instead of during editing.
Field Pairs to Constrain
branchesvsbranches-ignore(inon.pushandon.pull_request)pathsvspaths-ignore(inon.pushandon.pull_request)slash_commandvs label events (inon)commandvs label events (inon)- MCP
commandvscontainer(intools.(tool))
Approach
For each pair, add a oneOf constraint that ensures only one can be present:
{
"oneOf": [
{
"required": ["branches"],
"not": { "required": ["branches-ignore"] }
},
{
"required": ["branches-ignore"],
"not": { "required": ["branches"] }
},
{
"not": {
"anyOf": [
{ "required": ["branches"] },
{ "required": ["branches-ignore"] }
]
}
}
]
}Files to Modify
pkg/parser/schemas/frontmatter.json- Main schema file- After changes, run
make buildto rebuild with embedded schema
Acceptance Criteria
- Schema rejects YAML with both
branchesandbranches-ignore - Schema rejects YAML with both
pathsandpaths-ignore - Schema rejects slash_command with label events
- Schema rejects command with label events
- Schema rejects MCP configs with both command and container
- Existing valid configurations still pass validation
- Error messages clearly indicate mutual exclusivity
Testing
Create test workflows with invalid combinations and verify schema validation catches them before compile.
Related to #7575
AI generated by Plan Command for discussion #7569
Reactions are currently unavailable