Skip to content

Keep the bound of an exclusive @DecimalMin and @DecimalMax - #3457

Open
ErickGCA wants to merge 1 commit into
springdoc:mainfrom
ErickGCA:fix/decimal-exclusive-bounds
Open

ErickGCA wants to merge 1 commit into
springdoc:mainfrom
ErickGCA:fix/decimal-exclusive-bounds

Conversation

@ErickGCA

@ErickGCA ErickGCA commented Dec 1, 2026

Copy link
Copy Markdown

a request parameter with @DecimalMin(value = "0.5", inclusive = false) is documented without the bound. applyValidationsToSchema only calls setExclusiveMinimum(true) when the constraint isn't inclusive and never sets the value, so the schema ends up with exclusiveMinimum: true and no minimum. @DecimalMax does the same with exclusiveMaximum

now it follows what @Positive and @Negative already do in the same method: for OpenAPI 3.0 it sets minimum / maximum together with the exclusive flag, and for 3.1 it sets the numeric exclusiveMinimum / exclusiveMaximum. inclusive bounds are unchanged

SchemaUtilsDecimalBoundsTest covers exclusive bounds in 3.0 and 3.1 and the inclusive case. heads up, #3455 touches the same lines to parse the value as BigDecimal, whichever goes second needs a small rebase

A non-inclusive @DecimalMin or @DecimalMax only set the exclusive flag and
dropped the value. Set the bound together with the flag for OpenAPI 3.0 and
use the numeric exclusive bound for OpenAPI 3.1, as @positive and @Negative
already do.

This branch has not been deployed

No deployments
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