Skip to content

Fix #3431: preserve schemas containing Jackson 3 JsonNode and ObjectNode - #3440

Closed
nadunmA wants to merge 1 commit into
springdoc:mainfrom
nadunmA:fix/3431-jackson3-node-schema
Closed

nadunmA wants to merge 1 commit into
springdoc:mainfrom
nadunmA:fix/3431-jackson3-node-schema

Conversation

@nadunmA

@nadunmA nadunmA commented Nov 14, 2026

Copy link
Copy Markdown

Fixes #3431

Summary

  • Registered tools.jackson.databind.JsonNode alongside ObjectNode as an ObjectSchema replacement in SpringDocConfiguration.
  • Added AdditionalModelsConverter.isModelReplaced(Class<?>) and skipped bean property introspection in PolymorphicModelConverter when a type already has a registered schema or class replacement, preventing Jackson 3 JsonNode/ObjectNode types from dropping enclosing model schemas.
  • Added test coverage for JsonNode fields in Jackson3EnvelopeTest.

@bnasslahsen

Copy link
Copy Markdown
Collaborator

Thanks for the contribution and the clear description. #3431 is already fixed on main by the move to swagger-core 3.0 (Jackson 3), which will ship in 3.2.1: the three shapes from the issue (Wrapper<List<Item>>, Wrapper<Item> and a model with an ObjectNode field) keep their schemas, with the node documented as type: object.

We can't merge this change as it is:

  • Skipping PolymorphicModelConverter for every replaced type also skips the class a type is replaced with. With replaceWithClass(LegacyPet.class, Pet.class) and a polymorphic Pet, the property loses its oneOf of subtypes.
  • A JsonNode can be any JSON value, not only an object. It is currently documented as an unconstrained schema, which is more accurate than type: object.

So I'm closing this one, but thanks again for looking into it.

@nadunmA

nadunmA commented Nov 15, 2026

Copy link
Copy Markdown
Author

Makes complete sense. Thank you for the clear explanation and review!

@nadunmA
nadunmA deleted the fix/3431-jackson3-node-schema branch November 15, 2026 03:10
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.

Upgrade to swagger-core 3.0 (Jackson 3): schemas containing a tools.jackson node are dropped, more of them since 3.1.1

2 participants