Skip to content

Commit 49be7e1

Browse files
authored
Merge pull request #1106 from acacode/fix-cli-again
Fix CLI argument definitions and client generation logic
2 parents 9fed833 + c124f88 commit 49be7e1

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

.changeset/early-kings-marry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"swagger-typescript-api": patch
3+
---
4+
5+
Add boolean type for `extract-request-params` in command configuration.

.changeset/easy-paths-check.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"swagger-typescript-api": patch
3+
---
4+
5+
Fix generateClient logic to exclude only 'no-client' argument.

.changeset/moody-dodos-brake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"swagger-typescript-api": patch
3+
---
4+
5+
Initialise `customConfig` to `undefined` in command run function.

index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ const generateCommand = defineCommand({
146146
default: codeGenBaseConfig.enumNamesAsValues,
147147
},
148148
"extract-request-params": {
149+
type: "boolean",
149150
description:
150151
"extract request params to data contract (Also combine path params and query params into one object)",
151152
default: codeGenBaseConfig.extractRequestParams,
@@ -280,7 +281,7 @@ const generateCommand = defineCommand({
280281
},
281282
},
282283
run: async ({ args }) => {
283-
let customConfig;
284+
let customConfig = undefined;
284285

285286
if (args["custom-config"]) {
286287
try {
@@ -314,7 +315,7 @@ const generateCommand = defineCommand({
314315
extractResponseError: args["extract-response-error"],
315316
extractResponses: args["extract-responses"],
316317
fileName: args.name,
317-
generateClient: !(args.axios || args["no-client"]),
318+
generateClient: !args["no-client"],
318319
generateResponses: args.responses,
319320
generateRouteTypes: args["route-types"],
320321
generateUnionEnums: args["union-enums"],

0 commit comments

Comments
 (0)