Java Code Examples for org.eclipse.microprofile.openapi.models.media.Schema#getMinLength()

The following examples show how to use org.eclipse.microprofile.openapi.models.media.Schema#getMinLength() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BeanValidationScanner.java    From smallrye-open-api with Apache License 2.0 6 votes vote down vote up
void sizeString(AnnotationTarget target, Schema schema) {
    AnnotationInstance constraint = getConstraint(target, BV_SIZE);

    if (constraint != null) {
        Integer min = intValue(constraint, "min");
        Integer max = intValue(constraint, "max");

        if (min != null && schema.getMinLength() == null) {
            schema.setMinLength(min);
        }

        if (max != null && schema.getMaxLength() == null) {
            schema.setMaxLength(max);
        }
    }
}
 
Example 2
Source File: BeanValidationScanner.java    From smallrye-open-api with Apache License 2.0 5 votes vote down vote up
void notEmptyString(AnnotationTarget target, Schema schema) {
    AnnotationInstance constraint = getConstraint(target, BV_NOT_EMPTY);

    if (constraint != null) {
        if (schema.getNullable() == null) {
            schema.setNullable(Boolean.FALSE);
        }

        if (schema.getMinLength() == null) {
            schema.setMinLength(1);
        }
    }
}