mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-17 21:09:11 +00:00
[TypescriptAngular] gets package npm version from API specification (#2019)
This commit is contained in:
committed by
William Cheng
parent
aa15882e2b
commit
aa24f07433
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user