mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-02 06:50:53 +00:00
Merge remote-tracking branch 'origin/5.3.x' into 6.0.x
This commit is contained in:
commit
35f933b27f
@ -82,7 +82,6 @@ jobs:
|
||||
- ~/.bundle
|
||||
- ~/.go_workspace
|
||||
- ~/.gradle
|
||||
- ~/.pub-cache
|
||||
- ~/.cache/bower
|
||||
- ".git"
|
||||
- ~/.stack
|
||||
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1 +1,2 @@
|
||||
**/*.mustache linguist-vendored=true
|
||||
* text=auto eol=lf
|
||||
|
19
.github/actions/run-samples/action.yaml
vendored
Normal file
19
.github/actions/run-samples/action.yaml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: 'Run samples'
|
||||
description: 'Runs sample integration test profile with Maven'
|
||||
inputs:
|
||||
name:
|
||||
description: 'The Maven profile name'
|
||||
required: true
|
||||
goal:
|
||||
description: 'Maven goal'
|
||||
required: false
|
||||
default: 'verify'
|
||||
args:
|
||||
description: 'Additional maven arguments'
|
||||
required: false
|
||||
default: ''
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: mvn --no-snapshot-updates --batch-mode --quiet ${{ inputs.goal }} -P${{ inputs.name }} -Dintegration-test -Dmaven.javadoc.skip=true ${{ inputs.args }}
|
||||
shell: bash
|
14
.github/workflows/check-supported-versions.yaml
vendored
14
.github/workflows/check-supported-versions.yaml
vendored
@ -29,14 +29,14 @@ jobs:
|
||||
distribution: 'adopt'
|
||||
java-version: ${{ matrix.java }}
|
||||
|
||||
- uses: actions/cache@v2.1.5
|
||||
- uses: actions/cache@v2.1.6
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
|
||||
- uses: actions/cache@v2.1.5
|
||||
- uses: actions/cache@v2.1.6
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
@ -50,7 +50,7 @@ jobs:
|
||||
run: mvn -nsu -B --quiet -Djacoco.skip=true -Dorg.slf4j.simpleLogger.defaultLogLevel=error --no-transfer-progress clean install --file pom.xml ${{ matrix.flags }}
|
||||
|
||||
- name: Upload Maven build artifact
|
||||
uses: actions/upload-artifact@v2.2.3
|
||||
uses: actions/upload-artifact@v2.2.4
|
||||
if: matrix.java == '8' && matrix.os == 'ubuntu-latest'
|
||||
with:
|
||||
name: artifact
|
||||
@ -81,7 +81,7 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v2.0.8
|
||||
uses: actions/download-artifact@v2.0.10
|
||||
with:
|
||||
name: artifact
|
||||
- name: Run Ensures Script
|
||||
@ -90,6 +90,6 @@ jobs:
|
||||
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 }}
|
||||
mvn clean package -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
|
||||
# test with java (jersey2) client generation only as ensure-uptodate script is run in another job instead
|
||||
./bin/generate-samples.sh ./bin/configs/java-jersey2-8.yaml
|
||||
|
19
.github/workflows/openapi-generator-test-results.yaml
vendored
Normal file
19
.github/workflows/openapi-generator-test-results.yaml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: OpenAPI Generator Test Report
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ['OpenAPI Generator']
|
||||
types:
|
||||
- completed
|
||||
|
||||
# separate workflow required due to https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories
|
||||
jobs:
|
||||
report:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dorny/test-reporter@v1
|
||||
with:
|
||||
artifact: surefire-test-results
|
||||
name: JUnit Test results
|
||||
path: '**/surefire-reports/TEST-*.xml'
|
||||
reporter: java-junit
|
214
.github/workflows/openapi-generator.yaml
vendored
Normal file
214
.github/workflows/openapi-generator.yaml
vendored
Normal file
@ -0,0 +1,214 @@
|
||||
name: OpenAPI Generator
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- '[5-9]+.[0-9]+.x'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- '[5-9]+.[0-9]+.x'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: cache-maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
~/.gradle
|
||||
!~/.gradle/caches/*/plugin-resolution/
|
||||
!~/.m2/repository/org/openapitools/
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
- name: Run maven
|
||||
run: mvn --no-snapshot-updates --batch-mode --quiet install -DskipTests -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- run: ls -la modules/openapi-generator-cli/target
|
||||
- name: Upload openapi-generator-cli.jar artifact
|
||||
uses: actions/upload-artifact@v2.2.4
|
||||
with:
|
||||
name: openapi-generator-cli.jar
|
||||
path: modules/openapi-generator-cli/target/openapi-generator-cli.jar
|
||||
retention-days: 1
|
||||
|
||||
test:
|
||||
name: Unit tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: cache-maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
~/.gradle
|
||||
!~/.gradle/caches/*/plugin-resolution/
|
||||
!~/.m2/repository/org/openapitools/
|
||||
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
- name: Run unit tests
|
||||
run: mvn --no-snapshot-updates --batch-mode --quiet --fail-at-end test -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- name: Publish unit test reports
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v2.2.4
|
||||
with:
|
||||
name: surefire-test-results
|
||||
path: '**/surefire-reports/TEST-*.xml'
|
||||
|
||||
documentation:
|
||||
name: Docs up-to-date
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
- name: Download openapi-generator-cli.jar artifact
|
||||
uses: actions/download-artifact@v2.0.10
|
||||
with:
|
||||
name: openapi-generator-cli.jar
|
||||
path: modules/openapi-generator-cli/target
|
||||
- name: Generate docs
|
||||
run: |
|
||||
bash bin/meta-codegen.sh
|
||||
bash bin/utils/export_docs_generators.sh
|
||||
bash bin/utils/copy-to-website.sh
|
||||
bash bin/utils/export_generators_readme.sh
|
||||
- name: Verify git status
|
||||
run: |
|
||||
if [[ "$(git status --porcelain)" != "" ]]; then
|
||||
echo "UNCOMMITTED CHANGES ERROR"
|
||||
echo "There are uncommitted changes in working tree after execution of 'bin/ensure-up-to-date'"
|
||||
echo "Perform git diff"
|
||||
git --no-pager diff
|
||||
echo "Perform git status"
|
||||
git status
|
||||
echo -e "\nThis script runs in pull requests against the anticipated merge commit (as if the PR was merged now)."
|
||||
echo "When you see unexpected files here, it likely means that there are newer commits in master that you need to "
|
||||
echo -e "rebase or merge into your branch.\n"
|
||||
echo "Please run 'bin/utils/ensure-up-to-date' locally and commit changes (UNCOMMITTED CHANGES ERROR)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
samples:
|
||||
name: Samples up-to-date
|
||||
needs:
|
||||
- build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
- name: Download openapi-generator-cli.jar artifact
|
||||
uses: actions/download-artifact@v2.0.10
|
||||
with:
|
||||
name: openapi-generator-cli.jar
|
||||
path: modules/openapi-generator-cli/target
|
||||
- name: Generate samples
|
||||
run: bash bin/generate-samples.sh
|
||||
- name: Verify git status
|
||||
run: |
|
||||
if [[ "$(git status --porcelain)" != "" ]]; then
|
||||
echo "UNCOMMITTED CHANGES ERROR"
|
||||
echo "There are uncommitted changes in working tree after execution of 'bin/generate-samples.sh'"
|
||||
echo "Perform git diff"
|
||||
git --no-pager diff
|
||||
echo "Perform git status"
|
||||
git status
|
||||
echo -e "\nThis script runs in pull requests against the anticipated merge commit (as if the PR was merged now)."
|
||||
echo "When you see unexpected files here, it likely means that there are newer commits in master that you need to "
|
||||
echo -e "rebase or merge into your branch.\n"
|
||||
echo "Please run 'bin/generate-samples.sh' locally and commit changes (UNCOMMITTED CHANGES ERROR)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test-maven-plugin:
|
||||
name: Maven plugin tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: cache-maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
~/.gradle
|
||||
!~/.gradle/caches/*/plugin-resolution/
|
||||
!~/.m2/repository/org/openapitools/
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-test-maven-plugin-${{ env.cache-name }}-
|
||||
${{ runner.os }}-test-maven-plugin-
|
||||
- name: Run tests
|
||||
run: |
|
||||
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:
|
||||
name: Gradle plugin tests
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: cache-maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
~/.gradle
|
||||
!~/.gradle/caches/modules-2/modules-2.lock
|
||||
!~/.gradle/caches/*/plugin-resolution/
|
||||
!~/.m2/repository/org/openapitools/
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-test-gradle-plugin-${{ env.cache-name }}-
|
||||
${{ runner.os }}-test-gradle-plugin-
|
||||
- name: Run tests
|
||||
run: |
|
||||
(cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
|
||||
(cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
|
80
.github/workflows/samples-dart.yaml
vendored
Normal file
80
.github/workflows/samples-dart.yaml
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
name: Samples Dart
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- '[5-9]+.[0-9]+.x'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- '[5-9]+.[0-9]+.x'
|
||||
paths:
|
||||
- 'samples/openapi3/client/petstore/dart*/**'
|
||||
|
||||
jobs:
|
||||
tests-dart-2-10:
|
||||
name: Tests Dart 2.10
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 8
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
~/.gradle
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Cache test dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: pub-cache
|
||||
with:
|
||||
path: $PUB_CACHE
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('samples/**/pubspec.yaml') }}
|
||||
- uses: dart-lang/setup-dart@v1
|
||||
with:
|
||||
sdk: 2.10.5
|
||||
- name: Run tests
|
||||
uses: ./.github/actions/run-samples
|
||||
with:
|
||||
name: samples.dart-2.10
|
||||
|
||||
tests-dart-2-13:
|
||||
name: Tests Dart 2.13
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 8
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository
|
||||
~/.gradle
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Cache test dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: pub-cache
|
||||
with:
|
||||
path: $PUB_CACHE
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('samples/**/pubspec.yaml') }}
|
||||
- uses: dart-lang/setup-dart@v1
|
||||
with:
|
||||
sdk: 2.13.0
|
||||
- name: Run tests
|
||||
uses: ./.github/actions/run-samples
|
||||
with:
|
||||
name: samples.dart-2.13
|
66
.github/workflows/samples-kotlin.yaml
vendored
Normal file
66
.github/workflows/samples-kotlin.yaml
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
name: Samples Kotlin
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- '[5-9]+.[0-9]+.x'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- '[5-9]+.[0-9]+.x'
|
||||
paths:
|
||||
- 'samples/client/petstore/kotlin*/**'
|
||||
|
||||
env:
|
||||
GRADLE_VERSION: 6.9
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Kotlin
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sample:
|
||||
- samples/client/petstore/kotlin
|
||||
- samples/client/petstore/kotlin-gson
|
||||
- samples/client/petstore/kotlin-jackson
|
||||
# needs Android configured
|
||||
#- samples/client/petstore/kotlin-json-request-string
|
||||
- samples/client/petstore/kotlin-jvm-okhttp4-coroutines
|
||||
- samples/client/petstore/kotlin-moshi-codegen
|
||||
# need some special setup
|
||||
#- samples/client/petstore/kotlin-multiplatform
|
||||
- samples/client/petstore/kotlin-nonpublic
|
||||
- samples/client/petstore/kotlin-nullable
|
||||
- samples/client/petstore/kotlin-okhttp3
|
||||
- samples/client/petstore/kotlin-retrofit2
|
||||
- samples/client/petstore/kotlin-retrofit2-kotlinx_serialization
|
||||
- samples/client/petstore/kotlin-retrofit2-rx3
|
||||
- samples/client/petstore/kotlin-string
|
||||
- samples/client/petstore/kotlin-threetenbp
|
||||
- samples/client/petstore/kotlin-uppercase-enum
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: 8
|
||||
- name: Cache maven dependencies
|
||||
uses: actions/cache@v2.1.6
|
||||
env:
|
||||
cache-name: maven-repository
|
||||
with:
|
||||
path: |
|
||||
~/.gradle
|
||||
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Install Gradle wrapper
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
gradle-version: ${{ env.GRADLE_VERSION }}
|
||||
build-root-directory: ${{ matrix.sample }}
|
||||
arguments: wrapper
|
||||
- name: Build
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: ./gradlew build -x test
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -177,7 +177,6 @@ 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-mezzio-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
|
||||
@ -213,6 +212,7 @@ cabal.project.local
|
||||
samples/client/petstore/haskell-http-client/docs/haddock-bundle.min.js
|
||||
samples/client/petstore/haskell-http-client/docs/meta.json
|
||||
samples/client/petstore/haskell-http-client/docs/quick-jump.css
|
||||
samples/server/petstore/haskell-servant/stack.yaml.lock
|
||||
|
||||
# R
|
||||
.Rproj.user
|
||||
|
@ -76,11 +76,11 @@ before_install:
|
||||
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
||||
- docker ps -a
|
||||
# install crystal
|
||||
- curl -sSL https://dist.crystal-lang.org/apt/setup.sh | sudo bash
|
||||
- curl -sL "https://keybase.io/crystal/pgp_keys.asc" | sudo apt-key add -
|
||||
- echo "deb https://dist.crystal-lang.org/apt crystal main" | sudo tee /etc/apt/sources.list.d/crystal.list
|
||||
- sudo apt-get update
|
||||
- echo 'deb http://download.opensuse.org/repositories/devel:/languages:/crystal/xUbuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/devel:languages:crystal.list
|
||||
- curl -fsSL https://download.opensuse.org/repositories/devel:languages:crystal/xUbuntu_16.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_languages_crystal.gpg > /dev/null
|
||||
- sudo apt update
|
||||
- sudo apt install crystal
|
||||
- crystal --version
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.0
|
||||
- export PATH="$HOME/.yarn/bin:$PATH"
|
||||
# install rust
|
||||
|
@ -7,8 +7,6 @@ steps:
|
||||
commands:
|
||||
- ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
# run ensure up-to-date
|
||||
- /bin/bash bin/utils/ensure-up-to-date
|
||||
# test java native client
|
||||
- ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
|
||||
- ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
|
||||
|
@ -14,17 +14,6 @@ function cleanup {
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
function installDart {
|
||||
# install dart2
|
||||
sudo apt-get update
|
||||
sudo apt-get install apt-transport-https
|
||||
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
|
||||
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
|
||||
sudo apt-get update
|
||||
sudo apt-get install dart
|
||||
export PATH="$PATH:/usr/lib/dart/bin"
|
||||
}
|
||||
|
||||
if [ "$NODE_INDEX" = "1" ]; then
|
||||
echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..."
|
||||
java -version
|
||||
@ -35,21 +24,6 @@ if [ "$NODE_INDEX" = "1" ]; then
|
||||
ls -l /home/circleci/.ivy2/cache
|
||||
|
||||
elif [ "$NODE_INDEX" = "2" ]; then
|
||||
installDart
|
||||
|
||||
# run ensure-up-to-date sample script on SNAPSHOT version only
|
||||
project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout`
|
||||
if [[ $project_version == *"-SNAPSHOT" ]]; then
|
||||
echo "Running node $NODE_INDEX to test ensure-up-to-date"
|
||||
java -version
|
||||
|
||||
# clear any changes to the samples
|
||||
git checkout -- .
|
||||
|
||||
# look for outdated samples
|
||||
#./bin/utils/ensure-up-to-date
|
||||
# UPDATE: moved to drone.io
|
||||
fi
|
||||
echo "Running node $NODE_INDEX to test haskell"
|
||||
# install haskell
|
||||
curl -sSL https://get.haskellstack.org/ | sh
|
||||
|
@ -88,12 +88,10 @@ To add test cases (optional) covering the change in the code generator, please r
|
||||
|
||||
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 .
|
||||
/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 generated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
|
||||
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.
|
||||
- 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 generated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
|
||||
- During development, it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.
|
||||
- Run the tests in the sample folder using maven `mvn integration-test -f /path/to/pom.xml`, e.g. `mvn integration-test -f samples/client/petstore/python/pom.xml`. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
|
||||
- Finally, git commit the updated samples files: `git commit -a`
|
||||
(`git add -A` if added files with new test cases)
|
||||
- Finally, git commit the updated samples files: `git commit -a` (`git add -A` if added files with new test cases)
|
||||
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml)
|
||||
|
||||
To start the CI tests, you can:
|
||||
|
51
README.md
51
README.md
@ -9,18 +9,26 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.2.0`):
|
||||
[](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.2.1`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
[](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
|
||||
|
||||
|
||||
[5.3.x](https://github.com/OpenAPITools/openapi-generator/tree/5.3.x) (`5.3.x`):
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
|
||||
[6.0.x](https://github.com/OpenAPITools/openapi-generator/tree/6.0.x) (`6.0.x`):
|
||||
[](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://travis-ci.com/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
|
||||
@ -67,11 +75,11 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
||||
|
||||
| | Languages/Frameworks |
|
||||
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0, .NET 5.0. Libraries: RestSharp, HttpClient), **C++** (cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 11.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
|
||||
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.0, .NET Core 2.0, .NET 5.0. Libraries: RestSharp, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client), **k6**, **Kotlin**, **Lua**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 11.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs) |
|
||||
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/)), **Kotlin** (Spring Boot, Ktor, Vertx), **PHP** (Laravel, Lumen, Slim, Silex, [Symfony](https://symfony.com/), [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** (rust-server), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
|
||||
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer** |
|
||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer**, **WSDL** |
|
||||
|
||||
## Table of contents
|
||||
|
||||
@ -110,8 +118,9 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 6.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.0.0-SNAPSHOT/) | Nov/Dec 2021 | Minor release with breaking changes (no fallback) |
|
||||
| 5.2.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.2.0-SNAPSHOT/) | Jun/Jul 2021 | Minor release with breaking changes (with fallback) |
|
||||
| [5.1.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.1.1) (latest stable release) | 07.05.2021 | Patch release (enhancements, bug fixes, etc) |
|
||||
| 5.3.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.3.0-SNAPSHOT/) | Aug/Sep 2021 | Minor release with breaking changes (with fallback) |
|
||||
| 5.2.1 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.2.1-SNAPSHOT/) | 09.08.2021 | Patch release (enhancements, bug fixes, etc) |
|
||||
| [5.2.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.2.0) (latest stable release) | 09.07.2021 | Minor release with breaking changes (with fallback) |
|
||||
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
|
||||
|
||||
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||
@ -168,16 +177,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository.
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
|
||||
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.1/openapi-generator-cli-5.1.1.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.0/openapi-generator-cli-5.2.0.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.1/openapi-generator-cli-5.1.1.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.0/openapi-generator-cli-5.2.0.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
```
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.1/openapi-generator-cli-5.1.1.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.0/openapi-generator-cli-5.2.0.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@ -269,7 +278,7 @@ To reinstall with the latest master, run `brew uninstall openapi-generator && br
|
||||
To install OpenJDK (pre-requisites), please run
|
||||
```sh
|
||||
brew tap AdoptOpenJDK/openjdk
|
||||
brew cask install adoptopenjdk12
|
||||
brew install --cask adoptopenjdk12
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/
|
||||
```
|
||||
|
||||
@ -402,7 +411,7 @@ openapi-generator-cli version
|
||||
To use a specific version of "openapi-generator-cli"
|
||||
|
||||
```sh
|
||||
openapi-generator-cli version-manager set 5.1.1
|
||||
openapi-generator-cli version-manager set 5.2.0
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@ -426,7 +435,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.1.1/openapi-generator-cli-5.1.1.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.2.0/openapi-generator-cli-5.2.0.jar)
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
@ -564,6 +573,7 @@ Here is a list of community-contributed IDE plug-ins that integrate with OpenAPI
|
||||
## [4 - Companies/Projects using OpenAPI Generator](#table-of-contents)
|
||||
Here are some companies/projects (alphabetical order) using OpenAPI Generator in production. To add your company/project to the list, please visit [README.md](README.md) and click on the icon to edit the page.
|
||||
|
||||
- [Aalborg University](https://www.aau.dk)
|
||||
- [Adaptant Solutions AG](https://www.adaptant.io/)
|
||||
- [adesso SE](https://www.adesso.de/)
|
||||
- [Agoda](https://www.agoda.com/)
|
||||
@ -813,6 +823,9 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2021-03-31 - [使用OpenAPI Generator實現Open API Server](https://www.1ju.org/article/java-openapi-generator-server) at [億聚網](https://www.1ju.org/)
|
||||
- 2021-04-19 - [Introducing Twilio’s OpenAPI Specification Beta](https://www.twilio.com/blog/introducing-twilio-open-api-specification-beta) by [GARETH PAUL JONES](https://www.twilio.com/blog/author/gpj) at [Twilio Blog](https://www.twilio.com/blog)
|
||||
- 2021-04-22 - [Leveraging OpenApi strengths in a Micro-Service environment](https://medium.com/unibuddy-technology-blog/leveraging-openapi-strengths-in-a-micro-service-environment-3d7f9e7c26ff) by Nicolas Jellab at [Unibuddy Technology Blog](https://medium.com/unibuddy-technology-blog)
|
||||
- 2021-04-27 - [From zero to publishing PowerShell API clients in PowerShell Gallery within minutes](https://speakerdeck.com/wing328/from-zero-to-publishing-powershell-api-clients-in-powershell-gallery-within-minutes) by [William Cheng](https://github.com/wing328) at [PowerShell + DevOps Global Summit 2021](https://events.devopscollective.org/event/powershell-devops-global-summit-2021/)
|
||||
- 2021-05-31 - [FlutterでOpen Api Generator(Swagger)を使う](https://aakira.app/blog/2021/05/flutter-open-api/) by [AAkira](https://twitter.com/_a_akira)
|
||||
- 2021-06-22 - [Rest API Documentation and Client Generation With OpenAPI](https://dzone.com/articles/rest-api-documentation-and-client-generation-with) by [Prasanth Gullapalli](https://dzone.com/users/1011797/prasanthnath.g@gmail.com.html)
|
||||
|
||||
## [6 - About Us](#table-of-contents)
|
||||
|
||||
@ -842,6 +855,7 @@ Here is a list of template creators:
|
||||
* Bash: @bkryza
|
||||
* C: @PowerOfCreation @zhemant [:heart:](https://www.patreon.com/zhemant)
|
||||
* C++ REST: @Danielku15
|
||||
* C++ Tiny: @AndersSpringborg @kaareHH @michelealbano @mkakbas
|
||||
* C++ UE4: @Kahncode
|
||||
* C# (.NET 2.0): @who
|
||||
* C# (.NET Standard 1.3 ): @Gronsak
|
||||
@ -946,8 +960,10 @@ Here is a list of template creators:
|
||||
* PHP Laravel: @renepardon
|
||||
* PHP Lumen: @abcsun
|
||||
* PHP Slim: @jfastnacht
|
||||
* PHP Slim4: @ybelenko
|
||||
* PHP Symfony: @ksm2
|
||||
* PHP Zend Expressive (with Path Handler): @Articus
|
||||
* Python FastAPI: @krjakbrjak
|
||||
* Python AIOHTTP: @Jyhess
|
||||
* Ruby on Rails 5: @zlx
|
||||
* Rust (rust-server): @metaswitch
|
||||
@ -969,6 +985,7 @@ Here is a list of template creators:
|
||||
* Ktorm: @Luiz-Monad
|
||||
* MySQL: @ybelenko
|
||||
* Protocol Buffer: @wing328
|
||||
* WSDL @adessoDpd
|
||||
|
||||
:heart: = Link to support the contributor directly
|
||||
|
||||
@ -1010,7 +1027,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
|
||||
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) |
|
||||
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
|
||||
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) |
|
||||
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05) |
|
||||
| Clojure | |
|
||||
| Dart | @swipesight (2018/09) @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) |
|
||||
| Eiffel | @jvelilla (2017/09) |
|
||||
|
@ -29,8 +29,9 @@ install:
|
||||
- cmd: java -version
|
||||
- cmd: gradle -v
|
||||
- cmd: dir/w
|
||||
- git clone https://github.com/wing328/swagger-samples
|
||||
- git clone https://github.com/wing328/swagger-samples --depth 1
|
||||
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
|
||||
- ps: Start-Sleep -s 15
|
||||
- ps: $PSVersionTable.PSVersion
|
||||
- ps: Install-Module -Name Pester -Force -Scope CurrentUser
|
||||
build_script:
|
||||
@ -54,6 +55,8 @@ build_script:
|
||||
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-net47\Org.OpenAPITools.sln
|
||||
# build C# API client (.net 5.0)
|
||||
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-net5.0\Org.OpenAPITools.sln
|
||||
# build C# API client (.net 5.0 with ConditionalSerialization)
|
||||
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-ConditionalSerialization\Org.OpenAPITools.sln
|
||||
# build C# API client
|
||||
- nuget restore samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln
|
||||
- msbuild samples\client\petstore\csharp\OpenAPIClient\Org.OpenAPITools.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
@ -79,6 +82,8 @@ test_script:
|
||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-net47\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test C# API client (.net 5.0)
|
||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-net5.0\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test C# API Client using conditional-serialization
|
||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-ConditionalSerialization\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# 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
|
||||
# test c# API client (with PropertyChanged)
|
||||
|
@ -1,7 +1,7 @@
|
||||
generatorName: cpp-qt5-client
|
||||
outputDir: samples/client/petstore/cpp-qt5
|
||||
generatorName: cpp-qt-client
|
||||
outputDir: samples/client/petstore/cpp-qt
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-qt5-client
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-qt-client
|
||||
additionalProperties:
|
||||
cppNamespace: test_namespace
|
||||
modelNamePrefix: PFX
|
@ -1,4 +1,4 @@
|
||||
generatorName: cpp-qt5-qhttpengine-server
|
||||
outputDir: samples/server/petstore/cpp-qt5-qhttpengine-server
|
||||
generatorName: cpp-qt-qhttpengine-server
|
||||
outputDir: samples/server/petstore/cpp-qt-qhttpengine-server
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-qt-qhttpengine-server
|
7
bin/configs/cpp-tiny.yaml
Normal file
7
bin/configs/cpp-tiny.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
generatorName: cpp-tiny
|
||||
outputDir: samples/client/petstore/cpp-tiny
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/cpp-tiny
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
controller: "esp32"
|
@ -0,0 +1,12 @@
|
||||
# for .net standard
|
||||
generatorName: csharp-netcore
|
||||
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/java/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
|
||||
additionalProperties:
|
||||
packageGuid: '{fa96c953-af24-457d-8a01-f2fd2a7547a9}'
|
||||
useCompareNetObjects: true
|
||||
disallowAdditionalPropertiesIfNotPresent: false
|
||||
useOneOfDiscriminatorLookup: true
|
||||
targetFramework: netstandard2.0
|
||||
conditionalSerialization: true
|
9
bin/configs/go-server-chi-api-server.yaml
Normal file
9
bin/configs/go-server-chi-api-server.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
generatorName: go-server
|
||||
outputDir: samples/server/petstore/go-chi-server
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/go-server
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
packageName: petstoreserver
|
||||
addResponseHeaders: true
|
||||
router: "chi"
|
@ -6,3 +6,4 @@ additionalProperties:
|
||||
requestDateConverter: toString
|
||||
artifactId: kotlin-petstore-json-request-string
|
||||
parcelizeModels: true
|
||||
supportAndroidApiLevel25AndBelow: true
|
||||
|
6
bin/configs/php-mezzio-ph-modern.yaml
Normal file
6
bin/configs/php-mezzio-ph-modern.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
generatorName: php-mezzio-ph
|
||||
outputDir: samples/server/petstore/php-mezzio-ph-modern
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/php-mezzio-ph-modern
|
||||
additionalProperties:
|
||||
modern: "true"
|
6
bin/configs/python-fastapi.yaml
Normal file
6
bin/configs/python-fastapi.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
generatorName: python-fastapi
|
||||
outputDir: samples/server/petstore/python-fastapi
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/python-fastapi
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
9
bin/configs/scala-legacy.yaml
Normal file
9
bin/configs/scala-legacy.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
# This is for generating scala legacy client
|
||||
generatorName: scala-httpclient-deprecated
|
||||
outputDir: samples/client/petstore/scala-httpclient-deprecated
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/scala-httpclient
|
||||
additionalProperties:
|
||||
apiPackage: org.openapitools.example.api
|
||||
invokerPackage: org.openapitools.example.invoker
|
||||
artifactId: scala-legacy-petstore
|
10
bin/configs/swift5-oneOf.yaml
Normal file
10
bin/configs/swift5-oneOf.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/oneOf
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
@ -10,3 +10,4 @@ additionalProperties:
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
useBacktickEscapes: true
|
||||
generateModelAdditionalProperties: false
|
||||
|
@ -11,3 +11,4 @@ additionalProperties:
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
useSPMFileStructure: true
|
||||
useClasses: true
|
||||
swiftUseApiNamespace: true
|
||||
|
12
bin/configs/swift5-vapor.yaml
Normal file
12
bin/configs/swift5-vapor.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/vaporLibrary
|
||||
library: vapor
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
projectName: PetstoreClient
|
||||
useSPMFileStructure: true
|
||||
useClasses: true
|
||||
useBacktickEscapes: true
|
||||
mapFileBinaryToData: true
|
11
bin/configs/swift5-x-swift-hashable.yaml
Normal file
11
bin/configs/swift5-x-swift-hashable.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
generatorName: swift5
|
||||
outputDir: samples/client/petstore/swift5/x-swift-hashable
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
podAuthors: ""
|
||||
podSummary: PetstoreClient
|
||||
projectName: PetstoreClient
|
||||
podHomepage: https://github.com/openapitools/openapi-generator
|
||||
hashableModels: false
|
5
bin/configs/typescript-angular-v11-oneOf.yaml
Normal file
5
bin/configs/typescript-angular-v11-oneOf.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
generatorName: typescript-angular
|
||||
outputDir: samples/client/petstore/typescript-angular-v11-oneOf/builds/default
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOfArrayMapImport.yaml
|
||||
additionalProperties:
|
||||
ngVersion: 11.0.0
|
16
bin/configs/typescript-fetch-sagas-and-records.yaml
Normal file
16
bin/configs/typescript-fetch-sagas-and-records.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
generatorName: typescript-fetch
|
||||
outputDir: samples/client/petstore/typescript-fetch/builds/sagas-and-records
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml
|
||||
additionalProperties:
|
||||
npmVersion: 1.0.0
|
||||
npmName: '@openapitools/typescript-fetch-petstore'
|
||||
npmRepository: https://skimdb.npmjs.com/registry
|
||||
useSingleRequestParameter: false
|
||||
supportsES6: true
|
||||
typescriptThreePlus: true
|
||||
sagasAndRecords: true
|
||||
detectPassthroughModelsWithSuffixAndField: 'Response.data'
|
||||
inferUniqueIdFromNameSuffix: true
|
||||
inferEntityFromUniqueIdWithName: id
|
||||
packageAsSourceOnlyLibrary: false
|
||||
snapshot: false
|
6
bin/configs/wsdl-schema.yaml
Normal file
6
bin/configs/wsdl-schema.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
generatorName: wsdl-schema
|
||||
outputDir: samples/schema/petstore/wsdl-schema
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/wsdl/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/wsdl-schema
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
@ -83,7 +83,6 @@ declare -a xml_files=(
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/java-client.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/non-java.xml"
|
||||
"${root}/samples/meta-codegen/lib/pom.xml"
|
||||
"${root}/pom.xml"
|
||||
)
|
||||
|
||||
|
@ -92,12 +92,10 @@ To add test cases (optional) covering the change in the code generator, please r
|
||||
|
||||
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 .
|
||||
/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 generated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
|
||||
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.
|
||||
- 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 generated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
|
||||
- During development, it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.
|
||||
- Run the tests in the sample folder using maven `mvn integration-test -f /path/to/pom.xml`, e.g. `mvn integration-test -f samples/client/petstore/python/pom.xml`. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
|
||||
- Finally, git commit the updated samples files: `git commit -a`
|
||||
(`git add -A` if added files with new test cases)
|
||||
- Finally, git commit the updated samples files: `git commit -a` (`git add -A` if added files with new test cases)
|
||||
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml)
|
||||
|
||||
To start the CI tests, you can:
|
||||
|
@ -12,8 +12,9 @@ The following generators are available:
|
||||
* [bash](generators/bash.md)
|
||||
* [c](generators/c.md)
|
||||
* [clojure](generators/clojure.md)
|
||||
* [cpp-qt5-client](generators/cpp-qt5-client.md)
|
||||
* [cpp-qt-client](generators/cpp-qt-client.md)
|
||||
* [cpp-restsdk](generators/cpp-restsdk.md)
|
||||
* [cpp-tiny (beta)](generators/cpp-tiny.md)
|
||||
* [cpp-tizen](generators/cpp-tizen.md)
|
||||
* [cpp-ue4 (beta)](generators/cpp-ue4.md)
|
||||
* [crystal (beta)](generators/crystal.md)
|
||||
@ -61,7 +62,7 @@ The following generators are available:
|
||||
* [scala-sttp (beta)](generators/scala-sttp.md)
|
||||
* [scalaz](generators/scalaz.md)
|
||||
* [swift4-deprecated (deprecated)](generators/swift4-deprecated.md)
|
||||
* [swift5 (beta)](generators/swift5.md)
|
||||
* [swift5](generators/swift5.md)
|
||||
* [typescript (experimental)](generators/typescript.md)
|
||||
* [typescript-angular](generators/typescript-angular.md)
|
||||
* [typescript-angularjs-deprecated (deprecated)](generators/typescript-angularjs-deprecated.md)
|
||||
@ -80,7 +81,7 @@ The following generators are available:
|
||||
* [ada-server](generators/ada-server.md)
|
||||
* [aspnetcore](generators/aspnetcore.md)
|
||||
* [cpp-pistache-server](generators/cpp-pistache-server.md)
|
||||
* [cpp-qt5-qhttpengine-server](generators/cpp-qt5-qhttpengine-server.md)
|
||||
* [cpp-qt-qhttpengine-server](generators/cpp-qt-qhttpengine-server.md)
|
||||
* [cpp-restbed-server](generators/cpp-restbed-server.md)
|
||||
* [csharp-nancyfx](generators/csharp-nancyfx.md)
|
||||
* [erlang-server](generators/erlang-server.md)
|
||||
@ -119,6 +120,7 @@ The following generators are available:
|
||||
* [php-symfony](generators/php-symfony.md)
|
||||
* [python-aiohttp](generators/python-aiohttp.md)
|
||||
* [python-blueplanet](generators/python-blueplanet.md)
|
||||
* [python-fastapi (beta)](generators/python-fastapi.md)
|
||||
* [python-flask](generators/python-flask.md)
|
||||
* [ruby-on-rails](generators/ruby-on-rails.md)
|
||||
* [ruby-sinatra](generators/ruby-sinatra.md)
|
||||
@ -149,6 +151,7 @@ The following generators are available:
|
||||
* [ktorm-schema (beta)](generators/ktorm-schema.md)
|
||||
* [mysql-schema](generators/mysql-schema.md)
|
||||
* [protobuf-schema (beta)](generators/protobuf-schema.md)
|
||||
* [wsdl-schema (beta)](generators/wsdl-schema.md)
|
||||
|
||||
|
||||
## CONFIG generators
|
||||
|
@ -9,7 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|aspnetCoreVersion|ASP.NET Core version: 5.0, 3.1, 3.0, 2.2, 2.1, 2.0 (deprecated)|<dl><dt>**2.0**</dt><dd>ASP.NET Core 2.0</dd><dt>**2.1**</dt><dd>ASP.NET Core 2.1</dd><dt>**2.2**</dt><dd>ASP.NET Core 2.2</dd><dt>**3.0**</dt><dd>ASP.NET Core 3.0</dd><dt>**3.1**</dt><dd>ASP.NET Core 3.1</dd><dt>**5.0**</dt><dd>ASP.NET Core 5.0</dd></dl>|3.1|
|
||||
|buildTarget|Target to build an application or library|<dl><dt>**program**</dt><dd>Generate code for a standalone server</dd><dt>**library**</dt><dd>Generate code for a server abstract class library</dd></dl>|program|
|
||||
|classModifier|Class Modifier for controller classes: Empty string or abstract.|<dl><dt>****</dt><dd>Keep class default with no modifier</dd><dt>**abstract**</dt><dd>Make class abstract</dd></dl>||
|
||||
|classModifier|Class Modifier for controller classes: Empty string or abstract.| ||
|
||||
|compatibilityVersion|ASP.Net Core CompatibilityVersion| |Version_2_2|
|
||||
|enumNameSuffix|Suffix that will be appended to all enum names.| |Enum|
|
||||
|enumValueSuffix|Suffix that will be appended to all enum values.| |Enum|
|
||||
@ -17,8 +17,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|isLibrary|Is the build a library| |false|
|
||||
|licenseName|The name of the license| |NoLicense|
|
||||
|licenseUrl|The URL of the license| |http://localhost|
|
||||
|modelClassModifier|Model Class Modifier can be nothing or partial|<dl><dt>****</dt><dd>Keep model class default with no modifier</dd><dt>**partial**</dt><dd>Make model class partial</dd></dl>|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|
|
||||
|nullableReferenceTypes|Use nullable annotations in the project. Only supported on C# 8 / ASP.NET Core 3.0 or newer.| |false|
|
||||
|operationIsAsync|Set methods to async or sync (default).| |false|
|
||||
|operationModifier|Operation Modifier can be virtual or abstract|<dl><dt>**virtual**</dt><dd>Keep method virtual</dd><dt>**abstract**</dt><dd>Make method abstract</dd></dl>|virtual|
|
||||
|operationResultTask|Set methods result to Task<>.| |false|
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Config Options for cpp-qt5-client
|
||||
sidebar_label: cpp-qt5-client
|
||||
title: Config Options for cpp-qt-client
|
||||
sidebar_label: cpp-qt-client
|
||||
---
|
||||
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Config Options for cpp-qt5-qhttpengine-server
|
||||
sidebar_label: cpp-qt5-qhttpengine-server
|
||||
title: Config Options for cpp-qt-qhttpengine-server
|
||||
sidebar_label: cpp-qt-qhttpengine-server
|
||||
---
|
||||
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
243
docs/generators/cpp-tiny.md
Normal file
243
docs/generators/cpp-tiny.md
Normal file
@ -0,0 +1,243 @@
|
||||
---
|
||||
title: Config Options for cpp-tiny
|
||||
sidebar_label: cpp-tiny
|
||||
---
|
||||
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|controller|name of microcontroller (e.g esp32 or esp8266)| |esp32|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<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|
|
||||
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -> Value)| |true|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>bool</li>
|
||||
<li>double</li>
|
||||
<li>float</li>
|
||||
<li>int</li>
|
||||
<li>long</li>
|
||||
<li>std::string</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>alignas</li>
|
||||
<li>alignof</li>
|
||||
<li>and</li>
|
||||
<li>and_eq</li>
|
||||
<li>asm</li>
|
||||
<li>auto</li>
|
||||
<li>bitand</li>
|
||||
<li>bitor</li>
|
||||
<li>bool</li>
|
||||
<li>break</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>char</li>
|
||||
<li>char16_t</li>
|
||||
<li>char32_t</li>
|
||||
<li>class</li>
|
||||
<li>compl</li>
|
||||
<li>concept</li>
|
||||
<li>const</li>
|
||||
<li>const_cast</li>
|
||||
<li>constexpr</li>
|
||||
<li>continue</li>
|
||||
<li>decltype</li>
|
||||
<li>default</li>
|
||||
<li>delete</li>
|
||||
<li>do</li>
|
||||
<li>double</li>
|
||||
<li>dynamic_cast</li>
|
||||
<li>else</li>
|
||||
<li>enum</li>
|
||||
<li>explicit</li>
|
||||
<li>export</li>
|
||||
<li>extern</li>
|
||||
<li>false</li>
|
||||
<li>float</li>
|
||||
<li>for</li>
|
||||
<li>friend</li>
|
||||
<li>goto</li>
|
||||
<li>if</li>
|
||||
<li>inline</li>
|
||||
<li>int</li>
|
||||
<li>linux</li>
|
||||
<li>long</li>
|
||||
<li>mutable</li>
|
||||
<li>namespace</li>
|
||||
<li>new</li>
|
||||
<li>noexcept</li>
|
||||
<li>not</li>
|
||||
<li>not_eq</li>
|
||||
<li>nullptr</li>
|
||||
<li>operator</li>
|
||||
<li>or</li>
|
||||
<li>or_eq</li>
|
||||
<li>private</li>
|
||||
<li>protected</li>
|
||||
<li>public</li>
|
||||
<li>register</li>
|
||||
<li>reinterpret_cast</li>
|
||||
<li>requires</li>
|
||||
<li>return</li>
|
||||
<li>short</li>
|
||||
<li>signed</li>
|
||||
<li>sizeof</li>
|
||||
<li>static</li>
|
||||
<li>static_assert</li>
|
||||
<li>static_cast</li>
|
||||
<li>struct</li>
|
||||
<li>switch</li>
|
||||
<li>template</li>
|
||||
<li>this</li>
|
||||
<li>thread_local</li>
|
||||
<li>throw</li>
|
||||
<li>true</li>
|
||||
<li>try</li>
|
||||
<li>typedef</li>
|
||||
<li>typeid</li>
|
||||
<li>typename</li>
|
||||
<li>union</li>
|
||||
<li>unsigned</li>
|
||||
<li>using</li>
|
||||
<li>virtual</li>
|
||||
<li>void</li>
|
||||
<li>volatile</li>
|
||||
<li>wchar_t</li>
|
||||
<li>while</li>
|
||||
<li>xor</li>
|
||||
<li>xor_eq</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✗|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✗|ToolingExtension
|
||||
|MockServer|✗|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
|
@ -9,6 +9,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive| |false|
|
||||
|conditionalSerialization|Serialize only those properties which are initialized by user, accepted values are true or false, default value is false.| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|interfacePrefix|Prefix interfaces with a community standard or widely accepted prefix.| |I|
|
||||
@ -17,6 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |PascalCase|
|
||||
|netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false|
|
||||
|nonPublicApi|Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers.| |false|
|
||||
|nullableReferenceTypes|Use nullable annotations in the project. Only supported on C# 8 / ASP.NET Core 3.0 or newer.| |false|
|
||||
|optionalAssemblyInfo|Generate AssemblyInfo.cs.| |true|
|
||||
|optionalEmitDefaultValues|Set DataMember's EmitDefaultValue.| |false|
|
||||
|optionalMethodArgument|C# Optional method argument, e.g. void square(int x=10) (.net 4.0+ only).| |true|
|
||||
|
@ -13,6 +13,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|packageName|Go package name (convention: lowercase).| |openapi|
|
||||
|packageVersion|Go package version.| |1.0.0|
|
||||
|router|Specify the router which should be used.|<dl><dt>**mux**</dt><dd>mux</dd><dt>**chi**</dt><dd>chi</dd></dl>|mux|
|
||||
|serverPort|The network port the generated server binds to| |8080|
|
||||
|sourceFolder|source folder for generated code| |go|
|
||||
|
||||
|
@ -18,6 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
@ -80,16 +80,20 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>continue</li>
|
||||
<li>do</li>
|
||||
<li>else</li>
|
||||
<li>external</li>
|
||||
<li>false</li>
|
||||
<li>for</li>
|
||||
<li>fun</li>
|
||||
<li>if</li>
|
||||
<li>in</li>
|
||||
<li>interface</li>
|
||||
<li>internal</li>
|
||||
<li>is</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>open</li>
|
||||
<li>package</li>
|
||||
<li>private</li>
|
||||
<li>return</li>
|
||||
<li>super</li>
|
||||
<li>this</li>
|
||||
|
@ -17,6 +17,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|featureConditionalHeaders|Avoid sending content if client already has same content, by checking ETag or LastModified properties.| |false|
|
||||
|featureHSTS|Avoid sending content if client already has same content, by checking ETag or LastModified properties.| |true|
|
||||
|featureLocations|Generates routes in a typed way, for both: constructing URLs and reading the parameters.| |true|
|
||||
|featureMetrics|Enables metrics feature.| |true|
|
||||
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
|
||||
|library|library template (sub-template)|<dl><dt>**ktor**</dt><dd>ktor framework</dd></dl>|ktor|
|
||||
|modelMutable|Create mutable models| |false|
|
||||
@ -81,16 +82,20 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>continue</li>
|
||||
<li>do</li>
|
||||
<li>else</li>
|
||||
<li>external</li>
|
||||
<li>false</li>
|
||||
<li>for</li>
|
||||
<li>fun</li>
|
||||
<li>if</li>
|
||||
<li>in</li>
|
||||
<li>interface</li>
|
||||
<li>internal</li>
|
||||
<li>is</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>open</li>
|
||||
<li>package</li>
|
||||
<li>private</li>
|
||||
<li>return</li>
|
||||
<li>super</li>
|
||||
<li>this</li>
|
||||
|
@ -93,16 +93,20 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>continue</li>
|
||||
<li>do</li>
|
||||
<li>else</li>
|
||||
<li>external</li>
|
||||
<li>false</li>
|
||||
<li>for</li>
|
||||
<li>fun</li>
|
||||
<li>if</li>
|
||||
<li>in</li>
|
||||
<li>interface</li>
|
||||
<li>internal</li>
|
||||
<li>is</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>open</li>
|
||||
<li>package</li>
|
||||
<li>private</li>
|
||||
<li>return</li>
|
||||
<li>super</li>
|
||||
<li>this</li>
|
||||
|
@ -74,16 +74,20 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>continue</li>
|
||||
<li>do</li>
|
||||
<li>else</li>
|
||||
<li>external</li>
|
||||
<li>false</li>
|
||||
<li>for</li>
|
||||
<li>fun</li>
|
||||
<li>if</li>
|
||||
<li>in</li>
|
||||
<li>interface</li>
|
||||
<li>internal</li>
|
||||
<li>is</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>open</li>
|
||||
<li>package</li>
|
||||
<li>private</li>
|
||||
<li>return</li>
|
||||
<li>super</li>
|
||||
<li>this</li>
|
||||
|
@ -14,7 +14,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|dateLibrary|Option. Date library to use|<dl><dt>**threetenbp-localdatetime**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, for legacy app only)</dd><dt>**string**</dt><dd>String</dd><dt>**java8-localdatetime**</dt><dd>Java 8 native JSR310 (jvm only, for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)</dd><dt>**threetenbp**</dt><dd>Threetenbp - Backport of JSR310 (jvm only, preferred for jdk < 1.8)</dd></dl>|java8|
|
||||
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |camelCase|
|
||||
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-okhttp3**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-retrofit2**</dt><dd>Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.2.4. JSON processing: Kotlinx Serialization: 0.12.0.</dd></dl>|jvm-okhttp4|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**jvm-okhttp4**</dt><dd>[DEFAULT] Platform: Java Virtual Machine. HTTP client: OkHttp 4.2.0 (Android 5.0+ and Java 8+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-okhttp3**</dt><dd>Platform: Java Virtual Machine. HTTP client: OkHttp 3.12.4 (Android 2.3+ and Java 7+). JSON processing: Moshi 1.8.0.</dd><dt>**jvm-retrofit2**</dt><dd>Platform: Java Virtual Machine. HTTP client: Retrofit 2.6.2.</dd><dt>**multiplatform**</dt><dd>Platform: Kotlin multiplatform. HTTP client: Ktor 1.6.0. JSON processing: Kotlinx Serialization: 1.2.1.</dd></dl>|jvm-okhttp4|
|
||||
|modelMutable|Create mutable models| |false|
|
||||
|moshiCodeGen|Whether to enable codegen with the Moshi library. Refer to the [official Moshi doc](https://github.com/square/moshi#codegen) for more info.| |false|
|
||||
|packageName|Generated artifact package name.| |org.openapitools.client|
|
||||
@ -25,6 +25,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|
||||
|sourceFolder|source folder for generated code| |src/main/kotlin|
|
||||
|supportAndroidApiLevel25AndBelow|[WARNING] This flag will generate code that has a known security vulnerability. It uses `kotlin.io.createTempFile` instead of `java.nio.file.Files.createTempFile` in oder to support Android API level 25 and bellow. For more info, please check the following links https://github.com/OpenAPITools/openapi-generator/security/advisories/GHSA-23x4-m842-fmwf, https://github.com/OpenAPITools/openapi-generator/pull/9284| |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|
|
||||
|useRxJava2|Whether to use the RxJava2 adapter with the retrofit2 library.| |false|
|
||||
@ -83,16 +84,20 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>continue</li>
|
||||
<li>do</li>
|
||||
<li>else</li>
|
||||
<li>external</li>
|
||||
<li>false</li>
|
||||
<li>for</li>
|
||||
<li>fun</li>
|
||||
<li>if</li>
|
||||
<li>in</li>
|
||||
<li>interface</li>
|
||||
<li>internal</li>
|
||||
<li>is</li>
|
||||
<li>null</li>
|
||||
<li>object</li>
|
||||
<li>open</li>
|
||||
<li>package</li>
|
||||
<li>private</li>
|
||||
<li>return</li>
|
||||
<li>super</li>
|
||||
<li>this</li>
|
||||
|
@ -15,6 +15,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<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|
|
||||
|modelPackage|package for generated models| |null|
|
||||
|modern|use modern language features (generated code will require PHP 8.0)| |false|
|
||||
|packageName|The main package name for classes. e.g. GeneratedPetstore| |null|
|
||||
|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|
|
||||
|
@ -13,6 +13,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|discardReadOnly|Set discardReadonly to true to generate the Initialize cmdlet without readonly parameters| |null|
|
||||
|iconUri|A URL to an icon representing the generated PowerShell module| |null|
|
||||
|licenseUri|A URL to the license for the generated PowerShell module| |null|
|
||||
|modelsCmdletVerb|Verb to be used when generating the Models cmdlets in the examples.| |Initialize|
|
||||
|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|
|
||||
@ -21,6 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|releaseNotes|Release notes of the generated PowerShell module| |null|
|
||||
|skipVerbParsing|Set skipVerbParsing to not try get powershell verbs of operation names| |null|
|
||||
|tags|Tags applied to the generated PowerShell module. These help with module discovery in online galleries| |null|
|
||||
|useClassNameInModelsExamples|Use classname instead of name when generating the Models cmdlets in the examples.| |true|
|
||||
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |null|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
@ -23,6 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|
||||
|useNose|use the nose test framework| |false|
|
||||
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
|
@ -23,6 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|
||||
|useNose|use the nose test framework| |false|
|
||||
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
|
211
docs/generators/python-fastapi.md
Normal file
211
docs/generators/python-fastapi.md
Normal file
@ -0,0 +1,211 @@
|
||||
---
|
||||
title: Config Options for python-fastapi
|
||||
sidebar_label: python-fastapi
|
||||
---
|
||||
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<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|
|
||||
|packageName|python package name (convention: snake_case).| |openapi_server|
|
||||
|packageVersion|python package version.| |1.0.0|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|serverPort|TCP port to listen to in app.run| |8080|
|
||||
|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 |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>Dict</li>
|
||||
<li>List</li>
|
||||
<li>bool</li>
|
||||
<li>bytes</li>
|
||||
<li>date</li>
|
||||
<li>datetime</li>
|
||||
<li>dict</li>
|
||||
<li>file</li>
|
||||
<li>float</li>
|
||||
<li>int</li>
|
||||
<li>list</li>
|
||||
<li>object</li>
|
||||
<li>str</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>all_params</li>
|
||||
<li>and</li>
|
||||
<li>as</li>
|
||||
<li>assert</li>
|
||||
<li>async</li>
|
||||
<li>auth_settings</li>
|
||||
<li>await</li>
|
||||
<li>body_params</li>
|
||||
<li>break</li>
|
||||
<li>class</li>
|
||||
<li>continue</li>
|
||||
<li>def</li>
|
||||
<li>del</li>
|
||||
<li>elif</li>
|
||||
<li>else</li>
|
||||
<li>except</li>
|
||||
<li>exec</li>
|
||||
<li>false</li>
|
||||
<li>finally</li>
|
||||
<li>for</li>
|
||||
<li>form_params</li>
|
||||
<li>from</li>
|
||||
<li>global</li>
|
||||
<li>header_params</li>
|
||||
<li>if</li>
|
||||
<li>import</li>
|
||||
<li>in</li>
|
||||
<li>is</li>
|
||||
<li>lambda</li>
|
||||
<li>local_var_files</li>
|
||||
<li>none</li>
|
||||
<li>nonlocal</li>
|
||||
<li>not</li>
|
||||
<li>or</li>
|
||||
<li>pass</li>
|
||||
<li>path_params</li>
|
||||
<li>print</li>
|
||||
<li>property</li>
|
||||
<li>query_params</li>
|
||||
<li>raise</li>
|
||||
<li>resource_path</li>
|
||||
<li>return</li>
|
||||
<li>self</li>
|
||||
<li>true</li>
|
||||
<li>try</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
|
||||
|MockServer|✗|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
|
@ -23,6 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|supportPython2|support python2. This option has been deprecated and will be removed in the 5.x release.| |false|
|
||||
|useNose|use the nose test framework| |false|
|
||||
|usePythonSrcRootInImports|include pythonSrcRoot in import namespaces.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
|
@ -11,10 +11,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|apiNamePrefix|Prefix that will be appended to all API names ('tags'). Default: empty string. e.g. Pet => Pet.| |null|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|generateModelAdditionalProperties|Generate model additional properties (default: true)| |true|
|
||||
|hashableModels|Make hashable models (default: true)| |true|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<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->bool, string->int, int->string)| |false|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**urlsession**</dt><dd>[DEFAULT] HTTP client: URLSession</dd><dt>**alamofire**</dt><dd>HTTP client: Alamofire</dd></dl>|urlsession|
|
||||
|library|Library template (sub-template) to use|<dl><dt>**urlsession**</dt><dd>[DEFAULT] HTTP client: URLSession</dd><dt>**alamofire**</dt><dd>HTTP client: Alamofire</dd><dt>**vapor**</dt><dd>HTTP client: Vapor</dd></dl>|urlsession|
|
||||
|mapFileBinaryToData|[WARNING] This option will be removed and enabled by default in the future once we've enhanced the code to work with `Data` in all the different situations. Map File and Binary to Data (default: false)| |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|
|
||||
@ -36,6 +39,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|swiftPackagePath|Set a custom source path instead of OpenAPIClient/Classes/OpenAPIs.| |null|
|
||||
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|
||||
|useBacktickEscapes|Escape reserved words using backticks (default: false)| |false|
|
||||
|useClasses|Use final classes for models instead of structs (default: false)| |false|
|
||||
|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
243
docs/generators/tiny-cpp.md
Normal file
243
docs/generators/tiny-cpp.md
Normal file
@ -0,0 +1,243 @@
|
||||
---
|
||||
title: Config Options for tiny-cpp
|
||||
sidebar_label: tiny-cpp
|
||||
---
|
||||
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|controller|name of microcontroller (e.g esp32 or esp8266)| |esp32|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<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|
|
||||
|reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -> Value)| |true|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>bool</li>
|
||||
<li>double</li>
|
||||
<li>float</li>
|
||||
<li>int</li>
|
||||
<li>long</li>
|
||||
<li>std::string</li>
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
<li>alignas</li>
|
||||
<li>alignof</li>
|
||||
<li>and</li>
|
||||
<li>and_eq</li>
|
||||
<li>asm</li>
|
||||
<li>auto</li>
|
||||
<li>bitand</li>
|
||||
<li>bitor</li>
|
||||
<li>bool</li>
|
||||
<li>break</li>
|
||||
<li>case</li>
|
||||
<li>catch</li>
|
||||
<li>char</li>
|
||||
<li>char16_t</li>
|
||||
<li>char32_t</li>
|
||||
<li>class</li>
|
||||
<li>compl</li>
|
||||
<li>concept</li>
|
||||
<li>const</li>
|
||||
<li>const_cast</li>
|
||||
<li>constexpr</li>
|
||||
<li>continue</li>
|
||||
<li>decltype</li>
|
||||
<li>default</li>
|
||||
<li>delete</li>
|
||||
<li>do</li>
|
||||
<li>double</li>
|
||||
<li>dynamic_cast</li>
|
||||
<li>else</li>
|
||||
<li>enum</li>
|
||||
<li>explicit</li>
|
||||
<li>export</li>
|
||||
<li>extern</li>
|
||||
<li>false</li>
|
||||
<li>float</li>
|
||||
<li>for</li>
|
||||
<li>friend</li>
|
||||
<li>goto</li>
|
||||
<li>if</li>
|
||||
<li>inline</li>
|
||||
<li>int</li>
|
||||
<li>linux</li>
|
||||
<li>long</li>
|
||||
<li>mutable</li>
|
||||
<li>namespace</li>
|
||||
<li>new</li>
|
||||
<li>noexcept</li>
|
||||
<li>not</li>
|
||||
<li>not_eq</li>
|
||||
<li>nullptr</li>
|
||||
<li>operator</li>
|
||||
<li>or</li>
|
||||
<li>or_eq</li>
|
||||
<li>private</li>
|
||||
<li>protected</li>
|
||||
<li>public</li>
|
||||
<li>register</li>
|
||||
<li>reinterpret_cast</li>
|
||||
<li>requires</li>
|
||||
<li>return</li>
|
||||
<li>short</li>
|
||||
<li>signed</li>
|
||||
<li>sizeof</li>
|
||||
<li>static</li>
|
||||
<li>static_assert</li>
|
||||
<li>static_cast</li>
|
||||
<li>struct</li>
|
||||
<li>switch</li>
|
||||
<li>template</li>
|
||||
<li>this</li>
|
||||
<li>thread_local</li>
|
||||
<li>throw</li>
|
||||
<li>true</li>
|
||||
<li>try</li>
|
||||
<li>typedef</li>
|
||||
<li>typeid</li>
|
||||
<li>typename</li>
|
||||
<li>union</li>
|
||||
<li>unsigned</li>
|
||||
<li>using</li>
|
||||
<li>virtual</li>
|
||||
<li>void</li>
|
||||
<li>volatile</li>
|
||||
<li>wchar_t</li>
|
||||
<li>while</li>
|
||||
<li>xor</li>
|
||||
<li>xor_eq</li>
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✗|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✗|ToolingExtension
|
||||
|MockServer|✗|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
|
@ -24,6 +24,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|providedIn|Use this property to provide Injectables in wanted level (it is only valid in angular version greater or equal to 9.0.0).|<dl><dt>**root**</dt><dd>The application-level injector in most apps.</dd><dt>**none**</dt><dd>No providedIn (same as providedInRoot=false)</dd><dt>**any**</dt><dd>Provides a unique instance in each lazy loaded module while all eagerly loaded modules share one instance.</dd><dt>**platform**</dt><dd>A special singleton platform injector shared by all applications on the page.</dd></dl>|root|
|
||||
|providedInRoot|Use this property to provide Injectables in root (it is only valid in angular version greater or equal to 6.0.0). IMPORTANT: Deprecated for angular version greater or equal to 9.0.0, use **providedIn** instead.| |false|
|
||||
|
@ -15,6 +15,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<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|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|
@ -17,6 +17,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
@ -18,6 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|npmRepository|Use this property to set an url of 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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
@ -18,8 +18,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|prefixParameterInterfaces|Setting this property to true will generate parameter interface declarations prefixed with API class name to avoid name conflicts.| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|sagasAndRecords|Setting this property to true will generate additional files for use with redux-saga and immutablejs.| |false|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |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|
|
||||
|
@ -18,6 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
@ -19,6 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
@ -22,6 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|serviceFileSuffix|The suffix of the file of the generated service (service<suffix>.ts).| |.service|
|
||||
|serviceSuffix|The suffix of the generated service.| |Service|
|
||||
|
@ -18,6 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
@ -18,6 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
@ -18,6 +18,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|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|
|
||||
|nullSafeAdditionalProps|Set to make additional properties types declare that their indexer may return undefined| |false|
|
||||
|paramNaming|Naming convention for parameters: '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|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|
150
docs/generators/wsdl-schema.md
Normal file
150
docs/generators/wsdl-schema.md
Normal file
@ -0,0 +1,150 @@
|
||||
---
|
||||
title: Config Options for wsdl-schema
|
||||
sidebar_label: wsdl-schema
|
||||
---
|
||||
|
||||
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|hostname|the hostname of the service| |null|
|
||||
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<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|
|
||||
|serviceName|service name for the wsdl| |null|
|
||||
|soapPath|basepath of the soap services| |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 |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✗|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✗|ToolingExtension
|
||||
|MockServer|✗|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
|
@ -45,7 +45,7 @@ For full details of all options, see the [plugin README](https://github.com/Open
|
||||
|
||||
### Dependencies
|
||||
|
||||
The generated models use commonly use Swagger v2 annotations like `@ApiModelProperty`. A user may add Swagger v3 annotations:
|
||||
The generated models use commonly used Swagger v2 annotations like `@ApiModelProperty`. A user may add Swagger v3 annotations:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
|
@ -97,7 +97,7 @@ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.Valid
|
||||
[source,group]
|
||||
----
|
||||
plugins {
|
||||
id "org.openapi.generator" version "5.1.0"
|
||||
id "org.openapi.generator" version "5.1.1"
|
||||
}
|
||||
----
|
||||
|
||||
@ -113,7 +113,7 @@ buildscript {
|
||||
// url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:5.1.0"
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:5.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,11 +56,11 @@ import org.openapitools.codegen.validations.oas.RuleConfiguration
|
||||
open class ValidateTask : DefaultTask() {
|
||||
@get:InputFile
|
||||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
var inputSpec = project.objects.property<String>()
|
||||
val inputSpec = project.objects.property<String>()
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
var recommend = project.objects.property<Boolean?>()
|
||||
val recommend = project.objects.property<Boolean?>()
|
||||
|
||||
@Suppress("unused")
|
||||
@get:Internal
|
||||
@ -128,4 +128,4 @@ open class ValidateTask : DefaultTask() {
|
||||
out.println("Spec is valid.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package org.openapitools.generator.gradle.plugin
|
||||
import org.gradle.testkit.runner.GradleRunner
|
||||
import org.gradle.testkit.runner.TaskOutcome.FAILED
|
||||
import org.gradle.testkit.runner.TaskOutcome.SUCCESS
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.testng.annotations.DataProvider
|
||||
import org.testng.annotations.Test
|
||||
import java.io.File
|
||||
import kotlin.test.assertEquals
|
||||
@ -11,8 +13,25 @@ import kotlin.test.assertTrue
|
||||
class ValidateTaskDslTest : TestBase() {
|
||||
override var temp: File = createTempDir(javaClass.simpleName)
|
||||
|
||||
@Test
|
||||
fun `openApiValidate should fail on non-file spec`() {
|
||||
@DataProvider(name = "gradle_version_provider")
|
||||
fun gradleVersionProvider(): Array<Array<String?>> = arrayOf(
|
||||
arrayOf(null), // uses the version of Gradle used to build the plugin itself
|
||||
arrayOf("5.6.4"),
|
||||
arrayOf("6.9"),
|
||||
arrayOf("7.0"))
|
||||
|
||||
private fun getGradleRunner(gradleVersion: String?): GradleRunner {
|
||||
val gradleRunner = GradleRunner.create()
|
||||
return if (gradleVersion.isNullOrBlank()) {
|
||||
//Use the current version of Gradle
|
||||
gradleRunner
|
||||
} else {
|
||||
gradleRunner.withGradleVersion(gradleVersion)
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "gradle_version_provider")
|
||||
fun `openApiValidate should fail on non-file spec`(gradleVersion: String?) {
|
||||
// Arrange
|
||||
withProject("""
|
||||
| plugins {
|
||||
@ -25,20 +44,28 @@ class ValidateTaskDslTest : TestBase() {
|
||||
""".trimMargin())
|
||||
|
||||
// Act
|
||||
val result = GradleRunner.create()
|
||||
val result = getGradleRunner(gradleVersion)
|
||||
.withProjectDir(temp)
|
||||
.withArguments("openApiValidate")
|
||||
.withPluginClasspath()
|
||||
.buildAndFail()
|
||||
|
||||
// Assert
|
||||
assertTrue(result.output.contains("some_location' specified for property 'inputSpec' does not exist"), "Unexpected/no message presented to the user for a spec pointing to an invalid URI.")
|
||||
val gradleActualVersion = gradleVersion ?: GradleVersion.current().version
|
||||
val gradleVersionParts = gradleActualVersion.split(".")
|
||||
val isBeforeGradle7 = (gradleVersionParts.isEmpty() || gradleVersionParts[0].toInt() < 7)
|
||||
val expectedMessage = if (isBeforeGradle7) {
|
||||
"some_location' specified for property 'inputSpec' does not exist"
|
||||
} else {
|
||||
"An input file was expected to be present but it doesn't exist."
|
||||
}
|
||||
assertTrue(result.output.contains(expectedMessage), "Unexpected/no message presented to the user for a spec pointing to an invalid URI.")
|
||||
assertEquals(FAILED, result.task(":openApiValidate")?.outcome,
|
||||
"Expected a failed run, but found ${result.task(":openApiValidate")?.outcome}")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `openApiValidate should succeed on valid spec`() {
|
||||
@Test(dataProvider = "gradle_version_provider")
|
||||
fun `openApiValidate should succeed on valid spec`(gradleVersion: String?) {
|
||||
// Arrange
|
||||
val projectFiles = mapOf(
|
||||
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
|
||||
@ -55,7 +82,7 @@ class ValidateTaskDslTest : TestBase() {
|
||||
""".trimMargin(), projectFiles)
|
||||
|
||||
// Act
|
||||
val result = GradleRunner.create()
|
||||
val result = getGradleRunner(gradleVersion)
|
||||
.withProjectDir(temp)
|
||||
.withArguments("openApiValidate")
|
||||
.withPluginClasspath()
|
||||
@ -67,8 +94,8 @@ class ValidateTaskDslTest : TestBase() {
|
||||
"Expected a successful run, but found ${result.task(":openApiValidate")?.outcome}")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `openApiValidate should fail on invalid spec`() {
|
||||
@Test(dataProvider = "gradle_version_provider")
|
||||
fun `openApiValidate should fail on invalid spec`(gradleVersion: String?) {
|
||||
// Arrange
|
||||
val projectFiles = mapOf(
|
||||
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0-invalid.yaml")
|
||||
@ -84,7 +111,7 @@ class ValidateTaskDslTest : TestBase() {
|
||||
""".trimMargin(), projectFiles)
|
||||
|
||||
// Act
|
||||
val result = GradleRunner.create()
|
||||
val result = getGradleRunner(gradleVersion)
|
||||
.withProjectDir(temp)
|
||||
.withArguments("openApiValidate")
|
||||
.withPluginClasspath()
|
||||
@ -96,4 +123,4 @@ class ValidateTaskDslTest : TestBase() {
|
||||
"Expected a failed run, but found ${result.task(":openApiValidate")?.outcome}")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -219,6 +219,13 @@
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kotlin-stdlib for lowercase, uppercase, etc -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
@ -229,7 +236,7 @@
|
||||
<jodatime-version>2.7</jodatime-version>
|
||||
<maven-plugin-version>1.0.0</maven-plugin-version>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
<kotlin.version>1.3.50</kotlin.version>
|
||||
<kotlin.version>1.5.10</kotlin.version>
|
||||
<kotlinJvmTarget>1.8</kotlinJvmTarget>
|
||||
<moshi-kotlin.version>1.8.0</moshi-kotlin.version>
|
||||
<migbase64.version>2.2</migbase64.version>
|
||||
|
@ -153,7 +153,7 @@ public class Generator {
|
||||
List<File> files = new DefaultGenerator().opts(clientOptInput).generate();
|
||||
if (files.size() > 0) {
|
||||
List<File> filesToAdd = new ArrayList<>();
|
||||
LOGGER.debug("adding to " + outputFolder);
|
||||
LOGGER.debug("adding to {}", outputFolder);
|
||||
filesToAdd.add(new File(outputFolder));
|
||||
ZipUtil zip = new ZipUtil();
|
||||
zip.compressFiles(filesToAdd, outputFilename);
|
||||
|
@ -184,6 +184,9 @@ public class CodegenConstants {
|
||||
public static final String OPTIONAL_EMIT_DEFAULT_VALUES = "optionalEmitDefaultValues";
|
||||
public static final String OPTIONAL_EMIT_DEFAULT_VALUES_DESC = "Set DataMember's EmitDefaultValue.";
|
||||
|
||||
public static final String OPTIONAL_CONDITIONAL_SERIALIZATION = "conditionalSerialization";
|
||||
public static final String OPTIONAL_CONDITIONAL_SERIALIZATION_DESC = "Serialize only those properties which are initialized by user, accepted values are true or false, default value is false.";
|
||||
|
||||
public static final String NETCORE_PROJECT_FILE = "netCoreProjectFile";
|
||||
public static final String NETCORE_PROJECT_FILE_DESC = "Use the new format (.NET Core) for .NET project files (.csproj).";
|
||||
|
||||
@ -205,12 +208,20 @@ public class CodegenConstants {
|
||||
public static final String MODEL_PROPERTY_NAMING = "modelPropertyNaming";
|
||||
public static final String MODEL_PROPERTY_NAMING_DESC = "Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name";
|
||||
|
||||
public static final String PARAM_NAMING = "paramNaming";
|
||||
public static final String PARAM_NAMING_DESC = "Naming convention for parameters: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name";
|
||||
|
||||
public static final String DOTNET_FRAMEWORK = "targetFramework";
|
||||
public static final String DOTNET_FRAMEWORK_DESC = "The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`";
|
||||
|
||||
public static final String NULLABLE_REFERENCE_TYPES = "nullableReferenceTypes";
|
||||
public static final String NULLABLE_REFERENCE_TYPES_DESC = "Use nullable annotations in the project. Only supported on C# 8 / ASP.NET Core 3.0 or newer.";
|
||||
|
||||
public static final String TEMPLATING_ENGINE = "templatingEngine";
|
||||
public static final String TEMPLATING_ENGINE_DESC = "The templating engine plugin to use: \"mustache\" (default) or \"handlebars\" (beta)";
|
||||
|
||||
public static enum PARAM_NAMING_TYPE {camelCase, PascalCase, snake_case, original}
|
||||
|
||||
public static enum MODEL_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, original}
|
||||
|
||||
public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, original, UPPERCASE}
|
||||
@ -309,6 +320,12 @@ public class CodegenConstants {
|
||||
public static final String REMOVE_OPERATION_ID_PREFIX = "removeOperationIdPrefix";
|
||||
public static final String REMOVE_OPERATION_ID_PREFIX_DESC = "Remove prefix of operationId, e.g. config_getId => getId";
|
||||
|
||||
public static final String REMOVE_OPERATION_ID_PREFIX_DELIMITER = "removeOperationIdPrefixDelimiter";
|
||||
public static final String REMOVE_OPERATION_ID_PREFIX_DELIMITER_DESC = "Character to use as a delimiter for the prefix. Default: '_'";
|
||||
|
||||
public static final String REMOVE_OPERATION_ID_PREFIX_COUNT = "removeOperationIdPrefixCount";
|
||||
public static final String REMOVE_OPERATION_ID_PREFIX_COUNT_DESC = "Count of delimiter for the prefix. Use -1 for last Default: 1";
|
||||
|
||||
public static final String SKIP_OPERATION_EXAMPLE = "skipOperationExample";
|
||||
public static final String SKIP_OPERATION_EXAMPLE_DESC = "Skip examples defined in operations to avoid out of memory errors.";
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
public String defaultValue;
|
||||
public String arrayModelType;
|
||||
public boolean isAlias; // Is this effectively an alias of another simple type
|
||||
public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime;
|
||||
public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isShort, isUnboundedInteger, isBoolean;
|
||||
private boolean additionalPropertiesIsAnyType;
|
||||
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)
|
||||
public List<CodegenProperty> allVars = new ArrayList<CodegenProperty>(); // all properties (with parent's properties)
|
||||
@ -606,6 +606,30 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
this.isArray = isArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsShort() { return isShort; }
|
||||
|
||||
@Override
|
||||
public void setIsShort(boolean isShort) {
|
||||
this.isShort = isShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsBoolean() { return isBoolean; }
|
||||
|
||||
@Override
|
||||
public void setIsBoolean(boolean isBoolean) {
|
||||
this.isBoolean= isBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsUnboundedInteger() { return isUnboundedInteger; }
|
||||
|
||||
@Override
|
||||
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
||||
this.isUnboundedInteger = isUnboundedInteger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenProperty getAdditionalProperties() { return additionalProperties; }
|
||||
|
||||
@ -752,7 +776,10 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
return isAlias == that.isAlias &&
|
||||
isString == that.isString &&
|
||||
isInteger == that.isInteger &&
|
||||
isShort == that.isShort &&
|
||||
isLong == that.isLong &&
|
||||
isUnboundedInteger == that.isUnboundedInteger &&
|
||||
isBoolean == that.isBoolean &&
|
||||
isNumber == that.isNumber &&
|
||||
isNumeric == that.isNumeric &&
|
||||
isFloat == that.isFloat &&
|
||||
@ -839,7 +866,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
getDescription(), getClassVarName(), getModelJson(), getDataType(), getXmlPrefix(), getXmlNamespace(),
|
||||
getXmlName(), getClassFilename(), getUnescapedDescription(), getDiscriminator(), getDefaultValue(),
|
||||
getArrayModelType(), isAlias, isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble,
|
||||
isDate, isDateTime, isNull, hasValidation,
|
||||
isDate, isDateTime, isNull, hasValidation, isShort, isUnboundedInteger, isBoolean,
|
||||
getVars(), getAllVars(), getRequiredVars(), getOptionalVars(), getReadOnlyVars(), getReadWriteVars(),
|
||||
getParentVars(), getAllowableValues(), getMandatory(), getAllMandatory(), getImports(), hasVars,
|
||||
isEmptyVars(), hasMoreModels, hasEnums, isEnum, isNullable, hasRequired, hasOptional, isArray,
|
||||
@ -881,7 +908,10 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
sb.append(", isAlias=").append(isAlias);
|
||||
sb.append(", isString=").append(isString);
|
||||
sb.append(", isInteger=").append(isInteger);
|
||||
sb.append(", isShort=").append(isShort);
|
||||
sb.append(", isLong=").append(isLong);
|
||||
sb.append(", isUnboundedInteger=").append(isUnboundedInteger);
|
||||
sb.append(", isBoolean=").append(isBoolean);
|
||||
sb.append(", isNumber=").append(isNumber);
|
||||
sb.append(", isNumeric=").append(isNumeric);
|
||||
sb.append(", isFloat=").append(isFloat);
|
||||
|
@ -35,7 +35,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
public String example; // example value (x-example)
|
||||
public String jsonSchema;
|
||||
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary,
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType;
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isShort, isUnboundedInteger;
|
||||
public boolean isArray, isMap;
|
||||
public boolean isFile;
|
||||
public boolean isEnum;
|
||||
@ -184,7 +184,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
output.isString = this.isString;
|
||||
output.isNumeric = this.isNumeric;
|
||||
output.isInteger = this.isInteger;
|
||||
output.isShort = this.isShort;
|
||||
output.isLong = this.isLong;
|
||||
output.isUnboundedInteger = this.isUnboundedInteger;
|
||||
output.isDouble = this.isDouble;
|
||||
output.isDecimal = this.isDecimal;
|
||||
output.isFloat = this.isFloat;
|
||||
@ -209,7 +211,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired);
|
||||
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -231,7 +233,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
isString == that.isString &&
|
||||
isNumeric == that.isNumeric &&
|
||||
isInteger == that.isInteger &&
|
||||
isShort == that.isShort &&
|
||||
isLong == that.isLong &&
|
||||
isUnboundedInteger == that.isUnboundedInteger &&
|
||||
isNumber == that.isNumber &&
|
||||
isFloat == that.isFloat &&
|
||||
isDouble == that.isDouble &&
|
||||
@ -328,7 +332,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
sb.append(", isString=").append(isString);
|
||||
sb.append(", isNumeric=").append(isNumeric);
|
||||
sb.append(", isInteger=").append(isInteger);
|
||||
sb.append(", isShort=").append(isShort);
|
||||
sb.append(", isLong=").append(isLong);
|
||||
sb.append(", isUnboundedInteger=").append(isUnboundedInteger);
|
||||
sb.append(", isNumber=").append(isNumber);
|
||||
sb.append(", isFloat=").append(isFloat);
|
||||
sb.append(", isDouble=").append(isDouble);
|
||||
@ -560,6 +566,30 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
this.isArray = isArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsShort() { return isShort; }
|
||||
|
||||
@Override
|
||||
public void setIsShort(boolean isShort) {
|
||||
this.isShort = isShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsBoolean() { return isBoolean; }
|
||||
|
||||
@Override
|
||||
public void setIsBoolean(boolean isBoolean) {
|
||||
this.isBoolean = isBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsUnboundedInteger() { return isUnboundedInteger; }
|
||||
|
||||
@Override
|
||||
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
||||
this.isUnboundedInteger = isUnboundedInteger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenProperty getAdditionalProperties() { return additionalProperties; }
|
||||
|
||||
|
@ -118,7 +118,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
public boolean isString;
|
||||
public boolean isNumeric;
|
||||
public boolean isInteger;
|
||||
public boolean isShort;
|
||||
public boolean isLong;
|
||||
public boolean isUnboundedInteger;
|
||||
public boolean isNumber;
|
||||
public boolean isFloat;
|
||||
public boolean isDouble;
|
||||
@ -507,6 +509,30 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.isArray = isArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsShort() { return isShort; }
|
||||
|
||||
@Override
|
||||
public void setIsShort(boolean isShort) {
|
||||
this.isShort = isShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsBoolean() { return isBoolean; }
|
||||
|
||||
@Override
|
||||
public void setIsBoolean(boolean isBoolean) {
|
||||
this.isBoolean = isBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsUnboundedInteger() { return isUnboundedInteger; }
|
||||
|
||||
@Override
|
||||
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
||||
this.isUnboundedInteger = isUnboundedInteger;
|
||||
}
|
||||
|
||||
public Map<String, Object> getVendorExtensions() {
|
||||
return vendorExtensions;
|
||||
}
|
||||
@ -652,10 +678,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
this.maxProperties = maxProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Number getMultipleOf() {
|
||||
return multipleOf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultipleOf(Number multipleOf) {
|
||||
this.multipleOf = multipleOf;
|
||||
}
|
||||
@ -765,7 +793,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
sb.append(", isString=").append(isString);
|
||||
sb.append(", isNumeric=").append(isNumeric);
|
||||
sb.append(", isInteger=").append(isInteger);
|
||||
sb.append(", isShort=").append(isShort);
|
||||
sb.append(", isLong=").append(isLong);
|
||||
sb.append(", isUnboundedInteger=").append(isUnboundedInteger);
|
||||
sb.append(", isNumber=").append(isNumber);
|
||||
sb.append(", isFloat=").append(isFloat);
|
||||
sb.append(", isDouble=").append(isDouble);
|
||||
@ -838,7 +868,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
isString == that.isString &&
|
||||
isNumeric == that.isNumeric &&
|
||||
isInteger == that.isInteger &&
|
||||
isShort == that.isShort &&
|
||||
isLong == that.isLong &&
|
||||
isUnboundedInteger == that.isUnboundedInteger &&
|
||||
isNumber == that.isNumber &&
|
||||
isFloat == that.isFloat &&
|
||||
isDouble == that.isDouble &&
|
||||
@ -926,7 +958,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
hasMoreNonReadOnly, isPrimitiveType, isModel, isContainer, isString, isNumeric,
|
||||
isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isFile,
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject,
|
||||
isArray, isMap, isEnum, isReadOnly, isWriteOnly, isNullable,
|
||||
isArray, isMap, isEnum, isReadOnly, isWriteOnly, isNullable, isShort, isUnboundedInteger,
|
||||
isSelfReference, isCircularReference, isDiscriminator, _enum, allowableValues,
|
||||
items, mostInnerItems, additionalProperties, vars, requiredVars,
|
||||
vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase,
|
||||
|
@ -36,7 +36,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
public boolean isString;
|
||||
public boolean isNumeric;
|
||||
public boolean isInteger;
|
||||
public boolean isShort;
|
||||
public boolean isLong;
|
||||
public boolean isUnboundedInteger;
|
||||
public boolean isNumber;
|
||||
public boolean isFloat;
|
||||
public boolean isDouble;
|
||||
@ -89,7 +91,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBoolean, isDate,
|
||||
isDateTime, isUuid, isEmail, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType,
|
||||
isMap, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties,
|
||||
vars, requiredVars, isNull, hasValidation,
|
||||
vars, requiredVars, isNull, hasValidation, isShort, isUnboundedInteger,
|
||||
getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(),
|
||||
getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(),
|
||||
is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired);
|
||||
@ -104,7 +106,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
isString == that.isString &&
|
||||
isNumeric == that.isNumeric &&
|
||||
isInteger == that.isInteger &&
|
||||
isShort == that.isShort &&
|
||||
isLong == that.isLong &&
|
||||
isUnboundedInteger == that.isUnboundedInteger &&
|
||||
isNumber == that.isNumber &&
|
||||
isFloat == that.isFloat &&
|
||||
isDouble == that.isDouble &&
|
||||
@ -316,6 +320,30 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
this.isArray = isArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsShort() { return isShort; }
|
||||
|
||||
@Override
|
||||
public void setIsShort(boolean isShort) {
|
||||
this.isShort = isShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsBoolean() { return isBoolean; }
|
||||
|
||||
@Override
|
||||
public void setIsBoolean(boolean isBoolean) {
|
||||
this.isBoolean = isBoolean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsUnboundedInteger() { return isUnboundedInteger; }
|
||||
|
||||
@Override
|
||||
public void setIsUnboundedInteger(boolean isUnboundedInteger) {
|
||||
this.isUnboundedInteger = isUnboundedInteger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsModel(boolean isModel) {
|
||||
this.isModel = isModel;
|
||||
@ -402,7 +430,9 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
|
||||
sb.append(", isString=").append(isString);
|
||||
sb.append(", isNumeric=").append(isNumeric);
|
||||
sb.append(", isInteger=").append(isInteger);
|
||||
sb.append(", isShort=").append(isShort);
|
||||
sb.append(", isLong=").append(isLong);
|
||||
sb.append(", isUnboundedInteger=").append(isUnboundedInteger);
|
||||
sb.append(", isNumber=").append(isNumber);
|
||||
sb.append(", isFloat=").append(isFloat);
|
||||
sb.append(", isDouble=").append(isDouble);
|
||||
|
@ -177,6 +177,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected List<CliOption> cliOptions = new ArrayList<CliOption>();
|
||||
protected boolean skipOverwrite;
|
||||
protected boolean removeOperationIdPrefix;
|
||||
protected String removeOperationIdPrefixDelimiter = "_";
|
||||
protected int removeOperationIdPrefixCount = 1;
|
||||
protected boolean skipOperationExample;
|
||||
|
||||
protected final static Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)application\\/json(;.*)?");
|
||||
@ -254,10 +256,12 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// A cache to efficiently lookup a Schema instance based on the return value of `toModelName()`.
|
||||
private Map<String, Schema> modelNameToSchemaCache;
|
||||
|
||||
@Override
|
||||
public List<CliOption> cliOptions() {
|
||||
return cliOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
if (additionalProperties.containsKey(CodegenConstants.TEMPLATE_DIR)) {
|
||||
this.setTemplateDir((String) additionalProperties.get(CodegenConstants.TEMPLATE_DIR));
|
||||
@ -323,6 +327,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
.get(CodegenConstants.REMOVE_OPERATION_ID_PREFIX).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.REMOVE_OPERATION_ID_PREFIX_DELIMITER)) {
|
||||
this.setRemoveOperationIdPrefixDelimiter(additionalProperties
|
||||
.get(CodegenConstants.REMOVE_OPERATION_ID_PREFIX_DELIMITER).toString());
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.REMOVE_OPERATION_ID_PREFIX_COUNT)) {
|
||||
this.setRemoveOperationIdPrefixCount(Integer.parseInt(additionalProperties
|
||||
.get(CodegenConstants.REMOVE_OPERATION_ID_PREFIX_COUNT).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SKIP_OPERATION_EXAMPLE)) {
|
||||
this.setSkipOperationExample(Boolean.parseBoolean(additionalProperties
|
||||
.get(CodegenConstants.SKIP_OPERATION_EXAMPLE).toString()));
|
||||
@ -398,6 +412,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// override with any special post-processing for all models
|
||||
@Override
|
||||
@SuppressWarnings({"static-method", "unchecked"})
|
||||
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
||||
if (this.useOneOfInterfaces) {
|
||||
@ -500,6 +515,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param objs Map of models
|
||||
* @return maps of models with various updates
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> updateAllModels(Map<String, Object> objs) {
|
||||
Map<String, CodegenModel> allModels = getAllModels(objs);
|
||||
|
||||
@ -612,6 +628,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// override with any special post-processing
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||
return objs;
|
||||
@ -716,7 +733,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @return the sanitized value for enum
|
||||
*/
|
||||
public String toEnumValue(String value, String datatype) {
|
||||
if ("number".equalsIgnoreCase(datatype)) {
|
||||
if ("number".equalsIgnoreCase(datatype) || "boolean".equalsIgnoreCase(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\"" + escapeText(value) + "\"";
|
||||
@ -756,6 +773,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// override with any message to be shown right before the process finishes
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public void postProcess() {
|
||||
System.out.println("################################################################################");
|
||||
@ -766,28 +784,33 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// override with any special post-processing
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
return objs;
|
||||
}
|
||||
|
||||
// override with any special post-processing
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
||||
return objs;
|
||||
}
|
||||
|
||||
// override to post-process any model properties
|
||||
@Override
|
||||
@SuppressWarnings("unused")
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
}
|
||||
|
||||
// override to post-process any parameters
|
||||
@Override
|
||||
@SuppressWarnings("unused")
|
||||
public void postProcessParameter(CodegenParameter parameter) {
|
||||
}
|
||||
|
||||
//override with any special handling of the entire OpenAPI spec document
|
||||
@Override
|
||||
@SuppressWarnings("unused")
|
||||
public void preprocessOpenAPI(OpenAPI openAPI) {
|
||||
if (useOneOfInterfaces) {
|
||||
@ -872,23 +895,27 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// override with any special handling of the entire OpenAPI spec document
|
||||
@Override
|
||||
@SuppressWarnings("unused")
|
||||
public void processOpenAPI(OpenAPI openAPI) {
|
||||
}
|
||||
|
||||
// override with any special handling of the JMustache compiler
|
||||
@Override
|
||||
@SuppressWarnings("unused")
|
||||
public Compiler processCompiler(Compiler compiler) {
|
||||
return compiler;
|
||||
}
|
||||
|
||||
// override with any special handling for the templating engine
|
||||
@Override
|
||||
@SuppressWarnings("unused")
|
||||
public TemplatingEngineAdapter processTemplatingEngine(TemplatingEngineAdapter templatingEngine) {
|
||||
return templatingEngine;
|
||||
}
|
||||
|
||||
// override with any special text escaping logic
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String escapeText(String input) {
|
||||
if (input == null) {
|
||||
@ -915,6 +942,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param input String to be escaped
|
||||
* @return escaped string
|
||||
*/
|
||||
@Override
|
||||
public String escapeTextWhileAllowingNewLines(String input) {
|
||||
if (input == null) {
|
||||
return input;
|
||||
@ -935,6 +963,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
// override with any special encoding and escaping logic
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String encodePath(String input) {
|
||||
return escapeText(input);
|
||||
@ -947,6 +976,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param input String to be cleaned up
|
||||
* @return string with unsafe characters removed or escaped
|
||||
*/
|
||||
@Override
|
||||
public String escapeUnsafeCharacters(String input) {
|
||||
LOGGER.warn("escapeUnsafeCharacters should be overridden in the code generator with proper logic to escape " +
|
||||
"unsafe characters");
|
||||
@ -963,56 +993,69 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param input String to be cleaned up
|
||||
* @return string with quotation mark removed or escaped
|
||||
*/
|
||||
@Override
|
||||
public String escapeQuotationMark(String input) {
|
||||
LOGGER.warn("escapeQuotationMark should be overridden in the code generator with proper logic to escape " +
|
||||
"single/double quote");
|
||||
return input.replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> defaultIncludes() {
|
||||
return defaultIncludes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> typeMapping() {
|
||||
return typeMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> instantiationTypes() {
|
||||
return instantiationTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> reservedWords() {
|
||||
return reservedWords;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> languageSpecificPrimitives() {
|
||||
return languageSpecificPrimitives;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> importMapping() {
|
||||
return importMapping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String testPackage() {
|
||||
return testPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelPackage() {
|
||||
return modelPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiPackage() {
|
||||
return apiPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fileSuffix() {
|
||||
return fileSuffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String templateDir() {
|
||||
return templateDir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String embeddedTemplateDir() {
|
||||
if (embeddedTemplateDir != null) {
|
||||
return embeddedTemplateDir;
|
||||
@ -1021,90 +1064,112 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> apiDocTemplateFiles() {
|
||||
return apiDocTemplateFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> modelDocTemplateFiles() {
|
||||
return modelDocTemplateFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> reservedWordsMappings() {
|
||||
return reservedWordsMappings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> apiTestTemplateFiles() {
|
||||
return apiTestTemplateFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> modelTestTemplateFiles() {
|
||||
return modelTestTemplateFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> apiTemplateFiles() {
|
||||
return apiTemplateFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> modelTemplateFiles() {
|
||||
return modelTemplateFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separator + apiPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + File.separator + modelPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiTestFileFolder() {
|
||||
return outputFolder + File.separator + testPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelTestFileFolder() {
|
||||
return outputFolder + File.separator + testPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> additionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> serverVariableOverrides() {
|
||||
return serverVariables;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> vendorExtensions() {
|
||||
return vendorExtensions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SupportingFile> supportingFiles() {
|
||||
return supportingFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String outputFolder() {
|
||||
return outputFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutputDir(String dir) {
|
||||
this.outputFolder = dir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOutputDir() {
|
||||
return outputFolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInputSpec() {
|
||||
return inputSpec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputSpec(String inputSpec) {
|
||||
this.inputSpec = inputSpec;
|
||||
}
|
||||
@ -1233,6 +1298,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the file name of the Api
|
||||
* @return the file name of the Api
|
||||
*/
|
||||
@Override
|
||||
public String toApiFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
@ -1243,6 +1309,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the file name of the Api
|
||||
* @return the file name of the Api
|
||||
*/
|
||||
@Override
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
@ -1253,6 +1320,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the file name of the Api
|
||||
* @return the file name of the Api
|
||||
*/
|
||||
@Override
|
||||
public String toApiTestFilename(String name) {
|
||||
return toApiName(name) + "Test";
|
||||
}
|
||||
@ -1263,6 +1331,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the varible name of the Api
|
||||
* @return the snake-cased variable name
|
||||
*/
|
||||
@Override
|
||||
public String toApiVarName(String name) {
|
||||
return lowerCamelCase(name);
|
||||
}
|
||||
@ -1273,6 +1342,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the model name
|
||||
* @return the file name of the model
|
||||
*/
|
||||
@Override
|
||||
public String toModelFilename(String name) {
|
||||
return camelize(name);
|
||||
}
|
||||
@ -1283,6 +1353,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the model name
|
||||
* @return the file name of the model
|
||||
*/
|
||||
@Override
|
||||
public String toModelTestFilename(String name) {
|
||||
return camelize(name) + "Test";
|
||||
}
|
||||
@ -1293,6 +1364,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the model name
|
||||
* @return the file name of the model
|
||||
*/
|
||||
@Override
|
||||
public String toModelDocFilename(String name) {
|
||||
return camelize(name);
|
||||
}
|
||||
@ -1346,6 +1418,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name Codegen property object
|
||||
* @return the sanitized parameter name
|
||||
*/
|
||||
@Override
|
||||
public String toParamName(String name) {
|
||||
name = removeNonNameElementToCamelCase(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
if (reservedWords.contains(name)) {
|
||||
@ -1386,6 +1459,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* <p>
|
||||
* throws Runtime exception as reserved word is not allowed (default behavior)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String escapeReservedWord(String name) {
|
||||
throw new RuntimeException("reserved word " + name + " not allowed");
|
||||
@ -1397,6 +1471,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the name of the "Model"
|
||||
* @return the fully-qualified "Model" name for import
|
||||
*/
|
||||
@Override
|
||||
public String toModelImport(String name) {
|
||||
if ("".equals(modelPackage())) {
|
||||
return name;
|
||||
@ -1411,6 +1486,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the name of the "Model"
|
||||
* @return Map of fully-qualified models.
|
||||
*/
|
||||
@Override
|
||||
public Map<String,String> toModelImportMap(String name){
|
||||
return Collections.singletonMap(this.toModelImport(name),name);
|
||||
}
|
||||
@ -1421,6 +1497,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the name of the "Api"
|
||||
* @return the fully-qualified "Api" name for import
|
||||
*/
|
||||
@Override
|
||||
public String toApiImport(String name) {
|
||||
return apiPackage() + "." + name;
|
||||
}
|
||||
@ -1592,6 +1669,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param operation OAS operation object
|
||||
* @return string presentation of the example path
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String generateExamplePath(String path, Operation operation) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@ -2000,6 +2078,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return "oneOf<" + String.join(",", names) + ">";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema unaliasSchema(Schema schema, Map<String, String> usedImportMappings) {
|
||||
return ModelUtils.unaliasSchema(this.openAPI, schema, usedImportMappings);
|
||||
}
|
||||
@ -2142,6 +2221,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name name
|
||||
* @return a string presentation of the type
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String getTypeDeclaration(String name) {
|
||||
return name;
|
||||
@ -2153,6 +2233,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param schema property schema
|
||||
* @return a string presentation of the property type
|
||||
*/
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema schema) {
|
||||
if (schema == null) {
|
||||
LOGGER.warn("Null schema found. Default type to `NULL_SCHEMA_ERR`");
|
||||
@ -2189,6 +2270,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the name of the property
|
||||
* @return getter name based on naming convention
|
||||
*/
|
||||
@Override
|
||||
public String toBooleanGetter(String name) {
|
||||
return "get" + getterAndSetterCapitalize(name);
|
||||
}
|
||||
@ -2199,6 +2281,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the name of the property
|
||||
* @return getter name based on naming convention
|
||||
*/
|
||||
@Override
|
||||
public String toGetter(String name) {
|
||||
return "get" + getterAndSetterCapitalize(name);
|
||||
}
|
||||
@ -2209,6 +2292,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the name of the property
|
||||
* @return setter name based on naming convention
|
||||
*/
|
||||
@Override
|
||||
public String toSetter(String name) {
|
||||
return "set" + getterAndSetterCapitalize(name);
|
||||
}
|
||||
@ -2220,6 +2304,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the name of the Api
|
||||
* @return capitalized Api name
|
||||
*/
|
||||
@Override
|
||||
public String toApiName(String name) {
|
||||
if (name.length() == 0) {
|
||||
return "DefaultApi";
|
||||
@ -2235,6 +2320,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name the name of the model
|
||||
* @return capitalized model name
|
||||
*/
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
return camelize(modelNamePrefix + "_" + name + "_" + modelNameSuffix);
|
||||
}
|
||||
@ -2271,6 +2357,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param schema OAS Model object
|
||||
* @return Codegen Model object
|
||||
*/
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Schema schema) {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
if (typeAliases == null) {
|
||||
@ -2403,6 +2490,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (StringUtils.isBlank(interfaceSchema.get$ref())) {
|
||||
// primitive type
|
||||
String languageType = getTypeDeclaration(interfaceSchema);
|
||||
if (ModelUtils.isArraySchema(interfaceSchema) || ModelUtils.isMapSchema(interfaceSchema)) {
|
||||
CodegenProperty cp = fromProperty("composedSchemaImports", interfaceSchema);
|
||||
while (cp != null) {
|
||||
addImport(m, cp.complexType);
|
||||
cp = cp.items;
|
||||
}
|
||||
}
|
||||
|
||||
if (composed.getAnyOf() != null) {
|
||||
if (m.anyOf.contains(languageType)) {
|
||||
@ -2532,8 +2626,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
m.isNumeric = Boolean.TRUE;
|
||||
if (ModelUtils.isLongSchema(schema)) { // int64/long format
|
||||
m.isLong = Boolean.TRUE;
|
||||
} else { // int32 format
|
||||
m.isInteger = Boolean.TRUE;
|
||||
} else {
|
||||
m.isInteger = Boolean.TRUE; // older use case, int32 and unbounded int
|
||||
if (ModelUtils.isShortSchema(schema)) { // int32
|
||||
m.setIsShort(Boolean.TRUE);
|
||||
} else { // unbounded integer
|
||||
m.setIsUnboundedInteger(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
} else if (ModelUtils.isDateTimeSchema(schema)) {
|
||||
// NOTE: DateTime schemas as CodegenModel is a rare use case and may be removed at a later date.
|
||||
@ -2554,6 +2653,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else { // type is number and without format
|
||||
m.isNumber = Boolean.TRUE;
|
||||
}
|
||||
} else if (ModelUtils.isBooleanSchema(schema)) {
|
||||
m.isBoolean = Boolean.TRUE;
|
||||
} else if (ModelUtils.isFreeFormObject(openAPI, schema)) {
|
||||
addAdditionPropertiesToCodeGenModel(m, schema);
|
||||
}
|
||||
@ -2706,14 +2807,18 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
String modelName = ModelUtils.getSimpleRef(oneOf.get$ref());
|
||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, openAPI);
|
||||
if (thisCp == null) {
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing " + discPropName);
|
||||
LOGGER.warn(
|
||||
"'{}' defines discriminator '{}', but the referenced OneOf schema '{}' is missing {}",
|
||||
composedSchemaName, discPropName, modelName, discPropName);
|
||||
}
|
||||
if (cp.dataType == null) {
|
||||
cp = thisCp;
|
||||
continue;
|
||||
}
|
||||
if (cp != thisCp) {
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the OneOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior OneOf schema's. Make sure the " + discPropName + " type and required values are the same");
|
||||
LOGGER.warn(
|
||||
"'{}' defines discriminator '{}', but the OneOf schema '{}' has a different {} definition than the prior OneOf schema's. Make sure the {} type and required values are the same",
|
||||
composedSchemaName, discPropName, modelName, discPropName, discPropName);
|
||||
}
|
||||
}
|
||||
return cp;
|
||||
@ -2725,14 +2830,18 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
String modelName = ModelUtils.getSimpleRef(anyOf.get$ref());
|
||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, openAPI);
|
||||
if (thisCp == null) {
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing " + discPropName);
|
||||
LOGGER.warn(
|
||||
"'{}' defines discriminator '{}', but the referenced AnyOf schema '{}' is missing {}",
|
||||
composedSchemaName, discPropName, modelName, discPropName);
|
||||
}
|
||||
if (cp.dataType == null) {
|
||||
if (cp != null && cp.dataType == null) {
|
||||
cp = thisCp;
|
||||
continue;
|
||||
}
|
||||
if (cp != thisCp) {
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the AnyOf schema '" + modelName + "' has a different " + discPropName + " definition than the prior AnyOf schema's. Make sure the " + discPropName + " type and required values are the same");
|
||||
LOGGER.warn(
|
||||
"'{}' defines discriminator '{}', but the AnyOf schema '{}' has a different {} definition than the prior AnyOf schema's. Make sure the {} type and required values are the same",
|
||||
composedSchemaName, discPropName, modelName, discPropName, discPropName);
|
||||
}
|
||||
}
|
||||
return cp;
|
||||
@ -2870,7 +2979,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// schemas also has inline composed schemas
|
||||
// Note: if it is only inline one level, then the inline model resolver will move it into its own
|
||||
// schema and make it a $ref schema in the oneOf/anyOf location
|
||||
LOGGER.warn("Invalid inline schema defined in oneOf/anyOf in '" + composedSchemaName + "'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition");
|
||||
LOGGER.warn(
|
||||
"Invalid inline schema defined in oneOf/anyOf in '{}'. Per the OpenApi spec, for this case when a composed schema defines a discriminator, the oneOf/anyOf schemas must use $ref. Change this inline definition to a $ref definition",
|
||||
composedSchemaName);
|
||||
}
|
||||
CodegenProperty df = discriminatorFound(composedSchemaName, sc, discPropName, openAPI);
|
||||
String modelName = ModelUtils.getSimpleRef(ref);
|
||||
@ -2890,7 +3001,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required";
|
||||
}
|
||||
}
|
||||
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. " + msgSuffix);
|
||||
LOGGER.warn("'{}' defines discriminator '{}', but the referenced schema '{}' is incorrect. {}",
|
||||
composedSchemaName, discPropName, modelName, msgSuffix);
|
||||
}
|
||||
MappedModel mm = new MappedModel(modelName, toModelName(modelName));
|
||||
descendentSchemas.add(mm);
|
||||
@ -3185,6 +3297,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
if (p.getExtensions() != null && !p.getExtensions().isEmpty()) {
|
||||
property.getVendorExtensions().putAll(p.getExtensions());
|
||||
} else if (p.get$ref() != null) {
|
||||
Schema referencedSchema = ModelUtils.getReferencedSchema(this.openAPI, p);
|
||||
if (referencedSchema.getExtensions() != null && !referencedSchema.getExtensions().isEmpty()) {
|
||||
property.getVendorExtensions().putAll(referencedSchema.getExtensions());
|
||||
}
|
||||
}
|
||||
|
||||
String type = getSchemaType(p);
|
||||
@ -3192,10 +3309,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
property.isNumeric = Boolean.TRUE;
|
||||
if (ModelUtils.isLongSchema(p)) { // int64/long format
|
||||
property.isLong = Boolean.TRUE;
|
||||
} else { // int32 format
|
||||
property.isInteger = Boolean.TRUE;
|
||||
} else {
|
||||
property.isInteger = Boolean.TRUE; // older use case, int32 and unbounded int
|
||||
if (ModelUtils.isShortSchema(p)) { // int32
|
||||
property.setIsShort(Boolean.TRUE);
|
||||
} else { // unbounded integer
|
||||
property.setIsUnboundedInteger(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (ModelUtils.isBooleanSchema(p)) { // boolean type
|
||||
property.isBoolean = true;
|
||||
property.getter = toBooleanGetter(name);
|
||||
@ -3672,6 +3793,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param servers list of servers
|
||||
* @return Codegen Operation object
|
||||
*/
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path,
|
||||
String httpMethod,
|
||||
Operation operation,
|
||||
@ -3705,9 +3827,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
String operationId = getOrGenerateOperationId(operation, path, httpMethod);
|
||||
// remove prefix in operationId
|
||||
if (removeOperationIdPrefix) {
|
||||
int offset = operationId.indexOf('_');
|
||||
if (offset > -1) {
|
||||
operationId = operationId.substring(offset + 1);
|
||||
// The prefix is everything before the removeOperationIdPrefixCount occurrence of removeOperationIdPrefixDelimiter
|
||||
String[] componenets = operationId.split("[" + removeOperationIdPrefixDelimiter + "]");
|
||||
if (componenets.length > 1) {
|
||||
// If removeOperationIdPrefixCount is -1 or bigger that the number of occurrences, uses the last one
|
||||
int componenet_number = removeOperationIdPrefixCount == -1 ? componenets.length - 1 : removeOperationIdPrefixCount;
|
||||
componenet_number = Math.min(componenet_number, componenets.length - 1);
|
||||
// Reconstruct the operationId from its split elements and the delimiter
|
||||
operationId = String.join(removeOperationIdPrefixDelimiter, Arrays.copyOfRange(componenets, componenet_number, componenets.length));
|
||||
}
|
||||
}
|
||||
operationId = removeNonNameElementToCamelCase(operationId);
|
||||
@ -4067,6 +4194,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (Boolean.TRUE.equals(cp.isInteger)) {
|
||||
r.isInteger = true;
|
||||
r.isNumeric = true;
|
||||
if (Boolean.TRUE.equals(cp.isShort)) {
|
||||
r.isShort = true;
|
||||
} else if (Boolean.TRUE.equals(cp.isUnboundedInteger)) {
|
||||
r.isUnboundedInteger = true;
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(cp.isNumber)) {
|
||||
r.isNumber = true;
|
||||
r.isNumeric = true;
|
||||
@ -4422,7 +4554,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
else {
|
||||
LOGGER.warn("No object schema found for deepObject parameter" + codegenParameter + " deepObject won't have specific properties");
|
||||
LOGGER.warn(
|
||||
"No object schema found for deepObject parameter{} deepObject won't have specific properties",
|
||||
codegenParameter);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4475,6 +4609,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param securitySchemeMap a map of OAS SecuritySchemeDefinition object
|
||||
* @return a list of Codegen Security objects
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public List<CodegenSecurity> fromSecurity(Map<String, SecurityScheme> securitySchemeMap) {
|
||||
if (securitySchemeMap == null) {
|
||||
@ -4696,6 +4831,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param co Codegen Operation object
|
||||
* @param operations map of Codegen operations
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation
|
||||
co, Map<String, List<CodegenOperation>> operations) {
|
||||
@ -4714,7 +4850,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
if (!co.operationId.equals(uniqueName)) {
|
||||
LOGGER.warn("generated unique operationId `" + uniqueName + "`");
|
||||
LOGGER.warn("generated unique operationId `{}`", uniqueName);
|
||||
}
|
||||
co.operationId = uniqueName;
|
||||
co.operationIdLowerCase = uniqueName.toLowerCase(Locale.ROOT);
|
||||
@ -4869,7 +5005,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
final String key = entry.getKey();
|
||||
final Schema prop = entry.getValue();
|
||||
if (prop == null) {
|
||||
LOGGER.warn("Please report the issue. There shouldn't be null property for " + key);
|
||||
LOGGER.warn("Please report the issue. There shouldn't be null property for {}", key);
|
||||
} else {
|
||||
final CodegenProperty cp = fromProperty(key, prop);
|
||||
cp.required = mandatory.contains(key);
|
||||
@ -4963,7 +5099,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*/
|
||||
@SuppressWarnings("static-method")
|
||||
public String removeNonNameElementToCamelCase(String name) {
|
||||
return removeNonNameElementToCamelCase(name, "[-_:;#]");
|
||||
return removeNonNameElementToCamelCase(name, "[-_:;#" + removeOperationIdPrefixDelimiter + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4983,11 +5119,13 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFilename(String templateName, String tag) {
|
||||
String suffix = apiTemplateFiles().get(templateName);
|
||||
return apiFileFolder() + File.separator + toApiFilename(tag) + suffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFilename(String templateName, String modelName) {
|
||||
String suffix = modelTemplateFiles().get(templateName);
|
||||
return modelFileFolder() + File.separator + toModelFilename(modelName) + suffix;
|
||||
@ -5000,6 +5138,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param tag tag
|
||||
* @return the API documentation file name with full path
|
||||
*/
|
||||
@Override
|
||||
public String apiDocFilename(String templateName, String tag) {
|
||||
String docExtension = getDocExtension();
|
||||
String suffix = docExtension != null ? docExtension : apiDocTemplateFiles().get(templateName);
|
||||
@ -5013,43 +5152,69 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param tag tag
|
||||
* @return the API test file name with full path
|
||||
*/
|
||||
@Override
|
||||
public String apiTestFilename(String templateName, String tag) {
|
||||
String suffix = apiTestTemplateFiles().get(templateName);
|
||||
return apiTestFileFolder() + File.separator + toApiTestFilename(tag) + suffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverwrite(String filename) {
|
||||
return !(skipOverwrite && new File(filename).exists());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkipOverwrite() {
|
||||
return skipOverwrite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSkipOverwrite(boolean skipOverwrite) {
|
||||
this.skipOverwrite = skipOverwrite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRemoveOperationIdPrefix() {
|
||||
return removeOperationIdPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSkipOperationExample() {
|
||||
return skipOperationExample;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemoveOperationIdPrefix(boolean removeOperationIdPrefix) {
|
||||
this.removeOperationIdPrefix = removeOperationIdPrefix;
|
||||
}
|
||||
|
||||
public String getRemoveOperationIdPrefixDelimiter() {
|
||||
return removeOperationIdPrefixDelimiter;
|
||||
}
|
||||
|
||||
public void setRemoveOperationIdPrefixDelimiter(String removeOperationIdPrefixDelimiter) {
|
||||
this.removeOperationIdPrefixDelimiter = removeOperationIdPrefixDelimiter;
|
||||
}
|
||||
|
||||
public int getRemoveOperationIdPrefixCount() {
|
||||
return removeOperationIdPrefixCount;
|
||||
}
|
||||
|
||||
public void setRemoveOperationIdPrefixCount(int removeOperationIdPrefixCount) {
|
||||
this.removeOperationIdPrefixCount = removeOperationIdPrefixCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSkipOperationExample(boolean skipOperationExample) {
|
||||
this.skipOperationExample = skipOperationExample;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHideGenerationTimestamp() {
|
||||
return hideGenerationTimestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHideGenerationTimestamp(boolean hideGenerationTimestamp) {
|
||||
this.hideGenerationTimestamp = hideGenerationTimestamp;
|
||||
}
|
||||
@ -5060,6 +5225,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return the supported libraries
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> supportedLibraries() {
|
||||
return supportedLibraries;
|
||||
}
|
||||
@ -5069,6 +5235,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param library Library template
|
||||
*/
|
||||
@Override
|
||||
public void setLibrary(String library) {
|
||||
if (library != null && !supportedLibraries.containsKey(library)) {
|
||||
StringBuilder sb = new StringBuilder("Unknown library: " + library + "\nAvailable libraries:");
|
||||
@ -5089,6 +5256,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return Library template
|
||||
*/
|
||||
@Override
|
||||
public String getLibrary() {
|
||||
return library;
|
||||
}
|
||||
@ -5107,6 +5275,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param gitHost Git host
|
||||
*/
|
||||
@Override
|
||||
public void setGitHost(String gitHost) {
|
||||
this.gitHost = gitHost;
|
||||
}
|
||||
@ -5116,6 +5285,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return Git host
|
||||
*/
|
||||
@Override
|
||||
public String getGitHost() {
|
||||
return gitHost;
|
||||
}
|
||||
@ -5125,6 +5295,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param gitUserId Git user ID
|
||||
*/
|
||||
@Override
|
||||
public void setGitUserId(String gitUserId) {
|
||||
this.gitUserId = gitUserId;
|
||||
}
|
||||
@ -5134,6 +5305,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return Git user ID
|
||||
*/
|
||||
@Override
|
||||
public String getGitUserId() {
|
||||
return gitUserId;
|
||||
}
|
||||
@ -5143,6 +5315,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param gitRepoId Git repo ID
|
||||
*/
|
||||
@Override
|
||||
public void setGitRepoId(String gitRepoId) {
|
||||
this.gitRepoId = gitRepoId;
|
||||
}
|
||||
@ -5152,6 +5325,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return Git repo ID
|
||||
*/
|
||||
@Override
|
||||
public String getGitRepoId() {
|
||||
return gitRepoId;
|
||||
}
|
||||
@ -5161,6 +5335,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param releaseNote Release note
|
||||
*/
|
||||
@Override
|
||||
public void setReleaseNote(String releaseNote) {
|
||||
this.releaseNote = releaseNote;
|
||||
}
|
||||
@ -5170,6 +5345,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return Release note
|
||||
*/
|
||||
@Override
|
||||
public String getReleaseNote() {
|
||||
return releaseNote;
|
||||
}
|
||||
@ -5179,6 +5355,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return Documentation files extension
|
||||
*/
|
||||
@Override
|
||||
public String getDocExtension() {
|
||||
return docExtension;
|
||||
}
|
||||
@ -5188,6 +5365,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param userDocExtension documentation files extension
|
||||
*/
|
||||
@Override
|
||||
public void setDocExtension(String userDocExtension) {
|
||||
this.docExtension = userDocExtension;
|
||||
}
|
||||
@ -5197,6 +5375,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param httpUserAgent HTTP user agent
|
||||
*/
|
||||
@Override
|
||||
public void setHttpUserAgent(String httpUserAgent) {
|
||||
this.httpUserAgent = httpUserAgent;
|
||||
}
|
||||
@ -5206,6 +5385,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return HTTP user agent
|
||||
*/
|
||||
@Override
|
||||
public String getHttpUserAgent() {
|
||||
return httpUserAgent;
|
||||
}
|
||||
@ -5225,6 +5405,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param name string to be sanitize
|
||||
* @return sanitized string
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("static-method")
|
||||
public String sanitizeName(String name) {
|
||||
return sanitizeName(name, "\\W");
|
||||
@ -5334,6 +5515,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param tag Tag
|
||||
* @return Sanitized tag
|
||||
*/
|
||||
@Override
|
||||
public String sanitizeTag(String tag) {
|
||||
tag = camelize(sanitizeName(tag));
|
||||
|
||||
@ -5383,6 +5565,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (Boolean.TRUE.equals(property.isInteger)) {
|
||||
parameter.isInteger = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
if (Boolean.TRUE.equals(property.isShort)) {
|
||||
parameter.isShort = true;
|
||||
} else if (Boolean.TRUE.equals(property.isUnboundedInteger)) {
|
||||
parameter.isUnboundedInteger = true;
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(property.isDouble)) {
|
||||
parameter.isDouble = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
@ -5457,13 +5644,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// handle default value for enum, e.g. available => StatusEnum.AVAILABLE
|
||||
if (var.defaultValue != null) {
|
||||
final String enumDefaultValue = getEnumDefaultValue(var.defaultValue, dataType);
|
||||
|
||||
String enumName = null;
|
||||
final String enumDefaultValue;
|
||||
if (isDataTypeString(dataType)) {
|
||||
enumDefaultValue = toEnumValue(var.defaultValue, dataType);
|
||||
} else {
|
||||
enumDefaultValue = var.defaultValue;
|
||||
}
|
||||
for (Map<String, Object> enumVar : enumVars) {
|
||||
if (enumDefaultValue.equals(enumVar.get("value"))) {
|
||||
enumName = (String) enumVar.get("name");
|
||||
@ -5476,6 +5659,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
protected String getEnumDefaultValue(String defaultValue, String dataType) {
|
||||
final String enumDefaultValue;
|
||||
if (isDataTypeString(dataType)) {
|
||||
enumDefaultValue = toEnumValue(defaultValue, dataType);
|
||||
} else {
|
||||
enumDefaultValue = defaultValue;
|
||||
}
|
||||
return enumDefaultValue;
|
||||
}
|
||||
|
||||
protected List<Map<String, Object>> buildEnumVars(List<Object> values, String dataType) {
|
||||
List<Map<String, Object>> enumVars = new ArrayList<>();
|
||||
int truncateIdx = 0;
|
||||
@ -5562,6 +5755,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return a string of the full path to an override ignore file.
|
||||
*/
|
||||
@Override
|
||||
public String getIgnoreFilePathOverride() {
|
||||
return ignoreFilePathOverride;
|
||||
}
|
||||
@ -5571,6 +5765,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param ignoreFileOverride The full path to an ignore file
|
||||
*/
|
||||
@Override
|
||||
public void setIgnoreFilePathOverride(final String ignoreFileOverride) {
|
||||
this.ignoreFilePathOverride = ignoreFileOverride;
|
||||
}
|
||||
@ -5751,14 +5946,17 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp() {
|
||||
return null;
|
||||
}
|
||||
@ -6347,6 +6545,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @param file file to be processed
|
||||
* @param fileType file type
|
||||
*/
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
LOGGER.debug("Post processing file {} ({})", file, fileType);
|
||||
}
|
||||
@ -6356,6 +6555,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @return true if the option is enabled
|
||||
*/
|
||||
@Override
|
||||
public boolean isEnablePostProcessFile() {
|
||||
return enablePostProcessFile;
|
||||
}
|
||||
@ -6365,6 +6565,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param enablePostProcessFile true to enable post-processing file
|
||||
*/
|
||||
@Override
|
||||
public void setEnablePostProcessFile(boolean enablePostProcessFile) {
|
||||
this.enablePostProcessFile = enablePostProcessFile;
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ public class DefaultGenerator implements Generator {
|
||||
// TODO: initial behavior is "merge" user defined with built-in templates. consider offering user a "replace" option.
|
||||
if (userDefinedTemplates != null && !userDefinedTemplates.isEmpty()) {
|
||||
Map<String, SupportingFile> supportingFilesMap = config.supportingFiles().stream()
|
||||
.collect(Collectors.toMap(TemplateDefinition::getTemplateFile, Function.identity()));
|
||||
.collect(Collectors.toMap(TemplateDefinition::getTemplateFile, Function.identity(), (oldValue, newValue) -> oldValue));
|
||||
|
||||
// TemplateFileType.SupportingFiles
|
||||
userDefinedTemplates.stream()
|
||||
|
@ -77,7 +77,19 @@ public interface IJsonSchemaValidationProperties {
|
||||
|
||||
boolean getIsArray();
|
||||
|
||||
void setIsArray(boolean isArray);
|
||||
void setIsArray(boolean isShort);
|
||||
|
||||
boolean getIsShort();
|
||||
|
||||
void setIsShort(boolean isShort);
|
||||
|
||||
boolean getIsBoolean();
|
||||
|
||||
void setIsBoolean(boolean isBoolean);
|
||||
|
||||
boolean getIsUnboundedInteger();
|
||||
|
||||
void setIsUnboundedInteger(boolean isUnboundedInteger);
|
||||
|
||||
CodegenProperty getAdditionalProperties();
|
||||
|
||||
@ -110,4 +122,4 @@ public interface IJsonSchemaValidationProperties {
|
||||
boolean getHasRequired();
|
||||
|
||||
void setHasRequired(boolean hasRequired);
|
||||
}
|
||||
}
|
||||
|
@ -206,6 +206,7 @@ public class TemplateManager implements TemplatingExecutor, TemplateProcessor {
|
||||
* @return File representing the written file.
|
||||
* @throws IOException If file cannot be written.
|
||||
*/
|
||||
@Override
|
||||
public File writeToFile(String filename, byte[] contents) throws IOException {
|
||||
// Use Paths.get here to normalize path (for Windows file separator, space escaping on Linux/Mac, etc)
|
||||
File outputFile = Paths.get(filename).toFile();
|
||||
|
@ -34,7 +34,10 @@ public class GlobalSettings {
|
||||
private static ThreadLocal<Properties> properties = new InheritableThreadLocal<Properties>() {
|
||||
@Override
|
||||
protected Properties initialValue() {
|
||||
return (Properties) System.getProperties().clone();
|
||||
// avoid using System.getProperties().clone() which is broken in Gradle - see https://github.com/gradle/gradle/issues/17344
|
||||
Properties copy = new Properties();
|
||||
copy.putAll(System.getProperties());
|
||||
return copy;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -204,7 +204,7 @@ public class ExampleGenerator {
|
||||
output.add(kv);
|
||||
} else if (mediaType.startsWith(MIME_TYPE_XML)) {
|
||||
// TODO
|
||||
LOGGER.warn("XML example value of (array/primitive) is not handled at the moment: " + example);
|
||||
LOGGER.warn("XML example value of (array/primitive) is not handled at the moment: {}", example);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -296,7 +296,7 @@ public class ExampleGenerator {
|
||||
LOGGER.debug("URI or URL format, without default or enum, generating random one.");
|
||||
return "http://example.com/aeiou";
|
||||
}
|
||||
LOGGER.debug("No values found, using property name " + propertyName + " as example");
|
||||
LOGGER.debug("No values found, using property name {} as example", propertyName);
|
||||
return propertyName;
|
||||
} else if (!StringUtils.isEmpty(property.get$ref())) { // model
|
||||
String simpleName = ModelUtils.getSimpleRef(property.get$ref());
|
||||
|
@ -220,7 +220,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
protected String toAdaIdentifier(String name, String prefix) {
|
||||
// We cannot use reserved keywords for identifiers
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn("Identifier '" + name + "' is a reserved word, renamed to " + prefix + name);
|
||||
LOGGER.warn("Identifier '{}' is a reserved word, renamed to {}{}", name, prefix, name);
|
||||
name = prefix + name;
|
||||
}
|
||||
StringBuilder result = new StringBuilder();
|
||||
@ -277,6 +277,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
* @param name the name of the model
|
||||
* @return capitalized model name
|
||||
*/
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
String result = camelize(sanitizeName(name));
|
||||
|
||||
@ -287,20 +288,22 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
String modelName = "Model_" + result;
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (result.matches("^\\d.*")) {
|
||||
String modelName = "Model_" + result; // e.g. 200Response => Model_200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
if (languageSpecificPrimitives.contains(result)) {
|
||||
String modelName = "Model_" + result;
|
||||
LOGGER.warn(name + " (model name matches existing language type) cannot be used as a model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name matches existing language type) cannot be used as a model name. Renamed to {}",
|
||||
name, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
|
@ -162,14 +162,15 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (camelizedName.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@ -188,7 +189,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
if (inner == null) {
|
||||
LOGGER.warn(ap.getName() + "(array property) does not have a proper inner type defined");
|
||||
LOGGER.warn("{}(array property) does not have a proper inner type defined", ap.getName());
|
||||
// TODO maybe better defaulting to StringProperty than returning null
|
||||
return null;
|
||||
}
|
||||
@ -197,7 +198,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
Schema inner = getAdditionalProperties(p);
|
||||
|
||||
if (inner == null) {
|
||||
LOGGER.warn(p.getName() + "(map property) does not have a proper inner type defined");
|
||||
LOGGER.warn("{}(map property) does not have a proper inner type defined", p.getName());
|
||||
// TODO maybe better defaulting to StringProperty than returning null
|
||||
return null;
|
||||
}
|
||||
@ -408,7 +409,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
if (null == schemaType) {
|
||||
LOGGER.error("No Type defined for Property " + p);
|
||||
LOGGER.error("No Type defined for Property {}", p);
|
||||
}
|
||||
return toModelName(schemaType);
|
||||
}
|
||||
@ -425,7 +426,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize("call_" + operationId, true);
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||
return newOperationId;
|
||||
}
|
||||
|
||||
@ -642,6 +643,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
return p.replaceAll("\"", "%22");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toRegularExpression(String pattern) {
|
||||
return escapeText(pattern);
|
||||
}
|
||||
|
@ -41,12 +41,14 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
protected boolean optionalAssemblyInfoFlag = true;
|
||||
protected boolean optionalEmitDefaultValuesFlag = false;
|
||||
protected boolean conditionalSerialization = false;
|
||||
protected boolean optionalProjectFileFlag = true;
|
||||
protected boolean optionalMethodArgumentFlag = true;
|
||||
protected boolean useDateTimeOffsetFlag = false;
|
||||
protected boolean useCollection = false;
|
||||
protected boolean returnICollection = false;
|
||||
protected boolean netCoreProjectFileFlag = false;
|
||||
protected boolean nullReferenceTypesFlag = false;
|
||||
|
||||
protected String modelPropertyNaming = CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.PascalCase.name();
|
||||
|
||||
@ -356,6 +358,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
additionalProperties.put(CodegenConstants.NETCORE_PROJECT_FILE, netCoreProjectFileFlag);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.NULLABLE_REFERENCE_TYPES)) {
|
||||
setNullableReferenceTypes(convertPropertyToBooleanAndWriteBack(CodegenConstants.NULLABLE_REFERENCE_TYPES));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.NULLABLE_REFERENCE_TYPES, nullReferenceTypesFlag);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INTERFACE_PREFIX)) {
|
||||
String useInterfacePrefix = additionalProperties.get(CodegenConstants.INTERFACE_PREFIX).toString();
|
||||
if ("false".equals(useInterfacePrefix.toLowerCase(Locale.ROOT))) {
|
||||
@ -789,13 +797,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId)));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
// operationId starts with a number
|
||||
if (operationId.matches("^\\d.*")) {
|
||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId)));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@ -1032,13 +1040,14 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -1111,6 +1120,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
return interfacePrefix;
|
||||
}
|
||||
|
||||
public void setNullableReferenceTypes(final Boolean nullReferenceTypesFlag){
|
||||
this.nullReferenceTypesFlag = nullReferenceTypesFlag;
|
||||
if (nullReferenceTypesFlag == true){
|
||||
this.nullableType.add("string");
|
||||
}
|
||||
}
|
||||
|
||||
public void setInterfacePrefix(final String interfacePrefix) {
|
||||
this.interfacePrefix = interfacePrefix;
|
||||
}
|
||||
@ -1267,7 +1283,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -237,7 +237,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
@Override
|
||||
public String toOperationId(String operationId) {
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + escapeReservedWord(operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, escapeReservedWord(operationId));
|
||||
return escapeReservedWord(operationId);
|
||||
}
|
||||
return sanitizeName(super.toOperationId(operationId));
|
||||
@ -275,6 +275,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
* @param name the name of the property
|
||||
* @return getter name based on naming convention
|
||||
*/
|
||||
@Override
|
||||
public String toBooleanGetter(String name) {
|
||||
return "is" + getterAndSetterCapitalize(name);
|
||||
}
|
||||
@ -284,6 +285,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
return "std::shared_ptr<" + toModelName(str) + ">";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
@ -329,7 +331,7 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
@ -29,6 +28,9 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractDartCodegen.class);
|
||||
|
||||
protected static final List<String> DEFAULT_SUPPORTED_CONTENT_TYPES = Arrays.asList(
|
||||
"application/json", "application/x-www-form-urlencoded", "multipart/form-data");
|
||||
|
||||
public static final String PUB_LIBRARY = "pubLibrary";
|
||||
public static final String PUB_NAME = "pubName";
|
||||
public static final String PUB_VERSION = "pubVersion";
|
||||
@ -556,6 +558,68 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
||||
return op;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
super.postProcessOperationsWithModels(objs, allModels);
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
if (operations != null) {
|
||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : ops) {
|
||||
if (op.hasConsumes) {
|
||||
if (!op.formParams.isEmpty() || op.isMultipart) {
|
||||
// DefaultCodegen only sets this if the first consumes mediaType
|
||||
// is application/x-www-form-urlencoded or multipart.
|
||||
// Can just use the original
|
||||
op.prioritizedContentTypes = op.consumes;
|
||||
} else {
|
||||
// Prioritize content types by moving application/json to the front
|
||||
// similar to JavaCodegen
|
||||
op.prioritizedContentTypes = prioritizeContentTypes(op.consumes);
|
||||
String mediaType = op.prioritizedContentTypes.get(0).get("mediaType");
|
||||
if (!DEFAULT_SUPPORTED_CONTENT_TYPES.contains(mediaType)) {
|
||||
LOGGER.warn("The media-type '{}' for operation '{}' is not support in the Dart generators by default.", mediaType, op.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
private List<Map<String, String>> prioritizeContentTypes(List<Map<String, String>> consumes) {
|
||||
if (consumes.size() <= 1) {
|
||||
// no need to change any order
|
||||
return consumes;
|
||||
}
|
||||
|
||||
List<Map<String, String>> prioritizedContentTypes = new ArrayList<>(consumes.size());
|
||||
|
||||
List<Map<String, String>> jsonVendorMimeTypes = new ArrayList<>(consumes.size());
|
||||
List<Map<String, String>> jsonMimeTypes = new ArrayList<>(consumes.size());
|
||||
|
||||
for (Map<String, String> consume : consumes) {
|
||||
String mediaType = consume.get("mediaType");
|
||||
if (isJsonVendorMimeType(mediaType)) {
|
||||
jsonVendorMimeTypes.add(consume);
|
||||
} else if (isJsonMimeType(mediaType)) {
|
||||
jsonMimeTypes.add(consume);
|
||||
} else {
|
||||
prioritizedContentTypes.add(consume);
|
||||
}
|
||||
}
|
||||
|
||||
prioritizedContentTypes.addAll(0, jsonMimeTypes);
|
||||
prioritizedContentTypes.addAll(0, jsonVendorMimeTypes);
|
||||
return prioritizedContentTypes;
|
||||
}
|
||||
|
||||
private static boolean isMultipartType(String mediaType) {
|
||||
if (mediaType != null) {
|
||||
return "multipart/form-data".equals(mediaType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions, String dataType) {
|
||||
if (vendorExtensions != null && useEnumExtension && vendorExtensions.containsKey("x-enum-values")) {
|
||||
|
@ -192,22 +192,22 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, "model_" + name);
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after
|
||||
// camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to "
|
||||
+ ("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
"model_" + name);
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response
|
||||
// (after camelize)
|
||||
}
|
||||
// model name starts with _
|
||||
if (name.startsWith("_")) {
|
||||
LOGGER.warn(name + " (model name starts with _) cannot be used as model name. Renamed to "
|
||||
+ ("model" + name));
|
||||
LOGGER.warn("{} (model name starts with _) cannot be used as model name. Renamed to {}", name,
|
||||
"model" + name);
|
||||
name = "model" + name; // e.g. 200Response => Model200Response
|
||||
// (after camelize)
|
||||
}
|
||||
@ -344,8 +344,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(sanitizedOperationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to "
|
||||
+ camelize("call_" + operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize("call_" + operationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
@ -609,7 +608,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
@Override
|
||||
protected void updatePropertyForArray(CodegenProperty property, CodegenProperty innerProperty) {
|
||||
if (innerProperty == null) {
|
||||
LOGGER.warn("skipping invalid array property " + Json.pretty(property));
|
||||
LOGGER.warn("skipping invalid array property {}", Json.pretty(property));
|
||||
return;
|
||||
}
|
||||
property.dataFormat = innerProperty.dataFormat;
|
||||
|
@ -628,13 +628,13 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId)));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
// operationId starts with a number
|
||||
if (operationId.matches("^\\d.*")) {
|
||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId)));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId)));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@ -900,13 +900,14 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -1121,7 +1122,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -202,7 +202,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
// for reserved word append _
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as variable name. Renamed to " + escapeReservedWord(name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as variable name. Renamed to {}", name, escapeReservedWord(name));
|
||||
name = escapeReservedWord(name);
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
// really should just be a letter, e.g. "p Person"), but we'll get
|
||||
// around to that some other time... Maybe.
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as parameter name. Renamed to " + name + "_");
|
||||
LOGGER.warn("{} (reserved word) cannot be used as parameter name. Renamed to {}_", name, name);
|
||||
name = name + "_";
|
||||
}
|
||||
|
||||
@ -269,7 +269,8 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
name = toModel("model_" + name);
|
||||
|
||||
if (isReservedFilename(name)) {
|
||||
LOGGER.warn(name + ".go with suffix (reserved word) cannot be used as filename. Renamed to " + name + "_.go");
|
||||
LOGGER.warn("{}.go with suffix (reserved word) cannot be used as filename. Renamed to {}_.go", name,
|
||||
name);
|
||||
name += "_";
|
||||
}
|
||||
return name;
|
||||
@ -292,14 +293,14 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, "model_" + name);
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to "
|
||||
+ ("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
"model_" + name);
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -317,7 +318,8 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
// e.g. PetApi.go => pet_api.go
|
||||
api = "api_" + underscore(api);
|
||||
if (isReservedFilename(api)) {
|
||||
LOGGER.warn(name + ".go with suffix (reserved word) cannot be used as filename. Renamed to " + api + "_.go");
|
||||
LOGGER.warn("{}.go with suffix (reserved word) cannot be used as filename. Renamed to {}_.go", name,
|
||||
api);
|
||||
api += "_";
|
||||
}
|
||||
apiName = api;
|
||||
@ -441,14 +443,13 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(sanitizedOperationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to "
|
||||
+ camelize("call_" + sanitizedOperationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize("call_" + sanitizedOperationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
// operationId starts with a number
|
||||
if (sanitizedOperationId.matches("^\\d.*")) {
|
||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + sanitizedOperationId));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize("call_" + sanitizedOperationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
@ -831,7 +832,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -143,6 +143,7 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
return outputFolder + File.separator + packageName + File.separator + "api" + File.separator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + File.separator + packageName + File.separator + "model" + File.separator;
|
||||
}
|
||||
@ -193,13 +194,14 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, "model_" + name);
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + ("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
"model_" + name);
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -317,7 +319,7 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(sanitizedOperationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore("call_" + operationId));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, underscore("call_" + operationId));
|
||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||
}
|
||||
|
||||
|
@ -313,13 +313,14 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
String derivedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.API_PACKAGE));
|
||||
this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derivedInvokerPackage);
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
LOGGER.info("Invoker Package Name, originally not set, is now derived from api package name: " + derivedInvokerPackage);
|
||||
LOGGER.info("Invoker Package Name, originally not set, is now derived from api package name: {}", derivedInvokerPackage);
|
||||
} else if (additionalProperties.containsKey(CodegenConstants.MODEL_PACKAGE)) {
|
||||
// guess from model package
|
||||
String derivedInvokerPackage = deriveInvokerPackageName((String) additionalProperties.get(CodegenConstants.MODEL_PACKAGE));
|
||||
this.additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, derivedInvokerPackage);
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
LOGGER.info("Invoker Package Name, originally not set, is now derived from model package name: " + derivedInvokerPackage);
|
||||
LOGGER.info("Invoker Package Name, originally not set, is now derived from model package name: {}",
|
||||
derivedInvokerPackage);
|
||||
} else {
|
||||
//not set, use default to be passed to template
|
||||
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
|
||||
@ -538,12 +539,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
importMapping.put("com.fasterxml.jackson.annotation.JsonProperty", "com.fasterxml.jackson.annotation.JsonCreator");
|
||||
|
||||
if (additionalProperties.containsKey(JAVA8_MODE)) {
|
||||
setJava8Mode(Boolean.parseBoolean(additionalProperties.get(JAVA8_MODE).toString()));
|
||||
if (java8Mode) {
|
||||
additionalProperties.put("java8", true);
|
||||
} else {
|
||||
additionalProperties.put("java8", false);
|
||||
}
|
||||
setJava8ModeAndAdditionalProperties(Boolean.parseBoolean(additionalProperties.get(JAVA8_MODE).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(SUPPORT_ASYNC)) {
|
||||
@ -786,14 +782,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(camelizedName)) {
|
||||
final String modelName = "Model" + camelizedName;
|
||||
LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (camelizedName.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@ -1140,7 +1137,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
|
||||
if (null == openAPIType) {
|
||||
LOGGER.error("No Type defined for Schema " + p);
|
||||
LOGGER.error("No Type defined for Schema {}", p);
|
||||
}
|
||||
return toModelName(openAPIType);
|
||||
}
|
||||
@ -1157,7 +1154,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize("call_" + operationId, true);
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||
return newOperationId;
|
||||
}
|
||||
|
||||
@ -1284,7 +1281,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
continue;
|
||||
}
|
||||
for (Operation operation : path.readOperations()) {
|
||||
LOGGER.info("Processing operation " + operation.getOperationId());
|
||||
LOGGER.info("Processing operation {}", operation.getOperationId());
|
||||
if (hasBodyParameter(openAPI, operation) || hasFormParameter(openAPI, operation)) {
|
||||
String defaultContentType = hasFormParameter(openAPI, operation) ? "application/x-www-form-urlencoded" : "application/json";
|
||||
List<String> consumes = new ArrayList<>(getConsumesInfo(openAPI, operation));
|
||||
@ -1690,6 +1687,15 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.java8Mode = enabled;
|
||||
}
|
||||
|
||||
public void setJava8ModeAndAdditionalProperties(boolean enabled) {
|
||||
this.java8Mode = enabled;
|
||||
if (this.java8Mode) {
|
||||
this.additionalProperties.put("java8", true);
|
||||
} else {
|
||||
this.additionalProperties.put("java8", false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSupportAsync(boolean enabled) {
|
||||
this.supportAsync = enabled;
|
||||
}
|
||||
@ -1838,7 +1844,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -305,6 +305,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
|
||||
return outputFolder + "/" + output + "/" + apiPackage().replace('.', '/');
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseBeanValidation(boolean useBeanValidation) {
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
}
|
||||
|
@ -125,7 +125,11 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
"val",
|
||||
"var",
|
||||
"when",
|
||||
"while"
|
||||
"while",
|
||||
"private",
|
||||
"open",
|
||||
"external",
|
||||
"internal"
|
||||
));
|
||||
|
||||
defaultIncludes = new HashSet<String>(Arrays.asList(
|
||||
@ -421,7 +425,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
LOGGER.warn(CodegenConstants.INVOKER_PACKAGE + " with " + this.getName() + " generator is ignored. Use " + CodegenConstants.PACKAGE_NAME + ".");
|
||||
LOGGER.warn("{} with {} generator is ignored. Use {}.", CodegenConstants.INVOKER_PACKAGE, this.getName(), CodegenConstants.PACKAGE_NAME);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SERIALIZABLE_MODEL)) {
|
||||
@ -624,14 +628,15 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
// model name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(modifiedName)) {
|
||||
final String modelName = "Model" + modifiedName;
|
||||
LOGGER.warn(modifiedName + " (reserved word) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", modifiedName, modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (modifiedName.matches("^\\d.*")) {
|
||||
final String modelName = "Model" + modifiedName; // e.g. 200Response => Model200Response (after camelize)
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@ -655,7 +660,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize("call_" + operationId, true);
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId);
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||
return newOperationId;
|
||||
}
|
||||
|
||||
@ -890,7 +895,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -295,14 +295,15 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
if (inner == null) {
|
||||
LOGGER.warn(ap.getName() + "(array property) does not have a proper inner type defined.Default to string");
|
||||
LOGGER.warn("{}(array property) does not have a proper inner type defined.Default to string",
|
||||
ap.getName());
|
||||
inner = new StringSchema().description("TODO default missing array inner type to string");
|
||||
}
|
||||
return getTypeDeclaration(inner) + "[]";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = getAdditionalProperties(p);
|
||||
if (inner == null) {
|
||||
LOGGER.warn(p.getName() + "(map property) does not have a proper inner type defined. Default to string");
|
||||
LOGGER.warn("{}(map property) does not have a proper inner type defined. Default to string", p.getName());
|
||||
inner = new StringSchema().description("TODO default missing map inner type to string");
|
||||
}
|
||||
return getSchemaType(p) + "<string," + getTypeDeclaration(inner) + ">";
|
||||
@ -408,13 +409,14 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
// model name cannot use reserved keyword
|
||||
if (isReservedWord(name)) {
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
|
||||
}
|
||||
|
||||
// model name starts with number
|
||||
if (name.matches("^\\d.*")) {
|
||||
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
|
||||
LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name,
|
||||
camelize("model_" + name));
|
||||
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
|
||||
}
|
||||
|
||||
@ -492,13 +494,13 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
// method name cannot use reserved keyword, e.g. return
|
||||
if (isReservedWord(operationId)) {
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
|
||||
LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), true));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
// operationId starts with a number
|
||||
if (operationId.matches("^\\d.*")) {
|
||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true));
|
||||
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, camelize(sanitizeName("call_" + operationId), true));
|
||||
operationId = "call_" + operationId;
|
||||
}
|
||||
|
||||
@ -590,7 +592,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
// type is a model class, e.g. User
|
||||
example = "new " + getTypeDeclaration(type) + "()";
|
||||
} else {
|
||||
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
|
||||
LOGGER.warn("Type {} not handled properly in setParameterExampleValue", type);
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
@ -747,7 +749,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
if (exitValue != 0) {
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue);
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: " + command);
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
} catch (InterruptedException | IOException e) {
|
||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||
|
@ -600,6 +600,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, this.packageName);
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user