Skip to content

Commit b1b49e1

Browse files
author
Arun
authored
Merge branch 'master' into add-missing-reserved-words
2 parents d0b7af3 + 3a8874b commit b1b49e1

File tree

137 files changed

+1789
-1075
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+1789
-1075
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8+
set ags=generate --artifact-id "nodejs-petstore-server" -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l nodejs-server -o samples\server\petstore\nodejs
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%

modules/swagger-codegen-maven-plugin/examples/java-client.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
<properties>
121121
<swagger-annotations-version>1.5.21</swagger-annotations-version>
122122
<jersey-version>2.25.1</jersey-version>
123-
<jackson-version>2.9.9</jackson-version>
123+
<jackson-version>2.9.10</jackson-version>
124124
<jodatime-version>2.7</jodatime-version>
125125
<maven-plugin-version>1.0.0</maven-plugin-version>
126126
<junit-version>4.8.1</junit-version>

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public AbstractJavaCodegen() {
9898
modelDocTemplateFiles.put("model_doc.mustache", ".md");
9999
apiDocTemplateFiles.put("api_doc.mustache", ".md");
100100

101-
hideGenerationTimestamp = false;
102-
101+
hideGenerationTimestamp = false;
102+
103103
setReservedWordsLowerCase(
104104
Arrays.asList(
105105
// used as internal variables, can collide with parameter names
@@ -167,6 +167,7 @@ public AbstractJavaCodegen() {
167167
dateOptions.put("java8", "Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets \"" + JAVA8_MODE + "\" to true");
168168
dateOptions.put("threetenbp", "Backport of JSR310 (preferred for jdk < 1.8)");
169169
dateOptions.put("java8-localdatetime", "Java 8 using LocalDateTime (for legacy app only)");
170+
dateOptions.put("java8-instant", "Java 8 using Instant");
170171
dateOptions.put("joda", "Joda (for legacy app only)");
171172
dateOptions.put("legacy", "Legacy java.util.Date (if you really have a good reason not to use threetenbp");
172173
dateLibrary.setEnum(dateOptions);
@@ -440,13 +441,19 @@ public void processOpts() {
440441
} else if (dateLibrary.startsWith("java8")) {
441442
additionalProperties.put("java8", "true");
442443
additionalProperties.put("jsr310", "true");
443-
typeMapping.put("date", "LocalDate");
444-
importMapping.put("LocalDate", "java.time.LocalDate");
445444
if ("java8-localdatetime".equals(dateLibrary)) {
445+
typeMapping.put("date", "LocalDate");
446446
typeMapping.put("DateTime", "LocalDateTime");
447+
importMapping.put("LocalDate", "java.time.LocalDate");
447448
importMapping.put("LocalDateTime", "java.time.LocalDateTime");
449+
} else if ("java8-instant".equals(dateLibrary)) {
450+
typeMapping.put("date", "Instant");
451+
typeMapping.put("DateTime", "Instant");
452+
importMapping.put("Instant", "java.time.Instant");
448453
} else {
454+
typeMapping.put("date", "LocalDate");
449455
typeMapping.put("DateTime", "OffsetDateTime");
456+
importMapping.put("LocalDate", "java.time.LocalDate");
450457
importMapping.put("OffsetDateTime", "java.time.OffsetDateTime");
451458
}
452459
} else if (dateLibrary.equals("legacy")) {

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ public JavaClientCodegen() {
7474
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Send gzip-encoded requests"));
7575
cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception"));
7676

77-
supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.4. JSON processing: Jackson 2.9.9. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.");
78-
supportedLibraries.put("feign", "HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.9.9");
79-
supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.9");
77+
supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.4. JSON processing: Jackson 2.9.10. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.");
78+
supportedLibraries.put("feign", "HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.9.10");
79+
supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.10");
8080
supportedLibraries.put("okhttp-gson", "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.");
8181
supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.");
8282
supportedLibraries.put(RETROFIT_2, "HTTP client: OkHttp 3.8.0. JSON processing: Gson 2.6.1 (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)");
83-
supportedLibraries.put("resttemplate", "HTTP client: Spring RestTemplate 4.3.9-RELEASE. JSON processing: Jackson 2.9.9");
84-
supportedLibraries.put("resteasy", "HTTP client: Resteasy client 3.1.3.Final. JSON processing: Jackson 2.9.9");
85-
supportedLibraries.put("vertx", "HTTP client: VertX client 3.2.4. JSON processing: Jackson 2.9.9");
86-
supportedLibraries.put("google-api-client", "HTTP client: Google API client 1.23.0. JSON processing: Jackson 2.9.9");
83+
supportedLibraries.put("resttemplate", "HTTP client: Spring RestTemplate 4.3.9-RELEASE. JSON processing: Jackson 2.9.10");
84+
supportedLibraries.put("resteasy", "HTTP client: Resteasy client 3.1.3.Final. JSON processing: Jackson 2.9.10");
85+
supportedLibraries.put("vertx", "HTTP client: VertX client 3.2.4. JSON processing: Jackson 2.9.10");
86+
supportedLibraries.put("google-api-client", "HTTP client: Google API client 1.23.0. JSON processing: Jackson 2.9.10");
8787
supportedLibraries.put("rest-assured", "HTTP client: rest-assured : 3.1.0. JSON processing: Gson 2.6.1. Only for Java8");
8888

8989
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/NodeJSServerCodegen.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,13 @@ public String apiFilename(String templateName, String tag) {
158158
String result = super.apiFilename(templateName, tag);
159159

160160
if (templateName.equals("service.mustache")) {
161-
String stringToMatch = File.separator + "controllers" + File.separator;
162-
String replacement = File.separator + implFolder + File.separator;
163-
result = result.replaceAll(Pattern.quote(stringToMatch), replacement);
161+
String regexFileSep = File.separator;
162+
if (regexFileSep.equals("\\")) {
163+
regexFileSep = "\\\\";
164+
}
165+
String stringToMatch = regexFileSep + "controllers" + regexFileSep;
166+
String replacement = regexFileSep + implFolder + regexFileSep;
167+
result = result.replaceAll(stringToMatch, replacement);
164168
}
165169
return result;
166170
}

modules/swagger-codegen/src/main/resources/Groovy/build.gradle.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repositories {
2424

2525
ext {
2626
swagger_annotations_version = "1.5.8"
27-
jackson_version = "2.9.9"
27+
jackson_version = "2.9.10"
2828
}
2929

3030
dependencies {

modules/swagger-codegen/src/main/resources/Java/build.gradle.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ if(hasProperty('target') && target == 'android') {
121121

122122
ext {
123123
swagger_annotations_version = "1.5.17"
124-
jackson_version = "{{^threetenbp}}2.9.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}"
124+
jackson_version = "{{^threetenbp}}2.9.10{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}"
125125
jersey_version = "1.19.4"
126126
jodatime_version = "2.9.9"
127127
junit_version = "4.12"

modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.gradle.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ if(hasProperty('target') && target == 'android') {
101101

102102
ext {
103103
swagger_annotations_version = "1.5.9"
104-
jackson_version = "2.9.9"
104+
jackson_version = "2.9.10"
105105
{{#threetenbp}}
106106
threepane_version = "2.6.4"
107107
{{/threetenbp}}

modules/swagger-codegen/src/main/resources/Java/libraries/feign/build.sbt.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ lazy val root = (project in file(".")).
1414
"io.github.openfeign" % "feign-jackson" % "9.4.0" % "compile",
1515
"io.github.openfeign" % "feign-slf4j" % "9.4.0" % "compile",
1616
"io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile",
17-
"com.fasterxml.jackson.core" % "jackson-core" % "2.9.9" % "compile",
18-
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.9.9" % "compile",
19-
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.9" % "compile",
20-
"com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.9.9" % "compile",
17+
"com.fasterxml.jackson.core" % "jackson-core" % "2.9.10" % "compile",
18+
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.9.10" % "compile",
19+
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.10" % "compile",
20+
"com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.9.10" % "compile",
2121
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile",
2222
"com.brsanthu" % "migbase64" % "2.2" % "compile",
2323
"junit" % "junit" % "4.12" % "test",

modules/swagger-codegen/src/main/resources/Java/libraries/feign/pom.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
<swagger-core-version>1.5.18</swagger-core-version>
298298
<feign-version>9.4.0</feign-version>
299299
<feign-form-version>2.1.0</feign-form-version>
300-
<jackson-version>2.9.9</jackson-version>
300+
<jackson-version>2.9.10</jackson-version>
301301
{{#threetenbp}}
302302
<jackson-threetenbp-version>2.6.4</jackson-threetenbp-version>
303303
{{/threetenbp}}

0 commit comments

Comments
 (0)