Skip to content

Commit

Permalink
Merge pull request #1118 from swagger-api/oss-planning-663
Browse files Browse the repository at this point in the history
Fixed errors on generators
  • Loading branch information
HugoMario authored Mar 8, 2023
2 parents 24629d8 + d7c35cd commit 8f1af14
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString());
}

if (additionalProperties.containsKey(SNAPSHOT)
&& Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) {
if (additionalProperties.containsKey(SNAPSHOT) && Boolean.parseBoolean(additionalProperties.get(SNAPSHOT).toString())) {
this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date()));
}
additionalProperties.put(NPM_VERSION, npmVersion);
Expand All @@ -223,51 +222,64 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
}

additionalProperties.put("useHttpClientPackage", false);
if (ngVersion.atLeast("11.0.0")) {
if (ngVersion.atLeast("15.0.0")) {
additionalProperties.put("tsVersion", ">=4.8.2 <4.10.0");
additionalProperties.put("rxjsVersion", "7.5.5");
additionalProperties.put("ngPackagrVersion", "15.0.2");
additionalProperties.put("zonejsVersion", "0.11.5");
} else if (ngVersion.atLeast("14.0.0")) {
additionalProperties.put("tsVersion", ">=4.6.0 <=4.8.0");
additionalProperties.put("rxjsVersion", "7.5.5");
additionalProperties.put("ngPackagrVersion", "14.0.2");
additionalProperties.put("zonejsVersion", "0.11.5");
} else if (ngVersion.atLeast("13.0.0")) {
additionalProperties.put("tsVersion", ">=4.4.2 <4.5.0");
additionalProperties.put("rxjsVersion", "7.4.0");
additionalProperties.put("ngPackagrVersion", "13.0.3");
additionalProperties.put("zonejsVersion", "0.11.4");
} else if (ngVersion.atLeast("12.0.0")) {
additionalProperties.put("tsVersion", ">=4.3.0 <4.4.0");
additionalProperties.put("rxjsVersion", "7.4.0");
additionalProperties.put("ngPackagrVersion", "12.2.1");
additionalProperties.put("zonejsVersion", "0.11.4");
} else if (ngVersion.atLeast("11.0.0")) {
additionalProperties.put("tsVersion", ">=4.0.0 <4.1.0");
additionalProperties.put("rxjsVersion", "6.6.0");
additionalProperties.put("ngPackagrVersion", "11.0.2");
additionalProperties.put("tsickleVersion", "0.39.1");
additionalProperties.put("zonejsVersion", "0.11.3");
} else if (ngVersion.atLeast("10.0.0")) {
additionalProperties.put("tsVersion", ">=3.9.2 <4.0.0");
additionalProperties.put("rxjsVersion", "6.6.0");
additionalProperties.put("ngPackagrVersion", "10.0.3");
additionalProperties.put("tsickleVersion", "0.39.1");
additionalProperties.put("zonejsVersion", "0.10.2");
} else if (ngVersion.atLeast("9.0.0")) {
additionalProperties.put("tsVersion", ">=3.6.0 <3.8.0");
additionalProperties.put("rxjsVersion", "6.5.3");
additionalProperties.put("ngPackagrVersion", "9.0.1");
additionalProperties.put("tsickleVersion", "0.38.0");
additionalProperties.put("zonejsVersion", "0.10.2");
} else if (ngVersion.atLeast("8.0.0")) {
additionalProperties.put("tsVersion", ">=3.4.0 <3.6.0");
additionalProperties.put("rxjsVersion", "6.5.0");
additionalProperties.put("ngPackagrVersion", "5.4.0");
additionalProperties.put("tsickleVersion", "0.35.0");
additionalProperties.put("zonejsVersion", "0.9.1");
} else if (ngVersion.atLeast("7.0.0")) {
additionalProperties.put("tsVersion", ">=3.1.1 <3.2.0");
additionalProperties.put("rxjsVersion", "6.3.0");
additionalProperties.put("ngPackagrVersion", "5.1.0");
additionalProperties.put("tsickleVersion", "0.34.0");
additionalProperties.put("zonejsVersion", "0.8.26");

additionalProperties.put("useHttpClientPackage", true);
} else if (ngVersion.atLeast("6.0.0")) {
additionalProperties.put("tsVersion", ">=2.7.2 and <2.10.0");
additionalProperties.put("rxjsVersion", "6.1.0");
additionalProperties.put("ngPackagrVersion", "3.0.6");
additionalProperties.put("tsickleVersion", "0.32.1");
additionalProperties.put("zonejsVersion", "0.8.26");

additionalProperties.put("useHttpClientPackage", true);
} else {
additionalProperties.put("tsVersion", ">=2.1.5 and <2.8");
additionalProperties.put("rxjsVersion", "6.1.0");
additionalProperties.put("ngPackagrVersion", "3.0.6");
additionalProperties.put("tsickleVersion", "0.32.1");
additionalProperties.put("zonejsVersion", "0.8.26");

additionalProperties.put("useHttpClientPackage", true);
Expand Down Expand Up @@ -356,6 +368,24 @@ private boolean isLanguageGenericType(String type) {
return false;
}

protected void addOperationImports(CodegenOperation codegenOperation, Set<String> operationImports) {
for (String operationImport : operationImports) {
if (operationImport.contains("|")) {
String[] importNames = operationImport.split("\\|");
for (String importName : importNames) {
importName = importName.trim();
if (needToImport(importName)) {
codegenOperation.imports.add(importName);
}
}
} else {
if (needToImport(operationImport)) {
codegenOperation.imports.add(operationImport);
}
}
}
}

@Override
public void postProcessParameter(CodegenParameter parameter) {
super.postProcessParameter(parameter);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/JavaJaxRS/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class {{classname}} {
{{/useOas2}}
public Response {{nickname}}({{#parameters}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{>cookieParams}},{{/parameters}}@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.{{nickname}}({{#parameters}}{{paramName}},{{/parameters}}securityContext);
return delegate.{{nickname}}({{#parameters}}{{#isBinary}}{{#isBodyParam}}{{paramName}}{{/isBodyParam}}{{^isBodyParam}}{{paramName}}InputStream, {{paramName}}Detail{{/isBodyParam}}{{/isBinary}}{{^isBinary}}{{paramName}}{{/isBinary}},{{/parameters}}securityContext);
}
{{/@first}}
{{/contents}}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/JavaJaxRS/pojo.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/{{#description}}
{{#useOas2}}@ApiModel{{/useOas2}}{{^useOas2}}@Schema{{/useOas2}}(description = "{{{description}}}"){{/description}}
{{>generatedAnnotation}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable {{#interfaceModels}}, {{classname}}{{^@last}}, {{/@last}}{{#@last}} {{/@last}}{{/interfaceModels}}{{/serializableModel}}{{^serializableModel}}{{#interfaceModels}}{{#@first}}implements {{/@first}}{{classname}}{{^@last}}, {{/@last}}{{#@last}} {{/@last}}{{/interfaceModels}}{{/serializableModel}} {
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable {{#interfaceModels}}{{#@first}},{{/@first}} {{classname}}{{^@last}}, {{/@last}}{{#@last}} {{/@last}}{{/interfaceModels}}{{/serializableModel}}{{^serializableModel}}{{#interfaceModels}}{{#@first}}implements {{/@first}}{{classname}}{{^@last}}, {{/@last}}{{#@last}} {{/@last}}{{/interfaceModels}}{{/serializableModel}} {
{{#vars}}
{{#baseItems this}}
{{#is this 'enum'}}
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/handlebars/aspnetcore/NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
19 changes: 6 additions & 13 deletions src/main/resources/handlebars/typescript-angular/package.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,16 @@
"build": "ngc && npm pack"
},
{{/useNgPackagr}}
"peerDependencies": {
"@angular/core": "^{{ngVersion}}",{{#useHttpClientPackage}}
"@angular/http": "^{{ngVersion}}",{{/useHttpClientPackage}}
"@angular/common": "^{{ngVersion}}",
"@angular/compiler": "^{{ngVersion}}",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^{{rxjsVersion}}"
},
"devDependencies": {
"@angular/compiler-cli": "^{{ngVersion}}",
"@angular/core": "^{{ngVersion}}",{{#useHttpClientPackage}}
"@angular/http": "^{{ngVersion}}",{{/useHttpClientPackage}}
"@angular/core": "^{{ngVersion}}",
{{#useHttpClientPackage}}
"@angular/http": "^{{ngVersion}}",
{{/useHttpClientPackage}}
"@angular/common": "^{{ngVersion}}",
"@angular/compiler": "^{{ngVersion}}",
"@angular/platform-browser": "^{{ngVersion}}",{{#useNgPackagr}}
"ng-packagr": "^{{ngPackagrVersion}}",{{/useNgPackagr}}
"@angular/platform-browser": "^{{ngVersion}}",
"ng-packagr": "^{{ngPackagrVersion}}",
"reflect-metadata": "^0.1.3",
"rxjs": "^{{rxjsVersion}}",
"typescript": "{{{tsVersion}}}",
Expand Down

0 comments on commit 8f1af14

Please sign in to comment.