Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/flat-bugs-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"openapi-typescript": patch
---

Fix boolean flags not being parsed as bools and thus consuming the input argument if it is given last
36 changes: 18 additions & 18 deletions packages/openapi-typescript/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,29 @@ if (args.includes("--root-types-keep-casing") && !args.includes("--root-types"))
}

const BOOLEAN_FLAGS = [
"additionalProperties",
"additional-properties",
"alphabetize",
"arrayLength",
"array-length",
"check",
"conditionalEnums",
"contentNever",
"dedupeEnums",
"defaultNonNullable",
"emptyObjectsUnknown",
"conditional-enums",
"content-never",
"dedupe-enums",
"default-non-nullable",
"empty-objects-unknown",
"enum",
"enumValues",
"excludeDeprecated",
"exportType",
"generatePathParams",
"enum-values",
"exclude-deprecated",
"export-type",
"generate-path-params",
"help",
"immutable",
"makePathsEnum",
"pathParamsAsTypes",
"propertiesRequiredByDefault",
"readWriteMarkers",
"rootTypes",
"rootTypesKeepCasing",
"rootTypesNoSchemaPrefix",
"make-paths-enum",
"path-params-as-types",
"properties-required-by-default",
"read-write-markers",
"root-types",
"root-types-keep-casing",
"root-types-no-schema-prefix",
];

const flags = parser(args, {
Expand Down
16 changes: 16 additions & 0 deletions packages/openapi-typescript/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ describe("CLI", () => {
ci: { timeout: TIMEOUT },
},
],
[
"snapshot > GitHub API (root types, input file last)",
{
given: ["--root-types", "./examples/github-api.yaml"],
want: new URL("./examples/github-api-root-types.ts", root),
ci: { timeout: TIMEOUT },
},
],
[
"snapshot > GitHub API (next)",
{
Expand Down Expand Up @@ -84,6 +92,14 @@ describe("CLI", () => {
ci: { timeout: TIMEOUT },
},
],
[
"snapshot > enum root types filtering, input file last",
{
given: ["--root-types", "--enum", "--root-types-no-schema-prefix", "./examples/enum-root-types.yaml"],
want: new URL("./examples/enum-root-types.ts", root),
ci: { timeout: TIMEOUT },
},
],
];

for (const [testName, { given, want, ci }] of tests) {
Expand Down
Loading