Fix NullPointerException for info.version on Javascript client codegen (#5471)

* Fix NullPointerException for info.version on Javascript client codegen

* Set/Return project default version to 1.0.0 if info.version not found

* info version null check handled and default version/appVersion value set to 1.0.0

* Removed null check for info version. Fixed DefaultGenerator code to handle null check.

* Semicolon added missing
This commit is contained in:
erdarun
2017-04-25 18:45:39 +05:30
committed by wing328
parent 59801d5167
commit fa09d75180

View File

@@ -151,6 +151,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
}
if (info.getVersion() != null) {
config.additionalProperties().put("appVersion", config.escapeText(info.getVersion()));
} else {
LOGGER.error("Missing required field info version. Default appVersion set to 1.0.0");
config.additionalProperties().put("appVersion", "1.0.0");
}
if (StringUtils.isEmpty(info.getDescription())) {
// set a default description if none if provided
@@ -180,6 +183,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
}
if (info.getVersion() != null) {
config.additionalProperties().put("version", config.escapeText(info.getVersion()));
} else {
LOGGER.error("Missing required field info version. Default version set to 1.0.0");
config.additionalProperties().put("version", "1.0.0");
}
if (info.getTermsOfService() != null) {
config.additionalProperties().put("termsOfService", config.escapeText(info.getTermsOfService()));