Skip to content

fix(v4): JSON schema min/max intersection for draft-04 and openapi-3.0#5700

Open
ebroder wants to merge 1 commit intocolinhacks:mainfrom
ebroder:fix/json-schema-draft04-min-max-intersection
Open

fix(v4): JSON schema min/max intersection for draft-04 and openapi-3.0#5700
ebroder wants to merge 1 commit intocolinhacks:mainfrom
ebroder:fix/json-schema-draft04-min-max-intersection

Conversation

@ebroder
Copy link

@ebroder ebroder commented Feb 9, 2026

When both minimum and exclusiveMinimum exist (e.g., from .int().positive()), the conversion now picks the more restrictive constraint. Previously, the inclusive minimum would overwrite the exclusive one, producing incorrect output like minimum: -9007199254740991 instead of minimum: 0.

Same fix applied for maximum/exclusiveMaximum.

When both minimum and exclusiveMinimum exist (e.g., from
.int().positive()), the conversion now picks the more restrictive
constraint. Previously, the inclusive minimum would overwrite the
exclusive one, producing incorrect output like `minimum:
-9007199254740991` instead of `minimum: 0`.

Same fix applied for maximum/exclusiveMaximum.
Copy link
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — Clean, correct fix for a real bug. The logic properly handles the constraint intersection by comparing bounds and selecting the more restrictive one. Tests are comprehensive and cover the key scenarios.

Pullfrog  | View workflow runpullfrog.com𝕏

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