fix(downgrader): inline $refs into webhooks and components.pathItems removed by 3.1 to 3.0 - #25
Merged
Conversation
…removed by 3.1 to 3.0 Co-Authored-By: Claude <noreply@anthropic.com>
…ems-refs-conversion-6eacc4
… helpers Resolve refs with parseLocalRef/resolveLocalRef, guard recursion with isConverting and the pointers being inlined, and keep one schema finish function per call so converted schemas are reused. The inline cap is no longer needed. Co-Authored-By: Claude <noreply@anthropic.com>
…h target once An in-progress conversion is reused only within the same inline, so a callback, own field, or shared object that leads back into content still being converted is cut instead of forming a cycle. Inlined targets are converted once per converter, Path Item $refs inline only at Path Item locations, and security scheme aliases resolve through any local ref. Co-Authored-By: Claude <noreply@anthropic.com>
…o 3.0 ref inlining Fields a Path Item inherits from a later $ref hop are converted inside the inline, a conversion cut inside an inline is redone when reached again outside it so object cycles survive, and links are checked against the operationIds that remain in the output. Co-Authored-By: Claude <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.

3.1 → 3.0 no longer leaves
$refs pointing intowebhooksorcomponents.pathItems, which it removes. References into them from any position are replaced by their converted target, and LinkoperationRefs into them become anoperationIdor are removed. The output validates as 3.0. Documents without such references convert exactly as before.Fixes
$refs and Schema$refs into the removed parts are inlined in converted form, following reference chains. A chain that leaves them ends at that$ref. A Reference Object'ssummary/descriptionapplies to the inlined target.operationRefinto them becomes the target'soperationIdwhen that operation is still in the output. Otherwise the link is removed, together with Link$refs that lead to it.discriminator.mappingentries pointing into them are removed.{}, a Path Item keeps its own fields, and other references are dropped. Acyclic input always gives acyclic output, and object cycles in dereferenced input are kept.$refs inline only when they point at a Path Item.mutualTLSremoval and scope emptying also apply to escaped names and aliases into the removed parts.Behavior changes
$refs tocomponents.pathItemsthat reach themselves through callbacks are now cut to their own fields instead of dangling.Performance
Output is identical to main on both. The 3.1 → 3.0 cost is the per-
$refcheck, similar to what #24 added for 3.2 → 3.1.Testing
packages/downgrader/src. Lint and type-check pass.Known limits
$refpartway is not followed.operationIdis kept.convertInlinedhelper makes that a one-line follow-up.