Skip to content

Remove redundant union-enums option in favor of generate-union-enums #1141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 26, 2025
Merged
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/weak-lemons-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"swagger-typescript-api": patch
---

Remove redundant `union-enums` option in favor of `generate-union-enums`.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Options:
some swagger schemas use "default" response status code as success response type by default. (default: false)
-r, --responses generate additional information about request responses
also add typings for bad responses (default: false)
--union-enums generate all "enum" types as union types (T1 | T2 | TN) (default: false)
--generate-union-enums generate all "enum" types as union types (T1 | T2 | TN) (default: false)
--add-readonly generate readonly properties (default: false)
--route-types generate type definitions for API routes (default: false)
--[no-]client generate an API class (default: true)
Expand Down
5 changes: 0 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,6 @@ const generateCommand = defineCommand({
description: "data contract name suffix",
default: codeGenBaseConfig.typeSuffix,
},
"union-enums": {
type: "boolean",
description: 'generate all "enum" types as union types (T1 | T2 | TN)',
default: codeGenBaseConfig.generateUnionEnums,
},
"unwrap-response-data": {
type: "boolean",
description: "unwrap the data item from the response",
Expand Down
2 changes: 1 addition & 1 deletion tests/spec/unionEnums/__snapshots__/basic.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`basic > --union-enums 1`] = `
exports[`basic > --generate-union-enums 1`] = `
"/* eslint-disable */
/* tslint:disable */
// @ts-nocheck
Expand Down
2 changes: 1 addition & 1 deletion tests/spec/unionEnums/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("basic", async () => {
await fs.rm(tmpdir, { recursive: true });
});

test("--union-enums", async () => {
test("--generate-union-enums", async () => {
await generateApi({
fileName: "schema",
input: path.resolve(import.meta.dirname, "schema.json"),
Expand Down