Skip to content

[plan] Convert single-value enums to const and add format constraints #8137

@github-actions

Description

@github-actions

Objective

Improve schema quality by converting single-value enum arrays to const (JSON Schema best practice) and adding format constraints where appropriate.

Context

This addresses Issues #5 and #6 (Low priority) from the schema audit:

  • 10 instances use "enum": ["value"] instead of "const": "value"
  • Zero format constraints despite opportunities for stronger validation (email, uri, date-time, etc.)

These are minor refinements but improve schema correctness and validation strength.

Approach

Part 1: Convert Single-Value Enums

Find all instances of "enum": ["single-value"] and replace with "const": "single-value".

Expected pattern:

// Before
"type": {
  "enum": ["stdio"]
}

// After
"type": {
  "const": "stdio"
}

Part 2: Add Format Constraints

Identify fields that would benefit from format constraints:

  • URLs → "format": "uri"
  • Email addresses → "format": "email"
  • Date/time fields → "format": "date-time"
  • Relative references → "format": "uri-reference"

Note: Only add format constraints where validation makes sense. Don't add them just to have them.

Files to Modify

  • pkg/parser/schemas/main_workflow_schema.json
  • pkg/parser/schemas/included_file_schema.json
  • pkg/parser/schemas/mcp_config_schema.json

Implementation Steps

  1. Search for "enum": [ with single-element arrays
  2. Replace with "const": (10 expected instances)
  3. Review string fields for format constraint opportunities
  4. Add format constraints to URL, email, and date-time fields
  5. Test that validation behavior remains correct

Acceptance Criteria

  • All single-value enums converted to const
  • Format constraints added to appropriate string fields (URLs, dates, etc.)
  • Schema validation still passes
  • No breaking changes to validation behavior
  • Run make build and make test to verify everything compiles and tests pass

Estimated Effort

1-2 hours (includes careful validation testing)

AI generated by Plan Command for discussion #8130

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions