Compare commits

..

1 Commits

Author SHA1 Message Date
William Cheng
bea6af7f37 fix enum type comparison for string 2020-07-09 11:23:05 +08:00
5664 changed files with 130064 additions and 70090 deletions

View File

@@ -45,13 +45,9 @@ please create a Gist (https://gist.github.com) or upload it somewhere else and
link it here. link it here.
--> -->
##### Generation Details ##### Command line used for generation
<!-- <!-- including the language, libraries and various options -->
Prefer CLI steps, including the language, libraries and various options.
Providing config-based settings allows for simpler testing across CLI and plugins.
For examples, see https://github.com/OpenAPITools/openapi-generator/tree/master/bin/configs
-->
##### Steps to reproduce ##### Steps to reproduce

View File

@@ -4,8 +4,7 @@
### PR checklist ### PR checklist
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md). - [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
- [ ] Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
- [ ] 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. - [ ] 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/configs/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/config/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` - [ ] 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. - [ ] 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.

View File

@@ -1,87 +0,0 @@
name: Check Supported Java Versions
on:
push:
branches:
- master
jobs:
build:
name: Build on JDK ${{ matrix.java }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [8, 11]
os: [ubuntu-latest]
include:
- java: 8
os: windows-latest
- java: 13
os: ubuntu-latest
# Need to update to Gradle version with v13 support in modules/openapi-generator-gradle-plugin/pom.xml
flags: -am -pl modules/openapi-generator-cli
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('modules/openapi-generator-gradle-plugin/pom.xml') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Maven
shell: bash
run: mvn -nsu -B --quiet -Djacoco.skip=true -Dorg.slf4j.simpleLogger.defaultLogLevel=error --no-transfer-progress clean install --file pom.xml ${{ matrix.flags }}
- name: Test gradle
shell: bash
run: gradle -b modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle buildGoSdk --stacktrace
- name: Upload Maven build artifact
uses: actions/upload-artifact@v1
if: matrix.java == '8' && matrix.os == 'ubuntu-latest'
with:
name: artifact
path: modules/openapi-generator-cli/target/openapi-generator-cli.jar
verify:
name: Verifies integrity of the commit on ${{ matrix.os }}
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# include:
# - os: windows-latest
# flags: --skip-docs
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Download build artifact
uses: actions/download-artifact@v1
with:
name: artifact
- name: Run Ensures Script
shell: bash
run: |
git config --global core.fileMode false
git config --global core.safecrlf false
git config --global core.autocrlf true
mkdir -p modules/openapi-generator-cli/target/
mv artifact/openapi-generator-cli.jar modules/openapi-generator-cli/target/
./bin/utils/ensure-up-to-date ${{ matrix.flags }}

11
.gitignore vendored
View File

@@ -173,21 +173,10 @@ samples/client/petstore/python-asyncio/.venv/
samples/client/petstore/python-asyncio/.pytest_cache/ samples/client/petstore/python-asyncio/.pytest_cache/
samples/client/petstore/python-tornado/.venv/ samples/client/petstore/python-tornado/.venv/
# PHP
samples/client/petstore/php/OpenAPIClient-php/composer.lock
samples/openapi3/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
samples/openapi3/server/petstore/php-ze-ph/composer.lock
samples/server/petstore/php-laravel/lib/composer.lock
samples/server/petstore/php-lumen/lib/composer.lock
samples/server/petstore/php-slim4/composer.lock
samples/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
samples/server/petstore/php-ze-ph/composer.lock
# ts # ts
samples/client/petstore/typescript-angular2/npm/npm-debug.log samples/client/petstore/typescript-angular2/npm/npm-debug.log
samples/client/petstore/typescript-node/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-angular/tsd-debug.log
samples/client/petstore/typescript-axios/tests/**/dist/
samples/client/petstore/typescript-fetch/tests/**/dist/ samples/client/petstore/typescript-fetch/tests/**/dist/
# aspnetcore # aspnetcore

View File

@@ -3,7 +3,10 @@
## ##
## You can build _just_ this part with: ## You can build _just_ this part with:
## docker --target builder -t container-name:builder -f .hub.cli.dockerfile . ## docker --target builder -t container-name:builder -f .hub.cli.dockerfile .
FROM maven:3.6.3-jdk-11-openj9 as builder FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder
RUN set -x && \
apk add --no-cache bash
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR} WORKDIR ${GEN_DIR}
@@ -15,10 +18,11 @@ RUN mvn -am -pl "modules/openapi-generator-cli" package
## The final (release) image ## The final (release) image
## The resulting container here only needs the target jar ## The resulting container here only needs the target jar
## and ca-certificates (to be able to query HTTPS hosted specs) ## and ca-certificates (to be able to query HTTPS hosted specs)
FROM openjdk:11.0.8-jre-slim-buster FROM openjdk:8-jre-alpine
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
RUN apk --no-cache add ca-certificates bash
RUN mkdir -p ${GEN_DIR}/modules/openapi-generator-cli/target RUN mkdir -p ${GEN_DIR}/modules/openapi-generator-cli/target
WORKDIR ${GEN_DIR}/modules/openapi-generator-cli/target WORKDIR ${GEN_DIR}/modules/openapi-generator-cli/target

View File

@@ -3,7 +3,10 @@
## ##
## You can build _just_ this part with: ## You can build _just_ this part with:
## docker --target builder -t container-name:builder -f .hub.online.dockerfile . ## docker --target builder -t container-name:builder -f .hub.online.dockerfile .
FROM maven:3.6.3-jdk-11-openj9 as builder FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder
RUN set -x && \
apk add --no-cache bash
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR} WORKDIR ${GEN_DIR}
@@ -14,7 +17,7 @@ RUN mvn -am -pl "modules/openapi-generator-online" package
## The final (release) image ## The final (release) image
## The resulting container here only needs the target jar ## The resulting container here only needs the target jar
FROM openjdk:11.0.8-jre-slim-buster FROM openjdk:8-jre-alpine
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
ENV TARGET_DIR /generator ENV TARGET_DIR /generator

View File

@@ -77,13 +77,11 @@ before_install:
- docker pull swaggerapi/petstore - 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 run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a - docker ps -a
# -- skip bash test to shorten build time
# Add bats test framework and cURL for Bash script integration tests # Add bats test framework and cURL for Bash script integration tests
#- sudo add-apt-repository ppa:duggan/bats --yes - sudo add-apt-repository ppa:duggan/bats --yes
#- sudo apt-get update -qq - sudo apt-get update -qq
#- sudo apt-get install -qq bats - sudo apt-get install -qq bats
#- sudo apt-get install -qq curl - sudo apt-get install -qq curl
# -- skip bash test end
# install dart # install dart
#- sudo apt-get update #- sudo apt-get update
#- sudo apt-get install apt-transport-https #- sudo apt-get install apt-transport-https
@@ -95,6 +93,9 @@ before_install:
- phpenv versions - phpenv versions
- phpenv global 7.2.15 - phpenv global 7.2.15
- php -v - 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 # comment out below as installation failed in travis
# Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests. # 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). # - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490).
@@ -106,11 +107,9 @@ before_install:
# install Qt5 # install Qt5
- sudo apt install -y --no-install-recommends qt5-default - sudo apt install -y --no-install-recommends qt5-default
- cmake --version - cmake --version
# -- skip perl test to shorten build time
# perl dep # perl dep
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) - 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" - 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 # show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts - cat /etc/hosts
# show java version # show java version
@@ -150,6 +149,14 @@ script:
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet. # 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 clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
- mvn --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -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: after_success:
# push to maven repo # push to maven repo
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then - if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then

View File

@@ -17,11 +17,15 @@ trap cleanup EXIT
if [ "$NODE_INDEX" = "1" ]; then if [ "$NODE_INDEX" = "1" ]; then
echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..." echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..."
java -version 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 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 elif [ "$NODE_INDEX" = "2" ]; then
# run ensure-up-to-date sample script on SNAPSHOT version only # run ensure-up-to-date sample script on SNAPSHOT version only
@@ -36,6 +40,7 @@ elif [ "$NODE_INDEX" = "2" ]; then
# look for outdated samples # look for outdated samples
./bin/utils/ensure-up-to-date ./bin/utils/ensure-up-to-date
fi fi
#elif [ "$NODE_INDEX" = "3" ]; then
echo "Running node $NODE_INDEX to test haskell" echo "Running node $NODE_INDEX to test haskell"
# install haskell # install haskell
curl -sSL https://get.haskellstack.org/ | sh curl -sSL https://get.haskellstack.org/ | sh
@@ -55,17 +60,10 @@ elif [ "$NODE_INDEX" = "2" ]; then
# run integration tests # run integration tests
mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
else else
echo "Running node $NODE_INDEX to test 'samples.circleci.others' defined in pom.xml ..." 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 sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
java -version 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 # install dart2
sudo apt-get update sudo apt-get update
sudo apt-get install apt-transport-https sudo apt-get install apt-transport-https
@@ -75,8 +73,7 @@ else
sudo apt-get install dart sudo apt-get install dart
export PATH="$PATH:/usr/lib/dart/bin" export PATH="$PATH:/usr/lib/dart/bin"
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error mvn --no-snapshot-updates --quiet verify -Psamples.circleci.jdk7 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
fi fi

View File

@@ -4,7 +4,7 @@
- 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/openapitools/openapi-generator#getting-started) - 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/openapitools/openapi-generator#getting-started)
- Search the [open issue](https://github.com/openapitools/openapi-generator/issues) and [closed issue](https://github.com/openapitools/openapi-generator/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before. - Search the [open issue](https://github.com/openapitools/openapi-generator/issues) and [closed issue](https://github.com/openapitools/openapi-generator/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
- File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information. Failure to provide enough detail may result in slow response from the community. - File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information.
- Test with the latest master by building the JAR locally to see if the issue has already been addressed. - Test with the latest master by building the JAR locally to see if the issue has already been addressed.
- You can also make a suggestion or ask a question by opening an "issue". - You can also make a suggestion or ask a question by opening an "issue".
@@ -87,7 +87,8 @@ To add test cases (optional) covering the change in the code generator, please r
To test the templates, please perform the following: To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh . - 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 /bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/t
ree/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 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) 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`. - 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`.
@@ -109,8 +110,7 @@ See [OpenAPI Tools wiki](https://github.com/OpenAPITools/openapi-generator/wiki/
- Add test case(s) to cover the change - Add test case(s) to cover the change
- Document the fix in the code to make the code more readable - 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) - 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 - Recommended git settings
- `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around - `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/)) - 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/))

View File

@@ -1,4 +1,7 @@
FROM maven:3.6.3-jdk-11-openj9 FROM jimschubert/8-jdk-alpine-mvn:1.0
RUN set -x && \
apk add --no-cache bash
ENV GEN_DIR /opt/openapi-generator ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR} WORKDIR ${GEN_DIR}
@@ -26,6 +29,6 @@ RUN mvn -am -pl "modules/openapi-generator-cli" package
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["help"] CMD ["help"]

View File

@@ -1,22 +1,21 @@
<h1 align="center">OpenAPI Generator</h1> <h1 align="center">OpenAPI Generator</h1>
<div align="center"> <div align="center">
[![Stable releaases in Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22) [![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-orange)](./LICENSE) ![Open Collective backers](https://img.shields.io/opencollective/backers/openapi_generator?color=orange&label=OpenCollective%20Backers) [![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM) [![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator) [Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.0.0`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/master)](https://cloud.drone.io/OpenAPITools/openapi-generator)
[![iOS Build Status](https://app.bitrise.io/app/4a2b10a819d12b67/status.svg?token=859FMDR8QHwabCzwvZK6vQ&branch=master)](https://app.bitrise.io/app/4a2b10a819d12b67)
</div> </div>
<div align="center"> <div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.0.0`): [![Jion the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM)
[![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) [![Stable releaases in the Maven store](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) [![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
[![JDK11 Build](https://cloud.drone.io/api/badges/OpenAPITools/openapi-generator/status.svg?ref=refs/heads/master)](https://cloud.drone.io/OpenAPITools/openapi-generator)
[![Bitrise](https://img.shields.io/bitrise/4a2b10a819d12b67/master?label=bitrise%3A%20Swift+4,5&token=859FMDR8QHwabCzwvZK6vQ)](https://app.bitrise.io/app/4a2b10a819d12b67)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/openapitools/openapi-generator/Check%20Supported%20Java%20Versions/master?label=Check%20Supported%20Java%20Versions&logo=github&logoColor=green)](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
</div> </div>
@@ -579,7 +578,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Camptocamp](https://www.camptocamp.com/en) - [Camptocamp](https://www.camptocamp.com/en)
- [Cisco](https://www.cisco.com/) - [Cisco](https://www.cisco.com/)
- [codecentric AG](https://www.codecentric.de/) - [codecentric AG](https://www.codecentric.de/)
- [CoinAPI](https://www.coinapi.io/)
- [Commencis](https://www.commencis.com/) - [Commencis](https://www.commencis.com/)
- [Crossover Health](https://crossoverhealth.com/) - [Crossover Health](https://crossoverhealth.com/)
- [Cupix](https://www.cupix.com/) - [Cupix](https://www.cupix.com/)
@@ -616,8 +614,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [MoonVision](https://www.moonvision.io/) - [MoonVision](https://www.moonvision.io/)
- [Myworkout](https://myworkout.com) - [Myworkout](https://myworkout.com)
- [NamSor](https://www.namsor.com/) - [NamSor](https://www.namsor.com/)
- [Nokia](https://www.nokia.com/)
- [Options Clearing Corporation (OCC)](https://www.theocc.com/)
- [Openet](https://www.openet.com/) - [Openet](https://www.openet.com/)
- [openVALIDATION](https://openvalidation.io/) - [openVALIDATION](https://openvalidation.io/)
- [Oracle](https://www.oracle.com/) - [Oracle](https://www.oracle.com/)
@@ -627,7 +623,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager) - [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager)
- [QEDIT](https://qed-it.com) - [QEDIT](https://qed-it.com)
- [Qulix Systems](https://www.qulix.com) - [Qulix Systems](https://www.qulix.com)
- [Raksul](https://corp.raksul.com)
- [Raiffeisen Schweiz Genossenschaft](https://www.raiffeisen.ch) - [Raiffeisen Schweiz Genossenschaft](https://www.raiffeisen.ch)
- [RedHat](https://www.redhat.com) - [RedHat](https://www.redhat.com)
- [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development) - [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development)
@@ -642,7 +637,6 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [TUI InfoTec GmbH](http://www.tui-infotec.com/) - [TUI InfoTec GmbH](http://www.tui-infotec.com/)
- [unblu inc.](https://www.unblu.com/) - [unblu inc.](https://www.unblu.com/)
- [Veamly](https://www.veamly.com/) - [Veamly](https://www.veamly.com/)
- [wbt-solutions](https://www.wbt-solutions.de/)
- [Woleet](https://www.woleet.io/) - [Woleet](https://www.woleet.io/)
- [WSO2](https://wso2.com/) - [WSO2](https://wso2.com/)
- [Vouchery.io](https://vouchery.io) - [Vouchery.io](https://vouchery.io)
@@ -762,16 +756,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- 2020-05-19 - [Dead Simple APIs with Open API](https://www.youtube.com/watch?v=sIaXmR6xRAw) by [Chris Tankersley](https://github.com/dragonmantank) at [Nexmo](https://developer.nexmo.com/) - 2020-05-19 - [Dead Simple APIs with Open API](https://www.youtube.com/watch?v=sIaXmR6xRAw) by [Chris Tankersley](https://github.com/dragonmantank) at [Nexmo](https://developer.nexmo.com/)
- 2020-05-22 - [TypeScript REST API Client](https://dev.to/unhurried/typescript-rest-api-client-4in3) by ["unhurried"](https://dev.to/unhurried) - 2020-05-22 - [TypeScript REST API Client](https://dev.to/unhurried/typescript-rest-api-client-4in3) by ["unhurried"](https://dev.to/unhurried)
- 2020-05-28 - [【使用 lotify + Swagger 建置可共用的 LINE Notify bot】 - #NiJia @ Chatbot Developer Taiwan 第 #19 小聚](https://www.youtube.com/watch?v=agYVz6dzh1I) by [Chatbot Developer Taiwan](https://www.youtube.com/channel/UCxeYUyZNnHmpX23YNF-ewvw) - 2020-05-28 - [【使用 lotify + Swagger 建置可共用的 LINE Notify bot】 - #NiJia @ Chatbot Developer Taiwan 第 #19 小聚](https://www.youtube.com/watch?v=agYVz6dzh1I) by [Chatbot Developer Taiwan](https://www.youtube.com/channel/UCxeYUyZNnHmpX23YNF-ewvw)
- 2020-05-28 - [Building APIs with Laravel using OpenAPI](https://www.youtube.com/watch?v=xexLvQqAhiA) by [Chris Tankersley](https://github.com/dragonmantank) at [Laracon EU](https://laracon.eu/)
- 2020-06-23 - [新規サーバーアプリケーションにTypeScriptを採用してみた](https://www.cam-inc.co.jp/news/20200623) at [CAM Tech Blog](https://www.cam-inc.co.jp/news/tech-blog/) - 2020-06-23 - [新規サーバーアプリケーションにTypeScriptを採用してみた](https://www.cam-inc.co.jp/news/20200623) at [CAM Tech Blog](https://www.cam-inc.co.jp/news/tech-blog/)
- 2020-06-29 - [Artifact Abstract: Deployment of APIs on Android Mobile Devices and Microcontrollers](https://ieeexplore.ieee.org/document/9127353) by [Sergio Laso ; Marino Linaje ; Jose Garcia-Alonso ; Juan M. Murillo ; Javier Berrocal](https://ieeexplore.ieee.org/document/9127353/authors#authors) at [2020 IEEE International Conference on Pervasive Computing and Communications (PerCom)](https://ieeexplore.ieee.org/xpl/conhome/9125449/proceeding)
- 2020-07-07 - [5 Best API Documentation Tools](https://blog.dreamfactory.com/5-best-api-documentation-tools/) by Susanna Bouse at [DreamFactory Blog](https://blog.dreamfactory.com/)
- 2020-07-12 - [Open API 3.0の定義からgolangのサーバコードのスケルトンを作成する](https://qiita.com/professor/items/4cbd04ec084d13057bc2) by [@professor (Qiita Blog)](https://qiita.com/professor)
- 2020-07-20 - [Datadog API client libraries now available for Java and Go](https://www.datadoghq.com/blog/java-go-libraries/) by Jordan Obey at [Datadog Blog](https://www.datadoghq.com/blog)
- 2020-07-23 - [Generate Client SDK for .NET Core using Open Api](https://dev.to/no0law1/generate-client-sdk-for-net-core-using-open-api-2dgh) by [Nuno Reis](https://dev.to/no0law1)
- 2020-07-26 - [Dartのhttp_interceptorライブラリを使うと配列のクエリパラメータが消えてしまう件の応急処置](https://qiita.com/gyamoto/items/eeeff81b6770487319ed) by [@gyamoto](https://qiita.com/gyamoto)
- 2020-08-03 - [Criando Bibliotecas para APIs RESTful com OpenAPI, Swagger Editor e OpenAPI Generator](https://medium.com/@everisBrasil/criando-bibliotecas-para-apis-restful-com-openapi-swagger-editor-e-openapi-generator-75349a6420fd) by [everis Brasil (an NTT DATA Company)](https://medium.com/@everisBrasil)
- 2020-08-19 - [マイクロサービスを連携してみよう](https://thinkit.co.jp/article/17704) by [岡井 裕矢(おかい ゆうや)](https://thinkit.co.jp/author/17588), [泉 勝(いずみ まさる)](https://thinkit.co.jp/author/17705) at [Think ITシンクイット](https://thinkit.co.jp/)
## [6 - About Us](#table-of-contents) ## [6 - About Us](#table-of-contents)

View File

@@ -1,5 +1,5 @@
version: '{branch}-{build}' version: '{branch}-{build}'
image: Visual Studio 2019 image: Visual Studio 2017
hosts: hosts:
petstore.swagger.io: 127.0.0.1 petstore.swagger.io: 127.0.0.1
install: install:
@@ -15,14 +15,14 @@ install:
# install gradle # install gradle
- ps: | - ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\gradle\gradle-5.6.4" )) { if (!(Test-Path -Path "C:\gradle" )) {
(new-object System.Net.WebClient).DownloadFile( (new-object System.Net.WebClient).DownloadFile(
'https://services.gradle.org/distributions/gradle-5.6.4-bin.zip', 'https://services.gradle.org/distributions/gradle-5.3.1-bin.zip',
'C:\gradle-bin.zip' 'C:\gradle-bin.zip'
) )
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\gradle-bin.zip", "C:\gradle") [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\gradle-bin.zip", "C:\gradle")
} }
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH% - cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.3.1\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET MAVEN_OPTS=-Xmx4g - cmd: SET MAVEN_OPTS=-Xmx4g
- cmd: SET JAVA_OPTS=-Xmx4g - cmd: SET JAVA_OPTS=-Xmx4g
- cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5 - cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5
@@ -53,8 +53,8 @@ build_script:
- gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace - gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace
test_script: test_script:
# test c# API client (netcore) # test c# API client (netcore)
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
# test c# API client # test c# API client
- nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor - nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
# test c# API client (with PropertyChanged) # test c# API client (with PropertyChanged)

View File

@@ -1,5 +1,5 @@
generatorName: csharp generatorName: csharp
outputDir: samples/client/petstore/csharp/OpenAPIClient outputDir: samples/client/petstore/csharp/OpenAPIClient
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
additionalProperties: additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,6 +1,6 @@
generatorName: csharp-netcore generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties: additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -1,6 +1,6 @@
generatorName: csharp-netcore generatorName: csharp-netcore
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClientCore outputDir: samples/client/petstore/csharp-netcore/OpenAPIClientCore
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
additionalProperties: additionalProperties:
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'

View File

@@ -5,4 +5,3 @@ templateDir: modules/openapi-generator/src/main/resources/go-experimental
additionalProperties: additionalProperties:
enumClassPrefix: "true" enumClassPrefix: "true"
packageName: petstore packageName: petstore
disallowAdditionalPropertiesIfNotPresent: false

View File

@@ -1,15 +0,0 @@
generatorName: java
outputDir: samples/openapi3/client/petstore/java/jersey2-java8-special-characters
library: jersey2
inputSpec: modules/openapi-generator/src/test/resources/3_0/schema-with-special-characters.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: petstore-openapi3-jersey2-java8-special-characters
hideGenerationTimestamp: true
serverPort: "8082"
dateLibrary: java8
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false
systemProperties:
skipValidateSpec: "false"

View File

@@ -1,8 +0,0 @@
generatorName: kotlin
outputDir: samples/client/petstore/kotlin-retrofit2-rx3
library: jvm-retrofit2
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
artifactId: kotlin-petstore-retrofit2-rx3
useRxJava3: "true"

View File

@@ -0,0 +1,7 @@
generatorName: flash
outputDir: samples/client/petstore/flash
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/flash
additionalProperties:
invokerPackage: org.openapitools
packageName: org.openapitools

View File

@@ -1,4 +1,4 @@
generatorName: php-lumen generatorName: php-lumen
outputDir: samples/server/petstore/php-lumen outputDir: samples/server/petstore/php-lumen
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/php-lumen templateDir: modules/openapi-generator/src/main/resources/php-lumen

View File

@@ -4,7 +4,7 @@ library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties: additionalProperties:
java8: true java8: "false"
useBeanValidation: true useBeanValidation: true
artifactId: spring-boot-beanvalidation artifactId: spring-boot-beanvalidation
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"

View File

@@ -5,5 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties: additionalProperties:
artifactId: springboot-delegate artifactId: springboot-delegate
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"
java8: true java8: "false"
delegatePattern: "true" delegatePattern: "true"

View File

@@ -4,9 +4,8 @@ library: spring-mvc
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties: additionalProperties:
java8: true java8: "false"
booleanGetterPrefix: get booleanGetterPrefix: get
artifactId: spring-mvc-server artifactId: spring-mvc-server
hideGenerationTimestamp: "true" hideGenerationTimestamp: "true"
serverPort: "8002" serverPort: "8002"
additionalModelTypeAnnotations: '@com.fasterxml.jackson.annotation.JsonFilter(value = "filter-name");@com.fasterxml.jackson.annotation.JsonIgnoreProperties(value = "id")'

View File

@@ -1,9 +0,0 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
additionalProperties:
ngVersion: 10.0.0
npmVersion: 1.0.0
npmName: '@openapitools/typescript-angular-petstore'
npmRepository: https://skimdb.npmjs.com/registry
snapshot: false

View File

@@ -1,5 +0,0 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
additionalProperties:
ngVersion: 10.0.0

View File

@@ -1,9 +0,0 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
additionalProperties:
ngVersion: 9.0.0
npmVersion: 1.0.0
npmName: '@openapitools/typescript-angular-petstore'
npmRepository: https://skimdb.npmjs.com/registry
snapshot: false

View File

@@ -1,5 +0,0 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
additionalProperties:
ngVersion: 9.0.0

View File

@@ -1,6 +0,0 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/deno
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
platform: deno
npmName: ts-petstore-client

View File

@@ -1,7 +0,0 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/inversify
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
platform: node
npmName: ts-petstore-client
useInversify: true

View File

@@ -1,6 +0,0 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/jquery
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
framework: jquery
npmName: ts-petstore-client

View File

@@ -1,7 +0,0 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/object_params
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
platform: node
npmName: ts-petstore-client
useObjectParameters: true

View File

@@ -1,6 +0,0 @@
generatorName: typescript
outputDir: samples/openapi3/client/petstore/typescript/builds/default
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
additionalProperties:
platform: node
npmName: ts-petstore-client

51
bin/typescript.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
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/openapi-generator-cli/target/openapi-generator-cli.jar"
common_args="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript"
samples="samples/openapi3/client/petstore/typescript/builds"
if [ ! -f "$executable" ]
then
mvn -B 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"
printf "\033[32m## Creating default (fetch) client!\033[0m\n"
args="-o $samples/default --additional-properties=platform=node,npmName=ts-petstore-client $@"
java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating jquery client!\033[0m\n"
args="-o $samples/jquery --additional-properties=framework=jquery,npmName=ts-petstore-client $@"
java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating fetch object client!\033[0m\n"
args="-o $samples/object_params --additional-properties=platform=node,npmName=ts-petstore-client,useObjectParameters=true $@"
java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating fetch client with InversifyJS support!\033[0m\n"
args="-o $samples/inversify --additional-properties=platform=node,npmName=ts-petstore-client,useInversify=true $@"
java $JAVA_OPTS -jar $executable $common_args $args
printf "\033[32m## Creating Deno (fetch) client!\033[0m\n"
args="-o $samples/deno --additional-properties=platform=deno $@"
java $JAVA_OPTS -jar $executable $common_args $args

View File

@@ -19,13 +19,6 @@ if [ $status -ne 0 ]; then
exit $status exit $status
fi fi
if [[ "--skip-docs" == "${1}" ]]; then
# We export here rather than modify our iterable so that:
# - the scripts can show they ran and echo meaningfully
# - the scripts can do cleanup (if necessary) when skipped
export SKIP_EXPORT_DOCS=true
fi
# Some special case generators may expect to be run as a stanalone process (e.g. modifying classpath) # Some special case generators may expect to be run as a stanalone process (e.g. modifying classpath)
# Docs should always be run, regardless of batch or operation. # Docs should always be run, regardless of batch or operation.
declare -a always_iterate=( declare -a always_iterate=(

View File

@@ -5,11 +5,6 @@ echo "# START SCRIPT: ${SCRIPT}"
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [[ "true" == "${SKIP_EXPORT_DOCS}" ]]; then
echo "Skipping doc exports. Note that docs generated by Windows may break paths as they have not yet been normalized to OS-specific paths."
exit 0
fi
for GENERATOR in $(java -jar ${executable} list --short --include all | sed -e 's/,/\'$'\n''/g') for GENERATOR in $(java -jar ${executable} list --short --include all | sed -e 's/,/\'$'\n''/g')
do do
./bin/utils/export_generator.sh ${GENERATOR} ./bin/utils/export_generator.sh ${GENERATOR}

View File

@@ -22,9 +22,9 @@ jobs:
- restore_cache: - restore_cache:
keys: keys:
# Default branch if not # Default branch if not
- source-v2-{{ .Branch }}-{{ .Revision }} - source-v1-{{ .Branch }}-{{ .Revision }}
- source-v2-{{ .Branch }}- - source-v1-{{ .Branch }}-
- source-v2- - source-v1-
# Machine Setup # Machine Setup
# If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each # If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each
# The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out. # The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out.
@@ -70,7 +70,7 @@ jobs:
- run: ./CI/circle_parallel.sh - run: ./CI/circle_parallel.sh
# Save dependency cache # Save dependency cache
- save_cache: - save_cache:
key: source-v2-{{ .Branch }}-{{ .Revision }} key: source-v1-{{ .Branch }}-{{ .Revision }}
paths: paths:
# This is a broad list of cache paths to include many possible development environments # This is a broad list of cache paths to include many possible development environments
# You can probably delete some of these entries # You can probably delete some of these entries
@@ -78,7 +78,6 @@ jobs:
- ~/virtualenvs - ~/virtualenvs
- ~/.m2 - ~/.m2
- ~/.ivy2 - ~/.ivy2
- ~/.sbt
- ~/.bundle - ~/.bundle
- ~/.go_workspace - ~/.go_workspace
- ~/.gradle - ~/.gradle

View File

@@ -8,7 +8,7 @@ sidebar_label: Guidelines
- 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/openapitools/openapi-generator#getting-started) - 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/openapitools/openapi-generator#getting-started)
- Search the [open issue](https://github.com/openapitools/openapi-generator/issues) and [closed issue](https://github.com/openapitools/openapi-generator/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before. - Search the [open issue](https://github.com/openapitools/openapi-generator/issues) and [closed issue](https://github.com/openapitools/openapi-generator/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
- File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information. Failure to provide enough detail may result in slow response from the community. - File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information.
- Test with the latest master by building the JAR locally to see if the issue has already been addressed. - Test with the latest master by building the JAR locally to see if the issue has already been addressed.
- You can also make a suggestion or ask a question by opening an "issue". - You can also make a suggestion or ask a question by opening an "issue".
@@ -91,7 +91,8 @@ To add test cases (optional) covering the change in the code generator, please r
To test the templates, please perform the following: To test the templates, please perform the following:
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh . - 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 /bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/t
ree/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 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) 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`. - 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`.
@@ -113,8 +114,7 @@ See [OpenAPI Tools wiki](https://github.com/OpenAPITools/openapi-generator/wiki/
- Add test case(s) to cover the change - Add test case(s) to cover the change
- Document the fix in the code to make the code more readable - 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) - 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 - Recommended git settings
- `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around - `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/)) - 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/))

View File

@@ -1,70 +0,0 @@
---
id: file-post-processing
title: File post-processing
---
Each tool (CLI and plugins) supports enabling file post-processing at a high-level. Enabling this option allows for generators which support post-processing to call some external process for each generated file, passing the file path to that tool. The external tool must be defined in an environment variable supported by the generator.
Note that:
* this option is `--enable-post-process-file` in the CLI and `enablePostProcessFile` in plugins
* we require _both_ specifying the environment variable _and_ enabling the option at the tooling level; this feature is opt-in for security
* file processing occurs one at a time
* the external tool may be a custom script which invokes multiple tools
Also refer to the relevant documentation for [CLI](./usage.md), [Maven Plugin](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/README.md), [Gradle Plugin](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc), or [SBT Plugin](https://github.com/OpenAPITools/sbt-openapi-generator/blob/master/README.md).
## Supported Environment Variables
The following environment variables are supported by their respective generators:
<!-- query with: grep -Rn '_POST_PROCESS_FILE"' modules | grep -Eo '[^"]+_POST_PROCESS_FILE' | sort -u -->
* `CPP_POST_PROCESS_FILE`
* `CSHARP_POST_PROCESS_FILE`
* `C_POST_PROCESS_FILE`
* `DART_POST_PROCESS_FILE`
* `FSHARP_POST_PROCESS_FILE`
* `GO_POST_PROCESS_FILE`
* `HASKELL_POST_PROCESS_FILE`
* `JAVA_POST_PROCESS_FILE`
* `JS_POST_PROCESS_FILE`
* `KOTLIN_POST_PROCESS_FILE`
* `OCAML_POST_PROCESS_FILE`
* `PERL_POST_PROCESS_FILE`
* `PHP_POST_PROCESS_FILE`
* `POWERSHELL_POST_PROCESS_FILE`
* `PYTHON_POST_PROCESS_FILE`
* `RUBY_POST_PROCESS_FILE`
* `RUST_POST_PROCESS_FILE`
* `SCALA_POST_PROCESS_FILE`
* `SWIFT_POST_PROCESS_FILE`
* `TS_POST_PROCESS_FILE`
## Example
Let's see how to pass Ruby generated files to Rubocop, a static code analysis/linter/formatter tool.
```
# First, export the required environment variable
export RUBY_POST_PROCESS_FILE="/usr/local/bin/rubocop -a"
export OPENAPI_DOC="https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml"
# Invoke the generator with --enable-post-process-file
openapi-generator generate --enable-post-process-file -i $OPENAPI_DOC -g ruby -o .out-ruby/
```
You will now see messages logged about which files have been processed:
```
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/.rspec
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/spec/spec_helper.rb
[main] INFO o.o.c.languages.AbstractRubyCodegen - Successfully executed: /usr/local/bin/rubocopy -a /Users/jim/projects/openapi-generator/.out-ruby/spec/spec_helper.rb
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/spec/configuration_spec.rb
[main] INFO o.o.c.languages.AbstractRubyCodegen - Successfully executed: /usr/local/bin/rubocopy -a /Users/jim/projects/openapi-generator/.out-ruby/spec/configuration_spec.rb
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/spec/api_client_spec.rb
[main] INFO o.o.c.languages.AbstractRubyCodegen - Successfully executed: /usr/local/bin/rubocopy -a /Users/jim/projects/openapi-generator/.out-ruby/spec/api_client_spec.rb
[main] INFO o.o.codegen.TemplateManager - Skipped /Users/jim/projects/openapi-generator/.out-ruby/.openapi-generator-ignore (Skipped by supportingFiles options supplied by user.)
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/.openapi-generator/VERSION
[main] INFO o.o.codegen.TemplateManager - writing file /Users/jim/projects/openapi-generator/.out-ruby/.openapi-generator/FILES
```

View File

@@ -27,7 +27,7 @@ The following generators are available:
* [elm](generators/elm.md) * [elm](generators/elm.md)
* [erlang-client](generators/erlang-client.md) * [erlang-client](generators/erlang-client.md)
* [erlang-proper](generators/erlang-proper.md) * [erlang-proper](generators/erlang-proper.md)
* [flash-deprecated (deprecated)](generators/flash-deprecated.md) * [flash](generators/flash.md)
* [go](generators/go.md) * [go](generators/go.md)
* [go-experimental (experimental)](generators/go-experimental.md) * [go-experimental (experimental)](generators/go-experimental.md)
* [groovy](generators/groovy.md) * [groovy](generators/groovy.md)

View File

@@ -7,7 +7,7 @@ sidebar_label: aspnetcore
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|aspnetCoreVersion|ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)| |2.2| |aspnetCoreVersion|ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)| |2.2|
|buildTarget|Target to build an application or library| |program| |buildTarget|Target to build an application or library| |program|
|classModifier|Class Modifier for controller classes: Empty string or abstract.| || |classModifier|Class Modifier can be empty, abstract| ||
|compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2| |compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2|
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum| |enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|enumValueSuffix|Suffix that will be appended to all enum values.| |Enum| |enumValueSuffix|Suffix that will be appended to all enum values.| |Enum|
@@ -18,7 +18,7 @@ sidebar_label: aspnetcore
|modelClassModifier|Model Class Modifier can be nothing or partial| |partial| |modelClassModifier|Model Class Modifier can be nothing or partial| |partial|
|newtonsoftVersion|Version for Microsoft.AspNetCore.Mvc.NewtonsoftJson for ASP.NET Core 3.0+| |3.0.0| |newtonsoftVersion|Version for Microsoft.AspNetCore.Mvc.NewtonsoftJson for ASP.NET Core 3.0+| |3.0.0|
|operationIsAsync|Set methods to async or sync (default).| |false| |operationIsAsync|Set methods to async or sync (default).| |false|
|operationModifier|Operation Modifier can be virtual or abstract| |virtual| |operationModifier|Operation Modifier can be virtual, abstract or partial| |virtual|
|operationResultTask|Set methods result to Task&lt;&gt;.| |false| |operationResultTask|Set methods result to Task&lt;&gt;.| |false|
|packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI| |packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI|
|packageCopyright|Specifies an AssemblyCopyright for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |No Copyright| |packageCopyright|Specifies an AssemblyCopyright for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |No Copyright|

View File

@@ -1,6 +1,6 @@
--- ---
title: Config Options for flash-deprecated title: Config Options for flash
sidebar_label: flash-deprecated sidebar_label: flash
--- ---
| Option | Description | Values | Default | | Option | Description | Values | Default |

View File

@@ -5,7 +5,6 @@ sidebar_label: go-experimental
| Option | Description | Values | Default | | Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|enumClassPrefix|Prefix enum with class name| |false| |enumClassPrefix|Prefix enum with class name| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|isGoSubmodule|whether the generated Go module is a submodule| |false| |isGoSubmodule|whether the generated Go module is a submodule| |false|

View File

@@ -5,11 +5,9 @@ sidebar_label: go-gin-server
| Option | Description | Values | Default | | Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|apiPath|Name of the folder that contains the Go source code| |go|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|packageName|Go package name (convention: lowercase).| |openapi| |packageName|Go package name (convention: lowercase).| |openapi|
|packageVersion|Go package version.| |1.0.0| |packageVersion|Go package version.| |1.0.0|
|serverPort|The network port the generated server binds to| |8080|
## IMPORT MAPPING ## IMPORT MAPPING

View File

@@ -5,7 +5,6 @@ sidebar_label: go-server
| Option | Description | Values | Default | | Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|enumClassPrefix|Prefix enum with class name| |false|
|featureCORS|Enable Cross-Origin Resource Sharing middleware| |false| |featureCORS|Enable Cross-Origin Resource Sharing middleware| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|packageName|Go package name (convention: lowercase).| |openapi| |packageName|Go package name (convention: lowercase).| |openapi|

View File

@@ -31,10 +31,9 @@ sidebar_label: java
|invokerPackage|root package for generated code| |org.openapitools.client| |invokerPackage|root package for generated code| |org.openapitools.client|
|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 10.x. JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson| |library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 11.x. JSON processing: Jackson 2.9.x.</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2/3]=true'. (RxJava 1.x or 2.x or 3.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.9.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.9.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.9.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 4.x. JSON processing: Gson 2.x or Jackson 2.10.x. Only for Java 8</dd><dt>**native**</dt><dd>HTTP client: Java native HttpClient. JSON processing: Jackson 2.9.x. Only for Java11+</dd><dt>**microprofile**</dt><dd>HTTP client: Microprofile client 1.x. JSON processing: Jackson 2.9.x</dd></dl>|okhttp-gson|
|licenseName|The name of the license| |Unlicense| |licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org| |licenseUrl|The URL of the license| |http://unlicense.org|
|microprofileFramework|Framework for microprofile. Possible values &quot;kumuluzee&quot;| |null|
|modelPackage|package for generated models| |org.openapitools.client.model| |modelPackage|package for generated models| |org.openapitools.client.model|
|parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false| |parcelableModel|Whether to generate models for Android that implement Parcelable with the okhttp-gson library.| |false|
|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null|
@@ -53,7 +52,6 @@ sidebar_label: java
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |src/main/java| |sourceFolder|source folder for generated code| |src/main/java|
|supportJava6|Whether to support Java6 with the Jersey1 library. This option has been deprecated and will be removed in the 5.x release| |false| |supportJava6|Whether to support Java6 with the Jersey1 library. This option has been deprecated and will be removed in the 5.x release| |false|
|useAbstractionForFiles|Use alternative types instead of java.io.File to allow passing bytes without a file on disk. Available on resttemplate library| |false|
|useBeanValidation|Use BeanValidation API annotations| |false| |useBeanValidation|Use BeanValidation API annotations| |false|
|useGzipFeature|Send gzip-encoded requests| |false| |useGzipFeature|Send gzip-encoded requests| |false|
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false| |usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|

View File

@@ -33,7 +33,7 @@ sidebar_label: jaxrs-cxf-cdi
|invokerPackage|root package for generated code| |org.openapitools.api| |invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|library|library template (sub-template)|<dl><dt>**&lt;default&gt;**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd><dt>**kumuluzee**</dt><dd>Server using KumuluzEE</dd></dl>|&lt;default&gt;| |library|library template (sub-template)|<dl><dt>**&lt;default&gt;**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd></dl>|&lt;default&gt;|
|licenseName|The name of the license| |Unlicense| |licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org| |licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model| |modelPackage|package for generated models| |org.openapitools.model|

View File

@@ -33,7 +33,7 @@ sidebar_label: jaxrs-spec
|invokerPackage|root package for generated code| |org.openapitools.api| |invokerPackage|root package for generated code| |org.openapitools.api|
|java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true| |java8|Use Java8 classes instead of third party equivalents. Starting in 5.x, JDK8 is the default and the support for JDK7, JDK6 has been dropped|<dl><dt>**true**</dt><dd>Use Java 8 classes such as Base64</dd><dt>**false**</dt><dd>Various third party libraries as needed</dd></dl>|true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true| |legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|library|library template (sub-template)|<dl><dt>**&lt;default&gt;**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd><dt>**kumuluzee**</dt><dd>Server using KumuluzEE</dd></dl>|&lt;default&gt;| |library|library template (sub-template)|<dl><dt>**&lt;default&gt;**</dt><dd>JAXRS spec only, to be deployed in an app server (TomEE, JBoss, WLS, ...)</dd><dt>**quarkus**</dt><dd>Server using Quarkus</dd><dt>**thorntail**</dt><dd>Server using Thorntail</dd><dt>**openliberty**</dt><dd>Server using Open Liberty</dd><dt>**helidon**</dt><dd>Server using Helidon</dd></dl>|&lt;default&gt;|
|licenseName|The name of the license| |Unlicense| |licenseName|The name of the license| |Unlicense|
|licenseUrl|The URL of the license| |http://unlicense.org| |licenseUrl|The URL of the license| |http://unlicense.org|
|modelPackage|package for generated models| |org.openapitools.model| |modelPackage|package for generated models| |org.openapitools.model|

View File

@@ -25,7 +25,6 @@ sidebar_label: kotlin
|useCoroutines|Whether to use the Coroutines adapter with the retrofit2 library.| |false| |useCoroutines|Whether to use the Coroutines adapter with the retrofit2 library.| |false|
|useRxJava|Whether to use the RxJava adapter with the retrofit2 library.| |false| |useRxJava|Whether to use the RxJava adapter with the retrofit2 library.| |false|
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library.| |false| |useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library.| |false|
|useRxJava3|Whether to use the RxJava3 adapter with the retrofit2 library.| |false|
## IMPORT MAPPING ## IMPORT MAPPING

View File

@@ -0,0 +1,199 @@
---
title: Config Options for nodejs-server-deprecated
sidebar_label: nodejs-server-deprecated
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|exportedName|When the generated code will be deployed to Google Cloud Functions, this option can be used to update the name of the exported function. By default, it refers to the basePath. This does not affect normal standalone nodejs server code.| |null|
|googleCloudFunctions|When specified, it will generate the code which runs within Google Cloud Functions instead of standalone Node.JS server. See https://cloud.google.com/functions/docs/quickstart for the details of how to deploy the generated code.| |false|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|serverPort|TCP port to listen on.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|BigDecimal|java.math.BigDecimal|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|LinkedHashSet|java.util.LinkedHashSet|
|List|java.util.*|
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
|Map|java.util.Map|
|Set|java.util.*|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>break</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>const</li>
<li>continue</li>
<li>debugger</li>
<li>default</li>
<li>delete</li>
<li>do</li>
<li>else</li>
<li>enum</li>
<li>export</li>
<li>extends</li>
<li>finally</li>
<li>for</li>
<li>function</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>instanceof</li>
<li>let</li>
<li>new</li>
<li>return</li>
<li>super</li>
<li>switch</li>
<li>this</li>
<li>throw</li>
<li>try</li>
<li>typeof</li>
<li>var</li>
<li>void</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -0,0 +1,248 @@
---
title: Config Options for powershell-experimental
sidebar_label: powershell-experimental
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|apiNamePrefix|Prefix that will be appended to all PS objects. Default: empty string. e.g. Pet =&gt; PSPet.| |null|
|commonVerbs|PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly.| |null|
|packageGuid|GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.| |null|
|packageName|Client package name (e.g. PSTwitter).| |PSOpenAPITools|
|packageVersion|Package version (e.g. 0.1.2).| |0.1.2|
|powershellGalleryUrl|URL to the module in PowerShell Gallery (e.g. https://www.powershellgallery.com/packages/PSTwitter/).| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|BigDecimal|java.math.BigDecimal|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|LinkedHashSet|java.util.LinkedHashSet|
|List|java.util.*|
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
|Map|java.util.Map|
|Set|java.util.*|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Boolean</li>
<li>Byte</li>
<li>Byte[]</li>
<li>Char</li>
<li>Decimal</li>
<li>Double</li>
<li>Guid</li>
<li>Int16</li>
<li>Int32</li>
<li>Int64</li>
<li>ProgressRecord</li>
<li>SByte</li>
<li>SecureString</li>
<li>Single</li>
<li>String</li>
<li>System.DateTime</li>
<li>System.IO.FileInfo</li>
<li>TimeSpan</li>
<li>UInt16</li>
<li>UInt32</li>
<li>UInt64</li>
<li>Uri</li>
<li>Version</li>
<li>XmlDocument</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>args</li>
<li>begin</li>
<li>break</li>
<li>catch</li>
<li>consolefilename</li>
<li>continue</li>
<li>data</li>
<li>do</li>
<li>dynamicparam</li>
<li>else</li>
<li>elseif</li>
<li>end</li>
<li>error</li>
<li>event</li>
<li>eventargs</li>
<li>eventsubscriber</li>
<li>executioncontext</li>
<li>exit</li>
<li>false</li>
<li>filter</li>
<li>finally</li>
<li>for</li>
<li>foreach</li>
<li>from</li>
<li>function</li>
<li>home</li>
<li>host</li>
<li>if</li>
<li>in</li>
<li>input</li>
<li>lastexitcode</li>
<li>local</li>
<li>matches</li>
<li>myinvocation</li>
<li>nestedpromptlevel</li>
<li>null</li>
<li>param</li>
<li>pid</li>
<li>private</li>
<li>process</li>
<li>profile</li>
<li>pscmdlet</li>
<li>pscommandpath</li>
<li>psculture</li>
<li>psdebugcontext</li>
<li>pshome</li>
<li>psitem</li>
<li>psscriptroot</li>
<li>pssenderinfo</li>
<li>psuiculture</li>
<li>psversiontable</li>
<li>return</li>
<li>sender</li>
<li>shellid</li>
<li>stacktrace</li>
<li>switch</li>
<li>this</li>
<li>throw</li>
<li>trap</li>
<li>true</li>
<li>try</li>
<li>until</li>
<li>where</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -7,7 +7,6 @@ sidebar_label: powershell
| ------ | ----------- | ------ | ------- | | ------ | ----------- | ------ | ------- |
|apiNamePrefix|Prefix that will be appended to all PS objects. Default: empty string. e.g. Pet =&gt; PSPet.| |null| |apiNamePrefix|Prefix that will be appended to all PS objects. Default: empty string. e.g. Pet =&gt; PSPet.| |null|
|commonVerbs|PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly.| |null| |commonVerbs|PS common verb mappings. e.g. Delete=Remove:Patch=Update to map Delete with Remove and Patch with Update accordingly.| |null|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|discardReadOnly|Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters| |null| |discardReadOnly|Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters| |null|
|packageGuid|GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.| |null| |packageGuid|GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default.| |null|
|packageName|Client package name (e.g. PSTwitter).| |PSOpenAPITools| |packageName|Client package name (e.g. PSTwitter).| |PSOpenAPITools|

View File

@@ -0,0 +1,221 @@
---
title: Config Options for scala-akka-http
sidebar_label: scala-akka-http
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|akkaHttpVersion|The version of akka-http| |10.1.10|
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|artifactId|artifactId| |openapi-scala-akka-http-server|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|invokerPackage|root package for generated code| |org.openapitools.server|
|modelPackage|package for generated models| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|sourceFolder|source folder for generated code| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
|Array|java.util.List|
|ArrayList|java.util.ArrayList|
|Date|java.util.Date|
|DateTime|org.joda.time.*|
|File|java.io.File|
|HashMap|java.util.HashMap|
|ListBuffer|scala.collection.mutable.ListBuffer|
|ListSet|scala.collection.immutable.ListSet|
|LocalDate|org.joda.time.*|
|LocalDateTime|org.joda.time.*|
|LocalTime|org.joda.time.*|
|Timestamp|java.sql.Timestamp|
|URI|java.net.URI|
|UUID|java.util.UUID|
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|ListBuffer|
|map|Map|
|set|Set|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
<li>List</li>
<li>Long</li>
<li>Map</li>
<li>Object</li>
<li>Seq</li>
<li>String</li>
<li>boolean</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>abstract</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>def</li>
<li>do</li>
<li>else</li>
<li>extends</li>
<li>false</li>
<li>final</li>
<li>finally</li>
<li>for</li>
<li>forsome</li>
<li>if</li>
<li>implicit</li>
<li>import</li>
<li>lazy</li>
<li>match</li>
<li>new</li>
<li>null</li>
<li>object</li>
<li>override</li>
<li>package</li>
<li>private</li>
<li>protected</li>
<li>return</li>
<li>sealed</li>
<li>super</li>
<li>this</li>
<li>throw</li>
<li>trait</li>
<li>true</li>
<li>try</li>
<li>type</li>
<li>val</li>
<li>var</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✓|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✓|OAS2,OAS3

View File

@@ -0,0 +1,265 @@
---
title: Config Options for swift2-deprecated
sidebar_label: swift2-deprecated
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|podAuthors|Authors used for Podspec| |null|
|podDescription|Description used for Podspec| |null|
|podDocsetURL|Docset URL used for Podspec| |null|
|podDocumentationURL|Documentation URL used for Podspec| |null|
|podHomepage|Homepage used for Podspec| |null|
|podLicense|License used for Podspec| |null|
|podScreenshots|Screenshots used for Podspec| |null|
|podSocialMediaURL|Social Media URL used for Podspec| |null|
|podSource|Source information used for Podspec| |null|
|podSummary|Summary used for Podspec| |null|
|podVersion|Version used for Podspec| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|Project name in Xcode| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>AnyObject</li>
<li>Bool</li>
<li>Character</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>String</li>
<li>Void</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Any</li>
<li>AnyObject</li>
<li>Bool</li>
<li>COLUMN</li>
<li>Character</li>
<li>Class</li>
<li>Data</li>
<li>Double</li>
<li>ErrorResponse</li>
<li>FILE</li>
<li>FUNCTION</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>LINE</li>
<li>Protocol</li>
<li>Self</li>
<li>String</li>
<li>Type</li>
<li>Void</li>
<li>as</li>
<li>associativity</li>
<li>break</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>continue</li>
<li>convenience</li>
<li>default</li>
<li>defer</li>
<li>deinit</li>
<li>didSet</li>
<li>do</li>
<li>dynamic</li>
<li>dynamicType</li>
<li>else</li>
<li>enum</li>
<li>extension</li>
<li>fallthrough</li>
<li>false</li>
<li>fileprivate</li>
<li>final</li>
<li>for</li>
<li>func</li>
<li>get</li>
<li>guard</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>indirect</li>
<li>infix</li>
<li>init</li>
<li>inout</li>
<li>internal</li>
<li>is</li>
<li>lazy</li>
<li>left</li>
<li>let</li>
<li>mutating</li>
<li>nil</li>
<li>none</li>
<li>nonmutating</li>
<li>open</li>
<li>operator</li>
<li>optional</li>
<li>override</li>
<li>postfix</li>
<li>precedence</li>
<li>prefix</li>
<li>private</li>
<li>protocol</li>
<li>public</li>
<li>repeat</li>
<li>required</li>
<li>rethrows</li>
<li>return</li>
<li>right</li>
<li>self</li>
<li>set</li>
<li>static</li>
<li>struct</li>
<li>subscript</li>
<li>super</li>
<li>switch</li>
<li>throw</li>
<li>throws</li>
<li>true</li>
<li>try</li>
<li>typealias</li>
<li>unowned</li>
<li>var</li>
<li>weak</li>
<li>where</li>
<li>while</li>
<li>willSet</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -0,0 +1,259 @@
---
title: Config Options for swift3-deprecated
sidebar_label: swift3-deprecated
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|lenientTypeCast|Accept and cast values for simple types (string-&gt;bool, string-&gt;int, int-&gt;string)| |false|
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|podAuthors|Authors used for Podspec| |null|
|podDescription|Description used for Podspec| |null|
|podDocsetURL|Docset URL used for Podspec| |null|
|podDocumentationURL|Documentation URL used for Podspec| |null|
|podHomepage|Homepage used for Podspec| |null|
|podLicense|License used for Podspec| |null|
|podScreenshots|Screenshots used for Podspec| |null|
|podSocialMediaURL|Social Media URL used for Podspec| |null|
|podSource|Source information used for Podspec| |null|
|podSummary|Summary used for Podspec| |null|
|podVersion|Version used for Podspec| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|Project name in Xcode| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Any</li>
<li>AnyObject</li>
<li>Bool</li>
<li>Character</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>String</li>
<li>Void</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>Any</li>
<li>AnyObject</li>
<li>Bool</li>
<li>COLUMN</li>
<li>Character</li>
<li>Class</li>
<li>Data</li>
<li>Double</li>
<li>Error</li>
<li>ErrorResponse</li>
<li>FILE</li>
<li>FUNCTION</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>LINE</li>
<li>Protocol</li>
<li>Response</li>
<li>Self</li>
<li>String</li>
<li>Type</li>
<li>URL</li>
<li>Void</li>
<li>as</li>
<li>associativity</li>
<li>break</li>
<li>case</li>
<li>class</li>
<li>continue</li>
<li>convenience</li>
<li>default</li>
<li>deinit</li>
<li>didSet</li>
<li>do</li>
<li>dynamic</li>
<li>dynamicType</li>
<li>else</li>
<li>enum</li>
<li>extension</li>
<li>fallthrough</li>
<li>false</li>
<li>final</li>
<li>for</li>
<li>func</li>
<li>get</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>infix</li>
<li>init</li>
<li>inout</li>
<li>internal</li>
<li>is</li>
<li>lazy</li>
<li>left</li>
<li>let</li>
<li>mutating</li>
<li>nil</li>
<li>none</li>
<li>nonmutating</li>
<li>operator</li>
<li>optional</li>
<li>override</li>
<li>postfix</li>
<li>precedence</li>
<li>prefix</li>
<li>private</li>
<li>protocol</li>
<li>public</li>
<li>required</li>
<li>return</li>
<li>right</li>
<li>self</li>
<li>set</li>
<li>static</li>
<li>struct</li>
<li>subscript</li>
<li>super</li>
<li>switch</li>
<li>true</li>
<li>typealias</li>
<li>unowned</li>
<li>var</li>
<li>weak</li>
<li>where</li>
<li>while</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✗|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

317
docs/generators/swift4.md Normal file
View File

@@ -0,0 +1,317 @@
---
title: Config Options for swift4
sidebar_label: swift4
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|lenientTypeCast|Accept and cast values for simple types (string-&gt;bool, string-&gt;int, int-&gt;string)| |false|
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.(default: false)| |null|
|objcCompatible|Add additional properties and methods for Objective-C compatibility (default: false)| |null|
|podAuthors|Authors used for Podspec| |null|
|podDescription|Description used for Podspec| |null|
|podDocsetURL|Docset URL used for Podspec| |null|
|podDocumentationURL|Documentation URL used for Podspec| |null|
|podHomepage|Homepage used for Podspec| |null|
|podLicense|License used for Podspec| |null|
|podScreenshots|Screenshots used for Podspec| |null|
|podSocialMediaURL|Social Media URL used for Podspec| |null|
|podSource|Source information used for Podspec| |null|
|podSummary|Summary used for Podspec| |null|
|podVersion|Version used for Podspec| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|Project name in Xcode| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|unwrapRequired|Treat 'required' properties in response as non-optional (which would crash the app if api returns null as opposed to required option specified in json schema| |null|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Any</li>
<li>AnyObject</li>
<li>Bool</li>
<li>Character</li>
<li>Data</li>
<li>Date</li>
<li>Decimal</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
<li>Int32</li>
<li>Int64</li>
<li>String</li>
<li>URL</li>
<li>UUID</li>
<li>Void</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>#available</li>
<li>#colorLiteral</li>
<li>#column</li>
<li>#else</li>
<li>#elseif</li>
<li>#endif</li>
<li>#file</li>
<li>#fileLiteral</li>
<li>#function</li>
<li>#if</li>
<li>#imageLiteral</li>
<li>#line</li>
<li>#selector</li>
<li>#sourceLocation</li>
<li>Any</li>
<li>AnyObject</li>
<li>Array</li>
<li>Bool</li>
<li>COLUMN</li>
<li>Character</li>
<li>Class</li>
<li>ClosedRange</li>
<li>Codable</li>
<li>CountableClosedRange</li>
<li>CountableRange</li>
<li>Data</li>
<li>Decodable</li>
<li>Dictionary</li>
<li>Double</li>
<li>Encodable</li>
<li>Error</li>
<li>ErrorResponse</li>
<li>FILE</li>
<li>FUNCTION</li>
<li>Float</li>
<li>Float32</li>
<li>Float64</li>
<li>Float80</li>
<li>Int</li>
<li>Int16</li>
<li>Int32</li>
<li>Int64</li>
<li>Int8</li>
<li>LINE</li>
<li>OptionSet</li>
<li>Optional</li>
<li>Protocol</li>
<li>Range</li>
<li>Response</li>
<li>Self</li>
<li>Set</li>
<li>StaticString</li>
<li>String</li>
<li>Type</li>
<li>UInt</li>
<li>UInt16</li>
<li>UInt32</li>
<li>UInt64</li>
<li>UInt8</li>
<li>URL</li>
<li>Unicode</li>
<li>Void</li>
<li>_</li>
<li>as</li>
<li>associatedtype</li>
<li>associativity</li>
<li>break</li>
<li>case</li>
<li>catch</li>
<li>class</li>
<li>continue</li>
<li>convenience</li>
<li>default</li>
<li>defer</li>
<li>deinit</li>
<li>didSet</li>
<li>do</li>
<li>dynamic</li>
<li>dynamicType</li>
<li>else</li>
<li>enum</li>
<li>extension</li>
<li>fallthrough</li>
<li>false</li>
<li>fileprivate</li>
<li>final</li>
<li>for</li>
<li>func</li>
<li>get</li>
<li>guard</li>
<li>if</li>
<li>import</li>
<li>in</li>
<li>indirect</li>
<li>infix</li>
<li>init</li>
<li>inout</li>
<li>internal</li>
<li>is</li>
<li>lazy</li>
<li>left</li>
<li>let</li>
<li>mutating</li>
<li>nil</li>
<li>none</li>
<li>nonmutating</li>
<li>open</li>
<li>operator</li>
<li>optional</li>
<li>override</li>
<li>postfix</li>
<li>precedence</li>
<li>prefix</li>
<li>private</li>
<li>protocol</li>
<li>public</li>
<li>repeat</li>
<li>required</li>
<li>rethrows</li>
<li>return</li>
<li>right</li>
<li>self</li>
<li>set</li>
<li>static</li>
<li>struct</li>
<li>subscript</li>
<li>super</li>
<li>switch</li>
<li>throw</li>
<li>throws</li>
<li>true</li>
<li>try</li>
<li>typealias</li>
<li>unowned</li>
<li>var</li>
<li>weak</li>
<li>where</li>
<li>while</li>
<li>willSet</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✗|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✗|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✗|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✓|OAS2,OAS3
|ApiKey|✓|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✓|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✗|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -16,7 +16,7 @@ sidebar_label: typescript-angular
|modelFileSuffix|The suffix of the file of the generated model (model&lt;suffix&gt;.ts).| |null| |modelFileSuffix|The suffix of the file of the generated model (model&lt;suffix&gt;.ts).| |null|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original| |modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|modelSuffix|The suffix of the generated model.| |null| |modelSuffix|The suffix of the generated model.| |null|
|ngVersion|The version of Angular. (At least 6.0.0)| |10.0.0| |ngVersion|The version of Angular. (At least 6.0.0)| |9.0.0|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null| |npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null| |npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0| |npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
@@ -64,7 +64,6 @@ sidebar_label: typescript-angular
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -46,7 +46,6 @@ sidebar_label: typescript-angularjs-deprecated
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -0,0 +1,236 @@
---
title: Config Options for typescript-angularjs
sidebar_label: typescript-angularjs
---
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|disallowAdditionalPropertiesIfNotPresent|Specify the behavior when the 'additionalProperties' keyword is not present in the OAS document. If false: the 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications. If true: when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.This setting is currently ignored for OAS 2.0 documents: 1) When the 'additionalProperties' keyword is not present in a 2.0 schema, additional properties are NOT allowed. 2) Boolean values of the 'additionalProperties' keyword are ignored. It's as if additional properties are NOT allowed.Note: the root cause are issues #1369 and #1371, which must be resolved in the swagger-parser project.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>when the 'additionalProperties' keyword is not present in a schema, the value of 'additionalProperties' is automatically set to false, i.e. no additional properties are allowed. Note: this mode is not compliant with the JSON schema specification. This is the original openapi-generator behavior.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |PascalCase|
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|supportsES6|Generate code that conforms to ES6.| |false|
## IMPORT MAPPING
| Type/Alias | Imports |
| ---------- | ------- |
## INSTANTIATION TYPES
| Type/Alias | Instantiated By |
| ---------- | --------------- |
|array|Array|
## LANGUAGE PRIMITIVES
<ul class="column-ul">
<li>Array</li>
<li>Boolean</li>
<li>Date</li>
<li>Double</li>
<li>Error</li>
<li>File</li>
<li>Float</li>
<li>Integer</li>
<li>Long</li>
<li>Map</li>
<li>Object</li>
<li>ReadonlyArray</li>
<li>String</li>
<li>any</li>
<li>boolean</li>
<li>number</li>
<li>object</li>
<li>string</li>
</ul>
## RESERVED WORDS
<ul class="column-ul">
<li>abstract</li>
<li>await</li>
<li>boolean</li>
<li>break</li>
<li>byte</li>
<li>case</li>
<li>catch</li>
<li>char</li>
<li>class</li>
<li>const</li>
<li>continue</li>
<li>debugger</li>
<li>default</li>
<li>delete</li>
<li>do</li>
<li>double</li>
<li>else</li>
<li>enum</li>
<li>export</li>
<li>extends</li>
<li>false</li>
<li>final</li>
<li>finally</li>
<li>float</li>
<li>for</li>
<li>formParams</li>
<li>function</li>
<li>goto</li>
<li>headerParams</li>
<li>if</li>
<li>implements</li>
<li>import</li>
<li>in</li>
<li>instanceof</li>
<li>int</li>
<li>interface</li>
<li>let</li>
<li>long</li>
<li>native</li>
<li>new</li>
<li>null</li>
<li>package</li>
<li>private</li>
<li>protected</li>
<li>public</li>
<li>queryParameters</li>
<li>requestOptions</li>
<li>return</li>
<li>short</li>
<li>static</li>
<li>super</li>
<li>switch</li>
<li>synchronized</li>
<li>this</li>
<li>throw</li>
<li>transient</li>
<li>true</li>
<li>try</li>
<li>typeof</li>
<li>useFormData</li>
<li>var</li>
<li>varLocalDeferred</li>
<li>varLocalPath</li>
<li>void</li>
<li>volatile</li>
<li>while</li>
<li>with</li>
<li>yield</li>
</ul>
## FEATURE SET
### Client Modification Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasePath|✓|ToolingExtension
|Authorizations|✗|ToolingExtension
|UserAgent|✗|ToolingExtension
### Data Type Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Custom|✗|OAS2,OAS3
|Int32|✓|OAS2,OAS3
|Int64|✓|OAS2,OAS3
|Float|✓|OAS2,OAS3
|Double|✓|OAS2,OAS3
|Decimal|✓|ToolingExtension
|String|✓|OAS2,OAS3
|Byte|✓|OAS2,OAS3
|Binary|✓|OAS2,OAS3
|Boolean|✓|OAS2,OAS3
|Date|✓|OAS2,OAS3
|DateTime|✓|OAS2,OAS3
|Password|✓|OAS2,OAS3
|File|✓|OAS2
|Array|✓|OAS2,OAS3
|Maps|✓|ToolingExtension
|CollectionFormat|✓|OAS2
|CollectionFormatMulti|✓|OAS2
|Enum|✓|OAS2,OAS3
|ArrayOfEnum|✓|ToolingExtension
|ArrayOfModel|✓|ToolingExtension
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
|ArrayOfCollectionOfModel|✓|ToolingExtension
|ArrayOfCollectionOfEnum|✓|ToolingExtension
|MapOfEnum|✓|ToolingExtension
|MapOfModel|✓|ToolingExtension
|MapOfCollectionOfPrimitives|✓|ToolingExtension
|MapOfCollectionOfModel|✓|ToolingExtension
|MapOfCollectionOfEnum|✓|ToolingExtension
### Documentation Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Readme|✓|ToolingExtension
|Model|✓|ToolingExtension
|Api|✓|ToolingExtension
### Global Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Host|✓|OAS2,OAS3
|BasePath|✓|OAS2,OAS3
|Info|✓|OAS2,OAS3
|Schemes|✗|OAS2,OAS3
|PartialSchemes|✓|OAS2,OAS3
|Consumes|✓|OAS2
|Produces|✓|OAS2
|ExternalDocumentation|✓|OAS2,OAS3
|Examples|✓|OAS2,OAS3
|XMLStructureDefinitions|✗|OAS2,OAS3
|MultiServer|✗|OAS3
|ParameterizedServer|✗|OAS3
|ParameterStyling|✗|OAS3
|Callbacks|✗|OAS3
|LinkObjects|✗|OAS3
### Parameter Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Path|✓|OAS2,OAS3
|Query|✓|OAS2,OAS3
|Header|✓|OAS2,OAS3
|Body|✓|OAS2
|FormUnencoded|✓|OAS2
|FormMultipart|✓|OAS2
|Cookie|✓|OAS3
### Schema Support Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|Simple|✓|OAS2,OAS3
|Composite|✓|OAS2,OAS3
|Polymorphism|✓|OAS2,OAS3
|Union|✗|OAS3
### Security Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|BasicAuth|✗|OAS2,OAS3
|ApiKey|✗|OAS2,OAS3
|OpenIDConnect|✗|OAS3
|BearerToken|✗|OAS3
|OAuth2_Implicit|✗|OAS2,OAS3
|OAuth2_Password|✗|OAS2,OAS3
|OAuth2_ClientCredentials|✗|OAS2,OAS3
|OAuth2_AuthorizationCode|✗|OAS2,OAS3
### Wire Format Feature
| Name | Supported | Defined By |
| ---- | --------- | ---------- |
|JSON|✓|OAS2,OAS3
|XML|✓|OAS2,OAS3
|PROTOBUF|✗|ToolingExtension
|Custom|✗|OAS2,OAS3

View File

@@ -49,7 +49,6 @@ sidebar_label: typescript-aurelia
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -54,7 +54,6 @@ sidebar_label: typescript-axios
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -54,7 +54,6 @@ sidebar_label: typescript-fetch
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -55,7 +55,6 @@ sidebar_label: typescript-inversify
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -51,7 +51,6 @@ sidebar_label: typescript-jquery
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -54,7 +54,6 @@ sidebar_label: typescript-node
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>RequestDetailedFile</li> <li>RequestDetailedFile</li>
<li>RequestFile</li> <li>RequestFile</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -52,7 +52,6 @@ sidebar_label: typescript-redux-query
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -52,7 +52,6 @@ sidebar_label: typescript-rxjs
<li>Map</li> <li>Map</li>
<li>Object</li> <li>Object</li>
<li>ReadonlyArray</li> <li>ReadonlyArray</li>
<li>Set</li>
<li>String</li> <li>String</li>
<li>any</li> <li>any</li>
<li>boolean</li> <li>boolean</li>

View File

@@ -27,10 +27,6 @@ Please refer to https://github.com/upstart-commerce/sbt-openapi-generator
Please refer to https://github.com/OpenAPITools/openapi-generator-bazel Please refer to https://github.com/OpenAPITools/openapi-generator-bazel
### Cake Addin
3rd-party Cake Addin provided by [Lukas Körfer](https://github.com/lukoerfer): https://github.com/lukoerfer/cake-openapi-generator
### GitHub Integration ### GitHub Integration
To push the auto-generated SDK to GitHub, we provide `git_push.sh` to streamline the process. For example: To push the auto-generated SDK to GitHub, we provide `git_push.sh` to streamline the process. For example:

View File

@@ -522,12 +522,6 @@ openapi-generator generate \
> NOTE: mappings are applied to `DateTime`, as this is the representation of the primitive type. See [DefaultCodegen](https://github.com/OpenAPITools/openapi-generator/blob/7cee999543fcc00b7c1eb9f70f0456b707c7f9e2/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L1431). > NOTE: mappings are applied to `DateTime`, as this is the representation of the primitive type. See [DefaultCodegen](https://github.com/OpenAPITools/openapi-generator/blob/7cee999543fcc00b7c1eb9f70f0456b707c7f9e2/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L1431).
#### File Post-Processing
The `--enable-post-process-file` option enables specific generators to invoke some external language-specific formatting script. Each filename is passed _individually_ to this external script, allowing for linting, formatting, or other custom clean-up.
For more details, see [File Post-Processing](./file-post-processing.md).
### Target External Models ### Target External Models
Sometimes you don't want the codegen to make a model for you--you might want to just include one that already exists in your codebase. Say you already have a `User` object and want to reuse that, which has a different model package from the other generated files: Sometimes you don't want the codegen to make a model for you--you might want to just include one that already exists in your codebase. Say you already have a `User` object and want to reuse that, which has a different model package from the other generated files:

View File

@@ -234,7 +234,7 @@ public class Generate extends OpenApiGeneratorCommand {
+ " Useful for piping the JSON output of debug options (e.g. `--global-property debugOperations`) to an external parser directly while testing a generator.") + " Useful for piping the JSON output of debug options (e.g. `--global-property debugOperations`) to an external parser directly while testing a generator.")
private Boolean logToStderr; private Boolean logToStderr;
@Option(name = {"--enable-post-process-file"}, title = "enable post-processing of files (in generators supporting it)", description = CodegenConstants.ENABLE_POST_PROCESS_FILE_DESC) @Option(name = {"--enable-post-process-file"}, title = "enable post-process file", description = CodegenConstants.ENABLE_POST_PROCESS_FILE_DESC)
private Boolean enablePostProcessFile; private Boolean enablePostProcessFile;
@Option(name = {"--generate-alias-as-model"}, title = "generate alias (array, map) as model", description = CodegenConstants.GENERATE_ALIAS_AS_MODEL_DESC) @Option(name = {"--generate-alias-as-model"}, title = "generate alias (array, map) as model", description = CodegenConstants.GENERATE_ALIAS_AS_MODEL_DESC)

View File

@@ -72,7 +72,7 @@
</profiles> </profiles>
<properties> <properties>
<slf4j-version>1.7.29</slf4j-version> <slf4j-version>1.7.12</slf4j-version>
<guava-version>26.0-jre</guava-version> <guava-version>26.0-jre</guava-version>
</properties> </properties>
</project> </project>

View File

@@ -110,6 +110,9 @@ hs_err_pid*
.AppleDouble .AppleDouble
.LSOverride .LSOverride
# Icon must end with two \r
Icon
# Thumbnails # Thumbnails
._* ._*

View File

@@ -61,35 +61,6 @@ task validateBadSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valida
task validateSpecs(dependsOn: ['validateGoodSpec', 'validateBadSpec']) task validateSpecs(dependsOn: ['validateGoodSpec', 'validateBadSpec'])
---- ----
[NOTE]
====
The tasks support Gradle Up-To-Date checking and Gradle Cache. Enable caching globally by setting `org.gradle.caching=true` in the `gradle.settings`
file or by passing the command line property `--build-cache` when executing on the command line.
Disable up-to-date checks and caching by setting the following property when using the extension:
.Disable caching for extension
[source,groovy]
----
tasks.withType(org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
outputs.upToDateWhen { false }
outputs.cacheIf { false }
}
----
Disable up-to-date checks and caching for a custom task:
.Disable caching for custom task
[source,groovy]
----
task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
outputs.upToDateWhen { false }
outputs.cacheIf { false }
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
}
----
====
== Plugin Setup == Plugin Setup
//# RELEASE_VERSION //# RELEASE_VERSION

View File

@@ -1,5 +1,5 @@
#Thu Jan 30 22:14:34 EST 2020 #Thu Jan 30 22:14:34 EST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -1,18 +1,18 @@
# Local Spec Sample # Local Spec Sample
This example assumes you have Gradle 5.6.4+ installed. No gradle wrapper is provided in samples. This example assumes you have Gradle 4.7+ installed. No gradle wrapper is provided in samples.
First, publish the openapi-generator-gradle-plugin locally via `./gradlew assemble publishToMavenLocal` in the module directory. First, publish the openapi-generator-gradle-plugin locally via `./gradlew assemble install` in the module directory.
Then, run the following tasks in this example directory. Then, run the following tasks in this example directory.
```bash ```bash
gradle openApiGenerate # expected outcome: BUILD SCCESSFUL gradle openApiGenerate
gradle openApiMeta # expected outcome: BUILD SCCESSFUL gradle openApiMeta
gradle openApiValidate # expected outcome: BUILD FAILED gradle openApiValidate
gradle buildGoSdk # expected outcome: BUILD SCCESSFUL gradle buildGoSdk
gradle buildDotnetSdk # expected outcome: BUILD SCCESSFUL gradle buildDotnetSdk
gradle generateGoWithInvalidSpec # expected outcome: BUILD FAILED gradle generateGoWithInvalidSpec
``` ```
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example: The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:

View File

@@ -55,9 +55,9 @@ class OpenApiGeneratorPlugin : Plugin<Project> {
) )
val generators = extensions.create( val generators = extensions.create(
"openApiGenerators", "openApiGenerators",
OpenApiGeneratorGeneratorsExtension::class.java, OpenApiGeneratorGeneratorsExtension::class.java,
project project
) )
generate.outputDir.set("$buildDir/generate-resources/main") generate.outputDir.set("$buildDir/generate-resources/main")

View File

@@ -317,7 +317,7 @@ open class OpenApiGeneratorGenerateExtension(project: Project) {
} }
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
fun applyDefaults() { fun applyDefaults(){
releaseNote.set("Minor update") releaseNote.set("Minor update")
modelNamePrefix.set("") modelNamePrefix.set("")
modelNameSuffix.set("") modelNameSuffix.set("")

View File

@@ -19,14 +19,7 @@ package org.openapitools.generator.gradle.plugin.tasks
import org.gradle.api.DefaultTask import org.gradle.api.DefaultTask
import org.gradle.api.GradleException import org.gradle.api.GradleException
import org.gradle.api.provider.Property import org.gradle.api.provider.Property
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option import org.gradle.api.tasks.options.Option
import org.gradle.internal.logging.text.StyledTextOutput import org.gradle.internal.logging.text.StyledTextOutput
@@ -39,6 +32,7 @@ import org.openapitools.codegen.DefaultGenerator
import org.openapitools.codegen.config.CodegenConfigurator import org.openapitools.codegen.config.CodegenConfigurator
import org.openapitools.codegen.config.GlobalSettings import org.openapitools.codegen.config.GlobalSettings
/** /**
* A task which generates the desired code. * A task which generates the desired code.
* *
@@ -49,41 +43,35 @@ import org.openapitools.codegen.config.GlobalSettings
* @author Jim Schubert * @author Jim Schubert
*/ */
@Suppress("UnstableApiUsage") @Suppress("UnstableApiUsage")
@CacheableTask
open class GenerateTask : DefaultTask() { open class GenerateTask : DefaultTask() {
/** /**
* The verbosity of generation * The verbosity of generation
*/ */
@Optional @get:Internal
@Input
val verbose = project.objects.property<Boolean>() val verbose = project.objects.property<Boolean>()
/** /**
* Whether or not an input specification should be validated upon generation. * Whether or not an input specification should be validated upon generation.
*/ */
@Optional @get:Internal
@Input
val validateSpec = project.objects.property<Boolean>() val validateSpec = project.objects.property<Boolean>()
/** /**
* The name of the generator which will handle codegen. (see "openApiGenerators" task) * The name of the generator which will handle codegen. (see "openApiGenerators" task)
*/ */
@Optional @get:Internal
@Input
val generatorName = project.objects.property<String>() val generatorName = project.objects.property<String>()
/** /**
* The output target directory into which code will be generated. * The output target directory into which code will be generated.
*/ */
@Optional @get:Internal
@get:OutputDirectory
val outputDir = project.objects.property<String>() val outputDir = project.objects.property<String>()
@Suppress("unused") @Suppress("unused")
@get:Internal @get:Internal
@set:Option(option = "input", description = "The input specification.") @set:Option(option = "input", description = "The input specification.")
@Input
var input: String? = null var input: String? = null
set(value) { set(value) {
inputSpec.set(value) inputSpec.set(value)
@@ -92,30 +80,26 @@ open class GenerateTask : DefaultTask() {
/** /**
* The Open API 2.0/3.x specification location. * The Open API 2.0/3.x specification location.
*/ */
@get:InputFile @get:Internal
@PathSensitive(PathSensitivity.RELATIVE)
val inputSpec = project.objects.property<String>() val inputSpec = project.objects.property<String>()
/** /**
* The template directory holding a custom template. * The template directory holding a custom template.
*/ */
@Optional @get:Internal
@Input
val templateDir = project.objects.property<String?>() val templateDir = project.objects.property<String?>()
/** /**
* Adds authorization headers when fetching the OpenAPI definitions remotely. * Adds authorization headers when fetching the OpenAPI definitions remotely.
* Pass in a URL-encoded string of name:header with a comma separating multiple values * Pass in a URL-encoded string of name:header with a comma separating multiple values
*/ */
@Optional @get:Internal
@Input
val auth = project.objects.property<String>() val auth = project.objects.property<String>()
/** /**
* Sets specified global properties. * Sets specified global properties.
*/ */
@Optional @get:Internal
@Input
val globalProperties = project.objects.mapProperty<String, String>() val globalProperties = project.objects.mapProperty<String, String>()
/** /**
@@ -123,185 +107,159 @@ open class GenerateTask : DefaultTask() {
* File content should be in a json format { "optionKey":"optionValue", "optionKey1":"optionValue1"...} * File content should be in a json format { "optionKey":"optionValue", "optionKey1":"optionValue1"...}
* Supported options can be different for each language. Run config-help -g {generator name} command for language specific config options. * Supported options can be different for each language. Run config-help -g {generator name} command for language specific config options.
*/ */
@Optional @get:Internal
@Input
val configFile = project.objects.property<String>() val configFile = project.objects.property<String>()
/** /**
* Specifies if the existing files should be overwritten during the generation. * Specifies if the existing files should be overwritten during the generation.
*/ */
@Optional @get:Internal
@Input
val skipOverwrite = project.objects.property<Boolean?>() val skipOverwrite = project.objects.property<Boolean?>()
/** /**
* Package for generated classes (where supported) * Package for generated classes (where supported)
*/ */
@Optional @get:Internal
@Input
val packageName = project.objects.property<String>() val packageName = project.objects.property<String>()
/** /**
* Package for generated api classes * Package for generated api classes
*/ */
@Optional @get:Internal
@Input
val apiPackage = project.objects.property<String>() val apiPackage = project.objects.property<String>()
/** /**
* Package for generated models * Package for generated models
*/ */
@Optional @get:Internal
@Input
val modelPackage = project.objects.property<String>() val modelPackage = project.objects.property<String>()
/** /**
* Prefix that will be prepended to all model names. Default is the empty string. * Prefix that will be prepended to all model names. Default is the empty string.
*/ */
@Optional @get:Internal
@Input
val modelNamePrefix = project.objects.property<String>() val modelNamePrefix = project.objects.property<String>()
/** /**
* Suffix that will be appended to all model names. Default is the empty string. * Suffix that will be appended to all model names. Default is the empty string.
*/ */
@Optional @get:Internal
@Input
val modelNameSuffix = project.objects.property<String>() val modelNameSuffix = project.objects.property<String>()
/** /**
* Sets instantiation type mappings. * Sets instantiation type mappings.
*/ */
@Optional @get:Internal
@Input
val instantiationTypes = project.objects.mapProperty<String, String>() val instantiationTypes = project.objects.mapProperty<String, String>()
/** /**
* Sets mappings between OpenAPI spec types and generated code types. * Sets mappings between OpenAPI spec types and generated code types.
*/ */
@Optional @get:Internal
@Input
val typeMappings = project.objects.mapProperty<String, String>() val typeMappings = project.objects.mapProperty<String, String>()
/** /**
* Sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. * Sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value.
* You can also have multiple occurrences of this option. * You can also have multiple occurrences of this option.
*/ */
@Optional @get:Internal
@Input
val additionalProperties = project.objects.mapProperty<String, String>() val additionalProperties = project.objects.mapProperty<String, String>()
/** /**
* Sets server variable for server URL template substitution, in the format of name=value,name=value. * Sets server variable for server URL template substitution, in the format of name=value,name=value.
* You can also have multiple occurrences of this option. * You can also have multiple occurrences of this option.
*/ */
@Optional @get:Internal
@Input
val serverVariables = project.objects.mapProperty<String, String>() val serverVariables = project.objects.mapProperty<String, String>()
/** /**
* Specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: String,boolean,Boolean,Double. * Specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: String,boolean,Boolean,Double.
*/ */
@Optional @get:Internal
@Input
val languageSpecificPrimitives = project.objects.listProperty<String>() val languageSpecificPrimitives = project.objects.listProperty<String>()
/** /**
* Specifies mappings between a given class and the import that should be used for that class. * Specifies mappings between a given class and the import that should be used for that class.
*/ */
@Optional @get:Internal
@Input
val importMappings = project.objects.mapProperty<String, String>() val importMappings = project.objects.mapProperty<String, String>()
/** /**
* Root package for generated code. * Root package for generated code.
*/ */
@Optional @get:Internal
@Input
val invokerPackage = project.objects.property<String>() val invokerPackage = project.objects.property<String>()
/** /**
* GroupId in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators. * GroupId in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators.
*/ */
@Optional @get:Internal
@Input
val groupId = project.objects.property<String>() val groupId = project.objects.property<String>()
/** /**
* ArtifactId in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators. * ArtifactId in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators.
*/ */
@Optional @get:Internal
@Input
val id = project.objects.property<String>() val id = project.objects.property<String>()
/** /**
* Artifact version in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators. * Artifact version in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators.
*/ */
@Optional @get:Internal
@Input
val version = project.objects.property<String>() val version = project.objects.property<String>()
/** /**
* Reference the library template (sub-template) of a generator. * Reference the library template (sub-template) of a generator.
*/ */
@Optional @get:Internal
@Input
val library = project.objects.property<String?>() val library = project.objects.property<String?>()
/** /**
* Git host, e.g. gitlab.com. * Git host, e.g. gitlab.com.
*/ */
@Optional @get:Internal
@Input
val gitHost = project.objects.property<String?>() val gitHost = project.objects.property<String?>()
/** /**
* Git user ID, e.g. openapitools. * Git user ID, e.g. openapitools.
*/ */
@Optional @get:Internal
@Input
val gitUserId = project.objects.property<String?>() val gitUserId = project.objects.property<String?>()
/** /**
* Git repo ID, e.g. openapi-generator. * Git repo ID, e.g. openapi-generator.
*/ */
@Optional @get:Internal
@Input
val gitRepoId = project.objects.property<String?>() val gitRepoId = project.objects.property<String?>()
/** /**
* Release note, default to 'Minor update'. * Release note, default to 'Minor update'.
*/ */
@Optional @get:Internal
@Input
val releaseNote = project.objects.property<String?>() val releaseNote = project.objects.property<String?>()
/** /**
* HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}' * HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'
*/ */
@Optional @get:Internal
@Input
val httpUserAgent = project.objects.property<String?>() val httpUserAgent = project.objects.property<String?>()
/** /**
* Specifies how a reserved name should be escaped to. * Specifies how a reserved name should be escaped to.
*/ */
@Optional @get:Internal
@Input
val reservedWordsMappings = project.objects.mapProperty<String, String>() val reservedWordsMappings = project.objects.mapProperty<String, String>()
/** /**
* Specifies an override location for the .openapi-generator-ignore file. Most useful on initial generation. * Specifies an override location for the .openapi-generator-ignore file. Most useful on initial generation.
*/ */
@Optional @get:Internal
@Input
val ignoreFileOverride = project.objects.property<String?>() val ignoreFileOverride = project.objects.property<String?>()
/** /**
* Remove prefix of operationId, e.g. config_getId => getId * Remove prefix of operationId, e.g. config_getId => getId
*/ */
@Optional @get:Internal
@Input
val removeOperationIdPrefix = project.objects.property<Boolean?>() val removeOperationIdPrefix = project.objects.property<Boolean?>()
/** /**
@@ -313,8 +271,7 @@ open class GenerateTask : DefaultTask() {
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation. * in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride]. * For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/ */
@Optional @get:Internal
@Input
val apiFilesConstrainedTo = project.objects.listProperty<String>() val apiFilesConstrainedTo = project.objects.listProperty<String>()
/** /**
@@ -324,8 +281,7 @@ open class GenerateTask : DefaultTask() {
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation. * in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride]. * For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/ */
@Optional @get:Internal
@Input
val modelFilesConstrainedTo = project.objects.listProperty<String>() val modelFilesConstrainedTo = project.objects.listProperty<String>()
/** /**
@@ -338,8 +294,7 @@ open class GenerateTask : DefaultTask() {
* in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation. * in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation.
* For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride]. * For more control over generation of individual files, configure an ignore file and refer to it via [ignoreFileOverride].
*/ */
@Optional @get:Internal
@Input
val supportingFilesConstrainedTo = project.objects.listProperty<String>() val supportingFilesConstrainedTo = project.objects.listProperty<String>()
/** /**
@@ -350,8 +305,7 @@ open class GenerateTask : DefaultTask() {
* For more control over generation of individual files, configure an ignore file and * For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride]. * refer to it via [ignoreFileOverride].
*/ */
@Optional @get:Internal
@Input
val generateModelTests = project.objects.property<Boolean>() val generateModelTests = project.objects.property<Boolean>()
/** /**
@@ -362,8 +316,7 @@ open class GenerateTask : DefaultTask() {
* For more control over generation of individual files, configure an ignore file and * For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride]. * refer to it via [ignoreFileOverride].
*/ */
@Optional @get:Internal
@Input
val generateModelDocumentation = project.objects.property<Boolean>() val generateModelDocumentation = project.objects.property<Boolean>()
/** /**
@@ -374,8 +327,7 @@ open class GenerateTask : DefaultTask() {
* For more control over generation of individual files, configure an ignore file and * For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride]. * refer to it via [ignoreFileOverride].
*/ */
@Optional @get:Internal
@Input
val generateApiTests = project.objects.property<Boolean>() val generateApiTests = project.objects.property<Boolean>()
/** /**
@@ -386,23 +338,21 @@ open class GenerateTask : DefaultTask() {
* For more control over generation of individual files, configure an ignore file and * For more control over generation of individual files, configure an ignore file and
* refer to it via [ignoreFileOverride]. * refer to it via [ignoreFileOverride].
*/ */
@Optional @get:Internal
@Input
val generateApiDocumentation = project.objects.property<Boolean>() val generateApiDocumentation = project.objects.property<Boolean>()
/** /**
* A special-case setting which configures some generators with XML support. In some cases, * A special-case setting which configures some generators with XML support. In some cases,
* this forces json OR xml, so the default here is false. * this forces json OR xml, so the default here is false.
*/ */
@Optional @get:Internal
@Input
val withXml = project.objects.property<Boolean>() val withXml = project.objects.property<Boolean>()
/** /**
* To write all log messages (not just errors) to STDOUT * To write all log messages (not just errors) to STDOUT
*/ */
@Optional @get:Internal
@Input
val logToStderr = project.objects.property<Boolean>() val logToStderr = project.objects.property<Boolean>()
/** /**
@@ -411,15 +361,13 @@ open class GenerateTask : DefaultTask() {
* LANG_POST_PROCESS_FILE (e.g. GO_POST_PROCESS_FILE, SCALA_POST_PROCESS_FILE). Please open an issue if your target * LANG_POST_PROCESS_FILE (e.g. GO_POST_PROCESS_FILE, SCALA_POST_PROCESS_FILE). Please open an issue if your target
* generator does not support this functionality. * generator does not support this functionality.
*/ */
@Optional @get:Internal
@Input
val enablePostProcessFile = project.objects.property<Boolean>() val enablePostProcessFile = project.objects.property<Boolean>()
/** /**
* To skip spec validation. When true, we will skip the default behavior of validating a spec before generation. * To skip spec validation. When true, we will skip the default behavior of validating a spec before generation.
*/ */
@Optional @get:Internal
@Input
val skipValidateSpec = project.objects.property<Boolean>() val skipValidateSpec = project.objects.property<Boolean>()
/** /**
@@ -427,22 +375,19 @@ open class GenerateTask : DefaultTask() {
* definitions generated as top-level Array-of-items, List-of-items, Map-of-items definitions. * definitions generated as top-level Array-of-items, List-of-items, Map-of-items definitions.
* When true, A model representation either containing or extending the array,list,map (depending on specific generator implementation) will be generated. * When true, A model representation either containing or extending the array,list,map (depending on specific generator implementation) will be generated.
*/ */
@Optional @get:Internal
@Input
val generateAliasAsModel = project.objects.property<Boolean>() val generateAliasAsModel = project.objects.property<Boolean>()
/** /**
* A dynamic map of options specific to a generator. * A dynamic map of options specific to a generator.
*/ */
@Optional @get:Internal
@Input
val configOptions = project.objects.mapProperty<String, String>() val configOptions = project.objects.mapProperty<String, String>()
/** /**
* Templating engine: "mustache" (default) or "handlebars" (beta) * Templating engine: "mustache" (default) or "handlebars" (beta)
*/ */
@Optional @get:Internal
@Input
val engine = project.objects.property<String?>() val engine = project.objects.property<String?>()
private fun <T : Any?> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) { private fun <T : Any?> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) {

View File

@@ -19,18 +19,15 @@ package org.openapitools.generator.gradle.plugin.tasks
import com.samskivert.mustache.Mustache import com.samskivert.mustache.Mustache
import org.gradle.api.DefaultTask import org.gradle.api.DefaultTask
import org.gradle.api.GradleException import org.gradle.api.GradleException
import org.gradle.api.tasks.CacheableTask import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskAction
import org.gradle.internal.logging.text.StyledTextOutput import org.gradle.internal.logging.text.StyledTextOutput
import org.gradle.internal.logging.text.StyledTextOutputFactory import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.gradle.kotlin.dsl.property import org.gradle.kotlin.dsl.property
import org.openapitools.codegen.CodegenConfig import org.openapitools.codegen.*
import org.openapitools.codegen.CodegenConstants import org.openapitools.codegen.api.TemplatePathLocator
import org.openapitools.codegen.SupportingFile
import org.openapitools.codegen.TemplateManager
import org.openapitools.codegen.templating.CommonTemplateContentLocator import org.openapitools.codegen.templating.CommonTemplateContentLocator
import org.openapitools.codegen.templating.GeneratorTemplateContentLocator
import org.openapitools.codegen.templating.MustacheEngineAdapter import org.openapitools.codegen.templating.MustacheEngineAdapter
import org.openapitools.codegen.templating.TemplateManagerOptions import org.openapitools.codegen.templating.TemplateManagerOptions
import java.io.File import java.io.File
@@ -42,16 +39,15 @@ import java.nio.charset.Charset
* *
* @author Jim Schubert * @author Jim Schubert
*/ */
@CacheableTask
open class MetaTask : DefaultTask() { open class MetaTask : DefaultTask() {
@get:Input @get:Internal
val generatorName = project.objects.property<String>() val generatorName = project.objects.property<String>()
@get:Input @get:Internal
val packageName = project.objects.property<String>() val packageName = project.objects.property<String>()
@get:OutputDirectory @get:Internal
val outputFolder = project.objects.property<String>() val outputFolder = project.objects.property<String>()
@Suppress("unused") @Suppress("unused")
@@ -96,9 +92,9 @@ open class MetaTask : DefaultTask() {
val outputFile = File(destinationFolder, it.destinationFilename) val outputFile = File(destinationFolder, it.destinationFilename)
val templateProcessor = TemplateManager( val templateProcessor = TemplateManager(
TemplateManagerOptions(false, false), TemplateManagerOptions(false, false),
MustacheEngineAdapter(), MustacheEngineAdapter(),
arrayOf(CommonTemplateContentLocator("codegen")) arrayOf(CommonTemplateContentLocator("codegen"))
) )
val template = templateProcessor.getFullTemplateContents(it.templateFile) val template = templateProcessor.getFullTemplateContents(it.templateFile)

View File

@@ -23,12 +23,7 @@ import io.swagger.v3.parser.core.models.ParseOptions
import org.gradle.api.DefaultTask import org.gradle.api.DefaultTask
import org.gradle.api.GradleException import org.gradle.api.GradleException
import org.gradle.api.logging.Logging import org.gradle.api.logging.Logging
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option import org.gradle.api.tasks.options.Option
import org.gradle.internal.logging.text.StyledTextOutput import org.gradle.internal.logging.text.StyledTextOutput
@@ -54,12 +49,10 @@ import org.openapitools.codegen.validations.oas.RuleConfiguration
* @author Jim Schubert * @author Jim Schubert
*/ */
open class ValidateTask : DefaultTask() { open class ValidateTask : DefaultTask() {
@get:InputFile @get:Internal
@PathSensitive(PathSensitivity.RELATIVE)
var inputSpec = project.objects.property<String>() var inputSpec = project.objects.property<String>()
@Optional @get:Internal
@Input
var recommend = project.objects.property<Boolean?>() var recommend = project.objects.property<Boolean?>()
@Suppress("unused") @Suppress("unused")
@@ -87,6 +80,7 @@ open class ValidateTask : DefaultTask() {
val messages = result.messages.toSet() val messages = result.messages.toSet()
val out = services.get(StyledTextOutputFactory::class.java).create("openapi") val out = services.get(StyledTextOutputFactory::class.java).create("openapi")
val ruleConfiguration = RuleConfiguration() val ruleConfiguration = RuleConfiguration()
ruleConfiguration.isEnableRecommendations = recommendations ruleConfiguration.isEnableRecommendations = recommendations

View File

@@ -7,7 +7,7 @@ import java.io.File
import kotlin.test.assertEquals import kotlin.test.assertEquals
import kotlin.test.assertTrue import kotlin.test.assertTrue
class GenerateTaskDslTest : TestBase() { class GenerateTaskDslTest : TestBase() {
override var temp: File = createTempDir(javaClass.simpleName) override var temp: File = createTempDir(javaClass.simpleName)
private val defaultBuildGradle = """ private val defaultBuildGradle = """
@@ -46,18 +46,18 @@ class GenerateTaskDslTest : TestBase() {
assertTrue(result.output.contains("Successfully generated code to"), "User friendly generate notice is missing.") assertTrue(result.output.contains("Successfully generated code to"), "User friendly generate notice is missing.")
listOf( listOf(
"build/kotlin/.openapi-generator-ignore", "build/kotlin/.openapi-generator-ignore",
"build/kotlin/docs/PetsApi.md", "build/kotlin/docs/PetsApi.md",
"build/kotlin/docs/Error.md", "build/kotlin/docs/Error.md",
"build/kotlin/docs/Pet.md", "build/kotlin/docs/Pet.md",
"build/kotlin/README.md", "build/kotlin/README.md",
"build/kotlin/build.gradle", "build/kotlin/build.gradle",
"build/kotlin/.openapi-generator/VERSION", "build/kotlin/.openapi-generator/VERSION",
"build/kotlin/settings.gradle", "build/kotlin/settings.gradle",
"build/kotlin/src/main/kotlin/org/openapitools/example/model/Pet.kt", "build/kotlin/src/main/kotlin/org/openapitools/example/model/Pet.kt",
"build/kotlin/src/main/kotlin/org/openapitools/example/model/Error.kt", "build/kotlin/src/main/kotlin/org/openapitools/example/model/Error.kt",
"build/kotlin/src/main/kotlin/org/openapitools/example/api/PetsApi.kt", "build/kotlin/src/main/kotlin/org/openapitools/example/api/PetsApi.kt",
"build/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt" "build/kotlin/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt"
).map { ).map {
val f = File(temp, it) val f = File(temp, it)
assertTrue(f.exists() && f.isFile, "An expected file was not generated when invoking the generation.") assertTrue(f.exists() && f.isFile, "An expected file was not generated when invoking the generation.")
@@ -67,61 +67,6 @@ class GenerateTaskDslTest : TestBase() {
"Expected a successful run, but found ${result.task(":openApiGenerate")?.outcome}") "Expected a successful run, but found ${result.task(":openApiGenerate")?.outcome}")
} }
@Test
fun `openApiGenerate should used up-to-date instead of regenerate`() {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
)
withProject(defaultBuildGradle, projectFiles)
// Act
val resultFirstRun = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate")
.withPluginClasspath()
.build()
val resultSecondRun = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate")
.withPluginClasspath()
.build()
// Assert
assertTrue(resultFirstRun.output.contains("Task ':openApiGenerate' is not up-to-date"), "First run should not be up-to-date")
assertTrue(resultSecondRun.output.contains("Task :openApiGenerate UP-TO-DATE"), "Task of second run should be up-to-date")
}
@Test
fun `openApiGenerate should use cache instead of regenerate`() {
// Arrange
val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
)
withProject(defaultBuildGradle, projectFiles)
// Act
val resultFirstRun = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate", "--build-cache")
.withPluginClasspath()
.build()
// delete the build directory from the last run
File(temp, "build/kotlin").deleteRecursively()
// re-run
val resultSecondRun = GradleRunner.create()
.withProjectDir(temp)
.withArguments("openApiGenerate", "--build-cache")
.withPluginClasspath()
.build()
// Assert
assertTrue(resultFirstRun.output.contains("Task ':openApiGenerate' is not up-to-date"), "First run should not be up-to-date")
assertTrue(resultSecondRun.output.contains("Task :openApiGenerate FROM-CACHE"), "Task of second run should be from cache")
}
@Test @Test
fun `openApiValidate should fail on invalid spec`() { fun `openApiValidate should fail on invalid spec`() {
// Arrange // Arrange
@@ -183,10 +128,10 @@ class GenerateTaskDslTest : TestBase() {
} }
@Test @Test
fun `openapiGenerate should attempt to set handlebars when specified as engine`() { fun `openapiGenerate should attempt to set handlebars when specified as engine`(){
// Arrange // Arrange
val projectFiles = mapOf( val projectFiles = mapOf(
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml") "spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
) )
withProject(""" withProject("""
@@ -206,16 +151,16 @@ class GenerateTaskDslTest : TestBase() {
// Act // Act
val result = GradleRunner.create() val result = GradleRunner.create()
.withProjectDir(temp) .withProjectDir(temp)
.withArguments("openApiGenerate", "--stacktrace") .withArguments("openApiGenerate", "--stacktrace")
.withPluginClasspath() .withPluginClasspath()
.buildAndFail() .buildAndFail()
// Assert // Assert
// rather than write out full handlebars generator templates, we'll just test that the configurator has set handlebars as the engine. // rather than write out full handlebars generator templates, we'll just test that the configurator has set handlebars as the engine.
assertTrue(result.output.contains("HandlebarsException"), "Stack should expose an exception for missing templates.") assertTrue(result.output.contains("HandlebarsException"), "Stack should expose an exception for missing templates.")
assertTrue(result.output.contains("handlebars"), "Build should have attempted to use handlebars.") assertTrue(result.output.contains("handlebars"), "Build should have attempted to use handlebars.")
assertEquals(TaskOutcome.FAILED, result.task(":openApiGenerate")?.outcome, assertEquals(TaskOutcome.FAILED, result.task(":openApiGenerate")?.outcome,
"Expected a failed run, but found ${result.task(":openApiGenerate")?.outcome}") "Expected a failed run, but found ${result.task(":openApiGenerate")?.outcome}")
} }
} }

View File

@@ -185,7 +185,7 @@
<properties> <properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version> <swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version> <jersey-version>2.27</jersey-version>
<jackson-version>2.9.10</jackson-version> <jackson-version>2.8.9</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version> <jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>

View File

@@ -224,7 +224,7 @@
<properties> <properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version> <swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version> <jersey-version>2.27</jersey-version>
<jackson-version>2.9.10</jackson-version> <jackson-version>2.8.9</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version> <jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>

View File

@@ -15,7 +15,7 @@
<properties> <properties>
<swagger-annotations-version>1.5.8</swagger-annotations-version> <swagger-annotations-version>1.5.8</swagger-annotations-version>
<jersey-version>2.27</jersey-version> <jersey-version>2.27</jersey-version>
<jackson-version>2.9.10</jackson-version> <jackson-version>2.8.9</jackson-version>
<jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version> <jackson-databind-nullable-version>0.2.0</jackson-databind-nullable-version>
<jodatime-version>2.7</jodatime-version> <jodatime-version>2.7</jodatime-version>
<maven-plugin-version>1.0.0</maven-plugin-version> <maven-plugin-version>1.0.0</maven-plugin-version>

View File

@@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId> <groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId> <artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION --> <!-- RELEASE_VERSION -->
<version>5.0.0-SNAPSHOT</version> <version>4.3.1-SNAPSHOT</version>
<!-- /RELEASE_VERSION --> <!-- /RELEASE_VERSION -->
<executions> <executions>
<execution> <execution>

View File

@@ -15,8 +15,8 @@
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<spring-boot-version>2.2.9.RELEASE</spring-boot-version> <spring-boot-version>2.0.7.RELEASE</spring-boot-version>
<springfox-version>3.0.0</springfox-version> <springfox-version>2.8.0</springfox-version>
<junit-version>4.13</junit-version> <junit-version>4.13</junit-version>
<jackson-version>2.10.2</jackson-version> <jackson-version>2.10.2</jackson-version>
</properties> </properties>
@@ -105,17 +105,13 @@
<version>${springfox-version}</version> <version>${springfox-version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
</exclusion> </exclusion>
<exclusion> <exclusion>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId> <artifactId>swagger-models</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>

View File

@@ -23,7 +23,6 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.filter.ForwardedHeaderFilter;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -61,9 +60,4 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
} }
}; };
} }
@Bean
ForwardedHeaderFilter forwardedHeaderFilter() {
return new ForwardedHeaderFilter();
}
} }

View File

@@ -22,7 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@WebMvcTest(GenApiController.class) @WebMvcTest(GenApiController.class)
public class GenApiControllerTest { public class GenApiControllerTest {
private static final String OPENAPI_URL = "https://raw.githubusercontent.com/OpenAPITools/openapi-generator/v4.3.1/modules/openapi-generator/src/test/resources/petstore.json"; private static final String OPENAPI_URL = "http://petstore.swagger.io/v2/swagger.json";
private static final String UUID_REGEX = "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89aAbB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}"; private static final String UUID_REGEX = "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[89aAbB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}";
@Autowired @Autowired
@@ -43,7 +43,7 @@ public class GenApiControllerTest {
public void getLanguages(String type, String expected) throws Exception { public void getLanguages(String type, String expected) throws Exception {
mockMvc.perform(get("/api/gen/" + type)) mockMvc.perform(get("/api/gen/" + type))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.[*]").value(hasItem(expected))); .andExpect(jsonPath("$.[*]").value(hasItem(expected)));
} }
@@ -72,7 +72,7 @@ public class GenApiControllerTest {
private void getOptions(String type, String name) throws Exception { private void getOptions(String type, String name) throws Exception {
mockMvc.perform(get("/api/gen/" + type + "/" + name)) mockMvc.perform(get("/api/gen/" + type + "/" + name))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.sortParamsByRequiredFlag.opt").value("sortParamsByRequiredFlag")); .andExpect(jsonPath("$.sortParamsByRequiredFlag.opt").value("sortParamsByRequiredFlag"));
} }
@@ -88,10 +88,10 @@ public class GenApiControllerTest {
private void generateAndDownload(String type, String name) throws Exception { private void generateAndDownload(String type, String name) throws Exception {
String result = mockMvc.perform(post("http://test.com:1234/api/gen/" + type + "/" + name) String result = mockMvc.perform(post("http://test.com:1234/api/gen/" + type + "/" + name)
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON_UTF8)
.content("{\"openAPIUrl\": \"" + OPENAPI_URL + "\"}")) .content("{\"openAPIUrl\": \"" + OPENAPI_URL + "\"}"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.code").value(matchesPattern(UUID_REGEX))) .andExpect(jsonPath("$.code").value(matchesPattern(UUID_REGEX)))
.andExpect(jsonPath("$.link").value(matchesPattern("http\\:\\/\\/test.com\\:1234\\/api\\/gen\\/download\\/" + UUID_REGEX))) .andExpect(jsonPath("$.link").value(matchesPattern("http\\:\\/\\/test.com\\:1234\\/api\\/gen\\/download\\/" + UUID_REGEX)))
.andReturn().getResponse().getContentAsString(); .andReturn().getResponse().getContentAsString();
@@ -107,13 +107,13 @@ public class GenApiControllerTest {
@Test @Test
public void generateWIthForwardedHeaders() throws Exception { public void generateWIthForwardedHeaders() throws Exception {
String result = mockMvc.perform(post("http://test.com:1234/api/gen/clients/java") String result = mockMvc.perform(post("http://test.com:1234/api/gen/clients/java")
.contentType(MediaType.APPLICATION_JSON) .contentType(MediaType.APPLICATION_JSON_UTF8)
.header("X-Forwarded-Proto", "https") .header("X-Forwarded-Proto", "https")
.header("X-Forwarded-Host", "forwarded.com") .header("X-Forwarded-Host", "forwarded.com")
.header("X-Forwarded-Port", "5678") .header("X-Forwarded-Port", "5678")
.content("{\"openAPIUrl\": \"" + OPENAPI_URL + "\"}")) .content("{\"openAPIUrl\": \"" + OPENAPI_URL + "\"}"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.code").value(matchesPattern(UUID_REGEX))) .andExpect(jsonPath("$.code").value(matchesPattern(UUID_REGEX)))
.andExpect(jsonPath("$.link").value(matchesPattern("https\\:\\/\\/forwarded.com\\:5678\\/api\\/gen\\/download\\/" + UUID_REGEX))) .andExpect(jsonPath("$.link").value(matchesPattern("https\\:\\/\\/forwarded.com\\:5678\\/api\\/gen\\/download\\/" + UUID_REGEX)))
.andReturn().getResponse().getContentAsString(); .andReturn().getResponse().getContentAsString();

View File

@@ -258,7 +258,6 @@
<diffutils-version>1.3.0</diffutils-version> <diffutils-version>1.3.0</diffutils-version>
<guava-version>26.0-jre</guava-version> <guava-version>26.0-jre</guava-version>
<generex-version>1.0.2</generex-version> <generex-version>1.0.2</generex-version>
<rxgen-version>1.1</rxgen-version>
<jackson-version>2.10.1</jackson-version> <jackson-version>2.10.1</jackson-version>
<jackson-threetenbp-version>2.10.0</jackson-threetenbp-version> <jackson-threetenbp-version>2.10.0</jackson-threetenbp-version>
<kotlin-version>1.3.60</kotlin-version> <kotlin-version>1.3.60</kotlin-version>
@@ -374,11 +373,6 @@
<artifactId>generex</artifactId> <artifactId>generex</artifactId>
<version>${generex-version}</version> <version>${generex-version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.curious-odd-man</groupId>
<artifactId>rgxgen</artifactId>
<version>${rxgen-version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId> <artifactId>jackson-datatype-jsr310</artifactId>

View File

@@ -174,8 +174,6 @@ public interface CodegenConfig {
String toModelImport(String name); String toModelImport(String name);
Map<String,String> toModelImportMap(String name);
String toApiImport(String name); String toApiImport(String name);
void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations); void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations);

View File

@@ -49,11 +49,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public Set<String> oneOf = new TreeSet<String>(); public Set<String> oneOf = new TreeSet<String>();
public Set<String> allOf = new TreeSet<String>(); public Set<String> allOf = new TreeSet<String>();
// The schema name as written in the OpenAPI document.
public String name; public String name;
// The language-specific name of the class that implements this schema. // The language-specific name of the class that implements this schema.
// The name of the class is derived from the OpenAPI schema name with formatting rules applied. // The name of the class is derived from the OpenAPI schema name with formatting rules applied.
// The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
public String classname; public String classname;
// The value of the 'title' attribute in the OpenAPI document. // The value of the 'title' attribute in the OpenAPI document.
public String title; public String title;
@@ -222,17 +220,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.classVarName = classVarName; this.classVarName = classVarName;
} }
/**
* Return true if the classname property is sanitized, false if it is the same as the OpenAPI schema name.
* The OpenAPI schema name may be any valid JSON schema name, including non-ASCII characters.
* The name of the class may have to be sanitized with character escaping.
*
* @return true if the classname property is sanitized
*/
public boolean getIsClassnameSanitized() {
return !classname.equals(name);
}
public String getClassname() { public String getClassname() {
return classname; return classname;
} }

View File

@@ -22,7 +22,6 @@ import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.Ticker; import com.github.benmanes.caffeine.cache.Ticker;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Mustache.Compiler; import com.samskivert.mustache.Mustache.Compiler;
import com.samskivert.mustache.Mustache.Lambda; import com.samskivert.mustache.Mustache.Lambda;
@@ -1368,16 +1367,6 @@ public class DefaultCodegen implements CodegenConfig {
} }
} }
/**
* Returns the same content as [[toModelImport]] with key the fully-qualified Model name and value the initial input.
* In case of union types this method has a key for each separate model and import.
* @param name the name of the "Model"
* @return Map of fully-qualified models.
*/
public Map<String,String> toModelImportMap(String name){
return Collections.singletonMap(this.toModelImport(name),name);
}
/** /**
* Return the fully-qualified "Api" name for import * Return the fully-qualified "Api" name for import
* *
@@ -1779,7 +1768,7 @@ public class DefaultCodegen implements CodegenConfig {
if (encoding != null) { if (encoding != null) {
codegenParameter.contentType = encoding.getContentType(); codegenParameter.contentType = encoding.getContentType();
} else { } else {
LOGGER.debug("encoding not specified for {}", codegenParameter.baseName); LOGGER.debug("encoding not specified for " + codegenParameter.baseName);
} }
} }
} }
@@ -1801,9 +1790,6 @@ public class DefaultCodegen implements CodegenConfig {
/** /**
* Return the default value of the property * Return the default value of the property
* *
* Return null if you do NOT want a default value.
* Any non-null value will cause {{#defaultValue} check to pass.
*
* @param schema Property schema * @param schema Property schema
* @return string presentation of the default value of the property * @return string presentation of the default value of the property
*/ */
@@ -1824,7 +1810,7 @@ public class DefaultCodegen implements CodegenConfig {
*/ */
@SuppressWarnings("squid:S3923") @SuppressWarnings("squid:S3923")
private String getPropertyDefaultValue(Schema schema) { private String getPropertyDefaultValue(Schema schema) {
/* /**
* Although all branches return null, this is left intentionally as examples for new contributors * Although all branches return null, this is left intentionally as examples for new contributors
*/ */
if (ModelUtils.isBooleanSchema(schema)) { if (ModelUtils.isBooleanSchema(schema)) {
@@ -1971,18 +1957,14 @@ public class DefaultCodegen implements CodegenConfig {
return "oneOf<" + String.join(",", names) + ">"; return "oneOf<" + String.join(",", names) + ">";
} }
protected Schema unaliasSchema(Schema schema, Map<String, String> usedImportMappings) {
return ModelUtils.unaliasSchema(this.openAPI, schema, usedImportMappings);
}
/** /**
* Return a string representation of the schema type, resolving aliasing and references if necessary. * Return a string representation of the schema type, resolving aliasing and references if necessary.
* *
* @param schema input * @param schema
* @return the string representation of the schema type. * @return the string representation of the schema type.
*/ */
protected String getSingleSchemaType(Schema schema) { private String getSingleSchemaType(Schema schema) {
Schema unaliasSchema = unaliasSchema(schema, importMapping); Schema unaliasSchema = ModelUtils.unaliasSchema(this.openAPI, schema, importMapping);
if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema if (StringUtils.isNotBlank(unaliasSchema.get$ref())) { // reference to another definition/schema
// get the schema/model name from $ref // get the schema/model name from $ref
@@ -2080,9 +2062,7 @@ public class DefaultCodegen implements CodegenConfig {
} else if (isAnyTypeSchema(schema)) { } else if (isAnyTypeSchema(schema)) {
return "AnyType"; return "AnyType";
} else if (StringUtils.isNotEmpty(schema.getType())) { } else if (StringUtils.isNotEmpty(schema.getType())) {
if (!importMapping.containsKey(schema.getType())) { LOGGER.warn("Unknown type found in the schema: " + schema.getType());
LOGGER.warn("Unknown type found in the schema: " + schema.getType());
}
return schema.getType(); return schema.getType();
} }
// The 'type' attribute has not been set in the OAS schema, which means the value // The 'type' attribute has not been set in the OAS schema, which means the value
@@ -2220,7 +2200,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
// unalias schema // unalias schema
schema = unaliasSchema(schema, importMapping); schema = ModelUtils.unaliasSchema(this.openAPI, schema, importMapping);
if (schema == null) { if (schema == null) {
LOGGER.warn("Schema {} not found", name); LOGGER.warn("Schema {} not found", name);
return null; return null;
@@ -2334,7 +2314,7 @@ public class DefaultCodegen implements CodegenConfig {
m.interfaces = new ArrayList<String>(); m.interfaces = new ArrayList<String>();
for (Schema interfaceSchema : interfaces) { for (Schema interfaceSchema : interfaces) {
interfaceSchema = unaliasSchema(interfaceSchema, importMapping); interfaceSchema = ModelUtils.unaliasSchema(this.openAPI, interfaceSchema, importMapping);
if (StringUtils.isBlank(interfaceSchema.get$ref())) { if (StringUtils.isBlank(interfaceSchema.get$ref())) {
// primitive type // primitive type
@@ -2534,11 +2514,7 @@ public class DefaultCodegen implements CodegenConfig {
// process 'additionalProperties' // process 'additionalProperties'
if (schema.getAdditionalProperties() == null) { if (schema.getAdditionalProperties() == null) {
if (disallowAdditionalPropertiesIfNotPresent) { m.isAdditionalPropertiesTrue = false; // TODO fix the old (incorrect) behaviour (likely with an option)
m.isAdditionalPropertiesTrue = false;
} else {
m.isAdditionalPropertiesTrue = true;
}
} else if (schema.getAdditionalProperties() instanceof Boolean) { } else if (schema.getAdditionalProperties() instanceof Boolean) {
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) { if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
m.isAdditionalPropertiesTrue = true; m.isAdditionalPropertiesTrue = true;
@@ -2995,7 +2971,7 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.debug("debugging fromProperty for " + name + " : " + p); LOGGER.debug("debugging fromProperty for " + name + " : " + p);
// unalias schema // unalias schema
p = unaliasSchema(p, importMapping); p = ModelUtils.unaliasSchema(this.openAPI, p, importMapping);
CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY); CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY);
@@ -3172,9 +3148,10 @@ public class DefaultCodegen implements CodegenConfig {
} else if (ModelUtils.isArraySchema(p)) { } else if (ModelUtils.isArraySchema(p)) {
// default to string if inner item is undefined // default to string if inner item is undefined
ArraySchema arraySchema = (ArraySchema) p; ArraySchema arraySchema = (ArraySchema) p;
Schema innerSchema = unaliasSchema(getSchemaItems(arraySchema), importMapping); Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getSchemaItems(arraySchema), importMapping);
} else if (ModelUtils.isMapSchema(p)) { } else if (ModelUtils.isMapSchema(p)) {
Schema innerSchema = unaliasSchema(getAdditionalProperties(p), importMapping); Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getAdditionalProperties(p),
importMapping);
if (innerSchema == null) { if (innerSchema == null) {
LOGGER.error("Undefined map inner type for `{}`. Default to String.", p.getName()); LOGGER.error("Undefined map inner type for `{}`. Default to String.", p.getName());
innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type"); innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type");
@@ -3254,7 +3231,7 @@ public class DefaultCodegen implements CodegenConfig {
itemName = property.name; itemName = property.name;
} }
ArraySchema arraySchema = (ArraySchema) p; ArraySchema arraySchema = (ArraySchema) p;
Schema innerSchema = unaliasSchema(getSchemaItems(arraySchema), importMapping); Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getSchemaItems(arraySchema), importMapping);
CodegenProperty cp = fromProperty(itemName, innerSchema); CodegenProperty cp = fromProperty(itemName, innerSchema);
updatePropertyForArray(property, cp); updatePropertyForArray(property, cp);
} else if (ModelUtils.isMapSchema(p)) { } else if (ModelUtils.isMapSchema(p)) {
@@ -3266,7 +3243,8 @@ public class DefaultCodegen implements CodegenConfig {
property.maxItems = p.getMaxProperties(); property.maxItems = p.getMaxProperties();
// handle inner property // handle inner property
Schema innerSchema = unaliasSchema(getAdditionalProperties(p), importMapping); Schema innerSchema = ModelUtils.unaliasSchema(this.openAPI, getAdditionalProperties(p),
importMapping);
if (innerSchema == null) { if (innerSchema == null) {
LOGGER.error("Undefined map inner type for `{}`. Default to String.", p.getName()); LOGGER.error("Undefined map inner type for `{}`. Default to String.", p.getName());
innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type"); innerSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to undefined type");
@@ -3506,7 +3484,7 @@ public class DefaultCodegen implements CodegenConfig {
CodegenOperation op, CodegenOperation op,
ApiResponse methodResponse, ApiResponse methodResponse,
Map<String, String> importMappings) { Map<String, String> importMappings) {
Schema responseSchema = unaliasSchema(ModelUtils.getSchemaFromResponse(methodResponse), importMapping); Schema responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(methodResponse), importMappings);
if (responseSchema != null) { if (responseSchema != null) {
CodegenProperty cm = fromProperty("response", responseSchema); CodegenProperty cm = fromProperty("response", responseSchema);
@@ -3910,7 +3888,8 @@ public class DefaultCodegen implements CodegenConfig {
} }
Schema responseSchema; Schema responseSchema;
if (this.openAPI != null && this.openAPI.getComponents() != null) { if (this.openAPI != null && this.openAPI.getComponents() != null) {
responseSchema = unaliasSchema(ModelUtils.getSchemaFromResponse(response), importMapping); responseSchema = ModelUtils.unaliasSchema(this.openAPI, ModelUtils.getSchemaFromResponse(response),
importMapping);
} else { // no model/alias defined } else { // no model/alias defined
responseSchema = ModelUtils.getSchemaFromResponse(response); responseSchema = ModelUtils.getSchemaFromResponse(response);
} }
@@ -4151,7 +4130,7 @@ public class DefaultCodegen implements CodegenConfig {
} }
if (parameterSchema != null) { if (parameterSchema != null) {
parameterSchema = unaliasSchema(parameterSchema, Collections.<String, String>emptyMap()); parameterSchema = ModelUtils.unaliasSchema(this.openAPI, parameterSchema);
if (parameterSchema == null) { if (parameterSchema == null) {
LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String"); LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String");
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition."); parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
@@ -4691,7 +4670,7 @@ public class DefaultCodegen implements CodegenConfig {
private Map<String, Schema> unaliasPropertySchema(Map<String, Schema> properties) { private Map<String, Schema> unaliasPropertySchema(Map<String, Schema> properties) {
if (properties != null) { if (properties != null) {
for (String key : properties.keySet()) { for (String key : properties.keySet()) {
properties.put(key, unaliasSchema(properties.get(key), importMapping())); properties.put(key, ModelUtils.unaliasSchema(this.openAPI, properties.get(key), importMapping()));
} }
} }
@@ -5327,7 +5306,7 @@ public class DefaultCodegen implements CodegenConfig {
if (var.defaultValue != null) { if (var.defaultValue != null) {
String enumName = null; String enumName = null;
final String enumDefaultValue; final String enumDefaultValue;
if ("string".equalsIgnoreCase(dataType)) { if (typeMapping.get("string").equalsIgnoreCase(dataType)) {
enumDefaultValue = toEnumValue(var.defaultValue, dataType); enumDefaultValue = toEnumValue(var.defaultValue, dataType);
} else { } else {
enumDefaultValue = var.defaultValue; enumDefaultValue = var.defaultValue;
@@ -5667,11 +5646,8 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.debug("debugging fromRequestBodyToFormParameters= " + body); LOGGER.debug("debugging fromRequestBodyToFormParameters= " + body);
Schema schema = ModelUtils.getSchemaFromRequestBody(body); Schema schema = ModelUtils.getSchemaFromRequestBody(body);
schema = ModelUtils.getReferencedSchema(this.openAPI, schema); schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
List<String> allRequired = new ArrayList<String>(); if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
Map<String, Schema> properties = new LinkedHashMap<>(); Map<String, Schema> properties = schema.getProperties();
addProperties(properties, allRequired, schema);
if (!properties.isEmpty()) {
for (Map.Entry<String, Schema> entry : properties.entrySet()) { for (Map.Entry<String, Schema> entry : properties.entrySet()) {
CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER); CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER);
// key => property name // key => property name
@@ -5816,7 +5792,7 @@ public class DefaultCodegen implements CodegenConfig {
return codegenParameter; return codegenParameter;
} }
protected void addBodyModelSchema(CodegenParameter codegenParameter, String name, Schema schema, Set<String> imports, String bodyParameterName, boolean forceSimpleRef) { private void addBodyModelSchema(CodegenParameter codegenParameter, String name, Schema schema, Set<String> imports, String bodyParameterName, boolean forceSimpleRef) {
CodegenModel codegenModel = null; CodegenModel codegenModel = null;
if (StringUtils.isNotBlank(name)) { if (StringUtils.isNotBlank(name)) {
schema.setName(name); schema.setName(name);
@@ -5926,7 +5902,7 @@ public class DefaultCodegen implements CodegenConfig {
if (ModelUtils.isMapSchema(schema)) { if (ModelUtils.isMapSchema(schema)) {
// Schema with additionalproperties: true (including composed schemas with additionalproperties: true) // Schema with additionalproperties: true (including composed schemas with additionalproperties: true)
if (ModelUtils.isGenerateAliasAsModel(schema) && StringUtils.isNotBlank(name)) { if (ModelUtils.isGenerateAliasAsModel() && StringUtils.isNotBlank(name)) {
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true); this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true);
} else { } else {
Schema inner = getAdditionalProperties(schema); Schema inner = getAdditionalProperties(schema);
@@ -5967,7 +5943,7 @@ public class DefaultCodegen implements CodegenConfig {
setParameterNullable(codegenParameter, codegenProperty); setParameterNullable(codegenParameter, codegenProperty);
} }
} else if (ModelUtils.isArraySchema(schema)) { } else if (ModelUtils.isArraySchema(schema)) {
if (ModelUtils.isGenerateAliasAsModel(schema) && StringUtils.isNotBlank(name)) { if (ModelUtils.isGenerateAliasAsModel() && StringUtils.isNotBlank(name)) {
this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true); this.addBodyModelSchema(codegenParameter, name, schema, imports, bodyParameterName, true);
} else { } else {
final ArraySchema arraySchema = (ArraySchema) schema; final ArraySchema arraySchema = (ArraySchema) schema;
@@ -6205,7 +6181,7 @@ public class DefaultCodegen implements CodegenConfig {
return codegenServerVariables; return codegenServerVariables;
} }
protected void setParameterNullable(CodegenParameter parameter, CodegenProperty property) { private void setParameterNullable(CodegenParameter parameter, CodegenProperty property) {
if (parameter == null || property == null) { if (parameter == null || property == null) {
return; return;
} }
@@ -6508,33 +6484,4 @@ public class DefaultCodegen implements CodegenConfig {
return ModelUtils.getAdditionalProperties(openAPI, schema); return ModelUtils.getAdditionalProperties(openAPI, schema);
} }
final protected static Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)application\\/json(;.*)?");
final protected static Pattern JSON_VENDOR_MIME_PATTERN = Pattern.compile("(?i)application\\/vnd.(.*)+json(;.*)?");
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
*
* @param mime MIME string
* @return true if the input matches the JSON MIME
*/
protected static boolean isJsonMimeType(String mime) {
return mime != null && (JSON_MIME_PATTERN.matcher(mime).matches());
}
/**
* Check if the given MIME is a JSON Vendor MIME.
* JSON MIME examples:
* application/vnd.mycompany+json
* application/vnd.mycompany.resourceA.version1+json
*
* @param mime MIME string
* @return true if the input matches the JSON vendor MIME
*/
protected static boolean isJsonVendorMimeType(String mime) {
return mime != null && JSON_VENDOR_MIME_PATTERN.matcher(mime).matches();
}
} }

View File

@@ -58,9 +58,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path; import java.nio.file.Path;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static org.apache.commons.lang3.StringUtils.removeStart;
import static org.openapitools.codegen.utils.OnceLogger.once; import static org.openapitools.codegen.utils.OnceLogger.once;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@@ -454,13 +452,13 @@ public class DefaultGenerator implements Generator {
// A composed schema (allOf, oneOf, anyOf) is considered a Map schema if the additionalproperties attribute is set // A composed schema (allOf, oneOf, anyOf) is considered a Map schema if the additionalproperties attribute is set
// for that composed schema. However, in the case of a composed schema, the properties are defined or referenced // for that composed schema. However, in the case of a composed schema, the properties are defined or referenced
// in the inner schemas, and the outer schema does not have properties. // in the inner schemas, and the outer schema does not have properties.
if (!ModelUtils.isGenerateAliasAsModel(schema) && !ModelUtils.isComposedSchema(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty())) { if (!ModelUtils.isGenerateAliasAsModel() && !ModelUtils.isComposedSchema(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty())) {
// schema without property, i.e. alias to map // schema without property, i.e. alias to map
LOGGER.info("Model {} not generated since it's an alias to map (without property) and `generateAliasAsModel` is set to false (default)", name); LOGGER.info("Model {} not generated since it's an alias to map (without property) and `generateAliasAsModel` is set to false (default)", name);
continue; continue;
} }
} else if (ModelUtils.isArraySchema(schema)) { // check to see if it's an "array" model } else if (ModelUtils.isArraySchema(schema)) { // check to see if it's an "array" model
if (!ModelUtils.isGenerateAliasAsModel(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty())) { if (!ModelUtils.isGenerateAliasAsModel() && (schema.getProperties() == null || schema.getProperties().isEmpty())) {
// schema without property, i.e. alias to array // schema without property, i.e. alias to array
LOGGER.info("Model {} not generated since it's an alias to array (without property) and `generateAliasAsModel` is set to false (default)", name); LOGGER.info("Model {} not generated since it's an alias to array (without property) and `generateAliasAsModel` is set to false (default)", name);
continue; continue;
@@ -1079,11 +1077,26 @@ public class DefaultGenerator implements Generator {
allImports.addAll(op.imports); allImports.addAll(op.imports);
} }
Map<String,String> mappings = getAllImportsMappings(allImports); List<Map<String, String>> imports = new ArrayList<>();
Set<Map<String, String>> imports = toImportsObjects(mappings); Set<String> mappingSet = new TreeSet<>();
for (String nextImport : allImports) {
Map<String, String> im = new LinkedHashMap<>();
String mapping = config.importMapping().get(nextImport);
if (mapping == null) {
mapping = config.toModelImport(nextImport);
}
//Some codegen implementations rely on a list interface for the imports if (mapping != null && !mappingSet.contains(mapping)) { // ensure import (mapping) is unique
operations.put("imports", imports.stream().collect(Collectors.toList())); mappingSet.add(mapping);
im.put("import", mapping);
im.put("classname", nextImport);
if (!imports.contains(im)) { // avoid duplicates
imports.add(im);
}
}
}
operations.put("imports", imports);
// add a flag to indicate whether there's any {{import}} // add a flag to indicate whether there's any {{import}}
if (imports.size() > 0) { if (imports.size() > 0) {
@@ -1102,49 +1115,6 @@ public class DefaultGenerator implements Generator {
return operations; return operations;
} }
/**
* Transforms a set of imports to a map with key config.toModelImport(import) and value the import string.
* @param allImports - Set of imports
* @return Map of fully qualified import path and initial import.
*/
private Map<String,String> getAllImportsMappings(Set<String> allImports){
Map<String,String> result = new HashMap<>();
allImports.forEach(nextImport->{
String mapping = config.importMapping().get(nextImport);
if(mapping!= null){
result.put(mapping,nextImport);
}else{
result.putAll(config.toModelImportMap(nextImport));
}
});
return result;
}
/**
* Using an import map created via {@link #getAllImportsMappings(Set)} to build a list import objects.
* The import objects have two keys: import and classname which hold the key and value of the initial map entry.
*
* @param mappedImports Map of fully qualified import and import
* @return The set of unique imports
*/
private Set<Map<String,String>> toImportsObjects(Map<String,String> mappedImports){
Set<Map<String, String>> result = new TreeSet<Map<String,String>>(
(Comparator<Map<String, String>>) (o1, o2) -> {
String s1 = o1.get("classname");
String s2 = o2.get("classname");
return s1.compareTo(s2);
}
);
mappedImports.entrySet().forEach(mapping->{
Map<String, String> im = new LinkedHashMap<>();
im.put("import", mapping.getKey());
im.put("classname", mapping.getValue());
result.add(im);
});
return result;
}
private Map<String, Object> processModels(CodegenConfig config, Map<String, Schema> definitions) { private Map<String, Object> processModels(CodegenConfig config, Map<String, Schema> definitions) {
Map<String, Object> objs = new HashMap<>(); Map<String, Object> objs = new HashMap<>();
objs.put("package", config.modelPackage()); objs.put("package", config.modelPackage());
@@ -1352,23 +1322,10 @@ public class DefaultGenerator implements Generator {
} }
}); });
// NOTE: Don't use File.separator here as we write linux-style paths to FILES, and File.separator will
// result in incorrect match on Windows machines.
String relativeMeta = METADATA_DIR + "/VERSION";
filesToSort.sort(PathFileComparator.PATH_COMPARATOR); filesToSort.sort(PathFileComparator.PATH_COMPARATOR);
filesToSort.forEach(f -> { filesToSort.forEach(f -> {
String tmp = outDir.toPath().relativize(f.toPath()).normalize().toString(); String relativePath = outDir.toPath().relativize(f.toPath()).toString();
// some Java implementations don't honor .relativize documentation fully. if (!relativePath.equals(METADATA_DIR + File.separator + "VERSION")) {
// When outDir is /a/b and the input is /a/b/c/d, the result should be c/d.
// Some implementations make the output ./c/d which seems to mix the logic
// as documented for symlinks. So we need to trim any / or ./ from the start,
// as nobody should be generating into system root and our expectation is no ./
String relativePath = removeStart(removeStart(tmp, "." + File.separator), File.separator);
if (File.separator.equals("\\")) {
// ensure that windows outputs same FILES format
relativePath = relativePath.replace(File.separator, "/");
}
if (!relativePath.equals(relativeMeta)) {
sb.append(relativePath).append(System.lineSeparator()); sb.append(relativePath).append(System.lineSeparator());
} }
}); });

View File

@@ -17,10 +17,6 @@
package org.openapitools.codegen; package org.openapitools.codegen;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.core.util.Json; import io.swagger.v3.core.util.Json;
import io.swagger.v3.oas.models.*; import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.callbacks.Callback;
@@ -29,7 +25,6 @@ import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.responses.ApiResponses; import io.swagger.v3.oas.models.responses.ApiResponses;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -41,17 +36,6 @@ public class InlineModelResolver {
private OpenAPI openapi; private OpenAPI openapi;
private Map<String, Schema> addedModels = new HashMap<String, Schema>(); private Map<String, Schema> addedModels = new HashMap<String, Schema>();
private Map<String, String> generatedSignature = new HashMap<String, String>(); private Map<String, String> generatedSignature = new HashMap<String, String>();
// structure mapper sorts properties alphabetically on write to ensure models are
// serialized consistently for lookup of existing models
private static ObjectMapper structureMapper;
static {
structureMapper = Json.mapper().copy();
structureMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
structureMapper.writer(new DefaultPrettyPrinter());
}
static Logger LOGGER = LoggerFactory.getLogger(InlineModelResolver.class); static Logger LOGGER = LoggerFactory.getLogger(InlineModelResolver.class);
void flatten(OpenAPI openapi) { void flatten(OpenAPI openapi) {
@@ -504,25 +488,15 @@ public class InlineModelResolver {
} }
private String matchGenerated(Schema model) { private String matchGenerated(Schema model) {
try { String json = Json.pretty(model);
String json = structureMapper.writeValueAsString(model); if (generatedSignature.containsKey(json)) {
if (generatedSignature.containsKey(json)) { return generatedSignature.get(json);
return generatedSignature.get(json);
}
} catch (JsonProcessingException e) {
e.printStackTrace();
} }
return null; return null;
} }
private void addGenerated(String name, Schema model) { private void addGenerated(String name, Schema model) {
try { generatedSignature.put(Json.pretty(model), name);
String json = structureMapper.writeValueAsString(model);
generatedSignature.put(json, name);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
} }
/** /**
@@ -646,45 +620,13 @@ public class InlineModelResolver {
} }
XML xml = object.getXml(); XML xml = object.getXml();
Map<String, Schema> properties = object.getProperties(); Map<String, Schema> properties = object.getProperties();
// NOTE:
// No need to null check setters below. All defaults in the new'd Schema are null, so setting to null would just be a noop.
Schema model = new Schema(); Schema model = new Schema();
model.setType(object.getType());
// Even though the `format` keyword typically applies to primitive types only,
// the JSON schema specification states `format` can be used for any model type instance
// including object types.
model.setFormat(object.getFormat());
model.setDescription(description); model.setDescription(description);
model.setExample(example); model.setExample(example);
model.setName(object.getName()); model.setName(object.getName());
model.setXml(xml); model.setXml(xml);
model.setRequired(object.getRequired()); model.setRequired(object.getRequired());
model.setNullable(object.getNullable()); model.setNullable(object.getNullable());
model.setDiscriminator(object.getDiscriminator());
model.setWriteOnly(object.getWriteOnly());
model.setUniqueItems(object.getUniqueItems());
model.setTitle(object.getTitle());
model.setReadOnly(object.getReadOnly());
model.setPattern(object.getPattern());
model.setNot(object.getNot());
model.setMinProperties(object.getMinProperties());
model.setMinLength(object.getMinLength());
model.setMinItems(object.getMinItems());
model.setMinimum(object.getMinimum());
model.setMaxProperties(object.getMaxProperties());
model.setMaxLength(object.getMaxLength());
model.setMaxItems(object.getMaxItems());
model.setMaximum(object.getMaximum());
model.setExternalDocs(object.getExternalDocs());
model.setExtensions(object.getExtensions());
model.setExclusiveMinimum(object.getExclusiveMinimum());
model.setExclusiveMaximum(object.getExclusiveMaximum());
model.setExample(object.getExample());
model.setDeprecated(object.getDeprecated());
if (properties != null) { if (properties != null) {
flattenProperties(openAPI, properties, path); flattenProperties(openAPI, properties, path);
model.setProperties(properties); model.setProperties(properties);

View File

@@ -657,19 +657,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
} }
} }
// check if the payload is json and set x-is-json accordingly
if (operation.consumes != null) {
for (Map<String, String> consume : operation.consumes) {
if (consume.containsKey("mediaType")) {
if (isJsonMimeType(consume.get("mediaType"))) {
operation.vendorExtensions.put("x-is-json", true);
break;
}
}
}
}
if (operation.examples != null) { if (operation.examples != null) {
for (Map<String, String> example : operation.examples) { for (Map<String, String> example : operation.examples) {
for (Map.Entry<String, String> entry : example.entrySet()) { for (Map.Entry<String, String> entry : example.entrySet()) {

View File

@@ -469,7 +469,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty"); importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty");
importMapping.put("JsonSubTypes", "com.fasterxml.jackson.annotation.JsonSubTypes"); importMapping.put("JsonSubTypes", "com.fasterxml.jackson.annotation.JsonSubTypes");
importMapping.put("JsonTypeInfo", "com.fasterxml.jackson.annotation.JsonTypeInfo"); importMapping.put("JsonTypeInfo", "com.fasterxml.jackson.annotation.JsonTypeInfo");
importMapping.put("JsonTypeName", "com.fasterxml.jackson.annotation.JsonTypeName");
importMapping.put("JsonCreator", "com.fasterxml.jackson.annotation.JsonCreator"); importMapping.put("JsonCreator", "com.fasterxml.jackson.annotation.JsonCreator");
importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue"); importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue");
importMapping.put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore"); importMapping.put("JsonIgnore", "com.fasterxml.jackson.annotation.JsonIgnore");
@@ -798,7 +797,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
Schema<?> items = getSchemaItems((ArraySchema) schema); Schema<?> items = getSchemaItems((ArraySchema) schema);
String typeDeclaration = getTypeDeclaration(ModelUtils.unaliasSchema(this.openAPI, items)); String typeDeclaration = getTypeDeclaration(items);
Object java8obj = additionalProperties.get("java8"); Object java8obj = additionalProperties.get("java8");
if (java8obj != null) { if (java8obj != null) {
Boolean java8 = Boolean.valueOf(java8obj.toString()); Boolean java8 = Boolean.valueOf(java8obj.toString());
@@ -809,13 +808,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return String.format(Locale.ROOT, pattern, typeDeclaration); return String.format(Locale.ROOT, pattern, typeDeclaration);
} else if (ModelUtils.isMapSchema(schema) && !(schema instanceof ComposedSchema)) { } else if (ModelUtils.isMapSchema(schema) && !(schema instanceof ComposedSchema)) {
if (schema.getProperties() != null && schema.getProperties().size() > 0) {
// object is complex object with free-form additional properties
if (schema.getDefault() != null) {
return super.toDefaultValue(schema);
}
return null;
}
final String pattern; final String pattern;
if (fullJavaUtil) { if (fullJavaUtil) {
pattern = "new java.util.HashMap<%s>()"; pattern = "new java.util.HashMap<%s>()";

View File

@@ -17,8 +17,6 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.ComposedSchema; import io.swagger.v3.oas.models.media.ComposedSchema;
@@ -37,7 +35,6 @@ import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -133,8 +130,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
"File", "File",
"Error", "Error",
"Map", "Map",
"object", "object"
"Set"
)); ));
languageGenericTypes = new HashSet<>(Collections.singletonList( languageGenericTypes = new HashSet<>(Collections.singletonList(
@@ -144,8 +140,6 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
instantiationTypes.put("array", "Array"); instantiationTypes.put("array", "Array");
typeMapping = new HashMap<String, String>(); typeMapping = new HashMap<String, String>();
typeMapping.put("Set", "Set");
typeMapping.put("set", "Set");
typeMapping.put("Array", "Array"); typeMapping.put("Array", "Array");
typeMapping.put("array", "Array"); typeMapping.put("array", "Array");
typeMapping.put("boolean", "boolean"); typeMapping.put("boolean", "boolean");
@@ -227,47 +221,6 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
} }
} }
@Override
public String toModelImport( String name){
if(isUnionType(name)){
LOGGER.warn("The import is a union type. Consider using the toModelImportMap method.");
return toModelImportMap(name).values().stream().collect(Collectors.joining("|"));
}
return super.toModelImport(name);
}
/**
* Maps the fully qualified model import to the initial given name. In case of union types the map will have multiple entries.
* For example for "classA | classB" the map will two entries have ["model.classA","classA"] and ["model.classB","classB"].
*
* @param name the name of the "Model"
* @return Map between the fully qualified model import and the initial given name.
*/
@Override
public Map<String,String> toModelImportMap( String name){
if(isUnionType(name)){
String[] names = splitUnionType(name);
return toImportMap(names);
}
return toImportMap(name);
}
private boolean isUnionType(String name){
return name.contains("|");
}
private String[] splitUnionType(String name){
return name.replace(" ","").split("\\|");
}
private Map<String,String> toImportMap(String... names){
Map<String,String> result = Maps.newHashMap();
for(String name: names){
result.put(toModelImport(name),name);
}
return result;
}
@Override @Override
public void preprocessOpenAPI(OpenAPI openAPI) { public void preprocessOpenAPI(OpenAPI openAPI) {
@@ -893,7 +846,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
*/ */
protected List<String> getTypesFromSchemas(List<Schema> schemas) { protected List<String> getTypesFromSchemas(List<Schema> schemas) {
List<Schema> filteredSchemas = schemas.size() > 1 List<Schema> filteredSchemas = schemas.size() > 1
? schemas.stream().filter(schema -> !"AnyType".equals(super.getSchemaType(schema))).collect(Collectors.toList()) ? schemas.stream().filter(schema -> super.getSchemaType(schema) != "AnyType").collect(Collectors.toList())
: schemas; : schemas;
return filteredSchemas.stream().map(schema -> { return filteredSchemas.stream().map(schema -> {

View File

@@ -69,8 +69,8 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
protected String serverHost = "0.0.0.0"; protected String serverHost = "0.0.0.0";
protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbuckle version: 3.0.0, 4.0.0, 5.0.0"); protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbuckle version: 3.0.0, 4.0.0, 5.0.0");
protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)"); protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)");
private CliOption classModifier = new CliOption(CLASS_MODIFIER, "Class Modifier for controller classes: Empty string or abstract."); private CliOption classModifier = new CliOption(CLASS_MODIFIER, "Class Modifier can be empty, abstract");
private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual or abstract"); private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual, abstract or partial");
private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial"); private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial");
private boolean generateBody = true; private boolean generateBody = true;
private CliOption buildTarget = new CliOption("buildTarget", "Target to build an application or library"); private CliOption buildTarget = new CliOption("buildTarget", "Target to build an application or library");

View File

@@ -604,7 +604,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
} }
for (final CodegenProperty property : codegenModel.readWriteVars) { for (final CodegenProperty property : codegenModel.readWriteVars) {
if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.name.equals(parentCodegenModel.discriminator.getPropertyName())) { if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.baseName.equals(parentCodegenModel.discriminator.getPropertyName())) {
property.defaultValue = "\"" + name + "\""; property.defaultValue = "\"" + name + "\"";
} }
} }

View File

@@ -299,7 +299,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
} }
for (final CodegenProperty property : codegenModel.readWriteVars) { for (final CodegenProperty property : codegenModel.readWriteVars) {
if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.name.equals(parentCodegenModel.discriminator.getPropertyName())) { if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.baseName.equals(parentCodegenModel.discriminator.getPropertyName())) {
property.defaultValue = "\"" + name + "\""; property.defaultValue = "\"" + name + "\"";
} }
} }
@@ -343,6 +343,8 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
return "Generates a C# client library (.NET Standard, .NET Core)."; return "Generates a C# client library (.NET Standard, .NET Core).";
} }
// private void syncStringProperty(Map<String, Object> properties, String key)
public String getModelPropertyNaming() { public String getModelPropertyNaming() {
return this.modelPropertyNaming; return this.modelPropertyNaming;
} }
@@ -474,7 +476,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
+ "/pattern/modifiers convention. " + pattern + " is not valid."); + "/pattern/modifiers convention. " + pattern + " is not valid.");
} }
String regex = pattern.substring(1, i).replace("'", "\'").replace("\"", "\"\""); String regex = pattern.substring(1, i).replace("'", "\'");
List<String> modifiers = new ArrayList<String>(); List<String> modifiers = new ArrayList<String>();
// perl requires an explicit modifier to be culture specific and .NET is the reverse. // perl requires an explicit modifier to be culture specific and .NET is the reverse.
@@ -610,13 +612,10 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", clientPackageDir, "OpenAPIDateConverter.cs")); supportingFiles.add(new SupportingFile("OpenAPIDateConverter.mustache", clientPackageDir, "OpenAPIDateConverter.cs"));
supportingFiles.add(new SupportingFile("ClientUtils.mustache", clientPackageDir, "ClientUtils.cs")); supportingFiles.add(new SupportingFile("ClientUtils.mustache", clientPackageDir, "ClientUtils.cs"));
supportingFiles.add(new SupportingFile("HttpMethod.mustache", clientPackageDir, "HttpMethod.cs")); supportingFiles.add(new SupportingFile("HttpMethod.mustache", clientPackageDir, "HttpMethod.cs"));
if (supportsAsync) { supportingFiles.add(new SupportingFile("IAsynchronousClient.mustache", clientPackageDir, "IAsynchronousClient.cs"));
supportingFiles.add(new SupportingFile("IAsynchronousClient.mustache", clientPackageDir, "IAsynchronousClient.cs"));
}
supportingFiles.add(new SupportingFile("ISynchronousClient.mustache", clientPackageDir, "ISynchronousClient.cs")); supportingFiles.add(new SupportingFile("ISynchronousClient.mustache", clientPackageDir, "ISynchronousClient.cs"));
supportingFiles.add(new SupportingFile("RequestOptions.mustache", clientPackageDir, "RequestOptions.cs")); supportingFiles.add(new SupportingFile("RequestOptions.mustache", clientPackageDir, "RequestOptions.cs"));
supportingFiles.add(new SupportingFile("Multimap.mustache", clientPackageDir, "Multimap.cs")); supportingFiles.add(new SupportingFile("Multimap.mustache", clientPackageDir, "Multimap.cs"));
supportingFiles.add(new SupportingFile("RetryConfiguration.mustache", clientPackageDir, "RetryConfiguration.cs"));
supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache", supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache",
clientPackageDir, "IReadableConfiguration.cs")); clientPackageDir, "IReadableConfiguration.cs"));
@@ -640,8 +639,6 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj")); supportingFiles.add(new SupportingFile("netcore_testproject.mustache", testPackageFolder, testPackageName + ".csproj"));
} }
supportingFiles.add(new SupportingFile("appveyor.mustache", "", "appveyor.yml"));
additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath); additionalProperties.put("modelDocPath", modelDocPath);
} }

Some files were not shown because too many files have changed in this diff Show More