Skip to content

Commit

Permalink
Merge branch 'master' into allow-empty-models
Browse files Browse the repository at this point in the history
* master: (121 commits)
  [PowerShell] better publishing workflow (#7114)
  [aspnetcore] Typo issues in docs and generated code (#7094)
  fix http signaure auth in build.sbt (#7110)
  fix for the issue facing spec invlolving arrayschema structure with ref (#6310)
  [csharp-netcore] added cancellation tokens to async calls (#7077)
  [PS] Allow CI to publish the module (#7091)
  [Dart] Treat float as double (#6924)
  [Java][jersey2]Fix gradle HttpSignatureAuth dependencies (#7096)
  move maven,gradle tests to shipppable ci (#7108)
  [MARKDOWN] Fix issue 6089 with property and parameter names (#6105)
  [BUG] Multi-Part content type in response ignores properties of composed schema (allOf/oneOf) (#6073)
  [online] Fix for version conflicts with springfox/boot (#7102)
  skip some installations to shorten build time
  [Go][Exp] better code format (#7088)
  Fix Shippable CI (#7097)
  typescript-node: clean up require and import (#6947)
  commented out perl, bash tests to reduce build time
  Add a link to conference paper (#7086)
  Add a link to the blog post at qiita (#7084)
  migrate typescript.sh to new config format (#7078)
  ...
  • Loading branch information
jimschubert committed Aug 3, 2020
2 parents d1a8df0 + 1be98b4 commit 5e6d94e
Show file tree
Hide file tree
Showing 2,533 changed files with 42,679 additions and 22,493 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) beforehand.
- [ ] Run the shell script `./bin/generate-samples.sh`to update all Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/config/java*`. For Windows users, please run the script in [Git BASH](https://gitforwindows.org/).
- [ ] Run the shell script `./bin/generate-samples.sh`to update all Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/configs/java*`. For Windows users, please run the script in [Git BASH](https://gitforwindows.org/).
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`
- [ ] Copy the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
15 changes: 14 additions & 1 deletion .github/workflows/docker-tag-latest-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,20 @@ jobs:
- name: DockerHub Login
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

# Tags openapitools/openapi-generator-online, which is an automated build
# Tags openapitools/openapi-generator-cli
- name: "Tag openapi-generator-cli:x"
id: tag-openapi-generator-cli
if: always()
run: |
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}'
docker pull openapitools/openapi-generator-cli:${{steps.tagger.outputs.tag}}
docker tag openapitools/openapi-generator-cli:${{steps.tagger.outputs.tag}} openapitools/openapi-generator-cli:latest-release
docker push openapitools/openapi-generator-cli:latest-release
# Tags openapitools/openapi-generator-online
- name: "Tag openapi-generator-online:x"
id: tag-openapi-generator-online
if: always()
run: |
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}'
docker pull openapitools/openapi-generator-online:${{steps.tagger.outputs.tag}}
Expand All @@ -40,6 +51,7 @@ jobs:
# Tags openapitools/openapi-generator's CLI image (this repo holds CLI + Online via tag prefix)
- name: "Tag openapi-generator:cli-x"
id: tag-cli
if: always()
run: |
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}'
docker pull openapitools/openapi-generator:cli-${{steps.tagger.outputs.tag}}
Expand All @@ -49,6 +61,7 @@ jobs:
# Tags openapitools/openapi-generator's ONLINE image (this repo holds CLI + Online via tag prefix)
- name: "Tag openapi-generator:online-x"
id: tag-online
if: always()
run: |
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}'
docker pull openapitools/openapi-generator:online-${{steps.tagger.outputs.tag}}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ samples/client/petstore/python-tornado/.venv/
samples/client/petstore/typescript-angular2/npm/npm-debug.log
samples/client/petstore/typescript-node/npm/npm-debug.log
samples/client/petstore/typescript-angular/tsd-debug.log
samples/client/petstore/typescript-axios/tests/**/dist/
samples/client/petstore/typescript-fetch/tests/**/dist/

# aspnetcore
Expand Down Expand Up @@ -230,7 +231,8 @@ samples/client/petstore/dart/petstore/test/packages
**/.dart_tool

# JS
samples/client/petstore/javascript/package-lock.json
samples/client/petstore/javascript-es6/package-lock.json
samples/client/petstore/javascript-promise-es6/package-lock.json

# elm
samples/client/petstore/elm/index.html
Expand Down
23 changes: 8 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ before_install:
- docker pull swaggerapi/petstore
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a
# -- skip bash test to shorten build time
# Add bats test framework and cURL for Bash script integration tests
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
- sudo apt-get install -qq curl
#- sudo add-apt-repository ppa:duggan/bats --yes
#- sudo apt-get update -qq
#- sudo apt-get install -qq bats
#- sudo apt-get install -qq curl
# -- skip bash test end
# install dart
#- sudo apt-get update
#- sudo apt-get install apt-transport-https
Expand All @@ -93,9 +95,6 @@ before_install:
- phpenv versions
- phpenv global 7.2.15
- php -v
# install perl module
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
#- cpanm Test::Exception Test::More Log::Any LWP::UserAgent JSON URI:Query Module::Runtime DateTime Module::Find Moose::Role
# comment out below as installation failed in travis
# Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests.
# - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490).
Expand All @@ -107,9 +106,11 @@ before_install:
# install Qt5
- sudo apt install -y --no-install-recommends qt5-default
- cmake --version
# -- skip perl test to shorten build time
# perl dep
- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Igorned failure from cpanm"
# -- skip perl test end
# show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts
# show java version
Expand Down Expand Up @@ -149,14 +150,6 @@ script:
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
- mvn --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# test maven plugin
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
# test gradle plugin
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
after_success:
# push to maven repo
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
Expand Down
25 changes: 14 additions & 11 deletions CI/circle_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@ trap cleanup EXIT
if [ "$NODE_INDEX" = "1" ]; then
echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..."
java -version
# Install golang version 1.14
go version
sudo mkdir /usr/local/go1.14
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
export PATH="/usr/local/go1.14/go/bin:$PATH"
go version

mvn --no-snapshot-updates --quiet verify -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error

echo "show ivy2 cache"
ls -l /home/circleci/.ivy2/cache

elif [ "$NODE_INDEX" = "2" ]; then
# run ensure-up-to-date sample script on SNAPSHOT version only
Expand All @@ -40,7 +36,6 @@ elif [ "$NODE_INDEX" = "2" ]; then
# look for outdated samples
./bin/utils/ensure-up-to-date
fi
#elif [ "$NODE_INDEX" = "3" ]; then
echo "Running node $NODE_INDEX to test haskell"
# install haskell
curl -sSL https://get.haskellstack.org/ | sh
Expand All @@ -60,10 +55,17 @@ elif [ "$NODE_INDEX" = "2" ]; then
# run integration tests
mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
else
echo "Running node $NODE_INDEX to test 'samples.circleci.jdk7' defined in pom.xml ..."
sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
echo "Running node $NODE_INDEX to test 'samples.circleci.others' defined in pom.xml ..."
#sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
java -version

# Install golang version 1.14
go version
sudo mkdir /usr/local/go1.14
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
export PATH="/usr/local/go1.14/go/bin:$PATH"
go version

# install dart2
sudo apt-get update
sudo apt-get install apt-transport-https
Expand All @@ -73,7 +75,8 @@ else
sudo apt-get install dart
export PATH="$PATH:/usr/lib/dart/bin"

mvn --no-snapshot-updates --quiet verify -Psamples.circleci.jdk7 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
fi


15 changes: 10 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,16 @@ For [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master
To add test cases (optional) covering the change in the code generator, please refer to [modules/openapi-generator/src/test/java/org/openapitools/codegen](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/test/java/org/openapitools/codegen)

To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under `bin` and `bin/openapi3` folder. For example, run `./bin/python-petstore.sh` and `./bin/openapi3/python-petstore.sh` to update the Python PetStore API client under [`samples/client/petstore/python`](https://github.com/openapitools/openapi-generator/tree/master/samples/client/petstore/python) and [`samples/openapi3/client/petstore/python`](https://github.com/openapitools/openapi-generator/tree/master/samples/openapi3/client/petstore/python). 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 spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `./bin/python-petstore.sh -t modules/openapi-generator/src/main/resources/python`.
- Run the tests in the sample folder using maven `mvn integration-test -rf :<artifactId>`, e.g. open a shell in `samples/client/petstore/python`, run `mvn integration-test -rf :PythonPetstoreClientTests`. The artifactId of the project can be found in the pom.xml file. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)

- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh .
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/tree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
enerated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec fro
m time to time. If you've questions or concerns, please open a ticket to start a discussion)
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.
- Run the tests in the sample folder using maven `mvn integration-test -f /path/to/pom.xml`, e.g. `mvn integration-test -f samples/client/petstore/python/pom.xml`. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
- Finally, git commit the updated samples files: `git commit -a`
(`git add -A` if added files with new test cases)
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml)
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml)

To start the CI tests, you can:
- Run `mvn verify -Psamples`, assuming you have all the required tools installed to run tests for different languages.
Expand All @@ -105,7 +109,8 @@ See [OpenAPI Tools wiki](https://github.com/OpenAPITools/openapi-generator/wiki/
- Add test case(s) to cover the change
- Document the fix in the code to make the code more readable
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)
- File a PR with meaningful title, description and commit messages.
- File a PR with meaningful title, description and commit messages
- Make sure the option "Allow edits from maintainers" in the PR is selected so that the maintainers can update your PRs with minor fixes, if needed.
- Recommended git settings
- `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around
- To close an issue (e.g. issue 1542) automatically after a PR is merged, use keywords "fix", "close", "resolve" in the PR description, e.g. `fix #1542`. (Ref: [closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
Loading

0 comments on commit 5e6d94e

Please sign in to comment.