fix: resolve PrimitiveType casting for OpenAPI 3.1 schemas (#4963)#4989
Open
K5qu4r3d wants to merge 37 commits intoswagger-api:masterfrom
Open
fix: resolve PrimitiveType casting for OpenAPI 3.1 schemas (#4963)#4989K5qu4r3d wants to merge 37 commits intoswagger-api:masterfrom
K5qu4r3d wants to merge 37 commits intoswagger-api:masterfrom
Conversation
… enum" This reverts commit 7c0a6af.
modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/APIResponsesResourceTest.java
Outdated
Show resolved
Hide resolved
ewaostrowska
requested changes
Oct 17, 2025
modules/swagger-core/src/main/java/io/swagger/v3/core/util/PrimitiveType.java
Outdated
Show resolved
Hide resolved
modules/swagger-core/src/main/java/io/swagger/v3/core/util/PrimitiveType.java
Outdated
Show resolved
Hide resolved
modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java
Outdated
Show resolved
Hide resolved
modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/ReaderTest.java
Show resolved
Hide resolved
ewaostrowska
approved these changes
Nov 12, 2025
… enum" This reverts commit 7c0a6af.
15665a4 to
13e287a
Compare
5af7e9b to
47009dd
Compare
Contributor
|
There are still some failing tests in |
…xed-type-cast' into bug/4963-fix-schema-primitive-boxed-type-cast
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Thank you for contributing to swagger-core!
Please fill out the following information to help us review your PR efficiently.
Description
This PR fixes an issue where
PrimitiveTypeOpenAPI 3.1 schemas used in@ApiResponsecontent schema implementations are incorrectly cast to type"string"instead of properly-defined types.Problem
For each enum in
PrimitiveType, theircreateProperty31()method sets the value for only fieldtypeand nottypes.Solution
Updated
createProperty31()to set a value for fieldtypes. A new test classAPIResponsesResourceTestverifies that the resulting schema'stypeandtypesfield values match for each class defined in@Schema(implementation = ...).Relevant issue
Fixes: #4963
Type of Change
Checklist
Screenshots / Additional Context
Added files:
modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/APIResponsesResource.javamodules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/APIResponsesResourceTest.javaAffected files:
modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.javamodules/swagger-core/src/main/java/io/swagger/v3/core/util/PrimitiveType.javamodules/swagger-java17-support/src/test/java/io/swagger/v3/java17/resolving/v31/ModelResolverOAS31Test.javamodules/swagger-core/src/test/java/io/swagger/v3/core/resolving/Ticket2992Test.java