GeezerVison is showing github.com — Include Nonnull annotation from Jakarta Annotations for required items · swagger-api/swagger-core@67626df
File tree
Expand file treeCollapse file tree
Open diff view settings
main/java/io/swagger/v3/core/jackson test/java/io/swagger/v3/core
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1741,7 +1741,7 @@ protected boolean applyBeanValidatorAnnotations(Schema property, Annotation[] an |
1741 | 1741 |
|
1742 | 1742 | if (parent != null && |
1743 | 1743 | Arrays.stream(annotations).anyMatch( |
1744 | | - annotation -> annotation.annotationType().getSimpleName().equals("NonNull"))) { |
| 1744 | + annotation -> annotation.annotationType().getSimpleName().equalsIgnoreCase("NonNull"))) { |
1745 | 1745 | modified = updateRequiredItem(parent, property.getName()) || modified; |
1746 | 1746 |
|
1747 | 1747 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: modules/swagger-core/src/test/java/io/swagger/v3/core/oas/models/BeanValidationsModel.java +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | package io.swagger.v3.core.oas.models; |
2 | 2 |
|
| 3 | +import javax.annotation.Nonnull; |
3 | 4 | import javax.validation.constraints.DecimalMax; |
4 | 5 | import javax.validation.constraints.DecimalMin; |
5 | 6 | import javax.validation.constraints.Email; |
@@ -20,6 +21,7 @@ public class BeanValidationsModel { |
20 | 21 | protected Integer age; |
21 | 22 |
|
22 | 23 | @Pattern(regexp = "(?![-._])[-._a-zA-Z0-9]{3,32}") |
| 24 | + @Nonnull |
23 | 25 | protected String username; |
24 | 26 |
|
25 | 27 | @Size(min = 6, max = 20) |
|
Collapse file
Copy file name to clipboardExpand all lines: modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/BeanValidatorTest.java +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,6 +25,7 @@ public void readBeanValidatorTest() { |
25 | 25 | final Map<String, Schema> properties = model.getProperties(); |
26 | 26 |
|
27 | 27 | assertTrue(model.getRequired().contains("id")); |
| 28 | + assertTrue(model.getRequired().contains("username")); |
28 | 29 |
|
29 | 30 | final StringSchema username = (StringSchema) properties.get("username"); |
30 | 31 | assertEquals((String) username.getPattern(), "(?![-._])[-._a-zA-Z0-9]{3,32}"); |
|