krasa / krasa-jaxb-tools

XJC / JAXB plugin for generation of Bean Validation Annotations (JSR-303) and replacing primitive types
Apache License 2.0
61 stars 47 forks source link

minExclusive=0, fractionDigits=2 wrong annotation #38

Open SZD-48 opened 9 years ago

SZD-48 commented 9 years ago

Hi, for schema

<xs:complexType name="Invoice">
    <xs:sequence>
        <xs:element name="amount">
            <xs:simpleType>
                <xs:restriction base="xs:decimal">
                    <xs:minExclusive value="0"/>
                    <xs:fractionDigits value="2"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:element>
    </xs:sequence>
</xs:complexType>

plugin generates

@NotNull
@DecimalMin("1")
protected BigDecimal amount;

Thanks, Fedor.

EPluribusUnum commented 3 years ago

@SZD-48 , I ran into the same issue. Use : -XJsr303Annotations:JSR_349=true @DecimalMin(value = "0", inclusive = false) will be generated.

(see JaxbValidationsPlugins.java jsr349 variable)