Skip to content

Conversation

@mynnx
Copy link

@mynnx mynnx commented Dec 15, 2025

Changes

Resolves #2190 in which the CLI hangs when specifying a different path for redocly.yaml using the --redocly CLI flag. We've got several redocly.yaml files so this fix is necessary for us.

The old code only called findConfig on the dirname() of the argument you passed, looking for a redocly.yaml in that directory - so it wasn't looking for the file path you specified on the command line. In addition, when it couldn't find a path, it silently fell back to a minimal config waiting on input with a valid config.

Now it looks for either

  • a redocly.yaml file in the directory you've specified (old behavior), or
  • the specific file you're pointing at

and has clear error messages when it can't be found.

How to Review

Run the new test, or:

Happy path

 node packages/openapi-typescript/bin/cli.js \
  --redocly packages/openapi-typescript/test/fixtures/redocly-flag/redocly.alt.yaml
 ⚠  Component: "Problem" is never used. at #/components/schemas/Problem
🚀 b@v1 → ./output-alt/b.ts [53.7ms]
 ⚠  Component: "Problem" is never used. at #/components/schemas/Problem
🚀 a@v1 → ./output-alt/a.ts [64.2ms]
 ⚠  Component: "Problem" is never used. at #/components/schemas/Problem
🚀 c@v1 → ./output-alt/c.ts [74.9ms]

Failure path

 node packages/openapi-typescript/bin/cli.js \
  --redocly packages/openapi-typescript/test/fixtures/redocly-flag/NOT_A_REAL_FILE.yaml 
 ✘  Redocly config not found at: packages/openapi-typescript/test/fixtures/redocly-flag/redocly.alt.yam
file:///Users/mark.everett/Development/tmp/openapi-typescript/packages/openapi-typescript/bin/cli.js:161
  throw new Error(message);
        ^

Error: Redocly config not found at: packages/openapi-typescript/test/fixtures/redocly-flag/redocly.alt.yam
    at errorAndExit (file:///Users/mark.everett/Development/tmp/openapi-typescript/packages/openapi-typescript/bin/cli.js:161:9)
    ...

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • [] pnpm run update:examples run (only applicable for openapi-typescript)
    • ☝️  ERR_PNPM_NO_SCRIPT  Missing script: update:examples

@mynnx mynnx requested a review from a team as a code owner December 15, 2025 18:25
@mynnx mynnx requested a review from kerwanp December 15, 2025 18:25
@netlify
Copy link

netlify bot commented Dec 15, 2025

👷 Deploy request for openapi-ts pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 8ea3d2d

@changeset-bot
Copy link

changeset-bot bot commented Dec 15, 2025

⚠️ No Changeset found

Latest commit: 8ea3d2d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Providing --redocly option does nothing if redocly.yaml file exists, and hangs if it doesn't

1 participant