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() . These examples are extracted from open source projects. 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
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
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);
        }
    }
}