fix: calculate sibling properties based upon whether the schema is the array or the item in the array#5055
Merged
ewaostrowska merged 2 commits intoswagger-api:masterfrom Feb 26, 2026
Conversation
51e248b to
0dd5d47
Compare
… array or the item in the array
0dd5d47 to
099b8dd
Compare
Contributor
|
Hi @Mattias-Sehlstedt! |
ewaostrowska
approved these changes
Feb 26, 2026
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
Fixes: #5051
I have formalized the extra schema-annotation check that is done for a 3.1. specification. This check is done to properly add sibling properties (e.g., adding a description together with the
#ref).We now only expect one of the three different annotation scenarios to have an effect (being
schemaAnnotation,schemaAnnotationwithin thearrayAnnotation, or thearrayAnnotationitself). The basis for this being that they are mutually exclusive. We either have aSchema-annotation or anArraySchema-annotation. The second scenario was not handled before, but is now considered and supported.This change prevents the data leakage that occurred before due to the
arraySchema-annotation being applied to the object within the array.We can also see that this fixed a data leakage issue that occurred in the test for ModelWithArrayOfSubclasses, where the list properties ("description", "minItems", "uniqueItems") where also placed on the list object too.
This:
Should be this
Since the annotation is:
I also took the opportunity to adjust the test introduced with Mattias-Sehlstedt@0a5556a so that the expected json-definitions are placed in the resource folder like how it is with most tests.
Type of Change
Checklist
Screenshots / Additional Context