Skip to content

Keep the stricter minimum when @Size meets an existing one - #3450

Open
AdzerKI wants to merge 1 commit into
springdoc:mainfrom
AdzerKI:size-keeps-stricter-minimum
Open

AdzerKI wants to merge 1 commit into
springdoc:mainfrom
AdzerKI:size-keeps-stricter-minimum

Conversation

@AdzerKI

@AdzerKI AdzerKI commented Nov 26, 2026

Copy link
Copy Markdown

applyValidationsToSchema wrote @Size.min() over minLength / minItems unconditionally, so a request parameter with @NotBlank or @NotEmpty and @Size(max = ...) was documented with a minimum of 0. It now keeps the larger of the existing and the @Size minimum.

SchemaUtilsSizeTest covers strings and arrays: an existing minimum of 1 with @Size(max), a higher @Size(min), and no existing minimum.

Fixes #3449

@SiZe wrote its min() over minLength and minItems unconditionally, so a
request parameter with @notblank or @notempty and @SiZe(max = ...) was
documented with a minimum of 0 instead of 1.

Fixes springdoc#3449

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.

@Size on a request parameter lowers the minLength/minItems set for @NotBlank/@NotEmpty

1 participant