Skip to content

Commit 02fae4b

Browse files
Merge branch 'master' into do-not-set-nullable-on-objects
2 parents 8f9aeb7 + 5239cae commit 02fae4b

47 files changed

Lines changed: 1076 additions & 75 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/prepare-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v6
14-
- uses: tibdex/github-app-token@v2
14+
- uses: actions/create-github-app-token@v3
1515
id: generate-token
1616
with:
17-
app_id: ${{ secrets.APP_ID }}
18-
private_key: ${{ secrets.APP_PRIVATE_KEY }}
17+
client-id: ${{ secrets.APP_ID }}
18+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
1919
- name: Set up Python 3.10
2020
uses: actions/setup-python@v6
2121
with:

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v6
14-
- uses: tibdex/github-app-token@v2
14+
- uses: actions/create-github-app-token@v3
1515
id: generate-token
1616
with:
17-
app_id: ${{ secrets.APP_ID }}
18-
private_key: ${{ secrets.APP_PRIVATE_KEY }}
17+
client-id: ${{ secrets.APP_ID }}
18+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
1919
- name: Set up Python 3.10
2020
uses: actions/setup-python@v6
2121
with:

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ The OpenAPI Specification has undergone several revisions since initial creation
2323

2424
Swagger core Version | Release Date | OpenAPI Spec compatibility | Notes | Status
2525
------------------------- | ------------ | -------------------------- | ----- | ----
26-
2.2.48 (**current stable**)| 2026-04-13 | 3.x | [tag v2.2.48](https://github.com/swagger-api/swagger-core/tree/v2.2.48) | Supported
26+
2.2.49 (**current stable**)| 2026-04-28 | 3.x | [tag v2.2.49](https://github.com/swagger-api/swagger-core/tree/v2.2.49) | Supported
27+
2.2.48 | 2026-04-13 | 3.x | [tag v2.2.48](https://github.com/swagger-api/swagger-core/tree/v2.2.48) | Supported
2728
2.2.47 | 2026-04-09 | 3.x | [tag v2.2.47](https://github.com/swagger-api/swagger-core/tree/v2.2.47) | Supported
2829
2.2.46 | 2026-03-31 | 3.x | [tag v2.2.46](https://github.com/swagger-api/swagger-core/tree/v2.2.46) | Supported
2930
2.2.45 | 2026-03-09 | 3.x | [tag v2.2.45](https://github.com/swagger-api/swagger-core/tree/v2.2.45) | Supported
@@ -141,7 +142,7 @@ You need the following installed and available in your $PATH:
141142
* Jackson 2.4.5 or greater
142143

143144

144-
### To build from source (currently 2.2.49-SNAPSHOT)
145+
### To build from source (currently 2.2.50-SNAPSHOT)
145146
```
146147
# first time building locally
147148
mvn -N

modules/swagger-annotations/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.swagger.core.v3</groupId>
55
<artifactId>swagger-project</artifactId>
6-
<version>2.2.49-SNAPSHOT</version>
6+
<version>2.2.50-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

modules/swagger-bom-integration-test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.swagger.core.v3</groupId>
77
<artifactId>swagger-project</artifactId>
8-
<version>2.2.49-SNAPSHOT</version>
8+
<version>2.2.50-SNAPSHOT</version>
99
<relativePath>../..</relativePath>
1010
</parent>
1111

modules/swagger-bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>io.swagger.core.v3</groupId>
66
<artifactId>swagger-bom</artifactId>
7-
<version>2.2.49-SNAPSHOT</version>
7+
<version>2.2.50-SNAPSHOT</version>
88
<packaging>pom</packaging>
99

1010
<name>swagger-bom</name>

modules/swagger-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.swagger.core.v3</groupId>
55
<artifactId>swagger-project</artifactId>
6-
<version>2.2.49-SNAPSHOT</version>
6+
<version>2.2.50-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,14 @@
6868
import javax.validation.constraints.DecimalMin;
6969
import javax.validation.constraints.Max;
7070
import javax.validation.constraints.Min;
71+
import javax.validation.constraints.Negative;
72+
import javax.validation.constraints.NegativeOrZero;
7173
import javax.validation.constraints.NotBlank;
7274
import javax.validation.constraints.NotEmpty;
7375
import javax.validation.constraints.NotNull;
7476
import javax.validation.constraints.Pattern;
77+
import javax.validation.constraints.Positive;
78+
import javax.validation.constraints.PositiveOrZero;
7579
import javax.validation.constraints.Size;
7680
import javax.xml.bind.annotation.XmlAccessType;
7781
import javax.xml.bind.annotation.XmlAccessorType;
@@ -1898,6 +1902,34 @@ protected boolean applyBeanValidatorAnnotations(Schema property, Annotation[] an
18981902
modified = ValidationAnnotationsUtils.applyEmailConstraint(property, email) || modified;
18991903
}
19001904
}
1905+
if (annos.containsKey(JAVAX_POSITIVE)) {
1906+
Positive positive = (Positive) annos.get(JAVAX_POSITIVE);
1907+
boolean apply = checkGroupValidation(positive.groups(), invocationGroups, acceptNoGroups);
1908+
if (apply) {
1909+
modified = ValidationAnnotationsUtils.applyPositiveConstraint(property) || modified;
1910+
}
1911+
}
1912+
if (annos.containsKey(JAVAX_POSITIVE_OR_ZERO)) {
1913+
PositiveOrZero positiveOrZero = (PositiveOrZero) annos.get(JAVAX_POSITIVE_OR_ZERO);
1914+
boolean apply = checkGroupValidation(positiveOrZero.groups(), invocationGroups, acceptNoGroups);
1915+
if (apply) {
1916+
modified = ValidationAnnotationsUtils.applyPositiveOrZeroConstraint(property) || modified;
1917+
}
1918+
}
1919+
if (annos.containsKey(JAVAX_NEGATIVE)) {
1920+
Negative negative = (Negative) annos.get(JAVAX_NEGATIVE);
1921+
boolean apply = checkGroupValidation(negative.groups(), invocationGroups, acceptNoGroups);
1922+
if (apply) {
1923+
modified = ValidationAnnotationsUtils.applyNegativeConstraint(property) || modified;
1924+
}
1925+
}
1926+
if (annos.containsKey(JAVAX_NEGATIVE_OR_ZERO)) {
1927+
NegativeOrZero negativeOrZero = (NegativeOrZero) annos.get(JAVAX_NEGATIVE_OR_ZERO);
1928+
boolean apply = checkGroupValidation(negativeOrZero.groups(), invocationGroups, acceptNoGroups);
1929+
if (apply) {
1930+
modified = ValidationAnnotationsUtils.applyNegativeOrZeroConstraint(property) || modified;
1931+
}
1932+
}
19011933
if (validatorProcessor != null && validatorProcessor.getMode().equals(ValidatorProcessor.MODE.AFTER)) {
19021934
modified = validatorProcessor.applyBeanValidatorAnnotations(property, annotations, parent, applyNotNullAnnotations) || modified;
19031935
}
@@ -1961,6 +1993,18 @@ protected boolean applyBeanValidatorAnnotationsNoGroups(Schema property, Annotat
19611993
Email pattern = (Email) annos.get(JAVAX_EMAIL);
19621994
modified = ValidationAnnotationsUtils.applyEmailConstraint(property, pattern) || modified;
19631995
}
1996+
if (annos.containsKey(JAVAX_POSITIVE)) {
1997+
modified = ValidationAnnotationsUtils.applyPositiveConstraint(property) || modified;
1998+
}
1999+
if (annos.containsKey(JAVAX_POSITIVE_OR_ZERO)) {
2000+
modified = ValidationAnnotationsUtils.applyPositiveOrZeroConstraint(property) || modified;
2001+
}
2002+
if (annos.containsKey(JAVAX_NEGATIVE)) {
2003+
modified = ValidationAnnotationsUtils.applyNegativeConstraint(property) || modified;
2004+
}
2005+
if (annos.containsKey(JAVAX_NEGATIVE_OR_ZERO)) {
2006+
modified = ValidationAnnotationsUtils.applyNegativeOrZeroConstraint(property) || modified;
2007+
}
19642008
return modified;
19652009
}
19662010

modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -938,13 +938,18 @@ private static boolean shouldUseNodeAsExample(JsonNode node, Schema schemaObject
938938
if (node.isObject() || node.isArray()) {
939939
return true;
940940
}
941-
if (schemaObject != null && SchemaTypeUtils.isNumberSchema(schemaObject)) {
942-
return true;
943-
}
944-
if (schemaObject != null && SchemaTypeUtils.isStringSchema(schemaObject)) {
945-
return false;
941+
if (schemaObject != null) {
942+
if (SchemaTypeUtils.isNumberSchema(schemaObject)) {
943+
return true;
944+
}
945+
if (SchemaTypeUtils.isBooleanSchema(schemaObject)) {
946+
return true;
947+
}
948+
if (SchemaTypeUtils.isStringSchema(schemaObject)) {
949+
return false;
950+
}
946951
}
947-
return node.isNumber();
952+
return node.isNumber() || node.isBoolean();
948953
}
949954

950955
private static void setDefaultSchema(io.swagger.v3.oas.annotations.media.Schema schema, boolean openapi31, Schema schemaObject) {

modules/swagger-core/src/main/java/io/swagger/v3/core/util/ReflectionUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ private static void collectAnnotatedMethodsFromInterfaces(Class<?> type, Class<?
506506

507507
private static void collectAnnotatedDeclaredMethods(Class<?> cls, Class<? extends Annotation> annotation, List<Method> methods) {
508508
for (Method method : cls.getDeclaredMethods()) {
509-
if (method.isAnnotationPresent(annotation)) {
509+
if (!method.isBridge() && method.isAnnotationPresent(annotation)) {
510510
methods.add(method);
511511
}
512512
}

0 commit comments

Comments
 (0)