-
Notifications
You must be signed in to change notification settings - Fork 282
fix/tags order to v3 #2681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+95
−3
Merged
fix/tags order to v3 #2681
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7610d07
fix: Support custom tag ordering
spanglerco 008576c
Merge pull request #2679 from spanglerco/issue2678
baywet 0def787
chore(support/v2): release 2.4.3
release-please-token-provider[bot] 56446a6
Merge pull request #2680 from microsoft/release-please--branches--sup…
baywet ad5b91b
Merge branch 'support/v2' into fix/tags-order-to-v3
baywet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
Check warning
Code scanning / CodeQL
Reference equality test on System.Object Warning
Copilot Autofix
AI 1 day ago
In general, to fix this issue you should avoid using
==/!=between variables of typeobjector interface when the intent is value/semantic equality. Either cast to a more specific type that has an appropriateEquals/==implementation or callEqualsexplicitly. If the intent is to check identity, then useReferenceEquals(a, b).Here, the intent is: “if the existing
HashSet’s comparer is not the default comparer, keep the existing set; otherwise, wrap the incoming set in a newHashSetwithOpenApiTagComparer.Instance.” This logic should not depend on two comparer instances being the same object. The minimal behavioural change is to replace the reference comparison with a semantic equality comparison usingEquals, handling null-safety. We can do this by using!EqualityComparer<OpenApiTag>.Default.Equals(tags.Comparer)instead oftags.Comparer != EqualityComparer<OpenApiTag>.Default. This preserves the branch condition’s meaning (“comparer is different from the default”) but uses proper equality semantics instead of object identity. All other parts of the snippet remain unchanged, and no new imports or types are required.Concretely, in
src/Microsoft.OpenApi/Models/OpenApiDocument.cs, in theTagsproperty setter’s switch expression, update theHashSet<OpenApiTag>pattern clause to use!EqualityComparer<OpenApiTag>.Default.Equals(tags.Comparer).