fix(Assembler): say what to do about an ambiguous merge - #2222
Merged
Merged
Conversation
The message named the problem and stopped there. An author who stacks a header beside two responses is told their attribute matches multiple siblings, which is accurate and leaves them nowhere: the resolutions are to nest it in the one it belongs to, or to give it a `component` and reference it from each, and neither is obvious from the wording. Found migrating a real codebase, where this is the single reason a converted project loses most of its paths, and where it fires ten times in twenty-two files. It is not a migration-specific problem though -- the same message reaches anyone writing spec attributes by hand -- so the hint belongs in the diagnostic rather than in a migration guide. `AttributeFactoryTest` matches the message by pattern, so it still holds.
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.
Overview
Ambiguous mergenames the problem and stops there. An author who stacks a#[Header]beside two#[Response]attributes is told their attribute matches multiple siblings on the same target — accurate, and it leaves them nowhere. There are two ways out and neither is obvious from the wording: nest the attribute in the response it belongs to, or give it acomponentand reference it from each.The message now says so.
Changes
Utils\AttributeFactorycarries the two resolutions in the exception it already throws, at the source location it already reportsNotes
Found while converting a real codebase from
OpenApi\AttributestoOpenApi\Spec, where this is the single reason the converted project loses most of its paths — it fires ten times across twenty-two annotated files, because classic resolved the same code by writing the header into every sibling response and spec rightly refuses to guess at that.It is not a migration-specific problem, which is why the hint belongs here rather than in a migration guide: the same message reaches anyone writing spec attributes by hand.
docs/guide/spec-attributes.mdalready documents the equivalentResponse/MediaTypeambiguity.AttributeFactoryTestmatches the message by pattern, so it is unchanged and still passing.