You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by "James Bognar (JIRA)" <ji...@apache.org> on 2019/06/29 15:21:00 UTC

[jira] [Created] (JUNEAU-118) OpenAPI generator should look for Java Validator annotations.

James Bognar created JUNEAU-118:
-----------------------------------

             Summary: OpenAPI generator should look for Java Validator annotations.
                 Key: JUNEAU-118
                 URL: https://issues.apache.org/jira/browse/JUNEAU-118
             Project: Juneau
          Issue Type: New Feature
          Components: Code
    Affects Versions: 8.0.0
            Reporter: James Bognar


The OpenAPI generator depends heavily on the @Schema annotation. 

Enhance it to also work with Java Validation annotations:
 * *_@NotNull_* – validates that the annotated property value is not _null_
 * *_@AssertTrue_* – validates that the annotated property value is _true_
 * *_@Size_* – validates that the annotated property value has a size between the attributes _min_ and _max_; can be applied to _String_, _Collection_, _Map_, and array properties
 * *_@Min_* – _v_alidates that the annotated property has a value no smaller than the _value_ attribute
 * *_@Max_* – validates that the annotated property has a value no larger than the _value_ attribute
 * _*@Email*_ – validates that the annotated property is a valid email address

Some annotations accept additional attributes, but the _message_ attribute is common to all of them. This is the message that will usually be rendered when the value of the respective property fails validation.

Some additional annotations that can be found in the JSR are:
 * _*@NotEmpty*_ – validates that the property is not null or empty; can be applied to _String_, _Collection_, _Map_ or _Array_values
 * _*@NotBlank*_ – can be applied only to text values and validated that the property is not null or whitespace
 * _*@Positive*_ and _*@PositiveOrZero*_ – apply to numeric values and validate that they are strictly positive, or positive including 0
 * _*@Negative*_ and _*@NegativeOrZero*_



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)