Skip to content

Conversation

mnahkies
Copy link
Owner

adds support for the enum keyword to boolean schemas, which is handy for creating discriminated unions on occasion.

after this change a schema like:

type: boolean
enum:
  - true

will only allow true to be passed, vice-versa for false.

I've opted to not include the normal enum open/closed concept here as it seems a bit unnecessary when the enums domain can only contain two values at most - If open enums are expected to be needed then you should probably be using a string or number enum.

requested by @markios

mnahkies added 5 commits July 22, 2025 16:02
adds support for the `enum` keyword to `boolean` schemas, which
is handy for creating discriminated unions on ocassion.

requested by Mark
@mnahkies mnahkies enabled auto-merge (squash) July 23, 2025 12:21
@mnahkies mnahkies merged commit 46fea1e into main Jul 23, 2025
6 checks passed
@mnahkies mnahkies deleted the mn/feat/support-boolean-enums branch July 23, 2025 12:25
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.

1 participant