Skip to content

Commit 933b2aa

Browse files
authored
Merge pull request #1 from swagger-api/master
Update our fork
2 parents 6180b7b + 752ba61 commit 933b2aa

File tree

5,737 files changed

+423296
-103314
lines changed

Some content is hidden

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

5,737 files changed

+423296
-103314
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ samples/client/petstore/qt5cpp/build-*
3030
samples/client/petstore/qt5cpp/PetStore/PetStore
3131
samples/client/petstore/qt5cpp/PetStore/Makefile
3232
samples/client/petstore/java/hello.txt
33-
samples/client/petstore/android-java/hello.txt
33+
samples/client/petstore/android/default/hello.txt
3434
samples/client/petstore/objc/Build
3535
samples/client/petstore/objc/Pods
3636
samples/server/petstore/nodejs/node_modules

.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: 104 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,55 +13,130 @@ generated-sources/*
1313
generated-code/*
1414
*.swp
1515
*.swo
16-
*.csproj.user
16+
target
17+
.idea
18+
.lib
19+
atlassian-ide-plugin.xml
20+
.DS_Store
21+
packages/
22+
.pub
23+
.packages
24+
.vagrant/
25+
26+
.settings
27+
28+
*.mustache~
29+
*.java~
30+
*.pm~
31+
*.xml~
32+
*.t~
1733

1834
/target
1935
/generated-files
2036
/nbactions.xml
21-
*.pyc
22-
__pycache__
37+
38+
# scalatra
2339
samples/server-generator/scalatra/output
24-
samples/server-generator/node/output/node_modules
2540
samples/server-generator/scalatra/target
2641
samples/server-generator/scalatra/output/.history
42+
43+
# nodejs
44+
**/node_modules
45+
samples/server-generator/node/output/node_modules
46+
samples/server/petstore/nodejs/node_modules
47+
samples/server/petstore/nodejs-server/node_modules
48+
49+
# qt5 cpp
2750
samples/client/petstore/qt5cpp/PetStore/moc_*
2851
samples/client/petstore/qt5cpp/PetStore/*.o
29-
samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata
3052
samples/client/petstore/qt5cpp/build-*
3153
samples/client/petstore/qt5cpp/PetStore/PetStore
3254
samples/client/petstore/qt5cpp/PetStore/Makefile
55+
56+
#Java/Android
57+
**/.gradle
3358
samples/client/petstore/java/hello.txt
34-
samples/client/petstore/android-java/hello.txt
35-
samples/client/petstore/objc/SwaggerClientTests/Build
36-
samples/client/petstore/objc/SwaggerClientTests/Pods
37-
samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcworkspace
38-
samples/client/petstore/objc/SwaggerClientTests/Podfile.lock
39-
samples/server/petstore/nodejs/node_modules
40-
samples/client/petstore/csharp/SwaggerClientTest/.vs
41-
samples/client/petstore/csharp/SwaggerClientTest/obj
42-
samples/client/petstore/csharp/SwaggerClientTest/bin
43-
target
44-
.idea
45-
.lib
46-
atlassian-ide-plugin.xml
47-
.DS_Store
48-
packages/
49-
.pub
50-
.packages
59+
samples/client/petstore/java/okhttp-gson/hello.txt
60+
samples/client/petstore/java/jersey2-java8/hello.txt
61+
samples/client/petstore/android/default/hello.txt
62+
samples/client/petstore/android/volley/.gradle/
63+
samples/client/petstore/android/volley/build/
64+
samples/client/petstore/java/jersey2/.gradle/
65+
samples/client/petstore/java/jersey2/build/
66+
samples/client/petstore/java/okhttp-gson/.gradle/
67+
samples/client/petstore/java/okhttp-gson/build/
68+
samples/client/petstore/java/feign/build/
69+
samples/client/petstore/java/retrofit/build/
70+
samples/client/petstore/java/retrofit2/build/
71+
samples/client/petstore/java/retrofit2rx/build/
72+
samples/client/petstore/java/default/build/
73+
samples/client/petstore/scala/build/
5174

75+
#PHP
5276
samples/client/petstore/php/SwaggerClient-php/composer.lock
5377
samples/client/petstore/php/SwaggerClient-php/vendor/
54-
5578
samples/client/petstore/silex/SwaggerServer/composer.lock
5679
samples/client/petstore/silex/SwaggerServer/venodr/
80+
**/vendor/
81+
**/composer.lock
82+
83+
# Perl
84+
samples/client/petstore/perl/deep_module_test/
85+
86+
# Objc
87+
samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata
88+
samples/client/petstore/objc/default/SwaggerClientTests/Build
89+
samples/client/petstore/objc/default/SwaggerClientTests/Pods
90+
samples/client/petstore/objc/default/SwaggerClientTests/SwaggerClient.xcworkspace
91+
samples/client/petstore/objc/default/SwaggerClientTests/Podfile.lock
92+
93+
samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata
94+
samples/client/petstore/objc/core-data/SwaggerClientTests/Build
95+
samples/client/petstore/objc/core-data/SwaggerClientTests/Pods
96+
samples/client/petstore/objc/core-data/SwaggerClientTests/SwaggerClient.xcworkspace
97+
samples/client/petstore/objc/core-data/SwaggerClientTests/Podfile.lock
5798

99+
# Swift
100+
samples/client/petstore/swift/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata
101+
samples/client/petstore/swift/SwaggerClientTests/SwaggerClient.xcworkspace/xcuserdata
102+
samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/xcuserdata
103+
samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddata/xcschemes
104+
samples/client/petstore/swift/**/SwaggerClientTests/Podfile.lock
105+
106+
# C#
107+
*.csproj.user
108+
samples/client/petstore/csharp/SwaggerClient/IO.Swagger.userprefs
109+
samples/client/petstore/csharp/SwaggerClientTest/.vs
110+
samples/client/petstore/csharp/SwaggerClientTest/obj
111+
samples/client/petstore/csharp/SwaggerClientTest/bin
112+
samples/client/petstore/csharp/SwaggerClientTest/packages
113+
samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/
114+
samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/
115+
samples/client/petstore/csharp/SwaggerClientTest/TestResult.xml
116+
samples/client/petstore/csharp/SwaggerClientTest/nuget.exe
117+
samples/client/petstore/csharp/SwaggerClientTest/testrunner/
118+
samples/client/petstore/csharp/SwaggerClient/.vs
119+
samples/client/petstore/csharp/SwaggerClient/nuget.exe
120+
samples/client/petstore/csharp/SwaggerClient/obj
121+
samples/client/petstore/csharp/SwaggerClient/bin
122+
samples/client/petstore/csharp/SwaggerClient/obj/Debug/
123+
samples/client/petstore/csharp/SwaggerClient/bin/Debug/
124+
samples/client/petstore/csharp/SwaggerClient/packages
125+
samples/client/petstore/csharp/SwaggerClient/TestResult.xml
126+
127+
# Python
128+
*.pyc
129+
__pycache__
130+
samples/client/petstore/python/dev-requirements.txt.log
131+
samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt
132+
samples/client/petstore/python/.coverage
58133
samples/client/petstore/python/.projectile
59134
samples/client/petstore/python/.venv/
60135

61-
.settings
136+
# ts
137+
samples/client/petstore/typescript-node/npm/node_modules
138+
samples/client/petstore/typescript-node/**/typings
139+
samples/client/petstore/typescript-angular/**/typings
140+
samples/client/petstore/typescript-fetch/**/dist/
141+
samples/client/petstore/typescript-fetch/**/typings
62142

63-
*.mustache~
64-
*.java~
65-
*.pm~
66-
*.xml~
67-
*.t~

.travis.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
1-
sudo: false
1+
sudo: required
22
language: java
3-
script: mvn verify -Psamples
43
jdk:
54
- oraclejdk7
5+
- oraclejdk8
6+
7+
cache:
8+
directories:
9+
- $HOME/.m2
10+
11+
services:
12+
- docker
13+
14+
addons:
15+
hosts:
16+
- petstore.swagger.io
17+
18+
before_install:
19+
# required when sudo: required for the Ruby petstore tests
20+
- gem install bundler
21+
- npm install -g typescript
22+
- sudo pip install virtualenv
23+
# to run petstore server locally via docker
24+
- docker pull swaggerapi/petstore
25+
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
26+
- docker ps -a
27+
# show host table to confirm petstore.swagger.io is mapped to localhost
28+
- cat /etc/hosts
29+
30+
install:
31+
# Add Godeps dependencies to GOPATH and PATH
32+
- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.4 bash)"
33+
- export GOPATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace"
34+
- export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$PATH"
35+
36+
script:
37+
- mvn verify -Psamples
38+
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_IMAGE_NAME:latest $DOCKER_IMAGE_NAME:$TRAVIS_TAG; fi && docker push $DOCKER_IMAGE_NAME; fi
39+
40+
env:
41+
- DOCKER_IMAGE_NAME=swaggerapi/swagger-generator

CONTRIBUTING.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
## Before submitting an issue
44

5-
- Before submitting an issue, 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 Swagger spec for reproducing the issue (:bulb: use [Gist](https://gist.github.com) to share). If the Swagger 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"
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)
6+
- 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.
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

1412
- Search the [open issue](https://github.com/swagger-api/swagger-codegen/issues) to ensure no one else has reported something similar and no one is actively working on similar proposed change.
1513
- If no one has suggested something similar, open an ["issue"](https://github.com/swagger-api/swagger-codegen/issues) with your suggestion to gather feedback from the community.
14+
- It's recommended to **create a new git branch** for the change so that the merge commit message looks nicer in the commit history.
1615

1716
## How to contribute
1817

@@ -29,25 +28,38 @@ For a list of variables available in the template, please refer to this [page](h
2928

3029
### Style guide
3130
Code change should conform to the programming style guide of the respective langauages:
31+
- Android: https://source.android.com/source/code-style.html
3232
- C#: https://msdn.microsoft.com/en-us/library/vstudio/ff926074.aspx
33+
- C++: https://google.github.io/styleguide/cppguide.html
34+
- Haskell: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md
3335
- Java: https://google.github.io/styleguide/javaguide.html
36+
- JavaScript: https://github.com/airbnb/javascript/tree/master/es5
37+
- Groovy: http://groovy-lang.org/style-guide.html
38+
- Go: https://github.com/golang/go/wiki/CodeReviewComments
3439
- ObjC: https://github.com/NYTimes/objective-c-style-guide
40+
- Perl: http://perldoc.perl.org/perlstyle.html
3541
- PHP: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
3642
- Python: https://www.python.org/dev/peps/pep-0008/
3743
- Ruby: https://github.com/bbatsov/ruby-style-guide
44+
- Scala: http://docs.scala-lang.org/style/
45+
- Swift: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html
3846
- TypeScript: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines
3947

40-
4148
For other languages, feel free to suggest.
4249

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

52+
For [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#vendorExtensions), please follow the naming convention below:
53+
- For general vendor extension, use lower case and hyphen. e.g. `x-is-unique`, `x-content-type`
54+
- 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`
55+
- For a list of existing vendor extensions in use, please refer to https://github.com/swagger-api/swagger-codegen/wiki/Vendor-Extensions. If you've addaed new vendor extensions as part of your PR, please update the wiki page.
56+
4557
### Testing
4658

4759
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)
4860

4961
To test the templates, please perform the following:
50-
- Update the [Petstore](http://petstore.swagger.io/) sample by running the shell script under `bin` folder. For example, run `./bin/ruby-petstore.sh` to update the Ruby PetStore API client under [`samples/client/petstore/ruby`](https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/ruby) (For Windows, the batch files can be found under `bin\windows` folder)
62+
- Update the [Petstore](http://petstore.swagger.io/) sample by running the shell script under `bin` folder. For example, run `./bin/ruby-petstore.sh` to update the Ruby PetStore API client under [`samples/client/petstore/ruby`](https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/ruby) For Windows, the batch files can be found under `bin\windows` folder. (If you find that there are new files generated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI/Swagger spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
5163
- Run the tests in the sample folder, e.g. in `samples/client/petstore/ruby`, run `mvn integration-test -rf :RubyPetstoreClientTests`. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
5264
- Finally, git commit the updated samples files: `git commit -a`
5365
(`git add -A` if added files with new test cases)
@@ -56,7 +68,7 @@ To start the CI tests, you can run `mvn verify -Psamples` (assuming you've all t
5668

5769
### Tips
5870
- Smaller changes are easier to review
59-
- [Optional] For bug fixes, provide a Swagger spec to repeat the issue so that the reviewer can use it to confirm the fix
71+
- [Optional] For bug fixes, provide a OpenAPI Spec to repeat the issue so that the reviewer can use it to confirm the fix
6072
- Add test case(s) to cover the change
6173
- Document the fix in the code to make the code more readable
6274
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2015 SmartBear Software
1+
Copyright 2016 SmartBear Software
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)