From 81c0e81c7787dd450280b44dc5d3f70519b9bbad Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 13 Dec 2017 18:10:01 +0800 Subject: [PATCH] Add "Contact" name, URL (#7164) * update swagger parser, core version the latest * add info name and email --- .../main/java/io/swagger/codegen/DefaultGenerator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index 2c166e69577..bba4e9f0511 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -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())); }