Skip to content

Conversation

K5qu4r3d
Copy link

@K5qu4r3d K5qu4r3d commented Oct 7, 2025

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 PrimitiveType OpenAPI 3.1 schemas used in @ApiResponse content schema implementations are incorrectly cast to type "string" instead of properly-defined types.

Problem

For each enum in PrimitiveType, their createProperty31() method sets the value for only field type and not types.

Solution

Updated createProperty31() to set a value for field types. A new test class APIResponsesResourceTest verifies that the resulting schema's type and types field values match for each class defined in @Schema(implementation = ...).

Relevant issue

Fixes: #4963

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor (non-breaking change)
  • 🧪 Tests
  • 📝 Documentation
  • 🧹 Chore (build or tooling)

Checklist

  • I have added/updated tests as needed
  • I have added/updated documentation where applicable
  • The PR title is descriptive
  • The code builds and passes tests locally
  • I have linked related issues (if any)

Screenshots / Additional Context

  • Added files:

    • modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/resources/APIResponsesResource.java
    • modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/APIResponsesResourceTest.java
  • Affected files:

    • modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java
    • modules/swagger-core/src/main/java/io/swagger/v3/core/util/PrimitiveType.java
    • modules/swagger-java17-support/src/test/java/io/swagger/v3/java17/resolving/v31/ModelResolverOAS31Test.java
    • modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/Ticket2992Test.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Primitive boxed type schemas used in @ApiResponse content schema implementations are incorrectly cast to string

2 participants