From 28007b465120c46239ab04bd7d737e44e062cc9d Mon Sep 17 00:00:00 2001 From: Nedunchezhiyan-M Date: Mon, 13 Apr 2026 19:56:04 +0530 Subject: [PATCH 1/2] fix(openapi-typescript): resolve CLI hang when multi-word flags precede schema path yargs-parser only recognizes boolean flags by their exact registered name. The BOOLEAN_FLAGS array used camelCase (e.g. enumValues) but the CLI accepts kebab-case (--enum-values). Without the kebab-case form registered as boolean, yargs-parser consumed the next argument (the schema file path) as the flag's value, leaving flags._ empty and causing the CLI to read from stdin indefinitely. Fix by deriving and registering kebab-case equivalents of every camelCase boolean flag so both forms are properly treated as boolean. Fixes #2523 --- packages/openapi-typescript/bin/cli.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/openapi-typescript/bin/cli.js b/packages/openapi-typescript/bin/cli.js index 31be6e795..65834ce00 100755 --- a/packages/openapi-typescript/bin/cli.js +++ b/packages/openapi-typescript/bin/cli.js @@ -98,8 +98,14 @@ const BOOLEAN_FLAGS = [ "rootTypesNoSchemaPrefix", ]; +// yargs-parser only recognizes boolean flags by their exact registered name, +// so --enum-values (kebab-case) is not treated as boolean unless "enum-values" +// is also in the boolean list. Generate kebab-case equivalents so positional +// args after multi-word flags aren't silently consumed as flag values. +const BOOLEAN_FLAGS_KEBAB = BOOLEAN_FLAGS.map((f) => f.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)); + const flags = parser(args, { - boolean: BOOLEAN_FLAGS, + boolean: [...BOOLEAN_FLAGS, ...BOOLEAN_FLAGS_KEBAB], string: ["output", "redocly"], alias: { redocly: ["c"], From 9194e2134a3695d2ddd3dd72fab4cb9e6ac94a13 Mon Sep 17 00:00:00 2001 From: Nedunchezhiyan-M Date: Mon, 13 Apr 2026 20:42:19 +0530 Subject: [PATCH 2/2] chore: add changeset for CLI flag order fix --- .changeset/fix-cli-kebab-flag-order.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-cli-kebab-flag-order.md diff --git a/.changeset/fix-cli-kebab-flag-order.md b/.changeset/fix-cli-kebab-flag-order.md new file mode 100644 index 000000000..d5db53521 --- /dev/null +++ b/.changeset/fix-cli-kebab-flag-order.md @@ -0,0 +1,5 @@ +--- +"openapi-typescript": patch +--- + +Fix CLI hanging when multi-word flags appear before the schema file argument. Flags such as `--enum-values`, `--path-params-as-types`, `--dedupe-enums`, `--empty-objects-unknown`, and others were not recognized as boolean by the argument parser when written in kebab-case, causing the schema path to be silently consumed as the flag's value and leaving the CLI waiting on stdin. Both camelCase and kebab-case forms are now registered as boolean.