Skip to content

[task] Update schema to allow polymorphic types for category and version fields #4313

Closed

Description

@github-actions

Objective

Update JSON schema definitions to match runtime behavior for category and version fields that accept multiple types.

Context

Related to discussion #4307. The runtime accepts both string and numeric types for these fields, but the schema only documents string types, creating validation gaps.

Approach

  1. Update category field to accept both string and integer: "type": ["string", "integer"]
  2. Update version field to accept both string and number: "type": ["string", "number"]
  3. Add examples showing numeric usage
  4. Document conversion behavior in descriptions

Affected Fields

category (in safe-outputs.create-discussion)

Schema location: Look for create-discussion safe output configuration
Current: "type": "string"
Should be: "type": ["string", "integer"]
Runtime code (pkg/workflow/create_discussion.go:26-32):

switch v := category.(type) {
case string:
    discussionsConfig.Category = v
case int:  // NOT in current schema!
    discussionsConfig.Category = strconv.Itoa(v)
}

version (in engine and tool configurations)

Current: "type": "string"
Should be: "type": ["string", "number"]
Runtime code (pkg/workflow/runtime_setup.go:507-518):

switch v := versionAny.(type) {
case string:
    version = v
case int:
    version = fmt.Sprintf("%d", v)
case float64:
    if v == float64(int(v)) {
        version = fmt.Sprintf("%d", int(v))
    } else {
        version = fmt.Sprintf("%g", v)
    }
}

Files to Modify

  • Update: pkg/parser/schemas/main_workflow_schema.json

Acceptance Criteria

  • category field schema updated to "type": ["string", "integer"]
  • version field schema updated to "type": ["string", "number"]
  • Examples added showing numeric versions: version: 20 and version: 3.11
  • Field descriptions document that integers are converted to strings
  • Schema validation passes for workflows using numeric values

Examples That Should Now Validate

# category as integer
safe-outputs:
  create-discussion:
    category: 123

# version as number
engine:
  version: 20
  
tools:
  github:
    version: 3.11

AI generated by Plan Command for discussion #4307

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions