public static void applyValidationsToSchema(Schema<?> schema, List<Annotation> annotations, String openapiVersion) {
		annotations.forEach(anno -> {
			String annotationName = anno.annotationType().getSimpleName();
			if (annotationName.equals(Positive.class.getSimpleName())) {
				if (OpenApiVersion.OPENAPI_3_1.getVersion().equals(openapiVersion)) {
					schema.setExclusiveMinimumValue(BigDecimal.ZERO);
				}
				else {
					schema.setMinimum(BigDecimal.ZERO);
					schema.setExclusiveMinimum(true);
				}
			}
			if (annotationName.equals(PositiveOrZero.class.getSimpleName())) {
				schema.setMinimum(BigDecimal.ZERO);
			}
			if (annotationName.equals(NegativeOrZero.class.getSimpleName())) {
				schema.setMaximum(BigDecimal.ZERO);
			}
			if (annotationName.equals(Negative.class.getSimpleName())) {
				if (OpenApiVersion.OPENAPI_3_1.getVersion().equals(openapiVersion)) {
					schema.setExclusiveMaximumValue(BigDecimal.ZERO);
				}
				else {
					schema.setMaximum(BigDecimal.ZERO);
					schema.setExclusiveMaximum(true);
				}
			}
			if (annotationName.equals(Min.class.getSimpleName())) {
				schema.setMinimum(BigDecimal.valueOf(((Min) anno).value()));
			}
			if (annotationName.equals(Max.class.getSimpleName())) {
				schema.setMaximum(BigDecimal.valueOf(((Max) anno).value()));
			}
			if (annotationName.equals(DecimalMin.class.getSimpleName())) {
				DecimalMin min = (DecimalMin) anno;
				if (min.inclusive()) {
					schema.setMinimum(BigDecimal.valueOf(Double.parseDouble(min.value())));
				}
				else {
					schema.setExclusiveMinimum(true);
				}
			}
			if (annotationName.equals(DecimalMax.class.getSimpleName())) {
				DecimalMax max = (DecimalMax) anno;
				if (max.inclusive()) {
					schema.setMaximum(BigDecimal.valueOf(Double.parseDouble(max.value())));
				}
				else {
					schema.setExclusiveMaximum(true);
				}
			}
			if (annotationName.equals(Size.class.getSimpleName())) {
				String type = schema.getType();
				if (type == null && schema.getTypes() != null && schema.getTypes().size() == 1)
					type = schema.getTypes().iterator().next();
				if (OPENAPI_ARRAY_TYPE.equals(type)) {
					schema.setMinItems(((Size) anno).min());
					schema.setMaxItems(((Size) anno).max());
				}
				else if (OPENAPI_STRING_TYPE.equals(type)) {
					schema.setMinLength(((Size) anno).min());
					schema.setMaxLength(((Size) anno).max());
				}
			}
			if (annotationName.equals(Pattern.class.getSimpleName())) {
				schema.setPattern(((Pattern) anno).regexp());
			}
		});
		if (schema!=null && annotatedNotNull(annotations)) {
			String specVersion = schema.getSpecVersion().name();
			if (!"V30".equals(specVersion)) {
				schema.setNullable(false);
			}
		}
	}
Apply validations to schema. the annotation order effects the result of the
validation.

@param schema         the schema
@param annotations    the annotations
@param openapiVersion the openapi version
springdoc-openapi-starter-common/src/main/java/org/springdoc/core/utils/SchemaUtils.java