Skip to content

Commit 5c85257

Browse files
authored
Merge branch 'master' into dart-double-cast
2 parents d52168f + aa1f65d commit 5c85257

File tree

603 files changed

+11399
-4901
lines changed

Some content is hidden

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

603 files changed

+11399
-4901
lines changed

.travis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ before_install:
3939
- gem install bundler -v '< 2'
4040
- gem update --system 2.7.8
4141
- gem --version
42+
# install node version 10.x
43+
- nvm install 10.22.0
44+
- nvm use 10.22.0
45+
# install typescript
4246
- npm install -g typescript
4347
- npm install -g npm
4448
- npm config set registry http://registry.npmjs.org/
@@ -64,7 +68,18 @@ before_install:
6468
- cat /etc/hosts
6569
# show java version
6670
- java -version
67-
71+
# show node version
72+
- node -v
73+
# show node executable
74+
- which node
75+
# show npm version
76+
- npm -v
77+
# show npm executable
78+
- which npm
79+
# show typescript version
80+
- tsc -v
81+
# show tsc executable
82+
- which tsc
6883
install:
6984
# Add Godeps dependencies to GOPATH and PATH
7085
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.4 bash)"

.whitesource

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"scanSettings": {
3+
"configMode": "AUTO",
4+
"configExternalURL": "",
5+
"projectToken": "",
6+
"baseBranches": []
7+
},
8+
"checkRunSettings": {
9+
"vulnerableCheckRunConclusionLevel": "failure",
10+
"displayMode": "diff"
11+
},
12+
"issueSettings": {
13+
"minSeverityLevel": "LOW"
14+
}
15+
}

README.md

Lines changed: 60 additions & 51 deletions
Large diffs are not rendered by default.

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,6 @@
123123
<jackson-version>2.10.1</jackson-version>
124124
<jodatime-version>2.7</jodatime-version>
125125
<maven-plugin-version>1.0.0</maven-plugin-version>
126-
<junit-version>4.8.1</junit-version>
126+
<junit-version>4.13.1</junit-version>
127127
</properties>
128128
</project>

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.15-SNAPSHOT</version>
7+
<version>2.4.18-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.15-SNAPSHOT</version>
6+
<version>2.4.18-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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ public class CodegenModel {
5656
allMandatory = mandatory;
5757
}
5858

59+
public boolean getIsInteger() {
60+
return "Integer".equalsIgnoreCase(this.dataType);
61+
}
62+
63+
public boolean getIsNumber() {
64+
return "BigDecimal".equalsIgnoreCase(this.dataType);
65+
}
66+
5967
@Override
6068
public String toString() {
6169
return String.format("%s(%s)", name, classname);

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.util.regex.Pattern;
1212

1313
import io.swagger.models.properties.UntypedProperty;
14+
import io.swagger.util.Yaml;
1415
import org.apache.commons.lang3.ObjectUtils;
1516
import org.apache.commons.lang3.StringEscapeUtils;
1617
import org.apache.commons.lang3.StringUtils;
@@ -293,8 +294,8 @@ public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
293294
}
294295

295296
/**
296-
* Returns the common prefix of variables for enum naming if
297-
* two or more variables are present
297+
* Returns the common prefix of variables for enum naming if
298+
* two or more variables are present.
298299
*
299300
* @param vars List of variable names
300301
* @return the common prefix for naming
@@ -347,7 +348,7 @@ public String toEnumDefaultValue(String value, String datatype) {
347348
* @return the sanitized value for enum
348349
*/
349350
public String toEnumValue(String value, String datatype) {
350-
if ("number".equalsIgnoreCase(datatype)) {
351+
if (isPrimivite(datatype)) {
351352
return value;
352353
} else {
353354
return "\"" + escapeText(value) + "\"";
@@ -374,6 +375,12 @@ public String toEnumVarName(String value, String datatype) {
374375
}
375376
}
376377

378+
public boolean isPrimivite(String datatype) {
379+
return "number".equalsIgnoreCase(datatype)
380+
|| "integer".equalsIgnoreCase(datatype)
381+
|| "boolean".equalsIgnoreCase(datatype);
382+
}
383+
377384
// override with any special post-processing
378385
@SuppressWarnings("static-method")
379386
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
@@ -1500,6 +1507,10 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
15001507
properties.putAll(model.getProperties());
15011508
}
15021509

1510+
if (composed.getRequired() != null) {
1511+
required.addAll(composed.getRequired());
1512+
}
1513+
15031514
// child model (properties owned by the model itself)
15041515
Model child = composed.getChild();
15051516
if (child != null && child instanceof RefModel && allDefinitions != null) {
@@ -1525,6 +1536,9 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
15251536
// comment out below as allowableValues is not set in post processing model enum
15261537
m.allowableValues = new HashMap<String, Object>();
15271538
m.allowableValues.put("values", impl.getEnum());
1539+
if (m.dataType.equals("BigDecimal")) {
1540+
addImport(m, "BigDecimal");
1541+
}
15281542
}
15291543
if (impl.getAdditionalProperties() != null) {
15301544
addAdditionPropertiesToCodeGenModel(m, impl);
@@ -2762,6 +2776,7 @@ public CodegenParameter fromParameter(Parameter param, Set<String> imports) {
27622776
p.isPrimitiveType = cp.isPrimitiveType;
27632777
p.isContainer = true;
27642778
p.isListContainer = true;
2779+
p.uniqueItems = impl.getUniqueItems() == null ? false : impl.getUniqueItems();
27652780

27662781
// set boolean flag (e.g. isString)
27672782
setParameterBooleanFlagWithCodegenProperty(p, cp);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ protected void configureSwaggerInfo() {
261261
if (info.getTermsOfService() != null) {
262262
config.additionalProperties().put("termsOfService", config.escapeText(info.getTermsOfService()));
263263
}
264+
if (info.getVendorExtensions() != null && !info.getVendorExtensions().isEmpty()) {
265+
config.additionalProperties().put("info-extensions", info.getVendorExtensions());
266+
}
264267
}
265268

266269
protected void generateModelTests(List<File> files, Map<String, Object> models, String modelName) throws IOException {

0 commit comments

Comments
 (0)