fix(cli-v2): adjust file paths in fern config migrate to be root-relative#15817
Merged
Conversation
…tive Paths from generators.yml (relative to fern/) were not being adjusted when written to the root fern.yml. This caused 'file does not exist' errors for openapi specs, overrides, and docs.yml references. - Add adjustSpecPathsForSingleApi to re-root single-API spec paths - Fix docs to use ./fern/docs.yml instead of ./docs.yml - Normalize paths with .. segments (e.g. ../external/ -> ./external/) - Add test for single-API path adjustment - Update existing test assertions Resolves FER-10462
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
…tead of hardcoding FERN_DIRECTORY
Add handling for when sourcePrefix is an empty string so rebased spec paths are returned as "./<file>" rather than producing an extra slash or malformed path. Also add a unit test ensuring spec paths remain correct when fernDir equals projectRoot (empty sourcePrefix). This prevents incorrect './ /file' or double-slash paths for specs and overrides.
fern-support
approved these changes
May 14, 2026
fern-support
added a commit
that referenced
this pull request
May 14, 2026
…lative (#15817) * fix(cli-v2): adjust file paths in fern config migrate to be root-relative Paths from generators.yml (relative to fern/) were not being adjusted when written to the root fern.yml. This caused 'file does not exist' errors for openapi specs, overrides, and docs.yml references. - Add adjustSpecPathsForSingleApi to re-root single-API spec paths - Fix docs to use ./fern/docs.yml instead of ./docs.yml - Normalize paths with .. segments (e.g. ../external/ -> ./external/) - Add test for single-API path adjustment - Update existing test assertions Resolves FER-10462 * refactor: compute migration paths dynamically using path.relative instead of hardcoding FERN_DIRECTORY * fix: resolve biome lint errors (import ordering and unused import) * Handle empty sourcePrefix in rebasePath Add handling for when sourcePrefix is an empty string so rebased spec paths are returned as "./<file>" rather than producing an extra slash or malformed path. Also add a unit test ensuring spec paths remain correct when fernDir equals projectRoot (empty sourcePrefix). This prevents incorrect './ /file' or double-slash paths for specs and overrides. --------- Co-authored-by: Naman Anand <info@buildwithfern.com>
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.
Description
Linear ticket: Closes FER-10462
fern config migrateproduced wrong file path references in the generatedfern.ymlfor single-API projects. Paths fromgenerators.yml(relative to thefern/directory) were not re-rooted to be relative to the project root wherefern.ymlis written. Thedocs$refpointer also used./docs.ymlinstead of./fern/docs.yml.Changes Made
projectRootparameter toconvertSingleApi,convertMultiApi, andmigrateDocsYmlso paths are computed dynamically viapath.relative(projectRoot, fernDir)— no hardcoded directory namesrebaseSpecPaths(specs, sourcePrefix)/rebasePath(filePath, sourcePrefix)/computeRelativePosixPath(from, to), replacing the duplicatedadjustSpecPaths/adjustSpecPathsForSingleApifunctionsMigrator.tsto passthis.cwdasprojectRootto all path-adjusting functionsExample
Given
generators.ymlinfern/withopenapi: ../external/universal-api-v1.yamlandoverrides: ./openapi-overrides.yml:../external/...and./openapi-overrides.yml(wrong from project root)./external/universal-api-v1.yamland./fern/openapi-overrides.yml(correct)Testing
../pathspnpm formatcleanLink to Devin session: https://app.devin.ai/sessions/294b273b9cb84d6a82171f9c2e67a4a8
Requested by: @iamnamananand996