Add "Contact" name, URL (#7164)

* update swagger parser, core version the latest

* add info name and email
This commit is contained in:
William Cheng 2017-12-13 18:10:01 +08:00 committed by GitHub
parent c774e98464
commit 81c0e81c77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,11 +207,17 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
if (info.getContact() != null) {
Contact contact = info.getContact();
config.additionalProperties().put("infoUrl", config.escapeText(contact.getUrl()));
if (contact.getEmail() != null) {
config.additionalProperties().put("infoEmail", config.escapeText(contact.getEmail()));
}
if (contact.getName() != null) {
config.additionalProperties().put("infoName", config.escapeText(contact.getName()));
}
if (contact.getUrl() != null) {
config.additionalProperties().put("infoUrl", config.escapeText(contact.getUrl()));
}
}
if (info.getLicense() != null) {
License license = info.getLicense();
if (license.getName() != null) {
@ -221,12 +227,14 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
config.additionalProperties().put("licenseUrl", config.escapeText(license.getUrl()));
}
}
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()));
}