Skip to content

Commit 60a9ac3

Browse files
committed
2 parents 358e5a4 + 5ff87d4 commit 60a9ac3

File tree

56 files changed

+223
-106
lines changed

Some content is hidden

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

56 files changed

+223
-106
lines changed

README.md

Lines changed: 35 additions & 30 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.15-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.16-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.21-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.22-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.14</version>
55+
<version>2.4.15</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.20</version>
73+
<version>3.0.21</version>
7474
</dependency>
7575
```
7676

@@ -89,7 +89,7 @@ Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for addit
8989

9090
# Table of contents
9191

92-
- [Swagger Code Generator](#swagger-code-generator)
92+
- [Versioning](#versioning)
9393
- [Overview](#overview)
9494
- [Table of Contents](#table-of-contents)
9595
- Installation
@@ -134,8 +134,9 @@ 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.21-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.21-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release
138-
[3.0.20](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.20) (**current stable**) | 2020-05-18 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.20](https://github.com/swagger-api/swagger-codegen/tree/v3.0.20)
137+
3.0.22-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.22-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release
138+
[3.0.21](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.21) (**current stable**) | 2020-07-28 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.21](https://github.com/swagger-api/swagger-codegen/tree/v3.0.21)
139+
[3.0.20](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.20) | 2020-05-18 | 1.0, 1.1, 1.2, 2.0, 3.0 | [tag v3.0.20](https://github.com/swagger-api/swagger-codegen/tree/v3.0.20)
139140
[3.0.19](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.19) | 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)
140141
[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)
141142
[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)
@@ -155,8 +156,9 @@ Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
155156
[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
156157
[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
157158
[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
158-
2.4.15-SNAPSHOT (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.4.15-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Minor release
159-
[2.4.14](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.14) (**current stable**) | 2020-05-18 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.14](https://github.com/swagger-api/swagger-codegen/tree/v2.4.14)
159+
2.4.16-SNAPSHOT (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.4.16-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Minor release
160+
[2.4.15](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.15) (**current stable**) | 2020-07-28 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.15](https://github.com/swagger-api/swagger-codegen/tree/v2.4.15)
161+
[2.4.14](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.14) | 2020-05-18 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.14](https://github.com/swagger-api/swagger-codegen/tree/v2.4.14)
160162
[2.4.13](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.13) | 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)
161163
[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)
162164
[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)
@@ -184,15 +186,17 @@ If you're looking for the latest stable version, you can grab it directly from M
184186

185187
```sh
186188
# Download current stable 2.x.x branch (Swagger and OpenAPI version 2)
187-
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.14/swagger-codegen-cli-2.4.14.jar -O swagger-codegen-cli.jar
189+
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.15/swagger-codegen-cli-2.4.15.jar -O swagger-codegen-cli.jar
190+
191+
java -jar swagger-codegen-cli.jar help
188192

189193
# Download current stable 3.x.x branch (OpenAPI version 3)
190-
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.20/swagger-codegen-cli-3.0.20.jar -O swagger-codegen-cli.jar
194+
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.21/swagger-codegen-cli-3.0.21.jar -O swagger-codegen-cli.jar
191195

192-
java -jar swagger-codegen-cli.jar help
196+
java -jar swagger-codegen-cli.jar --help
193197
```
194198

195-
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.14/swagger-codegen-cli-2.4.14.jar`
199+
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.15/swagger-codegen-cli-2.4.15.jar`
196200

197201
On a mac, it's even easier with `brew`:
198202
```sh
@@ -232,7 +236,7 @@ To install, run `brew install swagger-codegen`
232236

233237
Here is an example usage:
234238
```sh
235-
swagger-codegen generate -i http://petstore.swagger.io/v2/swagger.json -l ruby -o /tmp/test/
239+
swagger-codegen generate -i https://petstore.swagger.io/v2/swagger.json -l ruby -o /tmp/test/
236240
```
237241

238242
### Docker
@@ -297,7 +301,7 @@ sleep 5
297301
GEN_IP=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $CID)
298302
# Execute an HTTP request and store the download link
299303
RESULT=$(curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
300-
"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"
304+
"swaggerUrl": "https://petstore.swagger.io/v2/swagger.json"
301305
}' 'http://localhost:8188/api/gen/clients/javascript' | jq '.link' | tr -d '"')
302306
# Download the generated zip and redirect to a file
303307
curl $RESULT > result.zip
@@ -317,7 +321,7 @@ Example:
317321

318322
```sh
319323
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \
320-
-i http://petstore.swagger.io/v2/swagger.json \
324+
-i https://petstore.swagger.io/v2/swagger.json \
321325
-l go \
322326
-o /local/out/go
323327
```
@@ -328,28 +332,28 @@ The generated code will be located under `./out/go` in the current directory.
328332

329333
## Getting Started
330334

331-
To generate a PHP client for http://petstore.swagger.io/v2/swagger.json, please run the following
335+
To generate a PHP client for https://petstore.swagger.io/v2/swagger.json, please run the following
332336
```sh
333337
git clone https://github.com/swagger-api/swagger-codegen
334338
cd swagger-codegen
335339
mvn clean package
336340
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
337-
-i http://petstore.swagger.io/v2/swagger.json \
341+
-i https://petstore.swagger.io/v2/swagger.json \
338342
-l php \
339343
-o /var/tmp/php_api_client
340344
```
341-
(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`)
345+
(if you're on Windows, replace the last command with `java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i https://petstore.swagger.io/v2/swagger.json -l php -o c:\temp\php_api_client`)
342346

343-
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.14/swagger-codegen-cli-2.4.14.jar)
347+
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.15/swagger-codegen-cli-2.4.15.jar)
344348

345-
To get a list of **general** options available, please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar help generate`
349+
To get a list of **general** options available, please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar help generate` (for version 3.x check [3.0.0 branch](https://github.com/swagger-api/swagger-codegen/tree/3.0.0))
346350

347351
To get a list of PHP specified options (which can be passed to the generator with a config file via the `-c` option), please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l php`
348352

349353
## Generators
350354

351355
### To generate a sample client library
352-
You can build a client against the swagger sample [petstore](http://petstore.swagger.io) API as follows:
356+
You can build a client against the swagger sample [petstore](https://petstore.swagger.io) API as follows:
353357

354358
```sh
355359
./bin/java-petstore.sh
@@ -361,7 +365,7 @@ This will run the generator with this command:
361365

362366
```sh
363367
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
364-
-i http://petstore.swagger.io/v2/swagger.json \
368+
-i https://petstore.swagger.io/v2/swagger.json \
365369
-l java \
366370
-o samples/client/petstore/java
367371
```
@@ -459,7 +463,7 @@ Note the `myClientCodegen` is an option now, and you can use the usual arguments
459463
```sh
460464
java -cp output/myLibrary/target/myClientCodegen-swagger-codegen-1.0.0.jar:modules/swagger-codegen-cli/target/swagger-codegen-cli.jar \
461465
io.swagger.codegen.SwaggerCodegen generate -l myClientCodegen\
462-
-i http://petstore.swagger.io/v2/swagger.json \
466+
-i https://petstore.swagger.io/v2/swagger.json \
463467
-o myClient
464468
```
465469

@@ -591,7 +595,7 @@ Each of these files creates reasonable defaults so you can get running quickly.
591595

592596
```sh
593597
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
594-
-i http://petstore.swagger.io/v2/swagger.json \
598+
-i https://petstore.swagger.io/v2/swagger.json \
595599
-l java \
596600
-o samples/client/petstore/java \
597601
-c path/to/config.json
@@ -695,7 +699,7 @@ or
695699

696700
You have options. The easiest is to use our [online validator](https://github.com/swagger-api/validator-badge) which not only will let you validate your spec, but with the debug flag, you can see what's wrong with your spec. For example:
697701

698-
http://online.swagger.io/validator/debug?url=http://petstore.swagger.io/v2/swagger.json
702+
http://online.swagger.io/validator/debug?url=https://petstore.swagger.io/v2/swagger.json
699703

700704
### Generating dynamic html api documentation
701705

@@ -771,15 +775,15 @@ One can also generate API client or server using the online generators (https://
771775

772776
For example, to generate Ruby API client, simply send the following HTTP request using curl:
773777
```sh
774-
curl -X POST -H "content-type:application/json" -d '{"swaggerUrl":"http://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/ruby
778+
curl -X POST -H "content-type:application/json" -d '{"swaggerUrl":"https://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/ruby
775779
```
776780
Then you will receive a JSON response with the URL to download the zipped code.
777781

778782
To customize the SDK, you can `POST` to `https://generator.swagger.io/gen/clients/{language}` with the following HTTP body:
779783
```json
780784
{
781785
"options": {},
782-
"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"
786+
"swaggerUrl": "https://petstore.swagger.io/v2/swagger.json"
783787
}
784788
```
785789
in which the `options` for a language can be obtained by submitting a `GET` request to `https://generator.swagger.io/api/gen/clients/{language}`:
@@ -813,12 +817,12 @@ To set package name to `pet_store`, the HTTP body of the request is as follows:
813817
"options": {
814818
"packageName": "pet_store"
815819
},
816-
"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"
820+
"swaggerUrl": "https://petstore.swagger.io/v2/swagger.json"
817821
}
818822
```
819823
and here is the curl command:
820824
```sh
821-
curl -H "Content-type: application/json" -X POST -d '{"options": {"packageName": "pet_store"},"swaggerUrl": "http://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/python
825+
curl -H "Content-type: application/json" -X POST -d '{"options": {"packageName": "pet_store"},"swaggerUrl": "https://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/python
822826
```
823827

824828
Instead of using `swaggerUrl` with an URL to the OpenAPI/Swagger spec, one can include the spec in the JSON payload with `spec`, e.g.
@@ -982,6 +986,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
982986
- [Trexle](https://trexle.com/)
983987
- [Upwork](http://upwork.com/)
984988
- [uShip](https://www.uship.com/)
989+
- [Variograma](https://variograma.pt)
985990
- [VMware](https://vmware.com/)
986991
- [Viavi Solutions Inc.](https://www.viavisolutions.com)
987992
- [W.UP](http://wup.hu/?siteLang=en)

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.16-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

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.16-SNAPSHOT</version>
88
<relativePath>../..</relativePath>
99
</parent>
1010
<artifactId>swagger-codegen-maven-plugin</artifactId>

modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
/**
5151
* Goal which generates client/server code from a swagger json/yaml definition.
5252
*/
53-
@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
53+
@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true)
5454
public class CodeGenMojo extends AbstractMojo {
5555

5656
@Parameter(name = "verbose", required = false, defaultValue = "false")
@@ -315,6 +315,13 @@ public class CodeGenMojo extends AbstractMojo {
315315

316316
@Override
317317
public void execute() throws MojoExecutionException {
318+
// Using the naive approach for achieving thread safety
319+
synchronized (CodeGenMojo.class) {
320+
execute_();
321+
}
322+
}
323+
324+
protected void execute_() throws MojoExecutionException {
318325

319326
if (skip) {
320327
getLog().info("Code generation is skipped.");

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.16-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: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,12 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
13981398
List<String> required = new ArrayList<String>();
13991399
Map<String, Property> allProperties;
14001400
List<String> allRequired;
1401+
1402+
List<Model> allComponents = composed.getAllOf();
1403+
if (allComponents.size() > 0 && composed.getParent() == null) {
1404+
rebuildComponents(composed);
1405+
}
1406+
14011407
if (supportsInheritance || supportsMixins) {
14021408
allProperties = new LinkedHashMap<String, Property>();
14031409
allRequired = new ArrayList<String>();
@@ -1477,7 +1483,7 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
14771483

14781484
if(parentName != null) {
14791485
m.parentSchema = parentName;
1480-
m.parent = toModelName(parentName);
1486+
m.parent = typeMapping.containsKey(parentName) ? typeMapping.get(parentName): toModelName(parentName);
14811487
addImport(m, m.parent);
14821488
if (allDefinitions != null) {
14831489
final Model parentModel = allDefinitions.get(m.parentSchema);
@@ -1534,6 +1540,30 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
15341540
return m;
15351541
}
15361542

1543+
private void rebuildComponents(ComposedModel composedModel) {
1544+
List<Model> allComponents = composedModel.getAllOf();
1545+
if (allComponents.size() >= 1) {
1546+
composedModel.setParent(allComponents.get(0));
1547+
if (allComponents.size() >= 2) {
1548+
composedModel.setChild(allComponents.get(allComponents.size() - 1));
1549+
List<RefModel> interfaces = new ArrayList();
1550+
int size = allComponents.size();
1551+
Iterator modelIterator = allComponents.subList(1, size - 1).iterator();
1552+
1553+
while(modelIterator.hasNext()) {
1554+
Model model = (Model)modelIterator.next();
1555+
if (model instanceof RefModel) {
1556+
RefModel ref = (RefModel)model;
1557+
interfaces.add(ref);
1558+
}
1559+
}
1560+
composedModel.setInterfaces(interfaces);
1561+
} else {
1562+
composedModel.setChild(new ModelImpl());
1563+
}
1564+
}
1565+
}
1566+
15371567
/**
15381568
* Recursively look for a discriminator in the interface tree
15391569
*/

0 commit comments

Comments
 (0)