Skip to content

Commit da31b75

Browse files
authored
Merge branch 'master' into python-empty-payload
2 parents 6c4381a + 13dbc0a commit da31b75

File tree

77 files changed

+1213
-336
lines changed

Some content is hidden

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

77 files changed

+1213
-336
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
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.13-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)
9+
- Master (2.4.14-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/build.svg?jobUrl=https://jenkins.swagger.io/job/oss-swagger-codegen-master)](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)
1212

13-
- 3.0.19-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)
13+
- 3.0.20-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)
1414
[![Java Test](https://img.shields.io/jenkins/build.svg?jobUrl=https://jenkins.swagger.io/job/oss-swagger-codegen-3)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-3)
1515
[![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)
1616

@@ -52,7 +52,7 @@ dependency example:
5252
<dependency>
5353
<groupId>io.swagger</groupId>
5454
<artifactId>swagger-codegen-maven-plugin</artifactId>
55-
<version>2.4.12</version>
55+
<version>2.4.13</version>
5656
</dependency>
5757
```
5858

@@ -70,7 +70,7 @@ dependency example:
7070
<dependency>
7171
<groupId>io.swagger.codegen.v3</groupId>
7272
<artifactId>swagger-codegen-maven-plugin</artifactId>
73-
<version>3.0.18</version>
73+
<version>3.0.19</version>
7474
</dependency>
7575
```
7676

@@ -134,11 +134,12 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
134134

135135
Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
136136
-------------------------- | ------------ | -------------------------- | -----
137-
3.0.19-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.19-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release
138-
[3.0.18](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.18) (**current stable**) | 2020-02-26 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.18](https://github.com/swagger-api/swagger-codegen/tree/v3.0.18)
139-
[3.0.17](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.17) (**current stable**) | 2020-02-23 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.17](https://github.com/swagger-api/swagger-codegen/tree/v3.0.17)
140-
[3.0.17](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.16) (**current stable**) | 2020-01-15 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.16](https://github.com/swagger-api/swagger-codegen/tree/v3.0.16)
141-
[3.0.15](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.15) (**current stable**) | 2020-01-03 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.15](https://github.com/swagger-api/swagger-codegen/tree/v3.0.15)
137+
3.0.20-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.20-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release
138+
[3.0.19](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.19) (**current stable**) | 2020-04-02 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.19](https://github.com/swagger-api/swagger-codegen/tree/v3.0.19)
139+
[3.0.18](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.18) | 2020-02-26 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.18](https://github.com/swagger-api/swagger-codegen/tree/v3.0.18)
140+
[3.0.17](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.17) | 2020-02-23 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.17](https://github.com/swagger-api/swagger-codegen/tree/v3.0.17)
141+
[3.0.17](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.16) | 2020-01-15 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.16](https://github.com/swagger-api/swagger-codegen/tree/v3.0.16)
142+
[3.0.15](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.15) | 2020-01-03 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.15](https://github.com/swagger-api/swagger-codegen/tree/v3.0.15)
142143
[3.0.14](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.14) | 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)
143144
[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)
144145
[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)
@@ -153,9 +154,10 @@ Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
153154
[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
154155
[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
155156
[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
156-
2.4.13-SNAPSHOT (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.4.13-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Minor release
157-
[2.4.12](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.12) (**current stable**) | 2020-01-15 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.12](https://github.com/swagger-api/swagger-codegen/tree/v2.4.12)
158-
[2.4.11](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.11) (**current stable**) | 2020-01-03 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.11](https://github.com/swagger-api/swagger-codegen/tree/v2.4.11)
157+
2.4.14-SNAPSHOT (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.4.14-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Minor release
158+
[2.4.13](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.13) (**current stable**) | 2020-04-02 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.13](https://github.com/swagger-api/swagger-codegen/tree/v2.4.13)
159+
[2.4.12](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.12) | 2020-01-15 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.12](https://github.com/swagger-api/swagger-codegen/tree/v2.4.12)
160+
[2.4.11](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.11) | 2020-01-03 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.11](https://github.com/swagger-api/swagger-codegen/tree/v2.4.11)
159161
[2.4.10](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.10) | 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)
160162
[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)
161163
[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)
@@ -175,22 +177,20 @@ Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
175177
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/2.0.17)
176178
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)
177179

178-
179-
180180
### Prerequisites
181181
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
182182

183183
```sh
184184
# Download current stable 2.x.x branch (Swagger and OpenAPI version 2)
185-
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.12/swagger-codegen-cli-2.4.12.jar -O swagger-codegen-cli.jar
185+
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.13/swagger-codegen-cli-2.4.13.jar -O swagger-codegen-cli.jar
186186

187187
# Download current stable 3.x.x branch (OpenAPI version 3)
188-
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.18/swagger-codegen-cli-3.0.18.jar -O swagger-codegen-cli.jar
188+
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.19/swagger-codegen-cli-3.0.19.jar -O swagger-codegen-cli.jar
189189

190190
java -jar swagger-codegen-cli.jar help
191191
```
192192

193-
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 https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.12/swagger-codegen-cli-2.4.12.jar`
193+
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 https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.13/swagger-codegen-cli-2.4.13.jar`
194194

195195
On a mac, it's even easier with `brew`:
196196
```sh
@@ -335,7 +335,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
335335
```
336336
(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`)
337337

338-
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.12/swagger-codegen-cli-2.4.12.jar)
338+
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.13/swagger-codegen-cli-2.4.13.jar)
339339

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

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.13-SNAPSHOT</version>
6+
<version>2.4.14-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public void run() {
280280
}
281281

282282
if (skipAliasGeneration != null) {
283-
configurator.setSkipAliasGeneration(removeOperationIdPrefix);
283+
configurator.setSkipAliasGeneration(skipAliasGeneration);
284284
}
285285

286286
if (ignoreImportMappings != null) {

modules/swagger-codegen-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
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.13-SNAPSHOT</version>
7+
<version>2.4.14-SNAPSHOT</version>
88
<relativePath>../..</relativePath>
99
</parent>
1010
<artifactId>swagger-codegen-maven-plugin</artifactId>

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.13-SNAPSHOT</version>
6+
<version>2.4.14-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class CodegenModel {
4040

4141
public Set<String> imports = new TreeSet<String>();
4242
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, hasOptional, isArrayModel, hasChildren;
43+
public CodegenProperty parentContainer;
4344
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
4445
public ExternalDocs externalDocs;
4546

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class CodegenProperty implements Cloneable {
4646
public List<String> _enum;
4747
public Map<String, Object> allowableValues;
4848
public CodegenProperty items;
49+
public Integer itemsDepth;
4950
public Map<String, Object> vendorExtensions;
5051
public boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
5152
public boolean isInherited;

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

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,12 +1604,24 @@ public String getterAndSetterCapitalize(String name) {
16041604
* @return Codegen Property object
16051605
*/
16061606
public CodegenProperty fromProperty(String name, Property p) {
1607+
return fromProperty(name, p, null);
1608+
}
1609+
/**
1610+
* Convert Swagger Property object to Codegen Property object
1611+
*
1612+
* @param name name of the property
1613+
* @param p Swagger property object
1614+
* @param itemsDepth the depth in nested containers or null
1615+
* @return Codegen Property object
1616+
*/
1617+
private CodegenProperty fromProperty(String name, Property p, Integer itemsDepth) {
16071618
if (p == null) {
16081619
LOGGER.error("unexpected missing property for name " + name);
16091620
return null;
16101621
}
16111622

16121623
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
1624+
property.itemsDepth = itemsDepth;
16131625
property.name = toVarName(name);
16141626
property.baseName = name;
16151627
property.nameInCamelCase = camelize(property.name, false);
@@ -1872,7 +1884,8 @@ public CodegenProperty fromProperty(String name, Property p) {
18721884
if (itemName == null) {
18731885
itemName = property.name;
18741886
}
1875-
CodegenProperty cp = fromProperty(itemName, ap.getItems());
1887+
CodegenProperty cp = fromProperty(itemName, ap.getItems(),
1888+
itemsDepth == null ? 1 : itemsDepth.intValue() + 1);
18761889
updatePropertyForArray(property, cp);
18771890
} else if (p instanceof MapProperty) {
18781891
MapProperty ap = (MapProperty) p;
@@ -1885,7 +1898,8 @@ public CodegenProperty fromProperty(String name, Property p) {
18851898
property.maxItems = ap.getMaxProperties();
18861899

18871900
// handle inner property
1888-
CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties());
1901+
CodegenProperty cp = fromProperty("inner", ap.getAdditionalProperties(),
1902+
itemsDepth == null ? 1 : itemsDepth.intValue() + 1);
18891903
updatePropertyForMap(property, cp);
18901904
} else {
18911905
setNonArrayMapProperty(property, type);
@@ -3088,10 +3102,10 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera
30883102
}
30893103

30903104
private void addParentContainer(CodegenModel m, String name, Property property) {
3091-
final CodegenProperty tmp = fromProperty(name, property);
3092-
addImport(m, tmp.complexType);
3105+
m.parentContainer = fromProperty(name, property);
3106+
addImport(m, m.parentContainer.complexType);
30933107
m.parent = toInstantiationType(property);
3094-
final String containerType = tmp.containerType;
3108+
final String containerType = m.parentContainer.containerType;
30953109
final String instantiationType = instantiationTypes.get(containerType);
30963110
if (instantiationType != null) {
30973111
addImport(m, instantiationType);
@@ -3981,4 +3995,14 @@ public void setIgnoreImportMapping(boolean ignoreImportMapping) {
39813995
public boolean defaultIgnoreImportMappingOption() {
39823996
return false;
39833997
}
3998+
3999+
protected boolean isModelObject(ModelImpl model) {
4000+
if ("object".equalsIgnoreCase(model.getType())) {
4001+
return true;
4002+
}
4003+
if ((StringUtils.EMPTY.equalsIgnoreCase(model.getType()) || model.getType() == null) && (model.getProperties() != null && !model.getProperties().isEmpty())) {
4004+
return true;
4005+
}
4006+
return false;
4007+
}
39844008
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ public void updateCodegenPropertyEnum(CodegenProperty var) {
516516
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
517517
super.postProcessOperations(objs);
518518
if (objs != null) {
519+
boolean hasAuthMethods = false;
519520
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
520521
if (operations != null) {
521522
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
@@ -564,8 +565,13 @@ public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
564565
}
565566

566567
processOperation(operation);
568+
569+
if (operation.hasAuthMethods) {
570+
hasAuthMethods = true;
571+
}
567572
}
568573
}
574+
objs.put("hasAuthMethods", hasAuthMethods);
569575
}
570576

571577
return objs;

0 commit comments

Comments
 (0)