Skip to content

Commit 4c39144

Browse files
authored
Merge branch 'master' into patch-1
2 parents c0298a5 + f1569a0 commit 4c39144

File tree

229 files changed

+1598
-714
lines changed

Some content is hidden

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

229 files changed

+1598
-714
lines changed

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
[![Build Status](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master-java7/badge/icon?subject=jenkins%20build%20-%20java%207)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master-java7/)
88

9-
- Master (2.4.9): [![Build Status](https://img.shields.io/travis/swagger-api/swagger-codegen/master.svg?label=Petstore%20Integration%20Test)](https://travis-ci.org/swagger-api/swagger-codegen)
9+
- Master (2.4.11-SNAPSHOT): [![Build Status](https://img.shields.io/travis/swagger-api/swagger-codegen/master.svg?label=Petstore%20Integration%20Test)](https://travis-ci.org/swagger-api/swagger-codegen)
1010
[![Java Test](https://img.shields.io/jenkins/s/https/jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master.svg)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master)
1111
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/swagger-api/swagger-codegen?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/swaggerhub-bot/swagger-codegen)
12-
- 3.0.13: [![Build Status](https://img.shields.io/travis/swagger-api/swagger-codegen/3.0.0.svg?label=Petstore%20Integration%20Test)](https://travis-ci.org/swagger-api/swagger-codegen)
12+
- 3.0.15-SNAPSHOT: [![Build Status](https://img.shields.io/travis/swagger-api/swagger-codegen/3.0.0.svg?label=Petstore%20Integration%20Test)](https://travis-ci.org/swagger-api/swagger-codegen)
1313
[![Java Test](https://img.shields.io/jenkins/s/https/jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-3.svg)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-3)
1414
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/swagger-api/swagger-codegen?branch=3.0.0&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/swaggerhub-bot/swagger-codegen)
1515

@@ -51,7 +51,7 @@ dependency example:
5151
<dependency>
5252
<groupId>io.swagger</groupId>
5353
<artifactId>swagger-codegen-maven-plugin</artifactId>
54-
<version>2.4.9</version>
54+
<version>2.4.10</version>
5555
</dependency>
5656
```
5757

@@ -69,7 +69,7 @@ dependency example:
6969
<dependency>
7070
<groupId>io.swagger.codegen.v3</groupId>
7171
<artifactId>swagger-codegen-maven-plugin</artifactId>
72-
<version>3.0.13</version>
72+
<version>3.0.14</version>
7373
</dependency>
7474
```
7575

@@ -133,8 +133,9 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
133133

134134
Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
135135
-------------------------- | ------------ | -------------------------- | -----
136-
3.0.14-SNAPSHOT (current 3.0.0, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/codegen/v3/swagger-codegen-cli/3.0.14-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release
137-
[3.0.13](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.13) (**current stable**) | 2019-16-14 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.13](https://github.com/swagger-api/swagger-codegen/tree/v3.0.13)
136+
3.0.15-SNAPSHOT (current 3.0.0, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/codegen/v3/swagger-codegen-cli/3.0.15-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release
137+
[3.0.14](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.14) (**current stable**) | 2019-11-16 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.14](https://github.com/swagger-api/swagger-codegen/tree/v3.0.14)
138+
[3.0.13](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.13) | 2019-10-16 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.13](https://github.com/swagger-api/swagger-codegen/tree/v3.0.13)
138139
[3.0.12](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.12) | 2019-10-14 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.12](https://github.com/swagger-api/swagger-codegen/tree/v3.0.12)
139140
[3.0.11](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.11) | 2019-08-24 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.11](https://github.com/swagger-api/swagger-codegen/tree/v3.0.11)
140141
[3.0.10](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.10) | 2019-07-11 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.10](https://github.com/swagger-api/swagger-codegen/tree/v3.0.10)
@@ -147,8 +148,9 @@ Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
147148
[3.0.2](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.2)| 2018-10-19 | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release
148149
[3.0.1](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.1)| 2018-10-05 | 1.0, 1.1, 1.2, 2.0, 3.0 | Major release with breaking changes
149150
[3.0.0](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.0)| 2018-09-06 | 1.0, 1.1, 1.2, 2.0, 3.0 | Major release with breaking changes
150-
2.4.10-SNAPSHOT (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.4.10-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Minor release
151-
[2.4.9](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.9) (**current stable**) | 2019-10-14 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.9](https://github.com/swagger-api/swagger-codegen/tree/v2.4.9)
151+
2.4.11-SNAPSHOT (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.4.11-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Minor release
152+
[2.4.10](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.10) (**current stable**) | 2019-11-16 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.10](https://github.com/swagger-api/swagger-codegen/tree/v2.4.10)
153+
[2.4.9](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.9) | 2019-10-14 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.9](https://github.com/swagger-api/swagger-codegen/tree/v2.4.9)
152154
[2.4.8](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.8) | 2019-08-24 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.8](https://github.com/swagger-api/swagger-codegen/tree/v2.4.8)
153155
[2.4.7](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.7) | 2019-07-11 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.7](https://github.com/swagger-api/swagger-codegen/tree/v2.4.7)
154156
[2.4.6](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.6) | 2019-06-28 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.6](https://github.com/swagger-api/swagger-codegen/tree/v2.4.6)
@@ -169,15 +171,15 @@ Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
169171

170172

171173
### Prerequisites
172-
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 7 runtime at a minimum):
174+
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
173175

174176
```sh
175-
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.9/swagger-codegen-cli-2.4.9.jar -O swagger-codegen-cli.jar
177+
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.10/swagger-codegen-cli-2.4.10.jar -O swagger-codegen-cli.jar
176178

177179
java -jar swagger-codegen-cli.jar help
178180
```
179181

180-
For Windows users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. `Invoke-WebRequest -OutFile swagger-codegen-cli.jar http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.9/swagger-codegen-cli-2.4.9.jar`
182+
For Windows users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. `Invoke-WebRequest -OutFile swagger-codegen-cli.jar http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.10/swagger-codegen-cli-2.4.10.jar`
181183

182184
On a mac, it's even easier with `brew`:
183185
```sh
@@ -186,12 +188,12 @@ brew install swagger-codegen
186188

187189
To build from source, you need the following installed and available in your `$PATH:`
188190

189-
* [Java 7 or 8](http://java.oracle.com)
191+
* [Java 8+](http://java.oracle.com)
190192

191193
* [Apache maven 3.3.3 or greater](http://maven.apache.org/)
192194

193195
#### OS X Users
194-
Don't forget to install Java 7 or 8. You probably have 1.6.
196+
Don't forget to install Java 8+.
195197

196198
Export `JAVA_HOME` in order to use the supported Java version:
197199
```sh
@@ -322,7 +324,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
322324
```
323325
(if you're on Windows, replace the last command with `java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l php -o c:\temp\php_api_client`)
324326

325-
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.9/swagger-codegen-cli-2.4.9.jar)
327+
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.10/swagger-codegen-cli-2.4.10.jar)
326328

327329
To get a list of **general** options available, please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar help generate`
328330

modules/swagger-codegen-cli/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.swagger</groupId>
55
<artifactId>swagger-codegen-project</artifactId>
6-
<version>2.4.10-SNAPSHOT</version>
6+
<version>2.4.11-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@
119119

120120
<properties>
121121
<swagger-annotations-version>1.5.21</swagger-annotations-version>
122-
<jersey-version>2.25.1</jersey-version>
123-
<jackson-version>2.9.10</jackson-version>
122+
<jersey-version>2.29.1</jersey-version>
123+
<jackson-version>2.10.1</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-maven-plugin/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>io.swagger</groupId>
66
<artifactId>swagger-codegen-project</artifactId>
7-
<version>2.4.10-SNAPSHOT</version>
7+
<version>2.4.11-SNAPSHOT</version>
88
<relativePath>../..</relativePath>
99
</parent>
1010
<artifactId>swagger-codegen-maven-plugin</artifactId>
@@ -62,7 +62,7 @@
6262
<plugin>
6363
<groupId>org.apache.maven.plugins</groupId>
6464
<artifactId>maven-plugin-plugin</artifactId>
65-
<version>3.4</version>
65+
<version>3.6.0</version>
6666
<configuration>
6767
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
6868
</configuration>

modules/swagger-codegen/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.swagger</groupId>
55
<artifactId>swagger-codegen-project</artifactId>
6-
<version>2.4.10-SNAPSHOT</version>
6+
<version>2.4.11-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,10 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
14741474
}
14751475
}
14761476

1477+
if (model.getProperties() != null) {
1478+
properties.putAll(model.getProperties());
1479+
}
1480+
14771481
// child model (properties owned by the model itself)
14781482
Model child = composed.getChild();
14791483
if (child != null && child instanceof RefModel && allDefinitions != null) {
@@ -1486,6 +1490,7 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
14861490
addProperties(allProperties, allRequired, child, allDefinitions);
14871491
}
14881492
}
1493+
14891494
addVars(m, properties, required, allDefinitions, allProperties, allRequired);
14901495
} else {
14911496
ModelImpl impl = (ModelImpl) model;
@@ -1556,9 +1561,14 @@ protected void addProperties(Map<String, Property> properties,
15561561
}
15571562
} else if (model instanceof RefModel) {
15581563
String interfaceRef = ((RefModel) model).getSimpleRef();
1559-
Model interfaceModel = allDefinitions.get(interfaceRef);
1560-
addProperties(properties, required, interfaceModel, allDefinitions);
1564+
if (allDefinitions != null) {
1565+
Model interfaceModel = allDefinitions.get(interfaceRef);
1566+
addProperties(properties, required, interfaceModel, allDefinitions);
1567+
}
15611568
} else if (model instanceof ComposedModel) {
1569+
if (model.getProperties() != null) {
1570+
properties.putAll(model.getProperties());
1571+
}
15621572
for (Model component :((ComposedModel) model).getAllOf()) {
15631573
addProperties(properties, required, component, allDefinitions);
15641574
}

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ protected String getScheme() {
107107
}
108108

109109
private String getHost() {
110+
StringBuilder hostBuilder = new StringBuilder();
111+
hostBuilder.append(getHostWithoutBasePath());
112+
if (!StringUtils.isEmpty(swagger.getBasePath()) && !swagger.getBasePath().equals("/")) {
113+
hostBuilder.append(swagger.getBasePath());
114+
}
115+
return hostBuilder.toString();
116+
}
117+
118+
private String getHostWithoutBasePath() {
110119
StringBuilder hostBuilder = new StringBuilder();
111120
hostBuilder.append(getScheme());
112121
hostBuilder.append("://");
@@ -116,9 +125,6 @@ private String getHost() {
116125
hostBuilder.append("localhost");
117126
LOGGER.warn("'host' not defined in the spec. Default to 'localhost'.");
118127
}
119-
if (!StringUtils.isEmpty(swagger.getBasePath()) && !swagger.getBasePath().equals("/")) {
120-
hostBuilder.append(swagger.getBasePath());
121-
}
122128
return hostBuilder.toString();
123129
}
124130

@@ -475,6 +481,7 @@ public int compare(CodegenOperation one, CodegenOperation another) {
475481
});
476482
Map<String, Object> operation = processOperations(config, tag, ops, allModels);
477483

484+
operation.put("hostWithoutBasePath", getHostWithoutBasePath());
478485
operation.put("basePath", basePath);
479486
operation.put("basePathWithoutHost", basePathWithoutHost);
480487
operation.put("contextPath", contextPath);
@@ -715,7 +722,7 @@ protected Map<String, Object> buildSupportFileBundle(List<Object> allOperations,
715722
if (swagger.getHost() != null) {
716723
bundle.put("host", swagger.getHost());
717724
}
718-
725+
bundle.put("hostWithoutBasePath", getHostWithoutBasePath());
719726
bundle.put("swagger", this.swagger);
720727
bundle.put("basePath", basePath);
721728
bundle.put("basePathWithoutHost", basePathWithoutHost);

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.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");
77+
supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.4. JSON processing: Jackson 2.10.1. 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.10.1");
79+
supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.29.1. JSON processing: Jackson 2.10.1");
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.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");
83+
supportedLibraries.put("resttemplate", "HTTP client: Spring RestTemplate 4.3.9-RELEASE. JSON processing: Jackson 2.10.1");
84+
supportedLibraries.put("resteasy", "HTTP client: Resteasy client 3.1.3.Final. JSON processing: Jackson 2.10.1");
85+
supportedLibraries.put("vertx", "HTTP client: VertX client 3.2.4. JSON processing: Jackson 2.10.1");
86+
supportedLibraries.put("google-api-client", "HTTP client: Google API client 1.23.0. JSON processing: Jackson 2.10.1");
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");

0 commit comments

Comments
 (0)