-
-
Notifications
You must be signed in to change notification settings - Fork 602
Open
Labels
bugSomething isn't workingSomething isn't workingopenapi-tsRelevant to the openapi-typescript libraryRelevant to the openapi-typescript library
Description
openapi-typescript version
7.10.1
Node.js version
24.7.0
OS + version
macOS 15.6.1
Description
This unfortunately burned way too much of my time to manually stick debug prints and find out how the parsing works.
When providing flags such as --array-length as the first parameters, the CLI will interpret them as part of the schema-file instead of flags and just hang during the resolution under this code:
if (schema instanceof node_stream.Readable) {
const contents = await new Promise((resolve) => {
schema.resume();
schema.setEncoding("utf8");
let content = "";
schema.on("data", (chunk) => {
content += chunk;
});
schema.on("end", () => {
resolve(content.trim());
});
});Reproduction
Run any flag such as --array-length before providing the schema
DEBUG=* npx openapi-typescript --array-length ./openapi.json -o ./generated-api.d.tsExpected result
Parse flags using a CLI library such as yargs OR validate a minimal startswith("-") to alert user of how to use
Required
- My OpenAPI schema is valid and passes the Redocly validator (
npx @redocly/cli@latest lint)
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)
matteom-synth and arashout
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopenapi-tsRelevant to the openapi-typescript libraryRelevant to the openapi-typescript library