Skip to content

fix: normalize const/single-value enums to IRModelConst - #531

Merged
mnahkies merged 2 commits into
mainfrom
feat/ir-const-enum-extensibility
Aug 15, 2026
Merged

fix: normalize const/single-value enums to IRModelConst#531
mnahkies merged 2 commits into
mainfrom
feat/ir-const-enum-extensibility

Conversation

@mnahkies

@mnahkies mnahkies commented Aug 15, 2026

Copy link
Copy Markdown
Owner

The JSON Schema const keyword (OpenAPI 3.1) was parsed away silently, widening literal types to their base type and breaking discriminated unions. Introduce an IRModelConst abstraction used for both const and single-value enum (which default to closed), so enum extensibility never applies to a constant.

Update type/schema builders and the discriminator check, and add a const-based discriminated union to the todo-lists integration spec.

Also addresses a few discrepancies where literals would've failed at runtime if used in a query string setting. Now coerced to number / boolean correctly.

closes #529

The JSON Schema `const` keyword (OpenAPI 3.1) was parsed away silently,
widening literal types to their base type and breaking discriminated unions.
Introduce an IRModelConst abstraction used for both `const` and single-value
`enum` (which default to closed), so enum extensibility never applies to a
constant. Update type/schema builders and the discriminator check, and add a
const-based discriminated union to the todo-lists integration spec.

closes #529
Delegate number enum literals to the abstract literal(), use z.coerce.number()
in the coercion preprocess, and route boolean enum values through
booleanLiteral so they stay permissive and consistent with boolean const.
@mnahkies
mnahkies marked this pull request as ready for review August 15, 2026 10:00
@mnahkies
mnahkies enabled auto-merge (squash) August 15, 2026 10:00
@mnahkies
mnahkies merged commit 9dd3485 into main Aug 15, 2026
23 checks passed
@mnahkies
mnahkies deleted the feat/ir-const-enum-extensibility branch August 15, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

const (single-value enum) is silently dropped, widening literal types to string

1 participant