Skip to content

openapi-ts tries opening wrong input path than what is provided in config. Replaces openapi.json with `Basic #2578

@douglasg14b

Description

@douglasg14b

openapi-typescript version

0.91.1

Node.js version

24.13

OS + version

Windows 10

Description

After upgrading from Node 20 to 24, openapi-ts no longer works as expected. It attempts to open a file that does not exist and was not passed into it through it's configuration. No other changes have been made to the project which was working previously.

I pass in a C:\[SNIP]\project\server\WebProject\openapi.json path to the openapi file.

It attempts to read C:\[SNIP]\project\server\WebProject\Basic

Config

import { defaultPlugins } from '@hey-api/openapi-ts';
import path from 'path';

const absoluteCurrentDirectory = path.normalize(__dirname);

const PATH_TO_OPENAPI = path.normalize(`${absoluteCurrentDirectory}/../server/WebProject/openapi.json`);
const OUTPUT_PATH = path.normalize(`${absoluteCurrentDirectory}/src/features/api-client/gen`);

export default {
    input: PATH_TO_OPENAPI,
    output: OUTPUT_PATH,
    plugins: [
        ...defaultPlugins,
        {
            name: '@hey-api/client-fetch',
            runtimeConfigPath: './src/features/api-client/hey-api.ts',
        },
        {
            asClass: false, // default
            name: '@hey-api/sdk',
        },
    ],
};

Logs

[Job 1] ⏳ Generating from 1 input:
[Job 1]   [1] C:\[SNIP]\project\server\WebProject\openapi.json
[Job 1] ❌ Failed with the message:
[Job 1]   Error opening file "C:\[SNIP]\project\server\WebProject\Basic"
ENOENT: no such file or directory, open 'C:\[SNIP]\project\server\WebProject\Basic'
[2026-02-04T21:19:22.885Z] Error: Error opening file "C:\[SNIP]\project\server\WebProject\Basic" 
ENOENT: no such file or directory, open 'C:\[SNIP]\project\server\WebProject\Basic'
Stack:
ResolverError: Error opening file "C:\[SNIP]\project\server\WebProject\Basic" 
ENOENT: no such file or directory, open 'C:\[SNIP]\project\server\WebProject\Basic'
    at Object.handler (C:\[SNIP]\project\userscript\node_modules\.pnpm\@hey-api+json-schema-ref-parser@1.2.3\node_modules\@hey-api\json-schema-ref-parser\dist\lib\resolvers\file.js:58:19)
    at async resolve$Ref (C:\[SNIP]\project\userscript\node_modules\.pnpm\@hey-api+json-schema-ref-parser@1.2.3\node_modules\@hey-api\json-schema-ref-parser\dist\lib\resolve-external.js:138:13)
    at async Promise.all (index 0)
    at async $RefParser.bundle (C:\[SNIP]\project\userscript\node_modules\.pnpm\@hey-api+json-schema-ref-parser@1.2.3\node_modules\@hey-api\json-schema-ref-parser\dist\lib\index.js:138:9)
    at async createClient$1 (file:///C:/[SNIP]/project/userscript/node_modules/.pnpm/@hey-api+openapi-ts@0.91.1_typescript@5.8.3/node_modules/@hey-api/openapi-ts/dist/src-Dgh53q8K.mjs:79:8)
    at async file:///C:/[SNIP]/project/userscript/node_modules/.pnpm/@hey-api+openapi-ts@0.91.1_typescript@5.8.3/node_modules/@hey-api/openapi-ts/dist/src-Dgh53q8K.mjs:182:12
    at async Promise.all (index 0)
    at async createClient (file:///C:/[SNIP]/project/userscript/node_modules/.pnpm/@hey-api+openapi-ts@0.91.1_typescript@5.8.3/node_modules/@hey-api/openapi-ts/dist/src-Dgh53q8K.mjs:180:21)
    at async Command.<anonymous> (file:///C:/[SNIP]/project/userscript/node_modules/.pnpm/@hey-api+openapi-ts@0.91.1_typescript@5.8.3/node_modules/@hey-api/openapi-ts/dist/run.mjs:38:8)
    at async Command.parseAsync (C:\[SNIP]\project\userscript\node_modules\.pnpm\commander@14.0.2\node_modules\commander\lib\command.js:1122:5)

Reproduction

Unknown, this just started happening and am unsure how to repro aside from my current env

Expected result

It uses the input path that's provided.

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