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)
Refs
Background
Follow-up from #3917 / #3928 / #3934. Two AdCP schemas use a boolean as the discriminator value:
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:
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
Acceptance (if we proceed)
Refs