From 341ad1fad4858b33b1f83948c2096a1a4bc3fec3 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 16 Jan 2022 21:16:01 +0800 Subject: [PATCH] [TypeScript Fetch] Default TypeScript fetch configuration to 3.6+ true #9974 (#11331) * Default TypeScript fetch configuration to 3.6+ true, as it's been out for a while now * TypeScript fetch update the three plus CLI option default to true * Apply doc generator patch * Build the project and update samples * remove VERSION * test ts fetch clients first * Revert "test ts fetch clients first" This reverts commit 590a7f2d30d67c6d9dd49d105a84b64c3525ff6e. Co-authored-by: szTheory --- docs/generators/typescript-fetch.md | 2 +- .../codegen/languages/TypeScriptFetchClientCodegen.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md index f548480236b..bdd09c09525 100644 --- a/docs/generators/typescript-fetch.md +++ b/docs/generators/typescript-fetch.md @@ -37,7 +37,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |supportsES6|Generate code that conforms to ES6.| |false| -|typescriptThreePlus|Setting this property to true will generate TypeScript 3.6+ compatible code.| |false| +|typescriptThreePlus|Setting this property to true will generate TypeScript 3.6+ compatible code.| |true| |useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |true| |withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false| |withoutRuntimeChecks|Setting this property to true will remove any runtime checks on the request and response payloads. Payloads will be casted to their expected types.| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index 5c810f7073b..8924e3b0b62 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -47,7 +47,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege private boolean prefixParameterInterfaces = false; protected boolean addedApiIndex = false; protected boolean addedModelIndex = false; - protected boolean typescriptThreePlus = false; + protected boolean typescriptThreePlus = true; protected boolean withoutRuntimeChecks = false; // "Saga and Record" mode. @@ -93,7 +93,7 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, CodegenConstants.USE_SINGLE_REQUEST_PARAMETER_DESC, SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString())); this.cliOptions.add(new CliOption(PREFIX_PARAMETER_INTERFACES, "Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); - this.cliOptions.add(new CliOption(TYPESCRIPT_THREE_PLUS, "Setting this property to true will generate TypeScript 3.6+ compatible code.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); + this.cliOptions.add(new CliOption(TYPESCRIPT_THREE_PLUS, "Setting this property to true will generate TypeScript 3.6+ compatible code.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.TRUE.toString())); this.cliOptions.add(new CliOption(WITHOUT_RUNTIME_CHECKS, "Setting this property to true will remove any runtime checks on the request and response payloads. Payloads will be casted to their expected types.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(SAGAS_AND_RECORDS, "Setting this property to true will generate additional files for use with redux-saga and immutablejs.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); }