Skip to content

[Code Quality] Add JSON Schema not constraints for mutually exclusive fields #14489

Closed as not planned

Description

@github-actions

Description

The schema documents mutually exclusive fields (branches/branches-ignore, paths/paths-ignore) in $comment fields but doesn't use JSON Schema's not constraint to enforce them automatically. This means schema validation tools won't catch these errors - only the compiler validates them at runtime.

Current behavior:

  • Schema comments document: "mutually exclusive with branches-ignore"
  • JSON Schema validation doesn't enforce this
  • Only compiler catches the error at runtime

Expected behavior:

  • JSON Schema validation catches mutually exclusive field usage
  • Errors caught earlier in development cycle (IDE, pre-commit hooks)

Suggested Changes

Add JSON Schema allOf + not constraints in pkg/parser/schemas/main_workflow_schema.json:

{
  "allOf": [
    {
      "not": {
        "required": ["branches", "branches-ignore"]
      }
    },
    {
      "not": {
        "required": ["paths", "paths-ignore"]
      }
    }
  ]
}

Files Affected

  • pkg/parser/schemas/main_workflow_schema.json (lines 292, 300, 308, 316)
  • Existing parser validation in pkg/workflow/compiler_filters_validation.go:87-103 (already handles this at runtime)

Success Criteria

  • JSON Schema validation rejects workflows with both branches + branches-ignore
  • JSON Schema validation rejects workflows with both paths + paths-ignore
  • Existing compiler validation tests pass
  • Schema validation provides clear error messages

Source

Extracted from Schema Consistency Checker discussion #14471

Finding excerpt:

"Schema documents mutually exclusive fields in $comment fields but doesn't use JSON Schema's not constraint to enforce them... Schema validation tools won't catch these errors; only the compiler validates them at runtime."

Priority

Medium - Improves developer experience by catching errors earlier. Enhances schema validation coverage.

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 9, 2026, 9:06 AM UTC

Activity

  1. github-actions commented on Feb 8, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster has assigned this to Copilot!

    I've identified this issue as a good candidate for automated resolution and assigned it to the Copilot agent.

    The Copilot agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    AI generated by Issue Monster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions