[Backport #2024 to 5.x] fix: remove consumed annotations from analysis registry#2025
Closed
github-actions[bot] wants to merge 1 commit into
Closed
[Backport #2024 to 5.x] fix: remove consumed annotations from analysis registry#2025github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Contributor
Author
|
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-2024-to-5.x
git worktree add --checkout .worktree/backport-2024-to-5.x backport-2024-to-5.x
cd .worktree/backport-2024-to-5.x
git reset --hard HEAD^
git cherry-pick -x 060af3bb9c4cba6a5859aba2c51cd1c129479410 |
2 tasks
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.
Automated backport of #2024 to branch
5.x.Summary
Analysis::removeAnnotation()as a proper API for removing annotations from the analysis registry — removes from bothSplObjectStorageand$context->annotationsarray (full inverse ofaddAnnotation)MergeJsonContentandMergeXmlContentnow fully clean up after consuming annotations:_contextto reflect the new parent (MediaType), so tree-walking validation sees the annotation in the correct location$analysis->annotations->offsetUnset()calls across processors (AugmentRefs,AugmentTags,BuildPaths,MergeIntoOpenApi) with the new method for consistencyBackground
After converting
JsonContentintoMediaType+ schema, the processor removed it from$parent->_unmergedbut:SplObjectStorageand$context->annotations_context->nestedpointing at the old parentWhen validation walks the tree via
collectAnnotations(), it finds theJsonContent(reused asMediaType->schema) and validates it. With the stale context, this could produce spurious "Unexpected @OA\JsonContent()" warnings — particularly for annotations created dynamically by processors.Test plan
JsonContent/XmlContentwarnings with dynamically-created annotations (openapi-extras integration)🤖 Generated with Claude Code