Skip to content

Commit bffb0fb

Browse files
committed
sync from origin master
2 parents 4d6d637 + c5eda55 commit bffb0fb

File tree

2,034 files changed

+78387
-34445
lines changed

Some content is hidden

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

2,034 files changed

+78387
-34445
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!--
2+
Please follow the issue template below for bug reports and feature requests.
3+
Also please indicate in the issue title which language/library is concerned. Eg: [JAVA] Bug generating foo with bar
4+
-->
5+
6+
##### Description
7+
8+
<!-- describe what is the issue and why this is a problem for you. -->
9+
10+
##### Swagger-codegen version
11+
12+
<!-- which version of swagger-codegen are you using, is it a regression? -->
13+
14+
##### Swagger declaration file content or url
15+
16+
<!-- if it is a bug, a json or yaml that produces it.
17+
If you post the code inline, please wrap it with
18+
```yaml
19+
(here your code)
20+
```
21+
(for YAML code) or
22+
```json
23+
(here your code)
24+
```
25+
(for JSON code), so it becomes more readable. If it is longer than about ten lines,
26+
please create a Gist (https://gist.github.com) or upload it somewhere else and
27+
link it here.
28+
-->
29+
30+
##### Command line used for generation
31+
32+
<!-- including the language, libraries and various options -->
33+
34+
##### Steps to reproduce
35+
36+
<!-- unambiguous set of steps to reproduce the bug.-->
37+
38+
##### Related issues
39+
40+
<!-- has a similar issue been reported before? -->
41+
42+
##### Suggest a Fix
43+
44+
<!-- if you can't fix the bug yourself, perhaps you can point to what might be
45+
causing the problem (line of code or commit) -->
46+

.gitignore

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ samples/server-generator/scalatra/target
4141
samples/server-generator/scalatra/output/.history
4242

4343
# nodejs
44+
**/node_modules/
4445
samples/server-generator/node/output/node_modules
4546
samples/server/petstore/nodejs/node_modules
4647
samples/server/petstore/nodejs-server/node_modules
@@ -62,6 +63,12 @@ samples/client/petstore/java/jersey2/.gradle/
6263
samples/client/petstore/java/jersey2/build/
6364
samples/client/petstore/java/okhttp-gson/.gradle/
6465
samples/client/petstore/java/okhttp-gson/build/
66+
samples/client/petstore/java/feign/build/
67+
samples/client/petstore/java/retrofit/build/
68+
samples/client/petstore/java/retrofit2/build/
69+
samples/client/petstore/java/retrofit2rx/build/
70+
samples/client/petstore/java/default/build/
71+
samples/client/petstore/scala/build/
6572

6673
#PHP
6774
samples/client/petstore/php/SwaggerClient-php/composer.lock
@@ -88,6 +95,7 @@ samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddat
8895

8996
# C#
9097
*.csproj.user
98+
samples/client/petstore/csharp/SwaggerClient/IO.Swagger.userprefs
9199
samples/client/petstore/csharp/SwaggerClientTest/.vs
92100
samples/client/petstore/csharp/SwaggerClientTest/obj
93101
samples/client/petstore/csharp/SwaggerClientTest/bin
@@ -104,6 +112,7 @@ samples/client/petstore/csharp/SwaggerClient/bin
104112
samples/client/petstore/csharp/SwaggerClient/obj/Debug/
105113
samples/client/petstore/csharp/SwaggerClient/bin/Debug/
106114
samples/client/petstore/csharp/SwaggerClient/packages
115+
samples/client/petstore/csharp/SwaggerClient/TestResult.xml
107116

108117
# Python
109118
*.pyc
@@ -116,13 +125,8 @@ samples/client/petstore/python/.venv/
116125

117126
# ts
118127
samples/client/petstore/typescript-node/npm/node_modules
119-
samples/client/petstore/typescript-fetch/with-package-metadata/node_modules
120-
samples/client/petstore/typescript-fetch/with-package-metadata/dist
121-
samples/client/petstore/typescript-fetch/with-package-metadata/typings
122-
samples/client/petstore/typescript-fetch/default/node_modules
123-
samples/client/petstore/typescript-fetch/default/dist
124-
samples/client/petstore/typescript-fetch/default/typings
125-
samples/client/petstore/typescript-fetch/default-es6/node_modules
126-
samples/client/petstore/typescript-fetch/default-es6/dist
127-
samples/client/petstore/typescript-fetch/default-es6/typings
128+
samples/client/petstore/typescript-node/**/typings
129+
samples/client/petstore/typescript-angular/**/typings
130+
samples/client/petstore/typescript-fetch/**/dist/
131+
samples/client/petstore/typescript-fetch/**/typings
128132

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ services:
1010
before_install:
1111
# required when sudo: required for the Ruby petstore tests
1212
- gem install bundler
13+
- npm install -g typescript
14+
- sudo pip install virtualenv
1315

1416
install:
1517

CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
## Before submitting an issue
44

5+
- If you're not using the latest master to generate API clients or server stubs, please give it another try by pulling the latest master as the issue may have already been addressed. Ref: [Getting Started](https://github.com/swagger-api/swagger-codegen#getting-started)
56
- Search the [open issue](https://github.com/swagger-api/swagger-codegen/issues) and [closed issue](https://github.com/swagger-api/swagger-codegen/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
6-
- The issue should contain details on how to repeat the issue, e.g.
7-
- the OpenAPI Spec for reproducing the issue (:bulb: use [Gist](https://gist.github.com) to share). If the OpenAPI Spec cannot be shared publicly, it will be hard for the community to help
8-
- version of Swagger Codegen
9-
- language (`-l` in the command line, e.g. java, csharp, php)
10-
- You can also make a suggestion or ask a question by opening an "issue"
7+
- File an [issue ticket](https://github.com/swagger-api/swagger-codegen/issues/new) by providing all the required information.
8+
- You can also make a suggestion or ask a question by opening an "issue".
119

1210
## Before submitting a PR
1311

@@ -42,11 +40,14 @@ Code change should conform to the programming style guide of the respective lang
4240
- Swift: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html
4341
- TypeScript: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines
4442

45-
4643
For other languages, feel free to suggest.
4744

4845
You may find the current code base not 100% conform to the coding style and we welcome contributions to fix those.
4946

47+
For [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#vendorExtensions), please follow the naming convention below:
48+
- For general vendor extension, use lower case and hyphen. e.g. `x-is-unique`, `x-content-type`
49+
- For language-specified vendor extension, put it in the form of `x-{lang}-{extension-name}`. e.g. `x-objc-operation-id`, `x-java-feign-retry-limit`
50+
5051
### Testing
5152

5253
To add test cases (optional) covering the change in the code generator, please refer to [modules/swagger-codegen/src/test/java/io/swagger/codegen](https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/test/java/io/swagger/codegen)

README.md

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
6969

7070
Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
7171
-------------------------- | ------------ | -------------------------- | -----
72-
2.1.7-SNAPSHOT | | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
72+
2.2.0-SNAPSHOT | | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
7373
2.1.6 (**current stable**) | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.6)
7474
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
7575
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)
@@ -386,8 +386,66 @@ To control the specific files being generated, you can pass a CSV list of what y
386386
-Dmodels=User -DsupportingFiles=StringUtil.java
387387
```
388388

389+
To control generation of docs and tests for api and models, pass false to the option. For api, these options are `-DapiTest=false` and `-DapiDocs=false`. For models, `-DmodelTest=false` and `-DmodelDocs=false`.
390+
These options default to true and don't limit the generation of the feature options listed above (like `-Dapi`):
391+
392+
```
393+
# generate only models (with tests and documentation)
394+
java -Dmodels {opts}
395+
396+
# generate only models (with tests but no documentation)
397+
java -Dmodels -DmodelDocs=false {opts}
398+
399+
# generate only User and Pet models (no tests and no documentation)
400+
java -Dmodels=User,Pet -DmodelTests=false {opts}
401+
402+
# generate only apis (without tests)
403+
java -Dapis -DapiTests=false {opts}
404+
405+
# generate only apis (modelTests option is ignored)
406+
java -Dapis -DmodelTests=false {opts}
407+
```
408+
389409
When using selective generation, _only_ the templates needed for the specific generation will be used.
390410

411+
### Ignore file format
412+
413+
Swagger codegen supports a `.swagger-codegen-ignore` file, similar to `.gitignore` or `.dockerignore` you're probably already familiar with.
414+
415+
The ignore file allows for better control over overwriting existing files than the `--skip-overwrite` flag. With the ignore file, you can specify individual files or directories can be ignored. This can be useful, for example if you only want a subset of the generated code.
416+
417+
Examples:
418+
419+
```
420+
# Swagger Codegen Ignore
421+
# Lines beginning with a # are comments
422+
423+
# This should match build.sh located anywhere.
424+
build.sh
425+
426+
# Matches build.sh in the root
427+
/build.sh
428+
429+
# Exclude all recursively
430+
docs/**
431+
432+
# Explicitly allow files excluded by other rules
433+
!docs/UserApi.md
434+
435+
# Recursively exclude directories named Api
436+
# You can't negate files below this directory.
437+
src/**/Api/
438+
439+
# When this file is nested under /Api (excluded above),
440+
# this rule is ignored because parent directory is excluded by previous rule.
441+
!src/**/PetApiTests.cs
442+
443+
# Exclude a single, nested file explicitly
444+
src/IO.Swagger.Test/Model/AnimalFarmTests.cs
445+
```
446+
447+
The `.swagger-codegen-ignore` file must exist in the root of the output directory.
448+
391449
### Customizing the generator
392450

393451
There are different aspects of customizing the code generator beyond just creating or modifying templates. Each language has a supporting configuration file to handle different type mappings, etc:
@@ -608,7 +666,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
608666
```
609667
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
610668
-i http://petstore.swagger.io/v2/swagger.json \
611-
-l silex \
669+
-l silex-PHP \
612670
-o samples/server/petstore/silex
613671
```
614672

@@ -789,20 +847,25 @@ Here are some companies/projects using Swagger Codegen in production. To add you
789847
- [Activehours](https://www.activehours.com/)
790848
- [Acunetix](https://www.acunetix.com/)
791849
- [Atlassian](https://www.atlassian.com/)
850+
- [Avenida Compras S.A.](https://www.avenida.com.ar)
792851
- [beemo](http://www.beemo.eu)
793852
- [bitly](https://bitly.com)
794853
- [Cachet Financial](http://www.cachetfinancial.com/)
795854
- [CloudBoost](https://www.CloudBoost.io/)
796855
- [Cupix](http://www.cupix.com)
856+
- [DBBest Technologies](https://www.dbbest.com)
797857
- [DocuSign](https://www.docusign.com)
798858
- [Ergon](http://www.ergon.ch/)
799859
- [eureka](http://eure.jp/)
800860
- [everystory.us](http://everystory.us)
801861
- [Expected Behavior](http://www.expectedbehavior.com/)
802862
- [FH Münster - University of Applied Sciences](http://www.fh-muenster.de)
863+
- [GraphHopper](https://graphhopper.com/)
864+
- [IMS Health](http://www.imshealth.com/en/solution-areas/technology-and-applications)
803865
- [Interactive Intelligence](http://developer.mypurecloud.com/)
804866
- [LANDR Audio](https://www.landr.com/)
805867
- [LiveAgent](https://www.ladesk.com/)
868+
- [Kabuku](http://www.kabuku.co.jp/en)
806869
- [Kuary](https://kuary.com/)
807870
- [nViso](http://www.nviso.ch/)
808871
- [Okiok](https://www.okiok.com)
@@ -813,12 +876,15 @@ Here are some companies/projects using Swagger Codegen in production. To add you
813876
- [PostAffiliatePro](https://www.postaffiliatepro.com/)
814877
- [Reload! A/S](https://reload.dk/)
815878
- [REstore](https://www.restore.eu)
879+
- [Revault Sàrl](http://revault.ch)
816880
- [Royal Bank of Canada (RBC)](http://www.rbc.com/canada.html)
881+
- [SCOOP Software GmbH](http://www.scoop-software.de)
817882
- [SmartRecruiters](https://www.smartrecruiters.com/)
818883
- [StyleRecipe](http://stylerecipe.co.jp)
819884
- [Svenska Spel AB](https://www.svenskaspel.se/)
820885
- [ThoughtWorks](https://www.thoughtworks.com)
821886
- [uShip](https://www.uship.com/)
887+
- [WEXO A/S](https://www.wexo.dk/)
822888
- [Zalando](https://tech.zalando.com)
823889
- [ZEEF.com](https://zeef.com/)
824890

@@ -836,13 +902,13 @@ Swaagger Codegen core team members are contributors who have been making signfic
836902
| Dart | |
837903
| Groovy | |
838904
| Go | @guohuang (2016/05/01) @neilotoole (2016/05/01) |
839-
| Java | @cbornet (2016/05/01) @xhh (2016/05/01) |
905+
| Java | @cbornet (2016/05/01) @xhh (2016/05/01) @epaul (2016/06/04) |
840906
| NodeJS/Javascript | @xhh (2016/05/01) |
841907
| ObjC | @mateuszmackowiak (2016/05/09) |
842908
| Perl | @wing328 (2016/05/01) |
843909
| PHP | @arnested (2016/05/01) |
844910
| Python | @scottrw93 (2016/05/01) |
845-
| Ruby | @wing328 (2016/05/01) |
911+
| Ruby | @wing328 (2016/05/01) @zlx (2016/05/22) |
846912
| Scala | |
847913
| Swift | @jaz-ah (2016/05/01) @Edubits (2016/05/01) |
848914
| TypeScript (Node) | @Vrolijkx (2016/05/01) |
@@ -894,6 +960,7 @@ Here is a list of template creators:
894960
* JAX-RS CXF: @hiveship
895961
* PHP Lumen: @abcsum
896962
* PHP Slim: @jfastnacht
963+
* Ruby on Rails 5: @zlx
897964

898965
## How to join the core team
899966

bin/android-petstore-httpclient.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=`ls -ld "$SCRIPT"`
7+
link=`expr "$ls" : '.*-> \(.*\)$'`
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=`dirname "$SCRIPT"`/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=`dirname "$SCRIPT"`/..
17+
APP_DIR=`cd "${APP_DIR}"; pwd`
18+
fi
19+
20+
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29+
ags="$@ generate -t modules/swagger-codegen/src/main/resources/android -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient"
30+
31+
java $JAVA_OPTS -jar $executable $ags

bin/android-petstore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ fi
2626

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

3131
java $JAVA_OPTS -jar $executable $ags

bin/java-petstore-feign.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ fi
2626

2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29-
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign"
29+
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-feign.json -o samples/client/petstore/java/feign -DhideGenerationTimestamp=true"
3030

3131
java $JAVA_OPTS -jar $executable $ags

bin/java-petstore-jersey2.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ fi
2626

2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29-
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2"
29+
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 -DhideGenerationTimestamp=true"
3030

31+
echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main"
32+
rm -rf samples/client/petstore/java/jersey2/src/main
33+
find samples/client/petstore/java/jersey2 -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
3134
java $JAVA_OPTS -jar $executable $ags

bin/java-petstore-okhttp-gson.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ fi
2626

2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29-
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson"
29+
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson -DhideGenerationTimestamp=true"
3030

31+
rm -rf samples/client/petstore/java/okhttp-gson/src/main
32+
find samples/client/petstore/java/okhttp-gson -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
3133
java $JAVA_OPTS -jar $executable $ags

0 commit comments

Comments
 (0)