Skip to content

Commit 2a359b5

Browse files
committed
Merge branch 'master' into fix-annotation-utils-cache-misses
2 parents 0f4e682 + 0e21bff commit 2a359b5

35 files changed

Lines changed: 1118 additions & 146 deletions

File tree

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.45 (**current stable**)| 2026-03-09 | 3.x | [tag v2.2.45](https://github.com/swagger-api/swagger-core/tree/v2.2.45) | Supported
26+
2.2.46 (**current stable**)| 2026-03-31 | 3.x | [tag v2.2.46](https://github.com/swagger-api/swagger-core/tree/v2.2.46) | Supported
27+
2.2.45 | 2026-03-09 | 3.x | [tag v2.2.45](https://github.com/swagger-api/swagger-core/tree/v2.2.45) | Supported
2728
2.2.44 | 2026-03-03 | 3.x | [tag v2.2.44](https://github.com/swagger-api/swagger-core/tree/v2.2.44) | Supported
2829
2.2.43 | 2026-02-17 | 3.x | [tag v2.2.43](https://github.com/swagger-api/swagger-core/tree/v2.2.43) | Supported
2930
2.2.42 | 2026-01-19 | 3.x | [tag v2.2.42](https://github.com/swagger-api/swagger-core/tree/v2.2.42) | Supported
@@ -138,7 +139,7 @@ You need the following installed and available in your $PATH:
138139
* Jackson 2.4.5 or greater
139140

140141

141-
### To build from source (currently 2.2.46-SNAPSHOT)
142+
### To build from source (currently 2.2.47-SNAPSHOT)
142143
```
143144
# first time building locally
144145
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.46-SNAPSHOT</version>
6+
<version>2.2.47-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

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.46-SNAPSHOT</version>
6+
<version>2.2.47-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: 82 additions & 76 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ public static Optional<Schema> getSchemaFromAnnotation(
786786
schemaObject.setExamples(parseExamplesArray(schema));
787787
}
788788

789-
if (!DEFAULT_SENTINEL.equals(schema.defaultValue())){
789+
if (schema.defaultValue() != null && !DEFAULT_SENTINEL.equals(schema.defaultValue())) {
790790
setDefaultSchema(schema, openapi31, schemaObject);
791791
}
792792
if (StringUtils.isNotBlank(schema.example()) &&

modules/swagger-core/src/test/java/io/swagger/v3/core/converting/ArrayOfSubclassTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import io.swagger.v3.core.converter.ModelConverters;
44
import io.swagger.v3.core.converter.ResolvedSchema;
55
import io.swagger.v3.core.oas.models.ModelWithArrayOfSubclasses;
6+
import io.swagger.v3.core.util.Json;
67
import io.swagger.v3.core.util.Json31;
78

89
import static org.testng.Assert.assertEquals;
910
import static org.testng.Assert.assertNotNull;
11+
12+
import io.swagger.v3.core.util.ResourceUtils;
1013
import org.testng.annotations.Test;
1114

12-
import java.nio.file.Files;
13-
import java.nio.file.Paths;
1415
import com.fasterxml.jackson.databind.ObjectMapper;
1516
import com.fasterxml.jackson.databind.JsonNode;
1617

@@ -21,7 +22,7 @@ public class ArrayOfSubclassTest {
2122
public void extractSubclassArray_oas31() throws Exception {
2223
ResolvedSchema schema = ModelConverters.getInstance(true).readAllAsResolvedSchema(ModelWithArrayOfSubclasses.Holder.class);
2324
assertNotNull(schema);
24-
String expectedJson = new String(Files.readAllBytes(Paths.get("src/test/resources/converting/ArrayOfSubclassTest_expected31.json")));
25+
String expectedJson = ResourceUtils.loadClassResource(getClass(), "converting/ArrayOfSubclassTest_expected31.json");
2526
String actualJson = Json31.pretty(schema);
2627
ObjectMapper mapper = new ObjectMapper();
2728
JsonNode expectedNode = mapper.readTree(expectedJson);
@@ -33,8 +34,8 @@ public void extractSubclassArray_oas31() throws Exception {
3334
public void extractSubclassArray_oas30() throws Exception {
3435
ResolvedSchema schema = ModelConverters.getInstance(false).readAllAsResolvedSchema(ModelWithArrayOfSubclasses.Holder.class);
3536
assertNotNull(schema);
36-
String expectedJson = new String(Files.readAllBytes(Paths.get("src/test/resources/converting/ArrayOfSubclassTest_expected30.json")));
37-
String actualJson = Json31.pretty(schema);
37+
String expectedJson = ResourceUtils.loadClassResource(getClass(), "converting/ArrayOfSubclassTest_expected30.json");
38+
String actualJson = Json.pretty(schema);
3839
ObjectMapper mapper = new ObjectMapper();
3940
JsonNode expectedNode = mapper.readTree(expectedJson);
4041
JsonNode actualNode = mapper.readTree(actualJson);

modules/swagger-core/src/test/java/io/swagger/v3/core/issues/Issue5001Test.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import io.swagger.v3.core.converter.AnnotatedType;
44
import io.swagger.v3.core.converter.ModelConverterContextImpl;
5+
import io.swagger.v3.core.converter.ModelConverters;
6+
import io.swagger.v3.core.converter.ResolvedSchema;
57
import io.swagger.v3.core.jackson.ModelResolver;
68
import io.swagger.v3.core.util.Configuration;
79
import io.swagger.v3.core.util.Json;
@@ -10,6 +12,7 @@
1012
import org.testng.annotations.Test;
1113

1214
import javax.annotation.Nullable;
15+
import java.util.List;
1316
import java.util.Set;
1417

1518
import static org.testng.Assert.*;
@@ -18,11 +21,11 @@
1821
* Reproduces GitHub Issue #5001
1922
* Native support for @Nullable annotations to generate proper nullable types
2023
*
21-
* Tests that @Nullable annotation is recognized and generates appropriate nullable output:
24+
* <p>Tests that @Nullable annotation is recognized and generates appropriate nullable output:
2225
* - OAS 3.0: nullable keyword
2326
* - OAS 3.1: type array with "null"
2427
*
25-
* Note: This test uses javax.annotation.Nullable which is automatically transformed to
28+
* <p>Note: This test uses javax.annotation.Nullable which is automatically transformed to
2629
* jakarta.annotation.Nullable in the swagger-core-jakarta module via the Eclipse Transformer.
2730
*
2831
* @see <a href="https://github.com/swagger-api/swagger-core/issues/5001">...</a>
@@ -33,7 +36,7 @@ public class Issue5001Test {
3336
* Tests @Nullable annotation with OAS 3.1 (type array output)
3437
*/
3538
@Test
36-
public void testNullableWithOAS31() throws Exception {
39+
public void testNullableWithOAS31() {
3740
final ModelResolver modelResolver = new ModelResolver(Json31.mapper());
3841
Configuration configuration = new Configuration();
3942
configuration.setOpenAPI31(true);
@@ -72,7 +75,7 @@ public void testNullableWithOAS31() throws Exception {
7275
* Tests @Nullable annotation with OAS 3.0 (nullable keyword output)
7376
*/
7477
@Test
75-
public void testNullableWithOAS30() throws Exception {
78+
public void testNullableWithOAS30() {
7679
final ModelResolver modelResolver = new ModelResolver(Json.mapper());
7780
Configuration configuration = new Configuration();
7881
configuration.setOpenAPI31(false);
@@ -103,7 +106,7 @@ public void testNullableWithOAS30() throws Exception {
103106
* Tests explicit @Schema annotations with OAS 3.1
104107
*/
105108
@Test
106-
public void testExplicitSchemaAnnotationsWithOAS31() throws Exception {
109+
public void testExplicitSchemaAnnotationsWithOAS31() {
107110
final ModelResolver modelResolver = new ModelResolver(Json31.mapper());
108111
Configuration configuration = new Configuration();
109112
configuration.setOpenAPI31(true);

0 commit comments

Comments
 (0)