Skip to content

fix!: correctly handle required map keys with nil schematics#39

Merged
mhanberg merged 1 commit intomainfrom
fix-maps
Mar 26, 2025
Merged

fix!: correctly handle required map keys with nil schematics#39
mhanberg merged 1 commit intomainfrom
fix-maps

Conversation

@mhanberg
Copy link
Owner

This patch remedies a bug where a required map key could have a nil
schematic, meaning set as the literal nil, but would be treated as if
the key was optional, rather than specifying the value is nil exactly.

This had downstream effects when used inside another schematic like the
oneof schematic. If you had two map schematics as options, both with
nil as the value schematic for its key, it would assume the first map
unified, but was just missing its key.

Now, map schematics with missing required keys will return errors with
"is missing".

This patch remedies a bug where a required map key could have a nil
schematic, meaning set as the literal nil, but would be treated as if
the key was optional, rather than specifying the value is nil exactly.

This had downstream effects when used inside another schematic like the
`oneof` schematic. If you had two map schematics as options, both with
`nil` as the value schematic for its key, it would assume the first map
unified, but was just missing its key.

Now, map schematics with missing required keys will return errors with
"is missing".
@mhanberg mhanberg merged commit 5302f19 into main Mar 26, 2025
11 checks passed
@mhanberg mhanberg deleted the fix-maps branch March 26, 2025 01:10
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