fix: rewrite composed refs inside extensions#602
Conversation
Composed bundles could leave root-level vendor extension `$refs` pointing at external files even when the referenced component had been composed into the bundle. Such refs made the bundled document not self-contained. Allow the final composed-ref rewrite pass to also process `$ref` values under `x-*` extension fields, and add a regression test. Spotted on our side once we upgraded to the latest vacuum version. In our case, we use extensions similarly to the included regression tests which stopped being properly composed. Related: pb33f@8585a05
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #602 +/- ##
==========================================
+ Coverage 99.75% 99.78% +0.03%
==========================================
Files 281 283 +2
Lines 34061 34479 +418
==========================================
+ Hits 33977 34405 +428
+ Misses 51 46 -5
+ Partials 33 28 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thank you for your contribution! one case that still leaves the composed bundle non-self-contained. The patch rewrites extension $refs when the complete target exactly matches an entry in processedNodes, but not when the ref points below a composed component. For example: x-related-field:
$ref: './models.yaml#/components/schemas/Thing/properties/id'If Could |
|
@daveshanley thanks, make sense! I tried to address it but I am not 100% confident I got it right, please let me know if additional adjustments are needed. |
Composed bundles could leave root-level vendor extension
$refspointing at external files even when the referenced component had been composed into the bundle. Such refs made the bundled document not self-contained.Allow the final composed-ref rewrite pass to also process
$refvalues underx-*extension fields, and add a regression test.Spotted on our side once we upgraded to the latest vacuum version. In our case, we use extensions similarly to the included regression tests which stopped being properly composed.
Related: 8585a05