Skip to content

schemas: boolean-discriminator unions need an enum migration to be discriminator-keyword-compatible #3936

Description

@bokelley

Background

Follow-up from #3917 / #3928 / #3934. Two AdCP schemas use a boolean as the discriminator value:

  • `content-standards/update-content-standards-response.json` `#/oneOf` — `success: true` vs `success: false`
  • `protocol/get-adcp-capabilities-response.json` `#/properties/adcp/properties/idempotency/oneOf` — `supported: true` vs `supported: false`

Both are valid JSON Schema (`const: true` / `const: false`) and validators that respect the `const` pattern narrow them correctly. But Ajv's discriminator implementation (`new Ajv({ discriminator: true })`, used in `tests/json-schema-validation.test.cjs` and `tests/composed-schema-validation.test.cjs`) requires unique string values, not booleans, so we cannot add `discriminator: { propertyName: "..." }` to either union. They remain ✓ via the const-property pattern but lose the OpenAPI codegen hint.

Proposed fix

Migrate each boolean discriminator to a string enum:

Schema Current Proposed
`update-content-standards-response` `success: true | false` `status: "ok" | "error"` (or similar)
`get-adcp-capabilities-response` idempotency `supported: true | false` `mode: "supported" | "unsupported"` (or similar)

Both are breaking wire changes — adopters checking `response.success === true` or `idempotency.supported === true` would need to update. Worth doing in 4.0 (or earlier in 3.x with a migration window).

Decision needed

  • Is the value of compatible discriminator-keyword codegen worth the breaking change?
  • If yes: schedule for 4.0 alongside the response-union family-wide `status` discriminator already in flight.
  • If no: document the boolean-discriminator pattern as intentional, and accept that Ajv's discriminator support won't validate these unions (the `const` pattern still does).

Acceptance (if we proceed)

  • Both schemas migrated to string-enum discriminator
  • adcp-client / adcp-py codegen regenerated
  • Migration note in the corresponding spec version's release notes
  • `scripts/oneof-discriminators.baseline.json` ratcheted (these will move from ✓-via-const to ✓-via-discriminator)

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    claude-triagedIssue has been triaged by the Claude Code triage routine. Remove to re-triage.enhancementNew feature or requestschemaJSON Schema source-of-truth: definitions, codegen artifacts, validation, hygiene

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions