The findConfigFile function in cli.mjs recursively walks up the directory tree looking for a formatter config file (biome.json, .prettierrc, etc.). The recursion stop condition only handles Unix systems:
if (searchPath === "/") return null;
On Windows, the filesystem root is a drive letter (e.g. C:), so this condition never evaluates to true. The function recurses infinitely until the call stack overflows.
Error output:
[error] unhandled error RangeError: Maximum call stack size exceeded
at Object.join (node:path:506:7)
at findConfigFile (file:///...cli.mjs:147:25)
at findConfigFile (file:///...cli.mjs:153:9)
at findConfigFile (file:///...cli.mjs:153:9)
... (repeated)
Steps to reproduce:
Use Windows 10/11
Ensure no biome.json or .prettierrc exists anywhere in the directory tree above the project
Run:
openapi-code-generator --input spec.yaml --input-type openapi3 --output src --template typescript-fetch --schema-builder zod-v4
Workaround
Adding an empty biome.json ({}) at the project root gives findConfigFile something to match, stopping the recursion before it reaches the root.
Suggested fix
Replace:
if (searchPath === "/") return null;
With:
if (searchPath === path.dirname(searchPath)) return null;
path.dirname() returns the same value when already at the root on any OS — this handles both / on Unix and C:\ on Windows.
Related issue: backslashes in generated import paths
The normalizeFrom method uses path.relative() and path.join() to construct ES module import paths. On Windows, these produce backslashes, resulting in invalid imports like:
import { ... } from "./..\models.ts"; // should be "../models.ts"
Replacing path.join / path.relative with their path.posix equivalents (or normalizing with .split(path.sep).join("/")) would fix this.
Environment
OS: Windows 10 (build 22631)
Node: v24.x
Package: @nahkies/openapi-code-generator (latest, installed June 2025)
The findConfigFile function in cli.mjs recursively walks up the directory tree looking for a formatter config file (biome.json, .prettierrc, etc.). The recursion stop condition only handles Unix systems:
if (searchPath === "/") return null;
On Windows, the filesystem root is a drive letter (e.g. C:), so this condition never evaluates to true. The function recurses infinitely until the call stack overflows.
Error output:
[error] unhandled error RangeError: Maximum call stack size exceeded
at Object.join (node:path:506:7)
at findConfigFile (file:///...cli.mjs:147:25)
at findConfigFile (file:///...cli.mjs:153:9)
at findConfigFile (file:///...cli.mjs:153:9)
... (repeated)
Steps to reproduce:
Use Windows 10/11
Ensure no biome.json or .prettierrc exists anywhere in the directory tree above the project
Run:
openapi-code-generator --input spec.yaml --input-type openapi3 --output src --template typescript-fetch --schema-builder zod-v4
Workaround
Adding an empty biome.json ({}) at the project root gives findConfigFile something to match, stopping the recursion before it reaches the root.
Suggested fix
Replace:
if (searchPath === "/") return null;
With:
if (searchPath === path.dirname(searchPath)) return null;
path.dirname() returns the same value when already at the root on any OS — this handles both / on Unix and C:\ on Windows.
Related issue: backslashes in generated import paths
The normalizeFrom method uses path.relative() and path.join() to construct ES module import paths. On Windows, these produce backslashes, resulting in invalid imports like:
import { ... } from "./..\models.ts"; // should be "../models.ts"
Replacing path.join / path.relative with their path.posix equivalents (or normalizing with .split(path.sep).join("/")) would fix this.
Environment
OS: Windows 10 (build 22631)
Node: v24.x
Package: @nahkies/openapi-code-generator (latest, installed June 2025)