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
branches vs branches-ignore (in on.push and on.pull_request)
paths vs paths-ignore (in on.push and on.pull_request)
slash_command vs label events (in on)
command vs label events (in on)
- MCP
command vs container (in tools.(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 build to rebuild with embedded schema
Acceptance Criteria
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
Objective
Add JSON Schema
oneOfconstraints to prevent mutually exclusive fields from being specified together.Context
Currently, the schema allows users to specify both
branchesandbranches-ignore, or bothpathsandpaths-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)commandvscontainer(intools.(tool))Approach
For each pair, add a
oneOfconstraint 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 filemake buildto rebuild with embedded schemaAcceptance Criteria
branchesandbranches-ignorepathsandpaths-ignoreTesting
Create test workflows with invalid combinations and verify schema validation catches them before compile.
Related to #7575