forked from loafle/openapi-generator-original
Issue#5376- changes to include swagger version in generated api files (#5449)
* Elizabeth - changes to include swagger version in generated api files * Filtering version.properties in swagger codegen module * Removing resource filtering from swagger codegen cli module * Merging master
This commit is contained in:
parent
efb337dd92
commit
702f193f61
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,7 +4,7 @@ out/
|
||||
*.iws
|
||||
classpath.txt
|
||||
version.properties
|
||||
!modules/swagger-codegen-cli/src/main/resources/version.properties
|
||||
!modules/swagger-codegen/src/main/resources/version.properties
|
||||
.project
|
||||
.classpath
|
||||
lib/*
|
||||
|
@ -18,7 +18,6 @@
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<excludes>
|
||||
<exclude>logback.xml</exclude>
|
||||
</excludes>
|
||||
@ -79,17 +78,6 @@
|
||||
<artifactId>swagger-codegen</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!--https://github.com/airlift/airline-->
|
||||
<dependency>
|
||||
<groupId>io.airlift</groupId>
|
||||
<artifactId>airline</artifactId>
|
||||
<version>0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.lambdaj</groupId>
|
||||
<artifactId>lambdaj</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
|
@ -1 +0,0 @@
|
||||
version = ${project.version}
|
@ -16,6 +16,7 @@
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<excludes>
|
||||
<exclude>logback.xml</exclude>
|
||||
</excludes>
|
||||
@ -249,6 +250,16 @@
|
||||
<artifactId>commons-cli</artifactId>
|
||||
<version>${commons-cli-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.airlift</groupId>
|
||||
<artifactId>airline</artifactId>
|
||||
<version>0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.lambdaj</groupId>
|
||||
<artifactId>lambdaj</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
|
@ -2,6 +2,7 @@ package io.swagger.codegen;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
import io.swagger.codegen.cmd.Version;
|
||||
import io.swagger.codegen.ignore.CodegenIgnoreProcessor;
|
||||
import io.swagger.models.*;
|
||||
import io.swagger.models.auth.OAuth2Definition;
|
||||
@ -10,6 +11,7 @@ import io.swagger.models.parameters.Parameter;
|
||||
import io.swagger.util.Json;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -17,8 +19,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
protected final Logger LOGGER = LoggerFactory.getLogger(DefaultGenerator.class);
|
||||
protected CodegenConfig config;
|
||||
@ -127,8 +127,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
config.processOpts();
|
||||
config.preprocessSwagger(swagger);
|
||||
// TODO need to obtain version from a file instead of hardcoding it
|
||||
config.additionalProperties().put("generatorVersion", "2.2.3-SNAPSHOT");
|
||||
config.additionalProperties().put("generatedDate", DateTime.now().toString());
|
||||
config.additionalProperties().put("generatorVersion", Version.readVersionFromResources());
|
||||
config.additionalProperties().put("generatorClass", config.getClass().getName());
|
||||
config.additionalProperties().put("inputSpec", config.getInputSpec());
|
||||
if (swagger.getVendorExtensions() != null) {
|
||||
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by the swagger code generator program ({{{generatorVersion}}}).
|
||||
* https://github.com/swagger-api/swagger-codegen
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
|
@ -0,0 +1 @@
|
||||
version = ${project.version}
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by the swagger code generator program (2.2.3-SNAPSHOT).
|
||||
* https://github.com/swagger-api/swagger-codegen
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by the swagger code generator program (2.2.3-SNAPSHOT).
|
||||
* https://github.com/swagger-api/swagger-codegen
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by the swagger code generator program (2.2.3-SNAPSHOT).
|
||||
* https://github.com/swagger-api/swagger-codegen
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -1,3 +1,9 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by the swagger code generator program (2.2.3-SNAPSHOT).
|
||||
* https://github.com/swagger-api/swagger-codegen
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import java.util.List;
|
||||
|
Loading…
x
Reference in New Issue
Block a user