openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

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

Open elliots opened this issue 8 months ago • 0 comments

openapi-typescript version

7.6.1

Node.js version

22.13.1

OS + version

macOS 15.3

Description

Two, possibly related issues.

First, if there is a redocly.yaml file, the --redocly/-c option is ignored and the redocly.yaml is used regardless

Second, if there is no redocly.yaml file, the --redocly/-c option causes openapi-typescript to hang

Reproduction

Repro for ignoring if redocly.yaml exists...

echo "apis:
  bad:
    root: bad.yml
    x-openapi-ts:
      output: bad.spec.ts" > ./redocly.yaml

echo "apis:
  good:
    root: good.yml
    x-openapi-ts:
      output: good.spec.ts" > ./redocly.good.yaml

DEBUG=* npx openapi-typescript --redocly=redocly.good.yaml

results in:

➜ ./repro.sh 
  openapi-ts:redoc 0ms Loaded Redoc config
/Users/elliot/repos/core/api/node_modules/@redocly/openapi-core/lib/resolve.js:113
            throw new ResolveError(error);
                  ^

ResolveError: ENOENT: no such file or directory '/Users/elliot/repos/core/api/test/bad.yml'

Repro for hanging with custom redocly file

echo "apis:
  only:
    root: only.yml
    x-openapi-ts:
      output: only.spec.ts" > ./redocly.only.yaml

DEBUG=* npx openapi-typescript --redocly=redocly.only.yaml

results in:

➜ ./repro.sh
  openapi-ts:redoc 0ms Loaded Redoc config

(process does not exit)

Expected result

Should use the configured file

Required

  • [x] My OpenAPI schema is valid and passes the Redocly validator (npx @redocly/cli@latest lint)

Extra

elliots avatar Mar 04 '25 22:03 elliots