Skip to content

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

Open
@elliots

Description

@elliots

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

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

Extra

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi-tsRelevant to the openapi-typescript library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions