From 8636efe49320dd9e2e5e0f331770931dd91ce889 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 26 Jul 2023 11:10:58 +0800 Subject: [PATCH 1/9] remove supportsES6 option --- .../languages/AbstractTypeScriptClientCodegen.java | 12 ------------ .../languages/TypeScriptAxiosClientCodegen.java | 5 +---- .../languages/TypeScriptFetchClientCodegen.java | 4 +--- .../aurelia/TypeScriptAureliaClientOptionsTest.java | 1 - .../fetch/TypeScriptFetchClientOptionsTest.java | 1 - .../TypeScriptAngularClientOptionsTest.java | 1 - .../TypeScriptNestjsClientOptionsTest.java | 1 - .../TypeScriptNodeClientOptionsTest.java | 1 - 8 files changed, 2 insertions(+), 24 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index 0a79193d69d3..2518522913d1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -244,7 +244,6 @@ protected String nullableQuotedJSString(@Nullable String string) { protected ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = ENUM_PROPERTY_NAMING_TYPE.PascalCase; protected PARAM_NAMING_TYPE paramNaming = PARAM_NAMING_TYPE.camelCase; protected boolean enumPropertyNamingReplaceSpecialChar = false; - protected Boolean supportsES6 = false; protected Boolean nullSafeAdditionalProps = false; protected HashSet languageGenericTypes; protected String npmName = null; @@ -356,7 +355,6 @@ public AbstractTypeScriptClientCodegen() { cliOptions.add(new CliOption(CodegenConstants.ENUM_NAME_SUFFIX, CodegenConstants.ENUM_NAME_SUFFIX_DESC).defaultValue(this.enumSuffix)); cliOptions.add(new CliOption(CodegenConstants.ENUM_PROPERTY_NAMING, CodegenConstants.ENUM_PROPERTY_NAMING_DESC).defaultValue(this.enumPropertyNaming.name())); cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_DESC_WITH_WARNING).defaultValue(this.modelPropertyNaming.name())); - cliOptions.add(new CliOption(CodegenConstants.SUPPORTS_ES6, CodegenConstants.SUPPORTS_ES6_DESC).defaultValue(String.valueOf(this.getSupportsES6()))); cliOptions.add(new CliOption(CodegenConstants.PARAM_NAMING, CodegenConstants.PARAM_NAMING_DESC).defaultValue(this.paramNaming.name())); this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package." + " Required to generate a full package")); @@ -403,8 +401,6 @@ public void processOpts() { setParamNaming((String) additionalProperties.get(CodegenConstants.PARAM_NAMING)); } - setSupportsES6(convertPropertyToBooleanAndWriteBack(CodegenConstants.SUPPORTS_ES6)); - if (additionalProperties.containsKey(NULL_SAFE_ADDITIONAL_PROPS)) { setNullSafeAdditionalProps(Boolean.valueOf(additionalProperties.get(NULL_SAFE_ADDITIONAL_PROPS).toString())); } @@ -1014,14 +1010,6 @@ public Map postProcessAllModels(Map objs) return result; } - public void setSupportsES6(Boolean value) { - supportsES6 = value; - } - - public Boolean getSupportsES6() { - return supportsES6; - } - public Boolean getNullSafeAdditionalProps() { return nullSafeAdditionalProps; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java index 5a6a4045a7cd..1dbc572fd26a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java @@ -290,10 +290,7 @@ private void addNpmPackageGeneration() { supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("package.mustache", "", "package.json")); supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); - // in case ECMAScript 6 is supported add another tsconfig for an ESM (ECMAScript Module) - if (supportsES6) { - supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); - } + supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); } @Override 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 0ab99f1f6523..449303321ea4 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 @@ -427,9 +427,7 @@ private void addNpmPackageGeneration() { supportingFiles.add(new SupportingFile("package.mustache", "", "package.json")); supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); // in case ECMAScript 6 is supported add another tsconfig for an ESM (ECMAScript Module) - if (supportsES6) { - supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); - } + supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); supportingFiles.add(new SupportingFile("npmignore.mustache", "", ".npmignore")); supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/aurelia/TypeScriptAureliaClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/aurelia/TypeScriptAureliaClientOptionsTest.java index 8da6662021ff..7ff866613b78 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/aurelia/TypeScriptAureliaClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/aurelia/TypeScriptAureliaClientOptionsTest.java @@ -46,7 +46,6 @@ protected void verifyOptions() { verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAureliaClientOptionsProvider.SORT_PARAMS_VALUE)); verify(clientCodegen).setModelPropertyNaming(TypeScriptAureliaClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); verify(clientCodegen).setParamNaming(TypeScriptAureliaClientOptionsProvider.PARAM_NAMING_VALUE); - verify(clientCodegen).setSupportsES6(TypeScriptAureliaClientOptionsProvider.SUPPORTS_ES6_VALUE); verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptAureliaClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(TypeScriptAureliaClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java index afbf555beb34..71a26ea22516 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientOptionsTest.java @@ -46,7 +46,6 @@ protected void verifyOptions() { verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.SORT_PARAMS_VALUE)); verify(clientCodegen).setModelPropertyNaming(TypeScriptFetchClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); verify(clientCodegen).setParamNaming(TypeScriptFetchClientOptionsProvider.PARAM_NAMING_VALUE); - verify(clientCodegen).setSupportsES6(TypeScriptFetchClientOptionsProvider.SUPPORTS_ES6_VALUE); verify(clientCodegen).setImportFileExtension(TypeScriptFetchClientOptionsProvider.IMPORT_FILE_EXTENSION_VALUE); verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); verify(clientCodegen).setWithoutRuntimeChecks(Boolean.valueOf(TypeScriptFetchClientOptionsProvider.WITHOUT_RUNTIME_CHECKS)); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java index 795620656913..ec5109399580 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientOptionsTest.java @@ -45,7 +45,6 @@ protected CodegenConfig getCodegenConfig() { protected void verifyOptions() { verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SORT_PARAMS_VALUE)); verify(clientCodegen).setModelPropertyNaming(TypeScriptAngularClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); - verify(clientCodegen).setSupportsES6(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SUPPORTS_ES6_VALUE)); verify(clientCodegen).setStringEnums(Boolean.parseBoolean(TypeScriptAngularClientOptionsProvider.STRING_ENUMS_VALUE)); verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); verify(clientCodegen).setQueryParamObjectFormat(TypeScriptAngularClientOptionsProvider.QUERY_PARAM_OBJECT_FORMAT_VALUE); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientOptionsTest.java index 7b812a7eb37e..2c74b1ac5834 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnestjs/TypeScriptNestjsClientOptionsTest.java @@ -46,7 +46,6 @@ protected void verifyOptions() { verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptNestjsClientOptionsProvider.SORT_PARAMS_VALUE)); verify(clientCodegen).setModelPropertyNaming(TypeScriptNestjsClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); verify(clientCodegen).setParamNaming(TypeScriptNestjsClientOptionsProvider.PARAM_NAMING_VALUE); - verify(clientCodegen).setSupportsES6(Boolean.valueOf(TypeScriptNestjsClientOptionsProvider.SUPPORTS_ES6_VALUE)); verify(clientCodegen).setStringEnums(Boolean.parseBoolean(TypeScriptNestjsClientOptionsProvider.STRING_ENUMS_VALUE)); verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptNestjsClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(TypeScriptNestjsClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientOptionsTest.java index 61999253c9dc..f7db43c97890 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypeScriptNodeClientOptionsTest.java @@ -46,7 +46,6 @@ protected void verifyOptions() { verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SORT_PARAMS_VALUE)); verify(clientCodegen).setModelPropertyNaming(TypeScriptNodeClientOptionsProvider.MODEL_PROPERTY_NAMING_VALUE); verify(clientCodegen).setParamNaming(TypeScriptNodeClientOptionsProvider.PARAM_NAMING_VALUE); - verify(clientCodegen).setSupportsES6(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SUPPORTS_ES6_VALUE)); verify(clientCodegen).setPrependFormOrBodyParameters(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(TypeScriptNodeClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); } From ce3bd1f79d15008dd2e42d2f15315b763b33c49b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 26 Jul 2023 11:52:48 +0800 Subject: [PATCH 2/9] more cleanup --- .../openapitools/codegen/CodegenConstants.java | 3 --- .../TypeScriptAngularClientOptionsProvider.java | 2 -- ...TypeScriptAngularJsClientOptionsProvider.java | 2 -- .../TypeScriptAureliaClientOptionsProvider.java | 2 -- .../TypeScriptFetchClientOptionsProvider.java | 2 -- .../TypeScriptNestjsClientOptionsProvider.java | 2 -- .../TypeScriptNodeClientOptionsProvider.java | 2 -- .../axios/TypeScriptAxiosClientCodegenTest.java | 15 --------------- .../fetch/TypeScriptFetchClientCodegenTest.java | 16 ---------------- .../TypescriptNodeES5IntegrationTest.java | 1 - .../TypescriptNodeEnumIntegrationTest.java | 1 - 11 files changed, 48 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index edc2ef10c096..dc1990f5e3f9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -272,9 +272,6 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, public static final String HTTP_USER_AGENT = "httpUserAgent"; public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'"; - public static final String SUPPORTS_ES6 = "supportsES6"; - public static final String SUPPORTS_ES6_DESC = "Generate code that conforms to ES6."; - public static final String SUPPORTS_ASYNC = "supportsAsync"; public static final String SUPPORTS_ASYNC_DESC = "Generate code that supports async operations."; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java index 2e034f0695f9..021e36713674 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java @@ -25,7 +25,6 @@ import java.util.Map; public class TypeScriptAngularClientOptionsProvider implements OptionsProvider { - public static final String SUPPORTS_ES6_VALUE = "false"; public static final String NULL_SAFE_ADDITIONAL_PROPS_VALUE = "false"; public static final String ENUM_NAME_SUFFIX = "Enum"; public static final String STRING_ENUMS_VALUE = "false"; @@ -67,7 +66,6 @@ public Map createOptions() { .put(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) .put(CodegenConstants.PARAM_NAMING, PARAM_NAMING_VALUE) - .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(AbstractTypeScriptClientCodegen.NULL_SAFE_ADDITIONAL_PROPS, NULL_SAFE_ADDITIONAL_PROPS_VALUE) .put(AbstractTypeScriptClientCodegen.ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR, ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_VALUE) .put(CodegenConstants.ENUM_NAME_SUFFIX, ENUM_NAME_SUFFIX) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularJsClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularJsClientOptionsProvider.java index fd62de4e03b8..131d923a105c 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularJsClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularJsClientOptionsProvider.java @@ -24,7 +24,6 @@ import java.util.Map; public class TypeScriptAngularJsClientOptionsProvider implements OptionsProvider { - public static final String SUPPORTS_ES6_VALUE = "false"; public static final String NULL_SAFE_ADDITIONAL_PROPS_VALUE = "false"; public static final String ENUM_NAME_SUFFIX = "Enum"; public static final String SORT_PARAMS_VALUE = "false"; @@ -47,7 +46,6 @@ public Map createOptions() { ImmutableMap.Builder builder = new ImmutableMap.Builder(); return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) .put(CodegenConstants.SORT_MODEL_PROPERTIES_BY_REQUIRED_FLAG, SORT_MODEL_PROPERTIES_VALUE) - .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(AbstractTypeScriptClientCodegen.NULL_SAFE_ADDITIONAL_PROPS, NULL_SAFE_ADDITIONAL_PROPS_VALUE) .put(CodegenConstants.ENUM_NAME_SUFFIX, ENUM_NAME_SUFFIX) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAureliaClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAureliaClientOptionsProvider.java index e975525974a6..442a2a9860d8 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAureliaClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAureliaClientOptionsProvider.java @@ -28,7 +28,6 @@ public class TypeScriptAureliaClientOptionsProvider implements OptionsProvider { public static final String SORT_PARAMS_VALUE = "false"; public static final String SORT_MODEL_PROPERTIES_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; - public static final Boolean SUPPORTS_ES6_VALUE = false; public static final Boolean NULL_SAFE_ADDITIONAL_PROPS_VALUE = false; public static final String ENUM_NAME_SUFFIX = "Enum"; public static final String ENUM_PROPERTY_NAMING_VALUE = "PascalCase"; @@ -55,7 +54,6 @@ public Map createOptions() { .put(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) .put(CodegenConstants.PARAM_NAMING, PARAM_NAMING_VALUE) - .put(CodegenConstants.SUPPORTS_ES6, String.valueOf(SUPPORTS_ES6_VALUE)) .put(AbstractTypeScriptClientCodegen.NULL_SAFE_ADDITIONAL_PROPS, String.valueOf(NULL_SAFE_ADDITIONAL_PROPS_VALUE)) .put(AbstractTypeScriptClientCodegen.ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR, ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_VALUE) .put(CodegenConstants.ENUM_NAME_SUFFIX, ENUM_NAME_SUFFIX) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java index e07f01cc32db..6170a7aad9a0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptFetchClientOptionsProvider.java @@ -28,7 +28,6 @@ public class TypeScriptFetchClientOptionsProvider implements OptionsProvider { public static final String SORT_PARAMS_VALUE = "false"; public static final String SORT_MODEL_PROPERTIES_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; - public static final Boolean SUPPORTS_ES6_VALUE = false; public static final String IMPORT_FILE_EXTENSION_VALUE = ""; public static final Boolean NULL_SAFE_ADDITIONAL_PROPS_VALUE = false; public static final String ENUM_NAME_SUFFIX = "Enum"; @@ -60,7 +59,6 @@ public Map createOptions() { .put(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) .put(CodegenConstants.PARAM_NAMING, PARAM_NAMING_VALUE) - .put(CodegenConstants.SUPPORTS_ES6, String.valueOf(SUPPORTS_ES6_VALUE)) .put(AbstractTypeScriptClientCodegen.NULL_SAFE_ADDITIONAL_PROPS, String.valueOf(NULL_SAFE_ADDITIONAL_PROPS_VALUE)) .put(AbstractTypeScriptClientCodegen.ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR, ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_VALUE) .put(CodegenConstants.ENUM_NAME_SUFFIX, ENUM_NAME_SUFFIX) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNestjsClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNestjsClientOptionsProvider.java index d09fafce21d3..c5f9a0304f3a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNestjsClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNestjsClientOptionsProvider.java @@ -24,7 +24,6 @@ import java.util.Map; public class TypeScriptNestjsClientOptionsProvider implements OptionsProvider { - public static final String SUPPORTS_ES6_VALUE = "false"; public static final String NULL_SAFE_ADDITIONAL_PROPS_VALUE = "false"; public static final String ENUM_NAME_SUFFIX = "Enum"; public static final String STRING_ENUMS_VALUE = "false"; @@ -63,7 +62,6 @@ public Map createOptions() { .put(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING_VALUE) .put(CodegenConstants.MODEL_PROPERTY_NAMING, MODEL_PROPERTY_NAMING_VALUE) .put(CodegenConstants.PARAM_NAMING, PARAM_NAMING_VALUE) - .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(AbstractTypeScriptClientCodegen.NULL_SAFE_ADDITIONAL_PROPS, NULL_SAFE_ADDITIONAL_PROPS_VALUE) .put(AbstractTypeScriptClientCodegen.ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR, ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_VALUE) .put(CodegenConstants.ENUM_NAME_SUFFIX, ENUM_NAME_SUFFIX) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java index fca76c379aef..7d481406c90d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptNodeClientOptionsProvider.java @@ -26,7 +26,6 @@ public class TypeScriptNodeClientOptionsProvider implements OptionsProvider { - public static final String SUPPORTS_ES6_VALUE = "false"; public static final String NULL_SAFE_ADDITIONAL_PROPS_VALUE = "false"; public static final String ENUM_NAME_SUFFIX = "Enum"; public static final String SORT_PARAMS_VALUE = "false"; @@ -54,7 +53,6 @@ public Map createOptions() { ImmutableMap.Builder builder = new ImmutableMap.Builder(); return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) .put(CodegenConstants.SORT_MODEL_PROPERTIES_BY_REQUIRED_FLAG, SORT_MODEL_PROPERTIES_VALUE) - .put(CodegenConstants.SUPPORTS_ES6, SUPPORTS_ES6_VALUE) .put(AbstractTypeScriptClientCodegen.NULL_SAFE_ADDITIONAL_PROPS, NULL_SAFE_ADDITIONAL_PROPS_VALUE) .put(AbstractTypeScriptClientCodegen.ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR, ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_VALUE) .put(CodegenConstants.ENUM_NAME_SUFFIX, ENUM_NAME_SUFFIX) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/axios/TypeScriptAxiosClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/axios/TypeScriptAxiosClientCodegenTest.java index 8a229bf14ff3..c413386a8037 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/axios/TypeScriptAxiosClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/axios/TypeScriptAxiosClientCodegenTest.java @@ -89,7 +89,6 @@ public void containsESMTSConfigFileInCaseOfES6AndNPM() { codegen.additionalProperties().put("npmName", "@openapi/typescript-axios-petstore"); codegen.additionalProperties().put("snapshot", false); codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT"); - codegen.additionalProperties().put("supportsES6", true); codegen.processOpts(); @@ -97,18 +96,4 @@ public void containsESMTSConfigFileInCaseOfES6AndNPM() { assertThat(codegen.supportingFiles()).contains(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); } - @Test - public void doesNotContainESMTSConfigFileInCaseOfES5AndNPM() { - TypeScriptAxiosClientCodegen codegen = new TypeScriptAxiosClientCodegen(); - - codegen.additionalProperties().put("npmName", "@openapi/typescript-axios-petstore"); - codegen.additionalProperties().put("snapshot", false); - codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT"); - codegen.additionalProperties().put("supportsES6", false); - - codegen.processOpts(); - - assertThat(codegen.supportingFiles()).contains(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); - assertThat(codegen.supportingFiles()).doesNotContain(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); - } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java index a6bccbff1ac7..b1f966173aca 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/fetch/TypeScriptFetchClientCodegenTest.java @@ -149,26 +149,10 @@ public void containsESMTSConfigFileInCaseOfES6AndNPM() { codegen.additionalProperties().put("npmName", "@openapi/typescript-fetch-petstore"); codegen.additionalProperties().put("snapshot", false); codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT"); - codegen.additionalProperties().put("supportsES6", true); codegen.processOpts(); assertThat(codegen.supportingFiles()).contains(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); assertThat(codegen.supportingFiles()).contains(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); } - - @Test - public void doesNotContainESMTSConfigFileInCaseOfES5AndNPM() { - TypeScriptFetchClientCodegen codegen = new TypeScriptFetchClientCodegen(); - - codegen.additionalProperties().put("npmName", "@openapi/typescript-fetch-petstore"); - codegen.additionalProperties().put("snapshot", false); - codegen.additionalProperties().put("npmVersion", "1.0.0-SNAPSHOT"); - codegen.additionalProperties().put("supportsES6", false); - - codegen.processOpts(); - - assertThat(codegen.supportingFiles()).contains(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); - assertThat(codegen.supportingFiles()).doesNotContain(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); - } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypescriptNodeES5IntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypescriptNodeES5IntegrationTest.java index b7fc1bcd368c..faa19f4f7242 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypescriptNodeES5IntegrationTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypescriptNodeES5IntegrationTest.java @@ -41,7 +41,6 @@ protected Map configProperties() { properties.put("npmName", "node-es6-test"); properties.put("npmVersion", "1.0.3"); properties.put("snapshot", "false"); - properties.put("supportsES6", "false"); return properties; } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypescriptNodeEnumIntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypescriptNodeEnumIntegrationTest.java index d5490934a9f0..00d822fa481d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypescriptNodeEnumIntegrationTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptnode/TypescriptNodeEnumIntegrationTest.java @@ -40,7 +40,6 @@ protected Map configProperties() { properties.put("npmName", "node-es6-test"); properties.put("npmVersion", "1.0.3"); properties.put("snapshot", "false"); - properties.put("supportsES6", "false"); return properties; } From d49b20b3bacda433fa0867621bc8c73ce415e36a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 27 Jul 2023 09:53:59 +0800 Subject: [PATCH 3/9] update ts template to remove supportsES6 option --- .../resources/typescript-angular/tsconfig.mustache | 4 ++-- .../resources/typescript-aurelia/package.json.mustache | 3 +-- .../main/resources/typescript-axios/package.mustache | 4 +--- .../main/resources/typescript-axios/tsconfig.mustache | 2 +- .../main/resources/typescript-fetch/package.mustache | 4 +--- .../main/resources/typescript-fetch/tsconfig.mustache | 2 +- .../resources/typescript-inversify/tsconfig.mustache | 4 ++-- .../main/resources/typescript-jquery/tsconfig.mustache | 2 +- .../main/resources/typescript-nestjs/tsconfig.mustache | 2 +- .../main/resources/typescript-node/tsconfig.mustache | 2 +- .../resources/typescript-redux-query/tsconfig.mustache | 2 +- .../main/resources/typescript-rxjs/tsconfig.mustache | 2 +- .../src/main/resources/typescript/api/api.mustache | 2 +- .../src/main/resources/typescript/http/http.mustache | 2 +- .../src/main/resources/typescript/package.mustache | 10 ---------- .../src/main/resources/typescript/tsconfig.mustache | 5 ----- .../typescript-rxjs/allOf-composition/tsconfig.json | 2 +- .../typescript/builds/with-unique-items/package.json | 5 +++-- .../typescript/builds/with-unique-items/tsconfig.json | 3 ++- .../builds/with-npm/tsconfig.json | 4 ++-- .../petstore/typescript-aurelia/default/package.json | 1 - .../.openapi-generator/FILES | 1 + .../package.json | 4 +++- .../tsconfig.json | 2 +- .../builds/with-npm-version/.openapi-generator/FILES | 1 + .../builds/with-npm-version/package.json | 4 +++- .../builds/with-npm-version/tsconfig.json | 2 +- .../.openapi-generator/FILES | 1 + .../builds/prefix-parameter-interfaces/package.json | 4 +++- .../builds/prefix-parameter-interfaces/tsconfig.json | 2 +- .../builds/with-npm-version/.openapi-generator/FILES | 1 + .../builds/with-npm-version/package.json | 4 +++- .../builds/with-npm-version/tsconfig.json | 2 +- .../without-runtime-checks/.openapi-generator/FILES | 1 + .../builds/without-runtime-checks/package.json | 4 +++- .../builds/without-runtime-checks/tsconfig.json | 2 +- .../petstore/typescript-jquery/npm/tsconfig.json | 2 +- .../builds/default/tsconfig.json | 2 +- .../builds/default/tsconfig.json | 2 +- .../client/petstore/typescript-node/npm/tsconfig.json | 2 +- .../builds/with-npm-version/tsconfig.json | 2 +- .../typescript-rxjs/builds/default/tsconfig.json | 2 +- .../builds/with-npm-version/tsconfig.json | 2 +- .../builds/with-progress-subscriber/tsconfig.json | 2 +- .../typescript/builds/composed-schemas/package.json | 5 +++-- .../typescript/builds/composed-schemas/tsconfig.json | 3 ++- .../petstore/typescript/builds/default/apis/PetApi.ts | 2 +- .../typescript/builds/default/apis/StoreApi.ts | 2 +- .../petstore/typescript/builds/default/apis/UserApi.ts | 2 +- .../petstore/typescript/builds/default/http/http.ts | 2 +- .../petstore/typescript/builds/default/package.json | 5 +++-- .../petstore/typescript/builds/default/tsconfig.json | 3 ++- .../typescript/builds/inversify/apis/PetApi.ts | 2 +- .../typescript/builds/inversify/apis/StoreApi.ts | 2 +- .../typescript/builds/inversify/apis/UserApi.ts | 2 +- .../petstore/typescript/builds/inversify/http/http.ts | 2 +- .../petstore/typescript/builds/inversify/package.json | 5 +++-- .../petstore/typescript/builds/inversify/tsconfig.json | 3 ++- .../petstore/typescript/builds/jquery/package.json | 5 +++-- .../petstore/typescript/builds/jquery/tsconfig.json | 3 ++- .../typescript/builds/object_params/apis/PetApi.ts | 2 +- .../typescript/builds/object_params/apis/StoreApi.ts | 2 +- .../typescript/builds/object_params/apis/UserApi.ts | 2 +- .../typescript/builds/object_params/http/http.ts | 2 +- .../typescript/builds/object_params/package.json | 5 +++-- .../typescript/builds/object_params/tsconfig.json | 3 ++- 66 files changed, 94 insertions(+), 88 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/tsconfig.mustache index dd4391c668ac..fd2abf8a2ad4 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/tsconfig.mustache @@ -4,8 +4,8 @@ "experimentalDecorators": true, "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, - "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", - "module": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}commonjs{{/supportsES6}}", + "target": "es6", + "module": "es6", "moduleResolution": "node", "removeComments": true, "sourceMap": true, diff --git a/modules/openapi-generator/src/main/resources/typescript-aurelia/package.json.mustache b/modules/openapi-generator/src/main/resources/typescript-aurelia/package.json.mustache index 91a55a9140cd..14e2b1c73cb1 100644 --- a/modules/openapi-generator/src/main/resources/typescript-aurelia/package.json.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-aurelia/package.json.mustache @@ -10,8 +10,7 @@ "browser": "./dist/Api.js", "typings": "./dist/Api.d.ts", "dependencies": { - {{^supportsES6}}"core-js": "^2.4.0", - {{/supportsES6}}"isomorphic-fetch": "^2.2.1", + "isomorphic-fetch": "^2.2.1", "aurelia-framework": "^1.3.1", "aurelia-http-client": "^1.3.0" }, diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache index 4ba75b22a0ca..69e4dc473994 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache @@ -17,12 +17,10 @@ "license": "Unlicense", "main": "./dist/index.js", "typings": "./dist/index.d.ts", -{{#supportsES6}} "module": "./dist/esm/index.js", "sideEffects": false, -{{/supportsES6}} "scripts": { - "build": "tsc {{#supportsES6}}&& tsc -p tsconfig.esm.json{{/supportsES6}}", + "build": "tsc && tsc -p tsconfig.esm.json", "prepare": "npm run build" }, "dependencies": { diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/tsconfig.mustache index d0ebbd47a6b6..6787045c385e 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/tsconfig.mustache @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}", + "target": "ES6", "module": "commonjs", "noImplicitAny": true, "outDir": "dist", diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/package.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/package.mustache index add4643dfe31..219ecab01951 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/package.mustache @@ -13,12 +13,10 @@ {{^packageAsSourceOnlyLibrary}} "main": "./dist/index.js", "typings": "./dist/index.d.ts", -{{#supportsES6}} "module": "./dist/esm/index.js", "sideEffects": false, -{{/supportsES6}} "scripts": { - "build": "tsc{{#supportsES6}} && tsc -p tsconfig.esm.json{{/supportsES6}}"{{^sagasAndRecords}}, + "build": "tsc && tsc -p tsconfig.esm.json"{{^sagasAndRecords}}, "prepare": "npm run build"{{/sagasAndRecords}} }, {{/packageAsSourceOnlyLibrary}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/tsconfig.mustache index a8778b096590..59125b6aacaf 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/tsconfig.mustache @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", + "target": "es6", {{#sagasAndRecords}} "strict": true, {{/sagasAndRecords}} diff --git a/modules/openapi-generator/src/main/resources/typescript-inversify/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-inversify/tsconfig.mustache index dd4391c668ac..fd2abf8a2ad4 100644 --- a/modules/openapi-generator/src/main/resources/typescript-inversify/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-inversify/tsconfig.mustache @@ -4,8 +4,8 @@ "experimentalDecorators": true, "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, - "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", - "module": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}commonjs{{/supportsES6}}", + "target": "es6", + "module": "es6", "moduleResolution": "node", "removeComments": true, "sourceMap": true, diff --git a/modules/openapi-generator/src/main/resources/typescript-jquery/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-jquery/tsconfig.mustache index f255a8814fc0..fa5e621b78bc 100644 --- a/modules/openapi-generator/src/main/resources/typescript-jquery/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-jquery/tsconfig.mustache @@ -3,7 +3,7 @@ "module": "commonjs", "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, - "target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}", + "target": "ES6", "moduleResolution": "node", "removeComments": true, "sourceMap": true, diff --git a/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.mustache index 2e51b4661df2..4cead0398342 100644 --- a/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-nestjs/tsconfig.mustache @@ -5,7 +5,7 @@ "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", + "target": "es6", "sourceMap": true, "outDir": "./dist", "baseUrl": "./", diff --git a/modules/openapi-generator/src/main/resources/typescript-node/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-node/tsconfig.mustache index de78697d22a3..82a8b637ec92 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/tsconfig.mustache @@ -3,7 +3,7 @@ "module": "commonjs", "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, - "target": "{{#supportsES6}}ES6{{/supportsES6}}{{^supportsES6}}ES5{{/supportsES6}}", + "target": "ES6", "allowSyntheticDefaultImports": true, "esModuleInterop": true, "strict": true, diff --git a/modules/openapi-generator/src/main/resources/typescript-redux-query/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-redux-query/tsconfig.mustache index 420c3a44f883..582e3dba3c62 100644 --- a/modules/openapi-generator/src/main/resources/typescript-redux-query/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-redux-query/tsconfig.mustache @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/tsconfig.mustache index 0779a8b0037f..236e4349cd72 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/tsconfig.mustache @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache index 1770f54dfa25..d1be496f1be4 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -4,7 +4,7 @@ import {Configuration} from '../configuration{{importFileExtension}}'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http{{importFileExtension}}'; {{#platforms}} {{#node}} -import {{^supportsES6}}* as{{/supportsES6}} FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; {{/node}} {{/platforms}} diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 0ecca57cd86f..07eef6289baa 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -1,7 +1,7 @@ {{#platforms}} {{#node}} // TODO: evaluate if we can easily get rid of this library -import {{^supportsES6}}* as{{/supportsES6}} FormData from "form-data{{importFileExtension}}"; +import FormData from "form-data{{importFileExtension}}"; import { URL, URLSearchParams } from 'url{{importFileExtension}}'; import * as http from 'http{{importFileExtension}}'; import * as https from 'https{{importFileExtension}}'; diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index fe5d0cc19ec3..d42810ec010d 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -15,21 +15,11 @@ ], "license": "Unlicense", "main": "./dist/index.js", - {{#supportsES6}} "type": "module", "module": "./dist/index.js", - {{/supportsES6}} - {{^supportsES6}} - "type": "commonjs", - {{/supportsES6}} "exports": { ".": { - {{#supportsES6}} "import": "./dist/index.js", - {{/supportsES6}} - {{^supportsES6}} - "require": "./dist/index.js", - {{/supportsES6}} "types": "./dist/index.d.js" } }, diff --git a/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache index b7aa518c46e4..330c9a336def 100644 --- a/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache @@ -2,13 +2,8 @@ "compilerOptions": { "strict": true, /* Basic Options */ - {{#supportsES6}} "target": "es6", "esModuleInterop": true, - {{/supportsES6}} - {{^supportsES6}} - "target": "es5", - {{/supportsES6}} "moduleResolution": "node", "declaration": true, diff --git a/samples/client/others/typescript-rxjs/allOf-composition/tsconfig.json b/samples/client/others/typescript-rxjs/allOf-composition/tsconfig.json index 59a60838a05c..6dee091ee8d4 100644 --- a/samples/client/others/typescript-rxjs/allOf-composition/tsconfig.json +++ b/samples/client/others/typescript-rxjs/allOf-composition/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/samples/client/others/typescript/builds/with-unique-items/package.json b/samples/client/others/typescript/builds/with-unique-items/package.json index 5396cefd2a8c..fe1ae8328e70 100644 --- a/samples/client/others/typescript/builds/with-unique-items/package.json +++ b/samples/client/others/typescript/builds/with-unique-items/package.json @@ -15,10 +15,11 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "commonjs", + "type": "module", + "module": "./dist/index.js", "exports": { ".": { - "require": "./dist/index.js", + "import": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/client/others/typescript/builds/with-unique-items/tsconfig.json b/samples/client/others/typescript/builds/with-unique-items/tsconfig.json index aa173eb68f32..2cc80c60873f 100644 --- a/samples/client/others/typescript/builds/with-unique-items/tsconfig.json +++ b/samples/client/others/typescript/builds/with-unique-items/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es5", + "target": "es6", + "esModuleInterop": true, "moduleResolution": "node", "declaration": true, diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/tsconfig.json b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/tsconfig.json index c01ebe255d4c..fd2abf8a2ad4 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/tsconfig.json +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/tsconfig.json @@ -4,8 +4,8 @@ "experimentalDecorators": true, "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, - "target": "es5", - "module": "commonjs", + "target": "es6", + "module": "es6", "moduleResolution": "node", "removeComments": true, "sourceMap": true, diff --git a/samples/client/petstore/typescript-aurelia/default/package.json b/samples/client/petstore/typescript-aurelia/default/package.json index 2d613cc26610..a0d95c1ba7bb 100644 --- a/samples/client/petstore/typescript-aurelia/default/package.json +++ b/samples/client/petstore/typescript-aurelia/default/package.json @@ -10,7 +10,6 @@ "browser": "./dist/Api.js", "typings": "./dist/Api.d.ts", "dependencies": { - "core-js": "^2.4.0", "isomorphic-fetch": "^2.2.1", "aurelia-framework": "^1.3.1", "aurelia-http-client": "^1.3.0" diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/.openapi-generator/FILES index aded8aa37a14..014d97041950 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/.openapi-generator/FILES @@ -18,4 +18,5 @@ model/some/levels/deep/pet.ts model/some/levels/deep/tag.ts model/some/levels/deep/user.ts package.json +tsconfig.esm.json tsconfig.json diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json index 8569103e4e4f..dc2da01a43e4 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/package.json @@ -17,8 +17,10 @@ "license": "Unlicense", "main": "./dist/index.js", "typings": "./dist/index.d.ts", + "module": "./dist/esm/index.js", + "sideEffects": false, "scripts": { - "build": "tsc ", + "build": "tsc && tsc -p tsconfig.esm.json", "prepare": "npm run build" }, "dependencies": { diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/tsconfig.json b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/tsconfig.json index d953a374d812..ca2334821401 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/tsconfig.json +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "ES5", + "target": "ES6", "module": "commonjs", "noImplicitAny": true, "outDir": "dist", diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/FILES index 534fae710fba..37591a69f79b 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/FILES @@ -8,4 +8,5 @@ configuration.ts git_push.sh index.ts package.json +tsconfig.esm.json tsconfig.json diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json b/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json index 8569103e4e4f..dc2da01a43e4 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json @@ -17,8 +17,10 @@ "license": "Unlicense", "main": "./dist/index.js", "typings": "./dist/index.d.ts", + "module": "./dist/esm/index.js", + "sideEffects": false, "scripts": { - "build": "tsc ", + "build": "tsc && tsc -p tsconfig.esm.json", "prepare": "npm run build" }, "dependencies": { diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.json b/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.json index d953a374d812..ca2334821401 100644 --- a/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.json +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "ES5", + "target": "ES6", "module": "commonjs", "noImplicitAny": true, "outDir": "dist", diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.openapi-generator/FILES index 38feffe8896a..cfa1534a047b 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/.openapi-generator/FILES @@ -15,4 +15,5 @@ src/models/Tag.ts src/models/User.ts src/models/index.ts src/runtime.ts +tsconfig.esm.json tsconfig.json diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/package.json b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/package.json index 0587300c451b..7c6d9667c05a 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/package.json +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/package.json @@ -9,8 +9,10 @@ }, "main": "./dist/index.js", "typings": "./dist/index.d.ts", + "module": "./dist/esm/index.js", + "sideEffects": false, "scripts": { - "build": "tsc", + "build": "tsc && tsc -p tsconfig.esm.json", "prepare": "npm run build" }, "devDependencies": { diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.json index 4567ec19899a..368cedd5da06 100644 --- a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/with-npm-version/.openapi-generator/FILES index 38feffe8896a..cfa1534a047b 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/.openapi-generator/FILES @@ -15,4 +15,5 @@ src/models/Tag.ts src/models/User.ts src/models/index.ts src/runtime.ts +tsconfig.esm.json tsconfig.json diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json b/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json index 0587300c451b..7c6d9667c05a 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/package.json @@ -9,8 +9,10 @@ }, "main": "./dist/index.js", "typings": "./dist/index.d.ts", + "module": "./dist/esm/index.js", + "sideEffects": false, "scripts": { - "build": "tsc", + "build": "tsc && tsc -p tsconfig.esm.json", "prepare": "npm run build" }, "devDependencies": { diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json index 4567ec19899a..368cedd5da06 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/.openapi-generator/FILES index 83b6414b911e..568a95d04699 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/.openapi-generator/FILES @@ -9,4 +9,5 @@ src/apis/index.ts src/index.ts src/models/index.ts src/runtime.ts +tsconfig.esm.json tsconfig.json diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/package.json b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/package.json index 0587300c451b..7c6d9667c05a 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/package.json +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/package.json @@ -9,8 +9,10 @@ }, "main": "./dist/index.js", "typings": "./dist/index.d.ts", + "module": "./dist/esm/index.js", + "sideEffects": false, "scripts": { - "build": "tsc", + "build": "tsc && tsc -p tsconfig.esm.json", "prepare": "npm run build" }, "devDependencies": { diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/tsconfig.json index 4567ec19899a..368cedd5da06 100644 --- a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/tsconfig.json +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/samples/client/petstore/typescript-jquery/npm/tsconfig.json b/samples/client/petstore/typescript-jquery/npm/tsconfig.json index e15ee4c5762c..fa5e621b78bc 100644 --- a/samples/client/petstore/typescript-jquery/npm/tsconfig.json +++ b/samples/client/petstore/typescript-jquery/npm/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, - "target": "ES5", + "target": "ES6", "moduleResolution": "node", "removeComments": true, "sourceMap": true, diff --git a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.json b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.json index c71e17c1b8ae..4cead0398342 100644 --- a/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.json +++ b/samples/client/petstore/typescript-nestjs-v6-provided-in-root/builds/default/tsconfig.json @@ -5,7 +5,7 @@ "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "es5", + "target": "es6", "sourceMap": true, "outDir": "./dist", "baseUrl": "./", diff --git a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.json b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.json index c71e17c1b8ae..4cead0398342 100644 --- a/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.json +++ b/samples/client/petstore/typescript-nestjs-v8-provided-in-root/builds/default/tsconfig.json @@ -5,7 +5,7 @@ "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "es5", + "target": "es6", "sourceMap": true, "outDir": "./dist", "baseUrl": "./", diff --git a/samples/client/petstore/typescript-node/npm/tsconfig.json b/samples/client/petstore/typescript-node/npm/tsconfig.json index afce3b7abd4a..82a8b637ec92 100644 --- a/samples/client/petstore/typescript-node/npm/tsconfig.json +++ b/samples/client/petstore/typescript-node/npm/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "noImplicitAny": false, "suppressImplicitAnyIndexErrors": true, - "target": "ES5", + "target": "ES6", "allowSyntheticDefaultImports": true, "esModuleInterop": true, "strict": true, diff --git a/samples/client/petstore/typescript-redux-query/builds/with-npm-version/tsconfig.json b/samples/client/petstore/typescript-redux-query/builds/with-npm-version/tsconfig.json index 4567ec19899a..368cedd5da06 100644 --- a/samples/client/petstore/typescript-redux-query/builds/with-npm-version/tsconfig.json +++ b/samples/client/petstore/typescript-redux-query/builds/with-npm-version/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/samples/client/petstore/typescript-rxjs/builds/default/tsconfig.json b/samples/client/petstore/typescript-rxjs/builds/default/tsconfig.json index 59a60838a05c..6dee091ee8d4 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/tsconfig.json +++ b/samples/client/petstore/typescript-rxjs/builds/default/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/tsconfig.json b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/tsconfig.json index 59a60838a05c..6dee091ee8d4 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/tsconfig.json +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/samples/client/petstore/typescript-rxjs/builds/with-progress-subscriber/tsconfig.json b/samples/client/petstore/typescript-rxjs/builds/with-progress-subscriber/tsconfig.json index 59a60838a05c..6dee091ee8d4 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-progress-subscriber/tsconfig.json +++ b/samples/client/petstore/typescript-rxjs/builds/with-progress-subscriber/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "declaration": true, - "target": "es5", + "target": "es6", "module": "commonjs", "moduleResolution": "node", "outDir": "dist", diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json index 8f6636e8cf8b..75f0bc16826a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json @@ -15,10 +15,11 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "commonjs", + "type": "module", + "module": "./dist/index.js", "exports": { ".": { - "require": "./dist/index.js", + "import": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json index aa173eb68f32..2cc80c60873f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es5", + "target": "es6", + "esModuleInterop": true, "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts index 5b3d37fe35a1..e632d988105b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts index 3bb0a2de754e..03b49fc7c851 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts index 352b499b3785..24914bbcb54f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index af0075aeba6f..b590ffcb114a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -1,5 +1,5 @@ // TODO: evaluate if we can easily get rid of this library -import * as FormData from "form-data"; +import FormData from "form-data"; import { URL, URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index f75fc96c282f..d35909520dc1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -15,10 +15,11 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "commonjs", + "type": "module", + "module": "./dist/index.js", "exports": { ".": { - "require": "./dist/index.js", + "import": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json index 4a8d5cb2f334..29da7f2215ef 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es5", + "target": "es6", + "esModuleInterop": true, "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts index 93928166fcdc..4dce7071fdbf 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts index 7537e2b4eccc..0c9bb481fe00 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts index 9f81f5e77f07..58d91b17e22e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index af0075aeba6f..b590ffcb114a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -1,5 +1,5 @@ // TODO: evaluate if we can easily get rid of this library -import * as FormData from "form-data"; +import FormData from "form-data"; import { URL, URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index b6496f55d05c..4cbafe1972c8 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -15,10 +15,11 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "commonjs", + "type": "module", + "module": "./dist/index.js", "exports": { ".": { - "require": "./dist/index.js", + "import": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json index e57dd6fe3b8c..1a2adff46202 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es5", + "target": "es6", + "esModuleInterop": true, "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json index ea49a041e5b2..180967bc8f0d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json @@ -15,10 +15,11 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "commonjs", + "type": "module", + "module": "./dist/index.js", "exports": { ".": { - "require": "./dist/index.js", + "import": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json index aa173eb68f32..2cc80c60873f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es5", + "target": "es6", + "esModuleInterop": true, "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts index 5b3d37fe35a1..e632d988105b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts index 3bb0a2de754e..03b49fc7c851 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts index 352b499b3785..24914bbcb54f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import * as FormData from "form-data"; +import FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index af0075aeba6f..b590ffcb114a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -1,5 +1,5 @@ // TODO: evaluate if we can easily get rid of this library -import * as FormData from "form-data"; +import FormData from "form-data"; import { URL, URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json index f75fc96c282f..d35909520dc1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json @@ -15,10 +15,11 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "commonjs", + "type": "module", + "module": "./dist/index.js", "exports": { ".": { - "require": "./dist/index.js", + "import": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json index 4a8d5cb2f334..29da7f2215ef 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es5", + "target": "es6", + "esModuleInterop": true, "moduleResolution": "node", "declaration": true, From eb103b5e838dc7bb9df0598ecb2217f8fb8c7be6 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 27 Jul 2023 10:13:42 +0800 Subject: [PATCH 4/9] use parameterNameMappings --- .../codegen/languages/AbstractTypeScriptClientCodegen.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index 2518522913d1..06c9a488a6ac 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -508,9 +508,9 @@ public String modelFileFolder() { @Override public String toParamName(String name) { - // obtain the name from nameMapping directly if provided - if (nameMapping.containsKey(name)) { - return nameMapping.get(name); + // obtain the name from parameterNameMapping directly if provided + if (parameterNameMapping.containsKey(name)) { + return parameterNameMapping.get(name); } name = sanitizeName(name, "[^\\w$]"); From dcae9a3cd58cba70db9309c301537aa02b576304 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 27 Jul 2023 10:33:32 +0800 Subject: [PATCH 5/9] update samples, doc --- docs/generators/javascript-flowtyped.md | 1 - docs/generators/typescript-angular.md | 1 - docs/generators/typescript-aurelia.md | 1 - docs/generators/typescript-axios.md | 1 - docs/generators/typescript-fetch.md | 1 - docs/generators/typescript-inversify.md | 1 - docs/generators/typescript-jquery.md | 1 - docs/generators/typescript-nestjs.md | 1 - docs/generators/typescript-node.md | 1 - docs/generators/typescript-redux-query.md | 1 - docs/generators/typescript-rxjs.md | 1 - docs/generators/typescript.md | 1 - .../tsconfig.esm.json | 7 +++++++ .../builds/with-npm-version/tsconfig.esm.json | 7 +++++++ .../builds/prefix-parameter-interfaces/tsconfig.esm.json | 7 +++++++ .../builds/with-npm-version/tsconfig.esm.json | 7 +++++++ .../builds/without-runtime-checks/tsconfig.esm.json | 7 +++++++ 17 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/tsconfig.esm.json create mode 100644 samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.esm.json create mode 100644 samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.esm.json create mode 100644 samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.esm.json create mode 100644 samples/client/petstore/typescript-fetch/builds/without-runtime-checks/tsconfig.esm.json diff --git a/docs/generators/javascript-flowtyped.md b/docs/generators/javascript-flowtyped.md index 349e7f5ed9a2..e4a56683fb51 100644 --- a/docs/generators/javascript-flowtyped.md +++ b/docs/generators/javascript-flowtyped.md @@ -36,7 +36,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |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| ## IMPORT MAPPING diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md index f2f009abd3b0..f66ca5ae7490 100644 --- a/docs/generators/typescript-angular.md +++ b/docs/generators/typescript-angular.md @@ -47,7 +47,6 @@ 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| |stringEnums|Generate string enums instead of objects for enum values.| |false| -|supportsES6|Generate code that conforms to ES6.| |false| |taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false| |useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |false| |withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false| diff --git a/docs/generators/typescript-aurelia.md b/docs/generators/typescript-aurelia.md index c5626a5cd637..43553bb0f1d9 100644 --- a/docs/generators/typescript-aurelia.md +++ b/docs/generators/typescript-aurelia.md @@ -35,7 +35,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |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| ## IMPORT MAPPING diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md index 1a9c502a5dcf..bc9043d76d05 100644 --- a/docs/generators/typescript-axios.md +++ b/docs/generators/typescript-axios.md @@ -38,7 +38,6 @@ 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| |stringEnums|Generate string enums instead of objects for enum values.| |false| -|supportsES6|Generate code that conforms to ES6.| |false| |useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |false| |withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false| |withNodeImports|Setting this property to true adds imports for NodeJS| |false| diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md index 6ae906f50ebd..9c6f3b6dbfa6 100644 --- a/docs/generators/typescript-fetch.md +++ b/docs/generators/typescript-fetch.md @@ -40,7 +40,6 @@ 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| |stringEnums|Generate string enums instead of objects for enum values.| |false| -|supportsES6|Generate code that conforms to ES6.| |false| |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/docs/generators/typescript-inversify.md b/docs/generators/typescript-inversify.md index ee226f6328d4..1a991d4d1d50 100644 --- a/docs/generators/typescript-inversify.md +++ b/docs/generators/typescript-inversify.md @@ -36,7 +36,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |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| |taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false| |usePromise|Setting this property to use promise instead of observable inside every service.| |false| |useRxJS6|Setting this property to use rxjs 6 instead of rxjs 5.| |false| diff --git a/docs/generators/typescript-jquery.md b/docs/generators/typescript-jquery.md index 74a31f6de1a1..0d6eea6b6d0c 100644 --- a/docs/generators/typescript-jquery.md +++ b/docs/generators/typescript-jquery.md @@ -37,7 +37,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |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| ## IMPORT MAPPING diff --git a/docs/generators/typescript-nestjs.md b/docs/generators/typescript-nestjs.md index 8bb3adffb916..ee4f096d174d 100644 --- a/docs/generators/typescript-nestjs.md +++ b/docs/generators/typescript-nestjs.md @@ -43,7 +43,6 @@ 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| |stringEnums|Generate string enums instead of objects for enum values.| |false| -|supportsES6|Generate code that conforms to ES6.| |false| |taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false| |withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false| diff --git a/docs/generators/typescript-node.md b/docs/generators/typescript-node.md index 73e2788e376a..76259057c468 100644 --- a/docs/generators/typescript-node.md +++ b/docs/generators/typescript-node.md @@ -36,7 +36,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |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| ## IMPORT MAPPING diff --git a/docs/generators/typescript-redux-query.md b/docs/generators/typescript-redux-query.md index 951dd928abf9..d7e9e225f8c0 100644 --- a/docs/generators/typescript-redux-query.md +++ b/docs/generators/typescript-redux-query.md @@ -36,7 +36,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |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| |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| diff --git a/docs/generators/typescript-rxjs.md b/docs/generators/typescript-rxjs.md index 96c60baaa3c1..83f81b45482a 100644 --- a/docs/generators/typescript-rxjs.md +++ b/docs/generators/typescript-rxjs.md @@ -36,7 +36,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |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| |withProgressSubscriber|Setting this property to true will generate API controller methods with support for subscribing to request progress.| |false| ## IMPORT MAPPING diff --git a/docs/generators/typescript.md b/docs/generators/typescript.md index a699db2c550b..600cc46aa924 100644 --- a/docs/generators/typescript.md +++ b/docs/generators/typescript.md @@ -40,7 +40,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl |snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false| |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| |useInversify|Enable this to generate decorators and service identifiers for the InversifyJS inversion of control container. If you set 'deno' as 'platform', the generator will process this value as 'disable'.| |false| |useObjectParameters|Use aggregate parameter objects as function arguments for api operations instead of passing each parameter as a separate function argument.| |false| |useRxJS|Enable this to internally use rxjs observables. If disabled, a stub is used instead. This is required for the 'angular' framework.| |false| diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/tsconfig.esm.json b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/tsconfig.esm.json new file mode 100644 index 000000000000..2c0331cce040 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version-and-separate-models-and-api/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + } +} diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.esm.json b/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.esm.json new file mode 100644 index 000000000000..2c0331cce040 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + } +} diff --git a/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.esm.json b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.esm.json new file mode 100644 index 000000000000..2c0331cce040 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + } +} diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.esm.json b/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.esm.json new file mode 100644 index 000000000000..2c0331cce040 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + } +} diff --git a/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/tsconfig.esm.json b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/tsconfig.esm.json new file mode 100644 index 000000000000..2c0331cce040 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/without-runtime-checks/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + } +} From d96a5f5685001152e74310526fdb950c1e67f6c1 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 27 Jul 2023 14:02:47 +0800 Subject: [PATCH 6/9] reinstall npm --- .../builds/default/package-lock.json | 206 ++++++------------ 1 file changed, 63 insertions(+), 143 deletions(-) diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json b/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json index 284af0de81ad..9b47b58581f0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json @@ -1,7 +1,7 @@ { "name": "ts-petstore-client", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -22,23 +22,23 @@ } }, "node_modules/@types/node": { - "version": "12.12.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz", - "integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w==" + "version": "20.4.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz", + "integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg==" }, "node_modules/@types/node-fetch": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz", - "integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz", + "integrity": "sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==", "dependencies": { "@types/node": "*", "form-data": "^3.0.0" } }, "node_modules/@types/node-fetch/node_modules/form-data": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -57,7 +57,7 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/combined-stream": { "version": "1.0.8", @@ -73,15 +73,15 @@ "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "engines": { "node": ">=0.4.0" } }, "node_modules/es6-promise": { - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", - "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==" + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" }, "node_modules/form-data": { "version": "2.5.1", @@ -97,46 +97,62 @@ } }, "node_modules/mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dependencies": { - "mime-db": "1.40.0" + "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" } }, "node_modules/node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, "engines": { "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, "node_modules/querystringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", - "integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -147,122 +163,26 @@ } }, "node_modules/url-parse": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", - "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "dependencies": { - "querystringify": "^2.0.0", + "querystringify": "^2.1.1", "requires-port": "^1.0.0" } - } - }, - "dependencies": { - "@types/node": { - "version": "12.12.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.7.tgz", - "integrity": "sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w==" - }, - "@types/node-fetch": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz", - "integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==", - "requires": { - "@types/node": "*", - "form-data": "^3.0.0" - }, - "dependencies": { - "form-data": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", - "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - } - } }, - "@types/url-parse": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/@types/url-parse/-/url-parse-1.4.4.tgz", - "integrity": "sha512-KtQLad12+4T/NfSxpoDhmr22+fig3T7/08QCgmutYA6QSznSRmEtuL95GrhVV40/0otTEdFc+etRcCTqhh1q5Q==", - "dev": true + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "es6-promise": { - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz", - "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg==" - }, - "form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" - }, - "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", - "requires": { - "mime-db": "1.40.0" - } - }, - "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" - }, - "querystringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", - "integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==" - }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" - }, - "typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "dev": true - }, - "url-parse": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.3.tgz", - "integrity": "sha512-rh+KuAW36YKo0vClhQzLLveoj8FwPJNu65xLb7Mrt+eZht0IPT0IXgSv8gcMegZ6NvjJUALf6Mf25POlMwD1Fw==", - "requires": { - "querystringify": "^2.0.0", - "requires-port": "^1.0.0" + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" } } } From 323fc81ff0b34af93167a64ba9ae8cf44acc3e72 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 28 Jul 2023 09:30:21 +0800 Subject: [PATCH 7/9] fix --- .../tests/default/test/http/isomorphic-fetch.test.ts | 4 ++-- .../client/petstore/typescript/tests/default/tsconfig.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts index 748c7ad46e33..7abdfb02ccfc 100644 --- a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts +++ b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts @@ -1,7 +1,7 @@ import * as petstore from "ts-petstore-client"; import { expect} from "chai"; -import * as FormData from "form-data"; +import FormData from "form-data"; let libs: { [key: string]: petstore.HttpLibrary } = { "isomorphic-fetch": new petstore.IsomorphicFetchHttpLibrary() @@ -68,4 +68,4 @@ for (let libName in libs) { }).catch(done) }) }) -} \ No newline at end of file +} diff --git a/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json b/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json index 4596f6e40bcf..0a5080d1bdab 100644 --- a/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "esModuleInterop": true, "module": "commonjs", "target": "es6", "noImplicitAny": true, From d31108c58e88894b534809e46d8c340b413eeba3 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 9 Aug 2023 15:20:02 +0800 Subject: [PATCH 8/9] add option to skip type module --- .../src/main/resources/typescript/package.mustache | 2 ++ .../others/typescript/builds/with-unique-items/package.json | 2 -- .../client/petstore/typescript/builds/browser/package.json | 2 -- .../petstore/typescript/builds/composed-schemas/package.json | 2 -- .../client/petstore/typescript/builds/default/package.json | 2 -- .../client/petstore/typescript/builds/inversify/package.json | 2 -- .../client/petstore/typescript/builds/jquery/package.json | 2 -- .../petstore/typescript/builds/object_params/package.json | 2 -- 8 files changed, 2 insertions(+), 14 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index d42810ec010d..f192d2ef72d3 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -15,8 +15,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + {{#supportTypeModule}} "type": "module", "module": "./dist/index.js", + {{/supportTypeModule}} "exports": { ".": { "import": "./dist/index.js", diff --git a/samples/client/others/typescript/builds/with-unique-items/package.json b/samples/client/others/typescript/builds/with-unique-items/package.json index fe1ae8328e70..acc457027c02 100644 --- a/samples/client/others/typescript/builds/with-unique-items/package.json +++ b/samples/client/others/typescript/builds/with-unique-items/package.json @@ -15,8 +15,6 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "module", - "module": "./dist/index.js", "exports": { ".": { "import": "./dist/index.js", diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/package.json b/samples/openapi3/client/petstore/typescript/builds/browser/package.json index 75f0bc16826a..c1cb8657b445 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/browser/package.json @@ -15,8 +15,6 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "module", - "module": "./dist/index.js", "exports": { ".": { "import": "./dist/index.js", diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json index 75f0bc16826a..c1cb8657b445 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json @@ -15,8 +15,6 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "module", - "module": "./dist/index.js", "exports": { ".": { "import": "./dist/index.js", diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index d35909520dc1..29b42f0b0ff1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -15,8 +15,6 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "module", - "module": "./dist/index.js", "exports": { ".": { "import": "./dist/index.js", diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index 4cbafe1972c8..12c5e8be9278 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -15,8 +15,6 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "module", - "module": "./dist/index.js", "exports": { ".": { "import": "./dist/index.js", diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json index 180967bc8f0d..7db30d7a0324 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json @@ -15,8 +15,6 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "module", - "module": "./dist/index.js", "exports": { ".": { "import": "./dist/index.js", diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json index d35909520dc1..29b42f0b0ff1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json @@ -15,8 +15,6 @@ ], "license": "Unlicense", "main": "./dist/index.js", - "type": "module", - "module": "./dist/index.js", "exports": { ".": { "import": "./dist/index.js", From 4198c2389dc22b2aa0b9129bef5966da1692ce73 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 9 Aug 2023 16:27:02 +0800 Subject: [PATCH 9/9] undo typescript change --- .../src/main/resources/typescript/api/api.mustache | 2 +- .../src/main/resources/typescript/http/http.mustache | 2 +- .../src/main/resources/typescript/package.mustache | 12 ++++++++++-- .../src/main/resources/typescript/tsconfig.mustache | 5 +++++ .../typescript/builds/with-unique-items/package.json | 3 ++- .../builds/with-unique-items/tsconfig.json | 3 +-- .../petstore/typescript/builds/browser/package.json | 2 ++ .../typescript/builds/composed-schemas/package.json | 3 ++- .../typescript/builds/composed-schemas/tsconfig.json | 3 +-- .../typescript/builds/default/apis/PetApi.ts | 2 +- .../typescript/builds/default/apis/StoreApi.ts | 2 +- .../typescript/builds/default/apis/UserApi.ts | 2 +- .../petstore/typescript/builds/default/http/http.ts | 2 +- .../petstore/typescript/builds/default/package.json | 3 ++- .../petstore/typescript/builds/default/tsconfig.json | 3 +-- .../typescript/builds/inversify/apis/PetApi.ts | 2 +- .../typescript/builds/inversify/apis/StoreApi.ts | 2 +- .../typescript/builds/inversify/apis/UserApi.ts | 2 +- .../typescript/builds/inversify/http/http.ts | 2 +- .../typescript/builds/inversify/package.json | 3 ++- .../typescript/builds/inversify/tsconfig.json | 3 +-- .../petstore/typescript/builds/jquery/package.json | 3 ++- .../petstore/typescript/builds/jquery/tsconfig.json | 3 +-- .../typescript/builds/object_params/apis/PetApi.ts | 2 +- .../typescript/builds/object_params/apis/StoreApi.ts | 2 +- .../typescript/builds/object_params/apis/UserApi.ts | 2 +- .../typescript/builds/object_params/http/http.ts | 2 +- .../typescript/builds/object_params/package.json | 3 ++- .../typescript/builds/object_params/tsconfig.json | 3 +-- .../tests/default/test/http/isomorphic-fetch.test.ts | 2 +- .../petstore/typescript/tests/default/tsconfig.json | 1 - 31 files changed, 50 insertions(+), 36 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache index d1be496f1be4..1770f54dfa25 100644 --- a/modules/openapi-generator/src/main/resources/typescript/api/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/api/api.mustache @@ -4,7 +4,7 @@ import {Configuration} from '../configuration{{importFileExtension}}'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http{{importFileExtension}}'; {{#platforms}} {{#node}} -import FormData from "form-data"; +import {{^supportsES6}}* as{{/supportsES6}} FormData from "form-data"; import { URLSearchParams } from 'url'; {{/node}} {{/platforms}} diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 07eef6289baa..0ecca57cd86f 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -1,7 +1,7 @@ {{#platforms}} {{#node}} // TODO: evaluate if we can easily get rid of this library -import FormData from "form-data{{importFileExtension}}"; +import {{^supportsES6}}* as{{/supportsES6}} FormData from "form-data{{importFileExtension}}"; import { URL, URLSearchParams } from 'url{{importFileExtension}}'; import * as http from 'http{{importFileExtension}}'; import * as https from 'https{{importFileExtension}}'; diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index f192d2ef72d3..fe5d0cc19ec3 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -15,13 +15,21 @@ ], "license": "Unlicense", "main": "./dist/index.js", - {{#supportTypeModule}} + {{#supportsES6}} "type": "module", "module": "./dist/index.js", - {{/supportTypeModule}} + {{/supportsES6}} + {{^supportsES6}} + "type": "commonjs", + {{/supportsES6}} "exports": { ".": { + {{#supportsES6}} "import": "./dist/index.js", + {{/supportsES6}} + {{^supportsES6}} + "require": "./dist/index.js", + {{/supportsES6}} "types": "./dist/index.d.js" } }, diff --git a/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache index 330c9a336def..b7aa518c46e4 100644 --- a/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache @@ -2,8 +2,13 @@ "compilerOptions": { "strict": true, /* Basic Options */ + {{#supportsES6}} "target": "es6", "esModuleInterop": true, + {{/supportsES6}} + {{^supportsES6}} + "target": "es5", + {{/supportsES6}} "moduleResolution": "node", "declaration": true, diff --git a/samples/client/others/typescript/builds/with-unique-items/package.json b/samples/client/others/typescript/builds/with-unique-items/package.json index acc457027c02..5396cefd2a8c 100644 --- a/samples/client/others/typescript/builds/with-unique-items/package.json +++ b/samples/client/others/typescript/builds/with-unique-items/package.json @@ -15,9 +15,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", "exports": { ".": { - "import": "./dist/index.js", + "require": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/client/others/typescript/builds/with-unique-items/tsconfig.json b/samples/client/others/typescript/builds/with-unique-items/tsconfig.json index 2cc80c60873f..aa173eb68f32 100644 --- a/samples/client/others/typescript/builds/with-unique-items/tsconfig.json +++ b/samples/client/others/typescript/builds/with-unique-items/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es6", - "esModuleInterop": true, + "target": "es5", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/package.json b/samples/openapi3/client/petstore/typescript/builds/browser/package.json index c1cb8657b445..75f0bc16826a 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/browser/package.json @@ -15,6 +15,8 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "module", + "module": "./dist/index.js", "exports": { ".": { "import": "./dist/index.js", diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json index c1cb8657b445..8f6636e8cf8b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json @@ -15,9 +15,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", "exports": { ".": { - "import": "./dist/index.js", + "require": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json index 2cc80c60873f..aa173eb68f32 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es6", - "esModuleInterop": true, + "target": "es5", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts index e632d988105b..5b3d37fe35a1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/PetApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts index 03b49fc7c851..3bb0a2de754e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/StoreApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts index 24914bbcb54f..352b499b3785 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/apis/UserApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index b590ffcb114a..af0075aeba6f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -1,5 +1,5 @@ // TODO: evaluate if we can easily get rid of this library -import FormData from "form-data"; +import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index 29b42f0b0ff1..f75fc96c282f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -15,9 +15,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", "exports": { ".": { - "import": "./dist/index.js", + "require": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json index 29da7f2215ef..4a8d5cb2f334 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es6", - "esModuleInterop": true, + "target": "es5", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts index 4dce7071fdbf..93928166fcdc 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/PetApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts index 0c9bb481fe00..7537e2b4eccc 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/StoreApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts index 58d91b17e22e..9f81f5e77f07 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/apis/UserApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index b590ffcb114a..af0075aeba6f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -1,5 +1,5 @@ // TODO: evaluate if we can easily get rid of this library -import FormData from "form-data"; +import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index 12c5e8be9278..b6496f55d05c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -15,9 +15,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", "exports": { ".": { - "import": "./dist/index.js", + "require": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json index 1a2adff46202..e57dd6fe3b8c 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es6", - "esModuleInterop": true, + "target": "es5", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json index 7db30d7a0324..ea49a041e5b2 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json @@ -15,9 +15,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", "exports": { ".": { - "import": "./dist/index.js", + "require": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json index 2cc80c60873f..aa173eb68f32 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es6", - "esModuleInterop": true, + "target": "es5", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts index e632d988105b..5b3d37fe35a1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/PetApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts index 03b49fc7c851..3bb0a2de754e 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/StoreApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts index 24914bbcb54f..352b499b3785 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/apis/UserApi.ts @@ -2,7 +2,7 @@ import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; -import FormData from "form-data"; +import * as FormData from "form-data"; import { URLSearchParams } from 'url'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index b590ffcb114a..af0075aeba6f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -1,5 +1,5 @@ // TODO: evaluate if we can easily get rid of this library -import FormData from "form-data"; +import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; import * as http from 'http'; import * as https from 'https'; diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json index 29b42f0b0ff1..f75fc96c282f 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json @@ -15,9 +15,10 @@ ], "license": "Unlicense", "main": "./dist/index.js", + "type": "commonjs", "exports": { ".": { - "import": "./dist/index.js", + "require": "./dist/index.js", "types": "./dist/index.d.js" } }, diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json index 29da7f2215ef..4a8d5cb2f334 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "strict": true, /* Basic Options */ - "target": "es6", - "esModuleInterop": true, + "target": "es5", "moduleResolution": "node", "declaration": true, diff --git a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts index 7abdfb02ccfc..4deb48f8640c 100644 --- a/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts +++ b/samples/openapi3/client/petstore/typescript/tests/default/test/http/isomorphic-fetch.test.ts @@ -1,7 +1,7 @@ import * as petstore from "ts-petstore-client"; import { expect} from "chai"; -import FormData from "form-data"; +import * as FormData from "form-data"; let libs: { [key: string]: petstore.HttpLibrary } = { "isomorphic-fetch": new petstore.IsomorphicFetchHttpLibrary() diff --git a/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json b/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json index 0a5080d1bdab..4596f6e40bcf 100644 --- a/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/tests/default/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "esModuleInterop": true, "module": "commonjs", "target": "es6", "noImplicitAny": true,