Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,7 @@ protected boolean applyBeanValidatorAnnotations(Schema property, Annotation[] an

if (parent != null &&
Arrays.stream(annotations).anyMatch(
annotation -> annotation.annotationType().getSimpleName().equals("NonNull"))) {
annotation -> annotation.annotationType().getSimpleName().equalsIgnoreCase("NonNull"))) {
modified = updateRequiredItem(parent, property.getName()) || modified;

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.swagger.v3.core.oas.models;

import javax.annotation.Nonnull;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Email;
Expand All @@ -20,6 +21,7 @@ public class BeanValidationsModel {
protected Integer age;

@Pattern(regexp = "(?![-._])[-._a-zA-Z0-9]{3,32}")
@Nonnull
protected String username;

@Size(min = 6, max = 20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void readBeanValidatorTest() {
final Map<String, Schema> properties = model.getProperties();

assertTrue(model.getRequired().contains("id"));
assertTrue(model.getRequired().contains("username"));

final StringSchema username = (StringSchema) properties.get("username");
assertEquals((String) username.getPattern(), "(?![-._])[-._a-zA-Z0-9]{3,32}");
Expand Down
Loading