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 0b6f677857a..fb52d38739d 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 @@ -16,6 +16,7 @@ import io.swagger.models.auth.SecuritySchemeDefinition; import io.swagger.util.Json; import org.apache.commons.io.IOUtils; +import org.joda.time.DateTime; import java.io.File; import java.io.FileInputStream; @@ -62,6 +63,10 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { List files = new ArrayList(); try { config.processOpts(); + + config.additionalProperties().put("generatedTime", DateTime.now().toString()); + config.additionalProperties().put("generatorClass", config.getClass().toString()); + if (swagger.getInfo() != null) { Info info = swagger.getInfo(); if (info.getTitle() != null) { diff --git a/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache index 79b44594816..6930b548d42 100644 --- a/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/ApiClient.mustache @@ -40,6 +40,7 @@ import {{invokerPackage}}.auth.HttpBasicAuth; import {{invokerPackage}}.auth.ApiKeyAuth; import {{invokerPackage}}.auth.OAuth; +{{>generatedAnnotation}} public class ApiClient { private Map hostMap = new HashMap(); private Map defaultHeaderMap = new HashMap(); diff --git a/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache b/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache index e936b423a91..4629c4e17be 100644 --- a/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/Configuration.mustache @@ -1,5 +1,6 @@ package {{invokerPackage}}; +{{>generatedAnnotation}} public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/modules/swagger-codegen/src/main/resources/Java/JsonUtil.mustache b/modules/swagger-codegen/src/main/resources/Java/JsonUtil.mustache index 29d5f55ecee..4866f8c0fce 100644 --- a/modules/swagger-codegen/src/main/resources/Java/JsonUtil.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/JsonUtil.mustache @@ -7,6 +7,7 @@ import com.fasterxml.jackson.core.JsonGenerator.Feature; import com.fasterxml.jackson.datatype.joda.*; +{{>generatedAnnotation}} public class JsonUtil { public static ObjectMapper mapper; diff --git a/modules/swagger-codegen/src/main/resources/Java/Pair.mustache b/modules/swagger-codegen/src/main/resources/Java/Pair.mustache index 9805c74903b..e2a47317afe 100644 --- a/modules/swagger-codegen/src/main/resources/Java/Pair.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/Pair.mustache @@ -1,5 +1,6 @@ package {{invokerPackage}}; +{{>generatedAnnotation}} public class Pair { private String name = ""; private String value = ""; diff --git a/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache b/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache index 035d6739dce..073966b0c21 100644 --- a/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/StringUtil.mustache @@ -1,5 +1,6 @@ package {{invokerPackage}}; +{{>generatedAnnotation}} public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/modules/swagger-codegen/src/main/resources/Java/api.mustache b/modules/swagger-codegen/src/main/resources/Java/api.mustache index c48c0503f5c..f8464e79fd2 100644 --- a/modules/swagger-codegen/src/main/resources/Java/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/api.mustache @@ -21,6 +21,7 @@ import java.io.File; import java.util.Map; import java.util.HashMap; +{{>generatedAnnotation}} {{#operations}} public class {{classname}} { private ApiClient {{localVariablePrefix}}apiClient; diff --git a/modules/swagger-codegen/src/main/resources/Java/apiException.mustache b/modules/swagger-codegen/src/main/resources/Java/apiException.mustache index 9afe96c6ffb..bb3b53b0aeb 100644 --- a/modules/swagger-codegen/src/main/resources/Java/apiException.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/apiException.mustache @@ -3,6 +3,7 @@ package {{invokerPackage}}; import java.util.Map; import java.util.List; +{{>generatedAnnotation}} public class ApiException extends Exception { private int code = 0; private String message = null; diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache index a1824b551ca..04be4812292 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/ApiKeyAuth.mustache @@ -5,6 +5,7 @@ import {{invokerPackage}}.Pair; import java.util.Map; import java.util.List; +{{>generatedAnnotation}} public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache index 265c74cb76f..037ef58ab90 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/Authentication.mustache @@ -5,6 +5,7 @@ import {{invokerPackage}}.Pair; import java.util.Map; import java.util.List; +{{>generatedAnnotation}} public interface Authentication { /** Apply authentication settings to header and query params. */ void applyToParams(List queryParams, Map headerParams); diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/HttpBasicAuth.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/HttpBasicAuth.mustache index 032ea57d4e8..63813e2504e 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/HttpBasicAuth.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/HttpBasicAuth.mustache @@ -8,6 +8,7 @@ import java.util.List; import java.io.UnsupportedEncodingException; import javax.xml.bind.DatatypeConverter; +{{>generatedAnnotation}} public class HttpBasicAuth implements Authentication { private String username; private String password; diff --git a/modules/swagger-codegen/src/main/resources/Java/auth/OAuth.mustache b/modules/swagger-codegen/src/main/resources/Java/auth/OAuth.mustache index 66cf2ac8f0f..a1f1b6a827c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/auth/OAuth.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/auth/OAuth.mustache @@ -5,6 +5,7 @@ import {{invokerPackage}}.Pair; import java.util.Map; import java.util.List; +{{>generatedAnnotation}} public class OAuth implements Authentication { @Override public void applyToParams(List queryParams, Map headerParams) { diff --git a/modules/swagger-codegen/src/main/resources/Java/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/Java/generatedAnnotation.mustache new file mode 100644 index 00000000000..49110fc1ad9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/generatedAnnotation.mustache @@ -0,0 +1 @@ +@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/Java/model.mustache b/modules/swagger-codegen/src/main/resources/Java/model.mustache index 0e12f514c48..39f0f0b6fa1 100644 --- a/modules/swagger-codegen/src/main/resources/Java/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/model.mustache @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * {{description}} **/{{/description}} @ApiModel(description = "{{{description}}}") +{{>generatedAnnotation}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{#vars}}{{#isEnum}} public enum {{datatypeWithEnum}} { diff --git a/modules/swagger-codegen/src/main/resources/JavaInflector/api.mustache b/modules/swagger-codegen/src/main/resources/JavaInflector/api.mustache index 5f5b5b1df9a..829a9daeabc 100644 --- a/modules/swagger-codegen/src/main/resources/JavaInflector/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaInflector/api.mustache @@ -13,6 +13,7 @@ import {{modelPackage}}.*; {{#imports}}import {{import}}; {{/imports}} +{{>generatedAnnotation}} {{#operations}} public class {{classname}} { diff --git a/modules/swagger-codegen/src/main/resources/JavaInflector/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaInflector/generatedAnnotation.mustache new file mode 100644 index 00000000000..49110fc1ad9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaInflector/generatedAnnotation.mustache @@ -0,0 +1 @@ +@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaInflector/model.mustache b/modules/swagger-codegen/src/main/resources/JavaInflector/model.mustache index 300d5e61dd9..db2480a8540 100644 --- a/modules/swagger-codegen/src/main/resources/JavaInflector/model.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaInflector/model.mustache @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * {{description}} **/{{/description}} @ApiModel(description = "{{{description}}}") +{{>generatedAnnotation}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{#vars}}{{#isEnum}} public enum {{datatypeWithEnum}} { diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiException.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiException.mustache index ffab3b1088e..11b4036b832 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiException.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiException.mustache @@ -1,5 +1,6 @@ package {{apiPackage}}; +{{>generatedAnnotation}} public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiOriginFilter.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiOriginFilter.mustache index 68675432c64..5db3301b3d9 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiOriginFilter.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiOriginFilter.mustache @@ -5,6 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; +{{>generatedAnnotation}} public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiResponseMessage.mustache index 94711b26efb..2b9a2b1f8c5 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiResponseMessage.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/ApiResponseMessage.mustache @@ -3,6 +3,7 @@ package {{apiPackage}}; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement +{{>generatedAnnotation}} public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/NotFoundException.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/NotFoundException.mustache index 8ab2c99e4f8..1bd5e207d7b 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/NotFoundException.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/NotFoundException.mustache @@ -1,5 +1,6 @@ package {{apiPackage}}; +{{>generatedAnnotation}} public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/api.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/api.mustache index 3216b60d516..9e1f808806e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/api.mustache @@ -26,6 +26,7 @@ import javax.ws.rs.*; {{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}} {{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}} @io.swagger.annotations.Api(value = "/{{baseName}}", description = "the {{baseName}} API") +{{>generatedAnnotation}} {{#operations}} public class {{classname}} { diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiService.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiService.mustache index 43e7cd8685c..a731da6c11c 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiService.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiService.mustache @@ -18,6 +18,7 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; +{{>generatedAnnotation}} {{#operations}} public abstract class {{classname}}Service { {{#operation}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiServiceFactory.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiServiceFactory.mustache index a434311d285..1bb63bc0775 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiServiceFactory.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiServiceFactory.mustache @@ -3,6 +3,7 @@ package {{package}}.factories; import {{package}}.{{classname}}Service; import {{package}}.impl.{{classname}}ServiceImpl; +{{>generatedAnnotation}} public class {{classname}}ServiceFactory { private final static {{classname}}Service service = new {{classname}}ServiceImpl(); diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiServiceImpl.mustache index d49fa4952a2..0acd755745e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiServiceImpl.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/apiServiceImpl.mustache @@ -18,6 +18,7 @@ import com.sun.jersey.multipart.FormDataParam; import javax.ws.rs.core.Response; +{{>generatedAnnotation}} {{#operations}} public class {{classname}}ServiceImpl extends {{classname}}Service { {{#operation}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/generatedAnnotation.mustache new file mode 100644 index 00000000000..49110fc1ad9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/generatedAnnotation.mustache @@ -0,0 +1 @@ +@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/model.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/model.mustache index 300d5e61dd9..db2480a8540 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/model.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/model.mustache @@ -12,6 +12,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * {{description}} **/{{/description}} @ApiModel(description = "{{{description}}}") +{{>generatedAnnotation}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{#vars}}{{#isEnum}} public enum {{datatypeWithEnum}} { diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/generatedAnnotation.mustache new file mode 100644 index 00000000000..49110fc1ad9 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/generatedAnnotation.mustache @@ -0,0 +1 @@ +@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}") \ No newline at end of file