Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
b9bbbc6
make sure to only escape an enum if the actual final variable name is…
jaz-ah Apr 6, 2016
bf71b51
[Swift] Enum parameters are now handled
fabdslv Apr 18, 2016
f8046bc
small example of a first integration-test of the code-generator
Vrolijkx May 1, 2016
15feb20
improving integration test concept.
Vrolijkx May 1, 2016
d78b5f1
adding diff for files in integration test
Vrolijkx May 1, 2016
80d210a
added travis.yml, remove old README.md
guohuang May 10, 2016
6e000cc
Merge branches 'feature/integration-test' and 'master' of https://git…
Vrolijkx May 11, 2016
0facbd7
added travis yml to code gen
guohuang May 13, 2016
492dbcb
added travis yml to code gen
guohuang May 13, 2016
164c728
Merge branch 'travis' of https://github.com/guohuang/swagger-codegen …
guohuang May 13, 2016
37ae53c
add support for additional properties in codegen
Vrolijkx May 16, 2016
c018936
add support for additional properties in codegen
Vrolijkx May 16, 2016
aa8b253
Merge branch 'master' of https://github.com/swagger-api/swagger-codeg…
Vrolijkx May 16, 2016
68d47be
remove not needed peer dependencies and add any type too additional p…
Vrolijkx May 16, 2016
ec65eb5
some small optimizations
Vrolijkx May 16, 2016
b36290f
adding node-es5-spec (still failing)
Vrolijkx May 16, 2016
5b1c779
fix unit test
Vrolijkx May 16, 2016
ca2174f
small code movement
Vrolijkx May 16, 2016
b61abf7
Merge branches 'feature/integration-test' and 'master' of https://git…
Vrolijkx May 16, 2016
66a49e7
always use es6 Promise syntax
Vrolijkx May 16, 2016
a093e7b
gradle wrapper for java api client;
zhenjun115 May 17, 2016
b519015
fixed travis build error
guohuang May 17, 2016
816ba6f
Code review remarks
Vrolijkx May 18, 2016
21e2b7b
[feature] Support for .swagger-codegen-ignore
jimschubert May 16, 2016
98385aa
checkpoint updating pod dependencies/moving to cocoapods1.0
jaz-ah May 18, 2016
9bdf7c4
move back to alamofire 3.1.5 because alamofire 3.2.x and up cause iss…
jaz-ah May 18, 2016
d2ccf48
Add ability to set useQuerystring on request globally for api.
May 18, 2016
b46bce3
Merge branch 'ione' into querystring
May 18, 2016
183b2f5
Run bash to generate new client.
May 18, 2016
2ea40ad
Merge pull request #2882 from Vrolijkx/feature/integration-test
wing328 May 19, 2016
2dda6a6
Merge pull request #2640 from fabdslv/issue-2531
wing328 May 19, 2016
a31f78b
Merge branch 'swift/enums' of https://github.com/jaz-ah/swagger-codeg…
wing328 May 19, 2016
861c618
Merge branch 'jaz-ah-swift/enums'
wing328 May 19, 2016
624e8ae
Merge pull request #2899 from jimschubert/feature/codegen-ignore
wing328 May 19, 2016
71176a8
skip integration test
wing328 May 19, 2016
798e070
Merge pull request #2913 from wing328/skip_integration_test
wing328 May 19, 2016
3b4331a
add ci to ts node npm
wing328 May 19, 2016
1e80455
add swagger codege ignore to ts node npm
wing328 May 19, 2016
f7ed6f0
add ci test for typescript angular
wing328 May 19, 2016
fe3d89f
add CI for typescript fetch
wing328 May 19, 2016
48971eb
update pom to include ci for typescript-fetch clients
wing328 May 19, 2016
69de0ec
update wording for ts test cases
wing328 May 19, 2016
7e3faed
small code cleanump
Vrolijkx May 19, 2016
9070f1a
Merge branches 'feature/integration-test' and 'master' of https://git…
Vrolijkx May 19, 2016
d583e17
Merge branch 'master' of https://github.com/swagger-api/swagger-codeg…
Vrolijkx May 19, 2016
244794b
fix integration tests
Vrolijkx May 19, 2016
a776b37
fix indentation
Vrolijkx May 19, 2016
d5626d0
fix indentation
Vrolijkx May 19, 2016
4e0e91e
move up to ios 9.3
jaz-ah May 19, 2016
d84c1cd
Fix any problem
Vrolijkx May 19, 2016
f45d6a4
Generate ruby enum
zlx May 19, 2016
1e45af2
install typescript in travis ci
wing328 May 20, 2016
7061952
commented out TS fetch related tests in pom.xml
wing328 May 20, 2016
6231970
run ruby test first
wing328 May 20, 2016
6c71dc3
Merge pull request #2910 from wing328/typescript_better_ci
wing328 May 20, 2016
c6f0380
Replaced {{mediaType}} with {{{mediaType}} to keep the original media
wing328 May 20, 2016
e02cfe8
Merge pull request #2921 from wing328/fix_consumes_and_produces2
wing328 May 20, 2016
a96d38e
Merge branch 'travis' of https://github.com/guohuang/swagger-codegen …
wing328 May 20, 2016
0134723
add back pom.xml for go petstore
wing328 May 20, 2016
2e402da
Merge branch 'guohuang-travis'
wing328 May 20, 2016
f2a2014
add gradle wrapper mustache for android api client;
zhenjun115 May 20, 2016
359c4b0
gradle wrapper mustache for java api client;
zhenjun115 May 20, 2016
87b2508
remove duplicated gradle wrapper mustache files from android api client;
zhenjun115 May 20, 2016
9a7e269
remove trailing spaces in the mustache template;
zhenjun115 May 20, 2016
cebaa64
Fix array problem
Vrolijkx May 20, 2016
e44e9fd
show security defs
catinred2 May 21, 2016
e884b2e
add basePathWithoutHost
catinred2 May 21, 2016
cd0d9f5
Merge pull request #2928 from catinred2/basePath
wing328 May 21, 2016
a1563ee
unescape mediaType in JS
wing328 May 21, 2016
42b0894
fix mediaType in clojure client
wing328 May 21, 2016
e903628
Merge branch 'swift/podupdate' of https://github.com/jaz-ah/swagger-c…
wing328 May 21, 2016
eb3a294
Merge branch 'jaz-ah-swift/podupdate'
wing328 May 21, 2016
90cf56a
more comprehensible text
catinred2 May 21, 2016
3ddff7d
Merge pull request #2930 from wing328/fix_consumes_and_produces3
wing328 May 21, 2016
a7ca387
remove ruby model leading space
zlx May 21, 2016
aaca9a4
Merge pull request #2922 from zhenjun115/android_api_client
wing328 May 21, 2016
bc44f74
Merge pull request #2912 from zlx/feature/ruby_enum_support
wing328 May 21, 2016
e1367ee
Merge pull request #2917 from Vrolijkx/feature/typescript_angular2_sh…
wing328 May 21, 2016
46fe27a
Merge pull request #2929 from catinred2/basicAuth
wing328 May 21, 2016
1a1bf74
[Swift] Add sample/tests for Swift client without PromiseKit
Edubits May 21, 2016
69ec14d
fix csharp constructor for model with read-only 1st property
wing328 May 21, 2016
6383f6f
Merge pull request #2932 from swagger-api/readonly_var
wing328 May 21, 2016
52a928b
Merge pull request #2931 from Edubits/swift-sample-without-promisekit
wing328 May 21, 2016
810d165
add zlx to ruby core team
wing328 May 22, 2016
4b4d5ae
Mispelling
AlexanderN May 22, 2016
c719f4d
Merge pull request #1 from alexandern/alexandern-patch-1
AlexanderN May 22, 2016
3035aeb
Misspellings
AlexanderN May 22, 2016
11c6a42
Merge pull request #2 from alexandern/alexandern-patch-1
AlexanderN May 22, 2016
6c33552
Merge pull request #2934 from alexandern/master
wing328 May 23, 2016
7b1cfde
add enum test in php api client
wing328 May 23, 2016
8ba19f0
Merge pull request #2939 from wing328/php_enum_test
wing328 May 23, 2016
91177cd
typescript-angular2 query string fix
ukeller May 13, 2016
9b9d585
Merge pull request #2864 from revaultch/master
wing328 May 23, 2016
917192e
add Revault Sàrl
wing328 May 23, 2016
d82bbfd
Merge branch 'java_api_client' of https://github.com/zhenjun115/swagg…
wing328 May 24, 2016
7d475b1
Merge branch 'zhenjun115-java_api_client'
wing328 May 24, 2016
c7110de
update ruby api client to use apache v2 license
wing328 May 24, 2016
d05d552
Merge pull request #2946 from wing328/ruby_license
wing328 May 24, 2016
568fa4f
add apache license to remaining ruby files (test, spec, etc)
wing328 May 24, 2016
68878ff
Merge pull request #2951 from wing328/ruby_add_license
wing328 May 24, 2016
29008b5
add licence template for ruby api client
wing328 May 24, 2016
d0770d2
Merge pull request #2953 from wing328/ruby_add_license
wing328 May 24, 2016
06dd7c4
add custom generator example to readme
sreich May 24, 2016
fefd507
Merge pull request #2956 from sreich/patch-1
fehguy May 24, 2016
efaccac
Add ability to set useQuerystring on request globally for api.
May 18, 2016
f9981f9
Run bash to generate new client.
May 18, 2016
7d9d8ae
Merge branch 'querystring' of github.com:pixelshaded/swagger-codegen …
May 24, 2016
c7e20d9
Update typings to not use globals/ambients. Update tsconfig to use ex…
May 24, 2016
1523142
Honor gitignore in npm folder.
May 24, 2016
d2c7b93
Add node and corejs to ambient typings since they represent native ty…
May 24, 2016
688a317
Move changes to samples to source code. Build, run, test.
May 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ samples/client/petstore/python/.venv/

# ts
samples/client/petstore/typescript-node/npm/node_modules
samples/client/petstore/typescript-node/**/typings
samples/client/petstore/typescript-angular/**/typings
samples/client/petstore/typescript-fetch/**/dist/
samples/client/petstore/typescript-fetch/**/typings

1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
before_install:
# required when sudo: required for the Ruby petstore tests
- gem install bundler
- npm install -g typescript

install:

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [PostAffiliatePro](https://www.postaffiliatepro.com/)
- [Reload! A/S](https://reload.dk/)
- [REstore](https://www.restore.eu)
- [Revault Sàrl](http://revault.ch)
- [Royal Bank of Canada (RBC)](http://www.rbc.com/canada.html)
- [SmartRecruiters](https://www.smartrecruiters.com/)
- [StyleRecipe](http://stylerecipe.co.jp)
Expand Down Expand Up @@ -864,7 +865,7 @@ Swaagger Codegen core team members are contributors who have been making signfic
| Perl | @wing328 (2016/05/01) |
| PHP | @arnested (2016/05/01) |
| Python | @scottrw93 (2016/05/01) |
| Ruby | @wing328 (2016/05/01) |
| Ruby | @wing328 (2016/05/01) @zlx (2016/05/22) |
| Scala | |
| Swift | @jaz-ah (2016/05/01) @Edubits (2016/05/01) |
| TypeScript (Node) | @Vrolijkx (2016/05/01) |
Expand Down
7 changes: 7 additions & 0 deletions bin/swift-petstore-promisekit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podAuthors": "",
"projectName": "PetstoreClient",
"responseAs": "PromiseKit"
}
31 changes: 31 additions & 0 deletions bin/swift-petstore-promisekit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l swift -c ./bin/swift-petstore-promisekit.json -o samples/client/petstore/swift-promisekit"

java $JAVA_OPTS -jar $executable $ags
6 changes: 4 additions & 2 deletions bin/swift-petstore.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"projectName": "PetstoreClient",
"responseAs": "PromiseKit"
"podSummary": "PetstoreClient",
"podHomepage": "https://github.com/swagger-api/swagger-codegen",
"podAuthors": "",
"projectName": "PetstoreClient"
}
Empty file modified bin/swift-petstore.sh
100755 → 100644
Empty file.
40 changes: 39 additions & 1 deletion modules/swagger-codegen-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,44 @@ mvn clean compile
- `configOptions` - a map of language-specific parameters (see below)
- `configHelp` - dumps the configuration help for the specified library (generates no sources)

### Custom Generator

Specifying a custom generator is a bit different. It doesn't support the classpath:/ syntax, but it does support the fully qualified name of the package. You can also specify your custom templates, which also get pulled in. Notice the dependency on a project, in the plugin scope. That would be your generator/template jar.

```xml
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger-codegen-maven-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>src/main/resources/yaml/yamlfilename.yaml</inputSpec>
<!-- language file, like e.g. JavaJaxRSCodegen shipped with swagger -->
<language>com.my.package.for.GeneratorLanguage</language>
<templateDirectory>myTemplateDir</templateDirectory>

<output>${project.build.directory}/generated-sources</output>
<apiPackage>${default.package}.handler</apiPackage>
<modelPackage>${default.package}.model</modelPackage>
<invokerPackage>${default.package}.handler</invokerPackage>
</configuration>
</execution>
</executions>

<dependencies>
<dependency>
<groupId>com.my.generator</groupId>
<artifactId>customgenerator</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
```

### Sample configuration

- Please see [an example configuration](examples) for using the plugin
- Please see [an example configuration](examples) for using the plugin
10 changes: 10 additions & 0 deletions modules/swagger-codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
</plugin>
</plugins>
</reporting>
<properties>
<diffutils-version>1.2.1</diffutils-version>
</properties>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
Expand Down Expand Up @@ -279,6 +282,13 @@
<!-- <version>${jmockit-version}</version> -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.java-diff-utils</groupId>
<artifactId>diffutils</artifactId>
<version>${diffutils-version}</version>
<scope>test</scope>
</dependency>

</dependencies>
<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ public String getFullTemplateFile(CodegenConfig config, String templateFile) {
}
}

public String readResourceContents(String resourceFilePath) {
StringBuilder sb = new StringBuilder();
Scanner scanner = new Scanner(this.getClass().getResourceAsStream(getCPResourcePath(resourceFilePath)), "UTF-8");
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
sb.append(line).append('\n');
}
return sb.toString();
}

public boolean embeddedTemplateExists(String name) {
return this.getClass().getClassLoader().getResource(getCPResourcePath(name)) != null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.swagger.codegen;

import io.swagger.codegen.auth.AuthMethod;

import java.util.HashMap;
import java.util.Map;

import io.swagger.codegen.auth.AuthMethod;

public class ClientOpts {
protected String uri;
protected String target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,5 @@ public interface CodegenConfig {

String getHttpUserAgent();

String getCommonTemplateDir();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package io.swagger.codegen;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import io.swagger.models.ExternalDocs;
import java.util.*;


public class CodegenModel {
public String parent, parentSchema;
Expand All @@ -19,6 +25,8 @@ public class CodegenModel {
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
public List<CodegenProperty> readOnlyVars = new ArrayList<CodegenProperty>(); // a list of read-only properties
public List<CodegenProperty> readWriteVars = new ArrayList<CodegenProperty>(); // a list of properties for read, write
public List<CodegenProperty> allVars;
public Map<String, Object> allowableValues;

Expand All @@ -32,6 +40,9 @@ public class CodegenModel {

public Map<String, Object> vendorExtensions;

//The type of the value from additional properties. Used in map like objects.
public String additionalPropertiesType;

{
// By default these are the same collections. Where the code generator supports inheritance, composed models
// store the complete closure of owned and inherited properties in allVars and allMandatory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,76 @@

import com.google.common.base.Function;
import com.google.common.collect.Lists;
import io.swagger.codegen.examples.ExampleGenerator;
import io.swagger.models.*;
import io.swagger.models.auth.*;
import io.swagger.models.parameters.*;
import io.swagger.models.properties.*;
import io.swagger.models.properties.PropertyBuilder.PropertyId;
import io.swagger.util.Json;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.Nullable;
import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.annotation.Nullable;

import io.swagger.codegen.examples.ExampleGenerator;
import io.swagger.models.ArrayModel;
import io.swagger.models.ComposedModel;
import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.Operation;
import io.swagger.models.RefModel;
import io.swagger.models.Response;
import io.swagger.models.Swagger;
import io.swagger.models.auth.ApiKeyAuthDefinition;
import io.swagger.models.auth.BasicAuthDefinition;
import io.swagger.models.auth.In;
import io.swagger.models.auth.OAuth2Definition;
import io.swagger.models.auth.SecuritySchemeDefinition;
import io.swagger.models.parameters.BodyParameter;
import io.swagger.models.parameters.CookieParameter;
import io.swagger.models.parameters.FormParameter;
import io.swagger.models.parameters.HeaderParameter;
import io.swagger.models.parameters.Parameter;
import io.swagger.models.parameters.PathParameter;
import io.swagger.models.parameters.QueryParameter;
import io.swagger.models.parameters.SerializableParameter;
import io.swagger.models.properties.AbstractNumericProperty;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.BaseIntegerProperty;
import io.swagger.models.properties.BinaryProperty;
import io.swagger.models.properties.BooleanProperty;
import io.swagger.models.properties.ByteArrayProperty;
import io.swagger.models.properties.DateProperty;
import io.swagger.models.properties.DateTimeProperty;
import io.swagger.models.properties.DecimalProperty;
import io.swagger.models.properties.DoubleProperty;
import io.swagger.models.properties.FloatProperty;
import io.swagger.models.properties.IntegerProperty;
import io.swagger.models.properties.LongProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
import io.swagger.models.properties.PropertyBuilder;
import io.swagger.models.properties.PropertyBuilder.PropertyId;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import io.swagger.models.properties.UUIDProperty;
import io.swagger.util.Json;


public class DefaultCodegen {
protected static final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
Expand All @@ -43,6 +94,7 @@ public class DefaultCodegen {
protected Map<String, String> modelDocTemplateFiles = new HashMap<String, String>();
protected String templateDir;
protected String embeddedTemplateDir;
protected String commonTemplateDir = "_common";
protected Map<String, Object> additionalProperties = new HashMap<String, Object>();
protected Map<String, Object> vendorExtensions = new HashMap<String, Object>();
protected List<SupportingFile> supportingFiles = new ArrayList<SupportingFile>();
Expand Down Expand Up @@ -390,6 +442,14 @@ public String embeddedTemplateDir() {
}
}

public String getCommonTemplateDir() {
return this.commonTemplateDir;
}

public void setCommonTemplateDir(String commonTemplateDir) {
this.commonTemplateDir = commonTemplateDir;
}

public Map<String, String> apiDocTemplateFiles() {
return apiDocTemplateFiles;
}
Expand Down Expand Up @@ -1207,8 +1267,7 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
m.dataType = getSwaggerType(p);
}
if (impl.getAdditionalProperties() != null) {
MapProperty mapProperty = new MapProperty(impl.getAdditionalProperties());
addParentContainer(m, name, mapProperty);
addAdditionPropertiesToCodeGenModel(m, impl);
}
addVars(m, impl.getProperties(), impl.getRequired());
}
Expand All @@ -1221,8 +1280,12 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
return m;
}

protected void addProperties(Map<String, Property> properties, List<String> required, Model model,
Map<String, Model> allDefinitions) {
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) {
MapProperty mapProperty = new MapProperty(swaggerModel.getAdditionalProperties());
addParentContainer(codegenModel, codegenModel.name, mapProperty);
}

protected void addProperties(Map<String, Property> properties, List<String> required, Model model, Map<String, Model> allDefinitions) {

if (model instanceof ModelImpl) {
ModelImpl mi = (ModelImpl) model;
Expand Down Expand Up @@ -2460,7 +2523,7 @@ private static String generateNextName(String name) {
}
}

private void addImport(CodegenModel m, String type) {
protected void addImport(CodegenModel m, String type) {
if (type != null && needToImport(type)) {
m.imports.add(type);
}
Expand Down Expand Up @@ -2535,11 +2598,19 @@ private void addVars(CodegenModel m, List<CodegenProperty> vars, Map<String, Pro
addImport(m, cp.complexType);
vars.add(cp);

if (Boolean.TRUE.equals(cp.required)) { // if required, add to the list "requiredVars"
// if required, add to the list "requiredVars"
if (Boolean.TRUE.equals(cp.required)) {
m.requiredVars.add(cp);
} else { // else add to the list "optionalVars" for optional property
m.optionalVars.add(cp);
}

// if readonly, add to readOnlyVars (list of properties)
if (Boolean.TRUE.equals(cp.isReadOnly)) {
m.readOnlyVars.add(cp);
} else { // else add to readWriteVars (list of properties)
m.readWriteVars.add(cp);
}
}
}
}
Expand Down
Loading