Skip to content

type: choice with options in custom job inputs generates invalid JSON Schema for Claude API #82

@sozercan

Description

@sozercan

When using type: choice with options in custom safe-output job inputs, the compiled workflow generates invalid JSON Schema that causes Claude API calls to fail with:

tools.17.custom.input_schema: JSON schema is invalid. It must match JSON Schema draft 2020-12

The gh-aw compiler passes type: choice through literally to the tool schema instead of converting it to valid JSON Schema format (type: string with enum).

The generated schema looks like:

{
  "test_target": {
    "description": "Which test target to run",
    "options": ["foo", "bar", "both"],
    "required": true,
    "type": "choice"
  }
}

But JSON Schema draft 2020-12 requires:

{
  "test_target": {
    "description": "Which test target to run",
    "enum": ["foo", "bar", "both"],
    "type": "string"
  }
}

Reproduction

on:
  workflow_dispatch:

permissions:
  contents: read

engine:
  model: claude-opus-4.5

safe-outputs:
  jobs:
    my-job:
      description: "A test job with choice input"
      runs-on: ubuntu-latest
      output: "Job completed"
      inputs:
        environment:
          description: "Target environment"
          required: true
          type: choice
          options: ["staging", "production"]
      steps:
        - name: Echo environment
          run: echo "Environment: ${{ inputs.environment }}"

Expected Behavior

The compiler should convert type: choice + options: [...] to valid JSON Schema:

type: choice → type: string
options: [...] → enum: [...]

Workaround

Use type: string and document valid values in the description:

inputs:
  environment:
    description: "Target environment. Valid values: staging, production"
    required: true
    type: string

Environment

gh-aw CLI version: 0.0.365+ (based on logs showing @github/[email protected])
Engine: Claude (claude-opus-4.5)
The issue may not occur with non-Claude engines that may not validate JSON Schema strictly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions