Skip to content

Commit 2156bfc

Browse files
author
Thibaud SOWA
committed
feat(typescript-angular): unify tsVersion param
fix #20204
1 parent 82f8d02 commit 2156bfc

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

docs/generators/typescript-angular.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
5252
|stringEnums|Generate string enums instead of objects for enum values.| |false|
5353
|supportsES6|Generate code that conforms to ES6.| |false|
5454
|taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false|
55-
|typescriptVersion|The version of typescript compatible with Angular (see ngVersion option).| |null|
55+
|tsVersion|The version of typescript compatible with Angular (see ngVersion option).| |null|
5656
|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|
5757
|useSquareBracketsInArrayNames|Setting this property to true will add brackets to array attribute names, e.g. my_values[].| |false|
5858
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public static enum PROVIDED_IN_LEVEL {none, root, any, platform}
7878
public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values.";
7979
public static final String QUERY_PARAM_OBJECT_FORMAT = "queryParamObjectFormat";
8080
public static final String USE_SQUARE_BRACKETS_IN_ARRAY_NAMES = "useSquareBracketsInArrayNames";
81-
public static final String TYPESCRIPT_VERSION = "typescriptVersion";
81+
public static final String TS_VERSION = "tsVersion";
8282
public static final String RXJS_VERSION = "rxjsVersion";
83-
public static final String NGPACKAGR_VERSION = "ngPackagrVersion ";
83+
public static final String NGPACKAGR_VERSION = "ngPackagrVersion";
8484
public static final String ZONEJS_VERSION = "zoneJsVersion";
8585

8686
protected String ngVersion = "19.0.0";
@@ -150,7 +150,7 @@ public TypeScriptAngularClientCodegen() {
150150
this.cliOptions.add(new CliOption(STRING_ENUMS, STRING_ENUMS_DESC).defaultValue(String.valueOf(this.stringEnums)));
151151
this.cliOptions.add(new CliOption(QUERY_PARAM_OBJECT_FORMAT, "The format for query param objects: 'dot', 'json', 'key'.").defaultValue(this.queryParamObjectFormat.name()));
152152
this.cliOptions.add(CliOption.newBoolean(USE_SQUARE_BRACKETS_IN_ARRAY_NAMES, "Setting this property to true will add brackets to array attribute names, e.g. my_values[].", false));
153-
this.cliOptions.add(new CliOption(TYPESCRIPT_VERSION, "The version of typescript compatible with Angular (see ngVersion option)."));
153+
this.cliOptions.add(new CliOption(TS_VERSION, "The version of typescript compatible with Angular (see ngVersion option)."));
154154
this.cliOptions.add(new CliOption(RXJS_VERSION, "The version of RxJS compatible with Angular (see ngVersion option)."));
155155
this.cliOptions.add(new CliOption(NGPACKAGR_VERSION, "The version of ng-packagr compatible with Angular (see ngVersion option)."));
156156
this.cliOptions.add(new CliOption(ZONEJS_VERSION, "The version of zone.js compatible with Angular (see ngVersion option)."));
@@ -321,15 +321,15 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
321321
.map(Map.Entry::getValue)
322322
.orElseThrow(() -> new IllegalArgumentException("Invalid ngVersion. Only Angular v9+ is supported."));
323323

324-
additionalProperties.put("tsVersion", additionalProperties.containsKey(TYPESCRIPT_VERSION)
325-
? additionalProperties.containsKey(TYPESCRIPT_VERSION)
324+
additionalProperties.put(TS_VERSION, additionalProperties.containsKey(TS_VERSION)
325+
? additionalProperties.containsKey(TS_VERSION)
326326
: angularDependencies.getTsVersion());
327327

328-
additionalProperties.put("rxjsVersion", additionalProperties.containsKey(RXJS_VERSION)
328+
additionalProperties.put(RXJS_VERSION, additionalProperties.containsKey(RXJS_VERSION)
329329
? additionalProperties.containsKey(RXJS_VERSION)
330330
: angularDependencies.getRxjsVersion());
331331

332-
additionalProperties.put("ngPackagrVersion", additionalProperties.containsKey(NGPACKAGR_VERSION)
332+
additionalProperties.put(NGPACKAGR_VERSION, additionalProperties.containsKey(NGPACKAGR_VERSION)
333333
? additionalProperties.containsKey(NGPACKAGR_VERSION)
334334
: angularDependencies.getNgPackagrVersion());
335335

modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class TypeScriptAngularClientOptionsProvider implements TypeScriptSharedC
3535
public static final String SERVICE_FILE_SUFFIX = ".service";
3636
public static final String MODEL_SUFFIX = "";
3737
public static final String MODEL_FILE_SUFFIX = "";
38-
public static final String TYPESCRIPT_VERSION = "";
38+
public static final String TS_VERSION = "";
3939
public static final String RXJS_VERSION = "";
4040
public static final String NGPACKAGR_VERSION = " ";
4141
public static final String ZONEJS_VERSION = "";
@@ -65,7 +65,7 @@ public Map<String, String> createOptions() {
6565
.put(TypeScriptAngularClientCodegen.FILE_NAMING, FILE_NAMING_VALUE)
6666
.put(TypeScriptAngularClientCodegen.QUERY_PARAM_OBJECT_FORMAT, QUERY_PARAM_OBJECT_FORMAT_VALUE)
6767
.put(TypeScriptAngularClientCodegen.USE_SQUARE_BRACKETS_IN_ARRAY_NAMES, Boolean.FALSE.toString())
68-
.put(TypeScriptAngularClientCodegen.TYPESCRIPT_VERSION, TYPESCRIPT_VERSION)
68+
.put(TypeScriptAngularClientCodegen.TS_VERSION, TS_VERSION)
6969
.put(TypeScriptAngularClientCodegen.RXJS_VERSION, RXJS_VERSION)
7070
.put(TypeScriptAngularClientCodegen.NGPACKAGR_VERSION, NGPACKAGR_VERSION)
7171
.put(TypeScriptAngularClientCodegen.ZONEJS_VERSION, ZONEJS_VERSION)

0 commit comments

Comments
 (0)