Commit 38f2bdc
fix: resolve incorrect relative paths in split component references (#175)
Fixes issue where split OpenAPI documents could not be bundled back
due to incorrect relative path generation in component $ref references.
**Problem:**
When splitting an OpenAPI document, components that reference other
components (e.g., User schema referencing NotificationPreferences)
would generate incorrect relative paths. This caused bundling to fail
with errors like:
"Cannot resolve: components/schemas/schemas/NotificationPreferences.json"
**Root Cause:**
In writeComponents(), the convertComponentsToRef() function was passed
'components' as currentFileDir instead of the full path 'components/{type}'.
This caused relative path calculation to be incorrect.
**Fix:**
Changed utils/split.js line 63 to pass the correct directory path:
- Before: convertComponentsToRef(..., 'components')
- After: convertComponentsToRef(..., path.join('components', componentType))
**Result:**
- Split documents now generate correct relative paths
- Bundling works correctly for all component references
- All existing tests continue to pass
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Claude <noreply@anthropic.com>1 parent 068cd25 commit 38f2bdc
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
0 commit comments