Skip to content

Commit 821bfad

Browse files
dding-gsmorimoto
andauthored
Remove redundant union-enums option in favor of generate-union-enums (#1141)
* fix: --union-enums option names fix to --generate-union-enums * Update vitest snapshot Signed-off-by: Sora Morimoto <[email protected]> * Add changeset Signed-off-by: Sora Morimoto <[email protected]> --------- Signed-off-by: Sora Morimoto <[email protected]> Co-authored-by: Sora Morimoto <[email protected]>
1 parent 868bdae commit 821bfad

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Diff for: .changeset/weak-lemons-buy.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"swagger-typescript-api": patch
3+
---
4+
5+
Remove redundant `union-enums` option in favor of `generate-union-enums`.

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Options:
2626
some swagger schemas use "default" response status code as success response type by default. (default: false)
2727
-r, --responses generate additional information about request responses
2828
also add typings for bad responses (default: false)
29-
--union-enums generate all "enum" types as union types (T1 | T2 | TN) (default: false)
29+
--generate-union-enums generate all "enum" types as union types (T1 | T2 | TN) (default: false)
3030
--add-readonly generate readonly properties (default: false)
3131
--route-types generate type definitions for API routes (default: false)
3232
--[no-]client generate an API class (default: true)

Diff for: index.ts

-5
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,6 @@ const generateCommand = defineCommand({
281281
description: "data contract name suffix",
282282
default: codeGenBaseConfig.typeSuffix,
283283
},
284-
"union-enums": {
285-
type: "boolean",
286-
description: 'generate all "enum" types as union types (T1 | T2 | TN)',
287-
default: codeGenBaseConfig.generateUnionEnums,
288-
},
289284
"unwrap-response-data": {
290285
type: "boolean",
291286
description: "unwrap the data item from the response",

Diff for: tests/spec/unionEnums/__snapshots__/basic.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`basic > --union-enums 1`] = `
3+
exports[`basic > --generate-union-enums 1`] = `
44
"/* eslint-disable */
55
/* tslint:disable */
66
// @ts-nocheck

Diff for: tests/spec/unionEnums/basic.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("basic", async () => {
1717
await fs.rm(tmpdir, { recursive: true });
1818
});
1919

20-
test("--union-enums", async () => {
20+
test("--generate-union-enums", async () => {
2121
await generateApi({
2222
fileName: "schema",
2323
input: path.resolve(import.meta.dirname, "schema.json"),

0 commit comments

Comments
 (0)