[TypescriptAngular] gets package npm version from API specification (#2019)

This commit is contained in:
Pablo Lázaro
2019-02-07 08:53:01 +01:00
committed by William Cheng
parent aa15882e2b
commit aa24f07433
2 changed files with 69 additions and 0 deletions

View File

@@ -206,6 +206,8 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
if (additionalProperties.containsKey(NPM_VERSION)) {
this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString());
} else if (this.getVersionFromApi() != null) {
this.setNpmVersion(this.getVersionFromApi());
}
if (additionalProperties.containsKey(SNAPSHOT)
@@ -650,4 +652,17 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
}
return name;
}
/**
* Returns version from OpenAPI info.
*
* @return
*/
private String getVersionFromApi() {
if (this.openAPI != null && this.openAPI.getInfo() != null) {
return this.openAPI.getInfo().getVersion();
} else {
return null;
}
}
}