Skip to content

fix: OAS 3.1 schema generation for raw Object properties is controlled with explicit-object-schema flag#5112

Open
Mattias-Sehlstedt wants to merge 1 commit intoswagger-api:masterfrom
Mattias-Sehlstedt:java-object-is-only-set-to-type-object-if-flag-is-true
Open

fix: OAS 3.1 schema generation for raw Object properties is controlled with explicit-object-schema flag#5112
Mattias-Sehlstedt wants to merge 1 commit intoswagger-api:masterfrom
Mattias-Sehlstedt:java-object-is-only-set-to-type-object-if-flag-is-true

Conversation

@Mattias-Sehlstedt
Copy link
Copy Markdown
Contributor

Pull Request

Thank you for contributing to swagger-core!

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


Description

Reverts changes from #5034 and restores the default resolving behavior for an OAS 3.1 Java Object to an empty type rather than type object.

Adds tests to highlight that such a resolving logic should be achieved by setting the explicit-object-schema flag to true.

Fixes: #5111

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

@Override
public Schema createProperty31() {
return explicitObjectType == null || explicitObjectType ? new JsonSchema().typesItem("object") : new JsonSchema();
return Boolean.TRUE.equals(explicitObjectType) ? new JsonSchema().typesItem("object") : new JsonSchema();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change where null is changed from true to false

@Mattias-Sehlstedt Mattias-Sehlstedt force-pushed the java-object-is-only-set-to-type-object-if-flag-is-true branch from ea4f967 to a693594 Compare April 7, 2026 19:29
@Mattias-Sehlstedt Mattias-Sehlstedt force-pushed the java-object-is-only-set-to-type-object-if-flag-is-true branch from a693594 to 8141257 Compare April 7, 2026 19:30
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]: A Java raw Object is always resolved to OAS 3.1 object

1 participant