fix: correct sibling logic when reading type from schema annotation#5240
Open
Mattias-Sehlstedt wants to merge 1 commit into
Open
fix: correct sibling logic when reading type from schema annotation#5240Mattias-Sehlstedt wants to merge 1 commit into
Mattias-Sehlstedt wants to merge 1 commit into
Conversation
Mattias-Sehlstedt
force-pushed
the
sibling-logic
branch
from
July 17, 2026 11:15
1fe20db to
8407b7e
Compare
Mattias-Sehlstedt
force-pushed
the
sibling-logic
branch
from
July 20, 2026 15:43
8407b7e to
43e89d2
Compare
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.
Pull Request
Thank you for contributing to swagger-core!
Please fill out the following information to help us review your PR efficiently.
Description
Introduces an intermediate fix for the issue reported in #5235. It does not implement fully fleshed type handling (overriding), but rather implements the smallest change possible while still keeping the previous behavior of being able to set
AnnotationType's type toString.Since this changes how
@Schema(type = )is read (thetypeis now not taken into consideration when resolving to OAS 3.1 in certain scenarios) it could be considered a breaking change. The fallback is to use@Schema(types = )when resolving to OAS 3.1. See later parts of comment for a reasoning regarding why the application should not try to coerce the types into each other between OAS 3.0 and OAS 3.1, and that they should instead be unaware about each other.A more extensive fix would be to clarify that this branching is not tied to sibling logic, but rather type coercion. But in order to implement that one would need to reason alot of what is the sought after behavior, especially for OAS 3.1 where there is several types with
@Schema(types = {"boolean", "string"}). But all of this is considered out of scope for an immediate fix.A known "bug" (that exists since before too) is that the underlying type might still leak data. For example with
becoming
{ "count": { "type": "boolean", "format": "int32" } }. This occurs since the
AnnotatedTypedoes not release the fieldIntegertype when the user specifiesboolean. And thus theformatis still derived and present from resolving the schema-primitiveInteger. But this is as previously stated more so tied to introducing full type overriding functionality.Fixes: #5235
Type of Change
Checklist