fix(downgrader): inline pathItems refs, convert cycles, map the 3.2 dialect - #10
Merged
Merged
Conversation
…ialect Path Item `$ref`s into `components.pathItems` are now inlined on the 3.1 to 3.0 hop instead of dangling in the output, following alias chains and letting the referencing object's own fields win. Cyclic object graphs (dereferenced documents) are converted with their cycles preserved rather than deep-copied unconverted. A 3.2 `jsonSchemaDialect` is rewritten to the 3.1 base dialect, and a non-string response `summary` no longer lands in the required 3.1 `description`. Output keys are assigned directly unless the prototype chain already knows them, which roughly halves cloning time while keeping `__proto__` and frozen-intrinsics environments safe.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Plain assignment already creates own properties for every other key on a plain object; only `__proto__` would route through the inherited setter. The prototype-chain guard and its frozen-intrinsics test are dropped.
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.

Deep review of
@openapi-spec/downgraderwith fixes for the gaps it turned up. 3.1 → 3.0 output no longer contains dangling$refs into the removedcomponents.pathItems, cyclic input graphs come out fully converted, and 3.2 documents stop carrying a 3.2 dialect URI into 3.1.Fixes
$refs intocomponents.pathItemsare inlined inpathsand callbacks, following alias chains; the referencing Path Item's own fields win on overlap. Unknown or cyclic targets are left as they were.jsonSchemaDialectnaming a 3.2 OAS dialect becomeshttps://spec.openapis.org/oas/3.1/dialect/base; other dialects pass through.summaryno longer becomes the required 3.1description; it falls back to"".Performance
__proto__is defined, so it stays a plain own property instead of replacing the prototype. Cloning is roughly twice as fast.Testing
setOwnagainst__proto__and otherObject.prototypemember names.Kept as-is
$schemainside a Schema Object naming the 3.2 dialect passes through (listed in the README as a known limitation).defaultMappingstill survives into 3.0 output, as before.