forked from loafle/openapi-generator-original
[typescript] make TypeScript version configurable (#20064)
This commit is contained in:
@@ -42,6 +42,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|typescriptMajorVersion|Specify the major version of TypeScript to use in the client code. Default is 5.| |5|
|
||||
|useErasableSyntax|Use erasable syntax for the generated code. This is a temporary feature and will be removed in the future.| |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|
|
||||
|
||||
@@ -78,6 +78,9 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
private static final String USE_OBJECT_PARAMS_SWITCH = "useObjectParameters";
|
||||
private static final String USE_OBJECT_PARAMS_DESC = "Use aggregate parameter objects as function arguments for api operations instead of passing each parameter as a separate function argument.";
|
||||
|
||||
protected static final String TYPESCRIPT_MAJOR_VERSION_SWTICH = "typescriptMajorVersion";
|
||||
private static final String TYPESCRIPT_MAJOR_VERSION_DESC = "Specify the major version of TypeScript to use in the client code. Default is 5.";
|
||||
|
||||
public static final String USE_ERASABLE_SYNTAX = "useErasableSyntax";
|
||||
public static final String USE_ERASABLE_SYNTAX_DESC = "Use erasable syntax for the generated code. This is a temporary feature and will be removed in the future.";
|
||||
|
||||
@@ -97,6 +100,9 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
protected String snapshot = null;
|
||||
protected ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = ENUM_PROPERTY_NAMING_TYPE.PascalCase;
|
||||
|
||||
@Getter @Setter
|
||||
protected String typescriptMajorVersion = "5";
|
||||
|
||||
private final DateTimeFormatter iso8601Date = DateTimeFormatter.ISO_DATE;
|
||||
private final DateTimeFormatter iso8601DateTime = DateTimeFormatter.ISO_DATE_TIME;
|
||||
|
||||
@@ -131,6 +137,7 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
cliOptions.add(new CliOption(TypeScriptClientCodegen.USE_RXJS_SWITCH, TypeScriptClientCodegen.USE_RXJS_SWITCH_DESC).defaultValue("false"));
|
||||
cliOptions.add(new CliOption(TypeScriptClientCodegen.USE_OBJECT_PARAMS_SWITCH, TypeScriptClientCodegen.USE_OBJECT_PARAMS_DESC).defaultValue("false"));
|
||||
cliOptions.add(new CliOption(TypeScriptClientCodegen.USE_INVERSIFY_SWITCH, TypeScriptClientCodegen.USE_INVERSIFY_SWITCH_DESC).defaultValue("false"));
|
||||
cliOptions.add(new CliOption(TypeScriptClientCodegen.TYPESCRIPT_MAJOR_VERSION_SWTICH, TypeScriptClientCodegen.TYPESCRIPT_MAJOR_VERSION_DESC).defaultValue(this.getTypescriptMajorVersion()));
|
||||
cliOptions.add(new CliOption(TypeScriptClientCodegen.IMPORT_FILE_EXTENSION_SWITCH, TypeScriptClientCodegen.IMPORT_FILE_EXTENSION_SWITCH_DESC));
|
||||
cliOptions.add(new CliOption(TypeScriptClientCodegen.USE_ERASABLE_SYNTAX, TypeScriptClientCodegen.USE_ERASABLE_SYNTAX_DESC).defaultValue("false"));
|
||||
|
||||
@@ -495,6 +502,8 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
if (additionalProperties.containsKey(NPM_REPOSITORY)) {
|
||||
setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString());
|
||||
}
|
||||
|
||||
additionalProperties.put(TYPESCRIPT_MAJOR_VERSION_SWTICH, typescriptMajorVersion);
|
||||
}
|
||||
|
||||
private String getHttpLibForFramework(String object) {
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^{{typescriptMajorVersion}}.0"
|
||||
}{{#npmRepository}},{{/npmRepository}}
|
||||
{{#npmRepository}}
|
||||
"publishConfig":{
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
"es6-promise": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0"
|
||||
"typescript": "^5.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user