You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@Size on a request parameter lowers the minLength/minItems set for @NotBlank/@NotEmpty #3449
For a request parameter, SchemaUtils.applyValidationsToSchema writes @Size.min() into minLength / minItems unconditionally. @Size(max = 10) has min = 0, so the minLength: 1 that @NotBlank gives the parameter schema is replaced with 0 (same for @NotEmpty and minItems).
minLength: 1 and minItems: 1: @Size should only raise a minimum that is already on the schema, never lower it.
Additional context
swagger-core has the same ordering issue when it resolves the parameter schema (swagger-api/swagger-core#5339, fix in swagger-api/swagger-core#5340). With that fix the schema reaches springdoc with minLength: 1, and applyValidationsToSchema still resets it to 0. I will open a PR.
Activity