fix: use stable comparator for playground parameter sorting#2381
Open
fix: use stable comparator for playground parameter sorting#2381
Conversation
The previous comparator returned 1 for equal-ranked items instead of 0, violating strict weak ordering. This made Array.prototype.sort behavior implementation-defined: Chrome's V8 preserved insertion order while Firefox's SpiderMonkey reversed the non-required tail.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Coverage Report
File CoverageNo changed files found. |
|
Preview build of published Zudoku package for commit 91df4cb. See the deployment at: https://e29a63de.cosmocargo-public-package.pages.dev Note This is a preview of the Cosmo Cargo example using the Zudoku package published to a local registry to ensure it'll be working when published to the public NPM registry. Last updated: 2026-04-24T08:22:22.119Z |
Contributor
There was a problem hiding this comment.
Pull request overview
Ensures deterministic ordering of OpenAPI Playground header/query parameters across JS engines by fixing the comparator to satisfy strict weak ordering when sorting by required.
Changes:
- Replace the previous non-strict comparator with a numeric comparator that returns
0when two parameters have the samerequiredstatus. - Normalize nullable
requiredflags via?? falsebefore comparison.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
The previous comparator returned 1 for equal-ranked items instead of 0, violating strict weak ordering. This made
Array.prototype.sortbehavior implementation-defined: Chrome's V8 preserved insertion order while Firefox's SpiderMonkey reversed the non-required tail.