Skip to content

Commit d716379

Browse files
committed
fix typescript-angular regression for non-NPM
1 parent 99f0b37 commit d716379

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/main/java/io/swagger/codegen/v3/generators/typescript/TypeScriptAngularClientCodegen.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ public void processOpts() {
160160
// Libraries generated with v2.x of ng-packagr will ship with AoT metadata in v4, which is intended for Angular v5 (and Angular v6).
161161
additionalProperties.put("useOldNgPackagr", !ngVersion.atLeast("5.0.0"));
162162

163+
// set http client usage
164+
if (ngVersion.atLeast("8.0.0")) {
165+
additionalProperties.put("useHttpClient", true);
166+
} else if (ngVersion.atLeast("4.3.0")) {
167+
additionalProperties.put("useHttpClient", true);
168+
} else {
169+
additionalProperties.put("useHttpClient", false);
170+
}
171+
163172
if (additionalProperties.containsKey(PROVIDED_IN_ROOT) && !ngVersion.atLeast("6.0.0")) {
164173
additionalProperties.put(PROVIDED_IN_ROOT,false);
165174
}
@@ -213,8 +222,6 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
213222
this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString());
214223
}
215224

216-
additionalProperties.put("useRxJS6", true);
217-
additionalProperties.put("useHttpClient", true);
218225
additionalProperties.put("useHttpClientPackage", false);
219226
if (ngVersion.atLeast("11.0.0")) {
220227
additionalProperties.put("tsVersion", ">=4.0.0 <4.1.0");
@@ -263,7 +270,6 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
263270
additionalProperties.put("tsickleVersion", "0.32.1");
264271
additionalProperties.put("zonejsVersion", "0.8.26");
265272

266-
additionalProperties.put("useRxJS6", false);
267273
additionalProperties.put("useHttpClientPackage", true);
268274
}
269275

0 commit comments

Comments
 (0)