Open
Description
Description
If you use the createClient
function in a node environment and pass in an OpenAPI spec as an object, createClient
attempts to read the current directory instead of using the spec.
eg:
createClient({
input: { openapi: '3.0.3', info: ... },
output: 'out',
dryRun: true,
plugins: ['@hey-api/client-fetch'],
});
Results in the error:
🔥 Unexpected error occurred. Error opening file "/path/to/my/project"
EISDIR: illegal operation on a directory, read
Reproducible example or configuration
https://github.com/cogwirrel/heyapi-bug-inline-spec
npm install
npx node broken.js
Notice that it works ok if we pretend we're in a browser:
// Pretend to be in a web environment
global.window = {};
global.location = { href: 'https://some-website/' };
await createClient({
input: { openapi: '3.0.3', info: ... },
output: 'out',
dryRun: true,
plugins: ['@hey-api/client-fetch'],
});
OpenAPI specification (optional)
No response
System information (optional)
Node v20.18.0
Activity