Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f4884c4
fix: verify Schema object getTypes() is not null or empty
K5qu4r3d Sep 24, 2025
debfed1
fix: add type values to all PrimitiveType JSON schemas
K5qu4r3d Sep 24, 2025
7c0a6af
fix: remove "type" and "types" value declarations from OBJECT enum
K5qu4r3d Sep 25, 2025
4baa804
Revert "fix: remove "type" and "types" value declarations from OBJECT…
K5qu4r3d Sep 26, 2025
e8cfe79
fix: fix existing test cases
K5qu4r3d Sep 26, 2025
5c655c6
Merge branch 'master' into bug/4963-fix-schema-primitive-boxed-type-cast
K5qu4r3d Sep 29, 2025
02179c1
fix: fix existing test cases pt. 2
K5qu4r3d Sep 30, 2025
23253a2
fix: update access modifier of class PrimitiveType.DateStub
K5qu4r3d Sep 30, 2025
26ab407
test: add test cases for updated OpenAPI 3.1 "type"/"types" value sch…
K5qu4r3d Oct 3, 2025
ecb8929
fix: update type values for date/time 3.1 schemas
K5qu4r3d Oct 3, 2025
b7791fa
Merge branch 'master' into bug/4963-fix-schema-primitive-boxed-type-cast
K5qu4r3d Oct 7, 2025
e4d7b45
fix: add "LocalTime" class mappings for PARTIAL_TIME
K5qu4r3d Oct 7, 2025
75bc935
fix: remove duplicate "LocalTime" model from expected YAML
K5qu4r3d Oct 7, 2025
935dacd
fix: convert APIResponsesResourceTest to parameterized test
K5qu4r3d Oct 8, 2025
1e1711a
Merge branch 'master' into bug/4963-fix-schema-primitive-boxed-type-cast
daniel-kmiecik Oct 10, 2025
1f0d050
Merge branch 'master' into bug/4963-fix-schema-primitive-boxed-type-cast
daniel-kmiecik Oct 14, 2025
cecddf1
fix: remove unnecessary comment
K5qu4r3d Nov 3, 2025
e6beba3
fix: remove enablePartialTime() call
K5qu4r3d Nov 3, 2025
c0da882
fix: rename variable for clarity
K5qu4r3d Nov 3, 2025
3b6d4a8
fix: verify Schema object getTypes() is not null or empty
K5qu4r3d Sep 24, 2025
156a10e
fix: add type values to all PrimitiveType JSON schemas
K5qu4r3d Sep 24, 2025
860c635
fix: remove "type" and "types" value declarations from OBJECT enum
K5qu4r3d Sep 25, 2025
d5004be
Revert "fix: remove "type" and "types" value declarations from OBJECT…
K5qu4r3d Sep 26, 2025
a2ab147
fix: fix existing test cases
K5qu4r3d Sep 26, 2025
fd8ad9f
fix: fix existing test cases pt. 2
K5qu4r3d Sep 30, 2025
dfbbc62
fix: update access modifier of class PrimitiveType.DateStub
K5qu4r3d Sep 30, 2025
e5f7312
test: add test cases for updated OpenAPI 3.1 "type"/"types" value sch…
K5qu4r3d Oct 3, 2025
1f1a35b
fix: update type values for date/time 3.1 schemas
K5qu4r3d Oct 3, 2025
a7242fe
fix: add "LocalTime" class mappings for PARTIAL_TIME
K5qu4r3d Oct 7, 2025
524b75d
fix: remove duplicate "LocalTime" model from expected YAML
K5qu4r3d Oct 7, 2025
7f833df
fix: convert APIResponsesResourceTest to parameterized test
K5qu4r3d Oct 8, 2025
81ab38b
fix: remove unnecessary comment
K5qu4r3d Nov 3, 2025
d09b729
fix: remove enablePartialTime() call
K5qu4r3d Nov 3, 2025
47009dd
fix: rename variable for clarity
K5qu4r3d Nov 3, 2025
a29a3d9
Merge remote-tracking branch 'origin/bug/4963-fix-schema-primitive-bo…
K5qu4r3d Nov 12, 2025
09b194a
test: update APIResponsesResourceTest to cover for null type
K5qu4r3d Nov 14, 2025
de6ecf5
Merge branch 'master' into bug/4963-fix-schema-primitive-boxed-type-cast
ewaostrowska Nov 20, 2025
3af388b
remove logic setting schema.type for oas 31
ewaostrowska Aug 27, 2026
0259332
Merge branch 'master' into bug/4963-fix-schema-primitive-boxed-type-cast
ewaostrowska Aug 27, 2026
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 @@ -1079,7 +1079,10 @@ public static Schema resolveSchemaFromType(Class<?> schemaImplementation,
existingSchemaObject = reResolvedSchema.get();
}
}
if (StringUtils.isBlank(existingSchemaObject.get$ref()) && StringUtils.isBlank(existingSchemaObject.getType())) {
boolean doesSchemaHaveNullOrEmptyTypes = existingSchemaObject.getTypes() == null || existingSchemaObject.getTypes().isEmpty();
if (StringUtils.isBlank(existingSchemaObject.get$ref())
&& StringUtils.isBlank(existingSchemaObject.getType())
&& doesSchemaHaveNullOrEmptyTypes) {
// default to string
existingSchemaObject.setType("string");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.swagger.v3.jaxrs2;

import io.swagger.v3.jaxrs2.matchers.SerializationMatchers;
import io.swagger.v3.jaxrs2.resources.APIResponsesResource;
import io.swagger.v3.oas.integration.SwaggerConfiguration;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema;
import org.testng.annotations.Test;

import java.util.Collections;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;

public class APIResponsesResourceTest {

@Test
public void testBooleanResponseSchema31() {
OpenAPI openAPI = new Reader(new SwaggerConfiguration().openAPI31(true))
.read(APIResponsesResource.class);

Schema responseSchema = openAPI.getPaths()
.get("/mypath")
.getPost()
.getResponses()
.get("200")
.getContent()
.get("*/*")
.getSchema();

assertNull(responseSchema.getType());
assertEquals(responseSchema.getTypes(), Collections.singleton("boolean"));
SerializationMatchers.assertEqualsToJson31(responseSchema, "{\"type\":\"boolean\"}");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.swagger.v3.jaxrs2.resources;

import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

import javax.ws.rs.POST;
import javax.ws.rs.Path;

@Path("mypath")
public class APIResponsesResource {

@POST
@ApiResponses({
@ApiResponse(
responseCode = "200",
content = @Content(schema = @Schema(implementation = Boolean.class))
)
})
public void myMethod() {
}
}
Loading