Skip to content

Conversation

@xeulbn
Copy link

@xeulbn xeulbn commented Jan 10, 2026

Pull Request

Thank you for contributing to swagger-core!

Please fill out the following information to help us review your PR efficiently.


Description

Related issue: #4682
This PR fixes an issue in OpenAPI 3.1 schema generation where properties
declared as raw Java Object are rendered as an empty schema ({}),
instead of an explicit object schema.

The issue does not occur in OAS 3.0.x, but appears in OAS 3.1 due to the
JSON Schema–based handling of types, where Schema#getTypes() is used
instead of Schema#getType() during serialization.

To address this, the OAS 3.1 schema generation for raw Object types
has been updated to explicitly set types = ["object"].

Additionally, regression tests have been added to cover:

  • raw Object properties
  • List<Object> item schemas
  • Map<String, Object> additionalProperties schemas

Fixes: #4682

Type of Change

  • 🐛 Bug fix
  • 🧪 Tests

Checklist

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

Screenshots / Additional Context

The tests were executed locally with:

mvn -pl modules/swagger-core -Dtest=ObjectFieldOas31ReproTest test

Before (OAS 3.1)

Before

After (OAS 3.1)

After

@xeulbn xeulbn changed the title Fix OAS 3.1 schema generation for raw Object properties fix : OAS 3.1 schema generation for raw Object properties Jan 10, 2026
@xeulbn xeulbn changed the title fix : OAS 3.1 schema generation for raw Object properties fix: OAS 3.1 schema generation for raw Object properties Jan 10, 2026
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 properties of type Object do not have any type information when generating open api 3.1.0

1 participant