Skip to content

[BUG] [Java] Bean Validation for min/max incorrect when exclusive set #2082

@GynnRickerbyNZPost

Description

@GynnRickerbyNZPost

When a field has a minimum/maximum specified, with the exclusive parameter set, e.g.

aNumber:
  type: number
  minimum: 2
  exclusiveMinimum: true

The generated Java Bean Validation code isn't correct.
E.g. Current incorrect code:

@Valid
@DecimalMin("2")
public BigDecimal getANumber() {

Expected code:

@Valid
@DecimalMin(value="2",inclusive=false)
public BigDecimal getANumber() {

Tested with Spring Generator (both spring-boot and spring-cloud libraries), but I believe all Java libraries are using the same validation generation code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions