Repository navigation
Fix JsonSchema cloning after early Swagger schema resolution - #3396
Merged
bnasslahsen merged 1 commit intoNov 4, 2026
Merged
Conversation
Read scalar OpenAPI 3.1 types with a per-read Jackson setting when cloning JsonSchema through the shared Swagger mapper. Preserve mapper configuration and avoid modifying the original schema when parameter constraints are applied. Fixes springdoc#3395
bnasslahsen
added a commit
that referenced
this pull request
Nov 4, 2026
KotlinNullablePropertyCustomizer (#3399) introspects through the serialization context, as Jackson 3 removed SerializationConfig.introspect. ObjectMapperProviderCompatibilityTest (#3396) registers its naming strategy as a mapper customizer, as Jackson 3 mappers are immutable, and the app27 test uses the Jackson 3 naming annotations. Signed-off-by: Badr NASS LAHSEN <badr.nasslahsen@gmail.com>
bnasslahsen
added a commit
that referenced
this pull request
Nov 4, 2026
Copy the user's OpenAPI bean, the servers, schemas and API responses with the exact deep copy of swagger-core 3.0.0 instead of a JSON round trip, which lost the state that is not serialized and needed the workaround of #3396 for OpenAPI 3.1 schemas. cloneViaJson stays for other objects. RequestSchemaCloningTest now checks that the copy is independent and keeps the schema state, rather than the Jackson 2 deserializer cache. Signed-off-by: Badr NASS LAHSEN <badr.nasslahsen@gmail.com>
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.
When swagger-core resolves a schema before
ObjectMapperProvideris initialized, Jackson can cache aJsonSchemadeserializer withoutSchemaTypeMixin. Cloning a schema with a scalartypethen fails and returns the original instance, allowing parameter validation constraints to modify a shared schema.Enable
ACCEPT_SINGLE_VALUE_AS_ARRAYon anObjectReaderforJsonSchemaclass targets using the sharedJson31.mapper(). The setting applies to that read while preserving mapper configuration, schema runtime types, and the existing behavior of separate custom mappers.Regression tests warm a real deserializer before provider initialization, verify that
@Minapplies to an independent clone for OpenAPI 3.0 and 3.1, and cover mapper customization compatibility and the unchanged global feature setting.Validation:
Tested source commit:
7d47c97c743dc49ff48474eeb76efca1d2724e63.Fixes #3395