forked from loafle/openapi-generator-original
Compare commits
171 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c317c753f0 | ||
|
|
d0a427a84c | ||
|
|
8f5639554e | ||
|
|
4d2b022619 | ||
|
|
e9fa936886 | ||
|
|
d21743e9e5 | ||
|
|
3da1999135 | ||
|
|
a88313c40c | ||
|
|
ebc1d7bd95 | ||
|
|
dbb42f9027 | ||
|
|
18cdb36d3e | ||
|
|
5d946289ef | ||
|
|
057c1080f8 | ||
|
|
83adc064a4 | ||
|
|
ad9e2395ac | ||
|
|
4aaaae765b | ||
|
|
4f84e86001 | ||
|
|
1f880f43d4 | ||
|
|
ad3ecadd75 | ||
|
|
a62d22593e | ||
|
|
f572125b30 | ||
|
|
b6197dd859 | ||
|
|
7df0f56fdc | ||
|
|
f7c3773903 | ||
|
|
b9a1c8f016 | ||
|
|
812d563c78 | ||
|
|
0f5e7d1e3c | ||
|
|
22950fa2b2 | ||
|
|
ee905cf0fe | ||
|
|
ab688d4c3a | ||
|
|
05aa956fe1 | ||
|
|
33107c14de | ||
|
|
5468b22b83 | ||
|
|
05f329959c | ||
|
|
946d145d30 | ||
|
|
d7736366b7 | ||
|
|
d44d9a3907 | ||
|
|
347a4cef47 | ||
|
|
b38166305f | ||
|
|
3894aa4759 | ||
|
|
139e9e458f | ||
|
|
b4f174753c | ||
|
|
733a180a62 | ||
|
|
92561085ba | ||
|
|
d4748a7a20 | ||
|
|
ebc98ec848 | ||
|
|
ef2299ad65 | ||
|
|
41f586bede | ||
|
|
28e0d9b22e | ||
|
|
51028f0c1b | ||
|
|
aa5adbf3f5 | ||
|
|
da37e980d3 | ||
|
|
77dfd40681 | ||
|
|
a9c7644c32 | ||
|
|
032911990d | ||
|
|
b5dac42959 | ||
|
|
3929afff7d | ||
|
|
515d4a0153 | ||
|
|
4a63aae746 | ||
|
|
af992e4b29 | ||
|
|
6dce8179de | ||
|
|
786458e928 | ||
|
|
60dcf8613f | ||
|
|
9edf70e980 | ||
|
|
dbdb6c51c4 | ||
|
|
19b68f75de | ||
|
|
c285f393b0 | ||
|
|
1b63822501 | ||
|
|
b4ea00ed42 | ||
|
|
7a1f7b2270 | ||
|
|
29c1688860 | ||
|
|
13c0b2c3c7 | ||
|
|
1f227061c6 | ||
|
|
53e5986800 | ||
|
|
63fdd3eaf0 | ||
|
|
8e0955fd3c | ||
|
|
14c7f39c2b | ||
|
|
23c9627b98 | ||
|
|
fa4462ef11 | ||
|
|
01ff635139 | ||
|
|
9dda4aa2e8 | ||
|
|
065c0281fa | ||
|
|
acedd1cfba | ||
|
|
c3b7ecff21 | ||
|
|
29c131e781 | ||
|
|
11eedc86dc | ||
|
|
4462d35195 | ||
|
|
659b00a4f9 | ||
|
|
5dae270c3e | ||
|
|
c79d056935 | ||
|
|
226a8b5f77 | ||
|
|
f8202df9aa | ||
|
|
7cf6ee1957 | ||
|
|
c9716fcebb | ||
|
|
403e9bca44 | ||
|
|
7a3b01a0f6 | ||
|
|
4db6f46a00 | ||
|
|
fc58adee31 | ||
|
|
7bf792a348 | ||
|
|
57e44e173f | ||
|
|
b335ba834f | ||
|
|
26ca6ab27e | ||
|
|
47e292c0e7 | ||
|
|
628e3d1914 | ||
|
|
de5651adac | ||
|
|
e1ef00903e | ||
|
|
ae099330b9 | ||
|
|
a3072680cd | ||
|
|
0af45b3823 | ||
|
|
becb424455 | ||
|
|
f898bfc7d6 | ||
|
|
f66fbf6969 | ||
|
|
7816ea076e | ||
|
|
6daecb88c2 | ||
|
|
6c8bc1ec88 | ||
|
|
d913b14d45 | ||
|
|
67d7f60f6a | ||
|
|
8d372fa66a | ||
|
|
ab6c6962c2 | ||
|
|
70616b541e | ||
|
|
9fb97c6c29 | ||
|
|
fe52529f05 | ||
|
|
c99226900b | ||
|
|
45654d28ed | ||
|
|
b7f389aacb | ||
|
|
b1837693b1 | ||
|
|
711ce5431a | ||
|
|
fa624ef38c | ||
|
|
e6f56626ed | ||
|
|
23bc2aaf6b | ||
|
|
3579094298 | ||
|
|
474df9dd5e | ||
|
|
a2401f71b0 | ||
|
|
8e7440e294 | ||
|
|
38b49e77af | ||
|
|
2525639875 | ||
|
|
764d7f3035 | ||
|
|
7e6ce69c64 | ||
|
|
5abf020be3 | ||
|
|
854296634a | ||
|
|
e71ae12e14 | ||
|
|
ba28702da0 | ||
|
|
402cf9a3a2 | ||
|
|
6a26ac8e20 | ||
|
|
97e27f2b36 | ||
|
|
9419de573e | ||
|
|
6e0ca448dd | ||
|
|
fea1377603 | ||
|
|
7813398e7e | ||
|
|
862e9cb79a | ||
|
|
ee2f585f37 | ||
|
|
8043a8b9f4 | ||
|
|
b7c5d38011 | ||
|
|
7937e2e0c9 | ||
|
|
0e0dc3f26b | ||
|
|
74e5c3ccd3 | ||
|
|
f137f3331a | ||
|
|
650aaa2bee | ||
|
|
b69fb79573 | ||
|
|
7e0382b08d | ||
|
|
03be3c612d | ||
|
|
0f981fffc3 | ||
|
|
d438d797da | ||
|
|
bedfe156bb | ||
|
|
97a3fc4b8e | ||
|
|
39f0177ede | ||
|
|
46a7d972b9 | ||
|
|
113d38eb71 | ||
|
|
e0021e662f | ||
|
|
773a8d8a08 | ||
|
|
0dc62e8b79 |
10
.github/workflows/check-supported-versions.yaml
vendored
10
.github/workflows/check-supported-versions.yaml
vendored
@@ -24,18 +24,18 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java }}
|
- name: Set up JDK ${{ matrix.java }}
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
|
|
||||||
- uses: actions/cache@v1
|
- uses: actions/cache@v2.1.5
|
||||||
with:
|
with:
|
||||||
path: ~/.m2/repository
|
path: ~/.m2/repository
|
||||||
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
|
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-maven-
|
${{ runner.os }}-maven-
|
||||||
|
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2.1.5
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.gradle/caches
|
~/.gradle/caches
|
||||||
@@ -49,7 +49,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 }}
|
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
|
- name: Upload Maven build artifact
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v2.2.3
|
||||||
if: matrix.java == '8' && matrix.os == 'ubuntu-latest'
|
if: matrix.java == '8' && matrix.os == 'ubuntu-latest'
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: artifact
|
||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Download build artifact
|
- name: Download build artifact
|
||||||
uses: actions/download-artifact@v1
|
uses: actions/download-artifact@v2.0.8
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: artifact
|
||||||
- name: Run Ensures Script
|
- name: Run Ensures Script
|
||||||
|
|||||||
2
.github/workflows/sonar.yml
vendored
2
.github/workflows/sonar.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
- name: Compile with Maven
|
- name: Compile with Maven
|
||||||
|
|||||||
30
.travis.yml
30
.travis.yml
@@ -62,6 +62,14 @@ addons:
|
|||||||
- petstore.swagger.io
|
- petstore.swagger.io
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
|
- sudo rm -rf /var/lib/apt/lists/*
|
||||||
|
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||||
|
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
|
||||||
|
- sudo apt-get update
|
||||||
|
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||||
|
- mkdir -vp ~/.docker/cli-plugins/
|
||||||
|
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
|
||||||
|
- chmod a+x ~/.docker/cli-plugins/docker-buildx
|
||||||
# to run petstore server locally via docker
|
# to run petstore server locally via docker
|
||||||
- echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin || true
|
- echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin || true
|
||||||
- docker pull swaggerapi/petstore
|
- docker pull swaggerapi/petstore
|
||||||
@@ -149,6 +157,8 @@ install:
|
|||||||
script:
|
script:
|
||||||
# fail fast
|
# fail fast
|
||||||
- set -e
|
- set -e
|
||||||
|
# show docker buildx version
|
||||||
|
- docker buildx version
|
||||||
# fail if the template files contains tabs
|
# fail if the template files contains tabs
|
||||||
- /bin/bash ./bin/utils/detect_tab_in_templates.sh
|
- /bin/bash ./bin/utils/detect_tab_in_templates.sh
|
||||||
# fail if the test files have changes
|
# fail if the test files have changes
|
||||||
@@ -199,12 +209,14 @@ after_success:
|
|||||||
echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin;
|
echo "$DOCKER_HUB_PASSWORD" | docker login --username=$DOCKER_HUB_USERNAME --password-stdin;
|
||||||
export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
|
export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
|
||||||
export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
|
export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
|
||||||
docker build --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online;
|
docker buildx create --use;
|
||||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||||
docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG;
|
docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME:latest -t $DOCKER_GENERATOR_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online;
|
||||||
|
echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME";
|
||||||
fi;
|
fi;
|
||||||
if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then
|
if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
|
||||||
docker push $DOCKER_GENERATOR_IMAGE_NAME && echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME";
|
docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-online --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/openapi-generator-online;
|
||||||
|
echo "Pushed to $DOCKER_GENERATOR_IMAGE_NAME for master";
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
## docker: build cli image and push to Docker Hub
|
## docker: build cli image and push to Docker Hub
|
||||||
@@ -213,12 +225,14 @@ after_success:
|
|||||||
cp docker-entrypoint.sh ./modules/openapi-generator-cli;
|
cp docker-entrypoint.sh ./modules/openapi-generator-cli;
|
||||||
export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
|
export cli_version=$(\mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[');
|
||||||
export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
|
export build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ");
|
||||||
docker build --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
|
docker buildx create --use;
|
||||||
|
docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
|
||||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||||
docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG;
|
docker buildx build --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest -t $DOCKER_CODEGEN_CLI_IMAGE_NAME:$TRAVIS_TAG -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
|
||||||
|
echo "Built and tagged $DOCKER_GENERATOR_IMAGE_NAME";
|
||||||
fi;
|
fi;
|
||||||
if [ ! -z "$TRAVIS_TAG" ] || [ "$TRAVIS_BRANCH" = "master" ]; then
|
if [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
|
||||||
docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME;
|
docker buildx build --push --platform linux/amd64,linux/arm64 --label=org.opencontainers.image.created=$build_date --label=org.opencontainers.image.title=openapi-generator-cli --label=org.opencontainers.image.revision=$TRAVIS_COMMIT --label=org.opencontainers.image.version=$cli_version -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/openapi-generator-cli;
|
||||||
echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME";
|
echo "Pushed to $DOCKER_CODEGEN_CLI_IMAGE_NAME";
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
|
|||||||
107
CI/.drone.yml
107
CI/.drone.yml
@@ -2,57 +2,60 @@ kind: pipeline
|
|||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# test nim client
|
# test Elm client
|
||||||
- name: nim-client-test
|
- name: elm
|
||||||
image: nimlang/nim
|
image: odesimple/elm:0.19
|
||||||
commands:
|
commands:
|
||||||
- (cd samples/client/petstore/nim/ && nim c sample_client.nim)
|
- (cd samples/openapi3/client/petstore/elm && ./elm-compile-test)
|
||||||
# test protobuf schema generator
|
|
||||||
- name: protobuf-schema-test
|
|
||||||
image: nanoservice/protobuf-go
|
|
||||||
commands:
|
|
||||||
- protoc --version
|
|
||||||
- mkdir /var/tmp/go/
|
|
||||||
- cd samples/config/petstore/protobuf-schema
|
|
||||||
- protoc --go_out=/var/tmp/go/ services/*
|
|
||||||
- protoc --go_out=/var/tmp/go/ models/*
|
|
||||||
# test aspnetcore 3.x
|
|
||||||
- name: aspnetcore-test
|
|
||||||
image: mcr.microsoft.com/dotnet/core/sdk:3.1
|
|
||||||
commands:
|
|
||||||
- (cd samples/server/petstore/aspnetcore-3.1/ && /bin/sh build.sh)
|
|
||||||
- (cd samples/server/petstore/aspnetcore-3.0/ && /bin/sh build.sh)
|
|
||||||
# test ocaml petstore client
|
|
||||||
- name: ocaml-test
|
|
||||||
image: ocaml/opam2:4.07
|
|
||||||
commands:
|
|
||||||
- sudo apt-get -y install m4
|
|
||||||
- cd samples/client/petstore/ocaml
|
|
||||||
- opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix
|
|
||||||
- opam pin add ocaml-migrate-parsetree 1.3.1
|
|
||||||
- eval $(opam env)
|
|
||||||
- sudo chmod -R 777 .
|
|
||||||
- dune build --build-dir=./_build
|
|
||||||
# test haskell client
|
|
||||||
- name: haskell-client-test
|
|
||||||
image: haskell:8.6.5
|
|
||||||
commands:
|
|
||||||
- (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast)
|
|
||||||
# test Java 11 HTTP client
|
# test Java 11 HTTP client
|
||||||
- name: java11-test
|
#- name: java11-test
|
||||||
image: openjdk:11.0
|
# image: openjdk:11.0
|
||||||
commands:
|
# commands:
|
||||||
- ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
# - ./mvnw --quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||||
- ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
# - ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||||
# test java native client
|
# # run ensure up-to-date
|
||||||
- ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
|
# - /bin/bash bin/utils/ensure-up-to-date
|
||||||
- ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
|
# # test java native client
|
||||||
- ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml
|
# - ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
|
||||||
# test all generators with fake petstore spec (2.0, 3.0)
|
# - ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
|
||||||
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
|
# - ./mvnw clean test -f samples/openapi3/client/petstore/java/native/pom.xml
|
||||||
# generate test scripts
|
# # test all generators with fake petstore spec (2.0, 3.0)
|
||||||
- /bin/bash bin/tests/run-all-test
|
# - /bin/bash bin/utils/test-fake-petstore-for-all.sh
|
||||||
# generate all petstore samples (client, servers, doc)
|
# # generate test scripts
|
||||||
- /bin/bash bin/generate-samples.sh
|
# - /bin/bash bin/tests/run-all-test
|
||||||
# generate all petstore samples (openapi3)
|
## test nim client
|
||||||
- /bin/bash bin/generate-samples.sh bin/configs/other/*.yaml
|
#- name: nim-client-test
|
||||||
|
# image: nimlang/nim
|
||||||
|
# commands:
|
||||||
|
# - (cd samples/client/petstore/nim/ && nim c sample_client.nim)
|
||||||
|
## test protobuf schema generator
|
||||||
|
#- name: protobuf-schema-test
|
||||||
|
# image: nanoservice/protobuf-go
|
||||||
|
# commands:
|
||||||
|
# - protoc --version
|
||||||
|
# - mkdir /var/tmp/go/
|
||||||
|
# - cd samples/config/petstore/protobuf-schema
|
||||||
|
# - protoc --go_out=/var/tmp/go/ services/*
|
||||||
|
# - protoc --go_out=/var/tmp/go/ models/*
|
||||||
|
## test aspnetcore 3.x
|
||||||
|
#- name: aspnetcore-test
|
||||||
|
# image: mcr.microsoft.com/dotnet/core/sdk:3.1
|
||||||
|
# commands:
|
||||||
|
# - (cd samples/server/petstore/aspnetcore-3.1/ && /bin/sh build.sh)
|
||||||
|
# - (cd samples/server/petstore/aspnetcore-3.0/ && /bin/sh build.sh)
|
||||||
|
## test ocaml petstore client
|
||||||
|
#- name: ocaml-test
|
||||||
|
# image: ocaml/opam2:4.07
|
||||||
|
# commands:
|
||||||
|
# - sudo apt-get -y install m4
|
||||||
|
# - cd samples/client/petstore/ocaml
|
||||||
|
# - opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix
|
||||||
|
# - opam pin add ocaml-migrate-parsetree 1.3.1
|
||||||
|
# - eval $(opam env)
|
||||||
|
# - sudo chmod -R 777 .
|
||||||
|
# - dune build --build-dir=./_build
|
||||||
|
## test haskell client
|
||||||
|
#- name: haskell-client-test
|
||||||
|
# image: haskell:8.6.5
|
||||||
|
# commands:
|
||||||
|
# - (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast)
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ function installDart {
|
|||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install dart
|
sudo apt-get install dart
|
||||||
export PATH="$PATH:/usr/lib/dart/bin"
|
export PATH="$PATH:/usr/lib/dart/bin"
|
||||||
export DART_POST_PROCESS="dart format"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$NODE_INDEX" = "1" ]; then
|
if [ "$NODE_INDEX" = "1" ]; then
|
||||||
@@ -48,7 +47,8 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
|||||||
git checkout -- .
|
git checkout -- .
|
||||||
|
|
||||||
# look for outdated samples
|
# look for outdated samples
|
||||||
./bin/utils/ensure-up-to-date
|
#./bin/utils/ensure-up-to-date
|
||||||
|
# UPDATE: moved to drone.io
|
||||||
fi
|
fi
|
||||||
echo "Running node $NODE_INDEX to test haskell"
|
echo "Running node $NODE_INDEX to test haskell"
|
||||||
# install haskell
|
# install haskell
|
||||||
@@ -81,8 +81,6 @@ else
|
|||||||
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
||||||
go version
|
go version
|
||||||
|
|
||||||
installDart
|
|
||||||
|
|
||||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||||
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||||
fi
|
fi
|
||||||
|
|||||||
32
README.md
32
README.md
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.1.0`):
|
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.1.1`):
|
||||||
[](https://travis-ci.org/OpenAPITools/openapi-generator)
|
[](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||||
@@ -18,6 +18,14 @@
|
|||||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||||
[](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
|
[](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
|
||||||
|
|
||||||
|
[5.2.x](https://github.com/OpenAPITools/openapi-generator/tree/5.2.x) (`5.2.x`):
|
||||||
|
[](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||||
|
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||||
|
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||||
|
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||||
|
[](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`):
|
[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.org/OpenAPITools/openapi-generator)
|
||||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||||
@@ -70,7 +78,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
|||||||
| | Languages/Frameworks |
|
| | 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) |
|
| **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), **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) |
|
| **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 documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
|
||||||
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
|
||||||
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer** |
|
| **Others** | **GraphQL**, **JMeter**, **Ktorm**, **MySQL Schema**, **Protocol Buffer** |
|
||||||
@@ -112,8 +120,9 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
|||||||
| OpenAPI Generator Version | Release Date | Notes |
|
| 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) |
|
| 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.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.1.0-SNAPSHOT/) | Mar/Apr 2021 | Minor release with breaking changes (with fallback) |
|
| 5.2.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.2.0-SNAPSHOT/) | May/Jun 2021 | Minor release with breaking changes (with fallback) |
|
||||||
| [5.0.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.0.1) (latest stable release) | 06.02.2021 | Patch release with enhancements, bug fixes, etc |
|
| 5.1.1 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.1.1-SNAPSHOT/) | Apr/May 2021 | Patch release (enhancements, bug fixes, etc) |
|
||||||
|
| [5.1.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.1.0) (latest stable release) | 20.03.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) |
|
| [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
|
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||||
@@ -553,7 +562,7 @@ When code is generated from this project, it shall be considered **AS IS** and o
|
|||||||
|
|
||||||
### [3.5 - IDE Integration](#table-of-contents)
|
### [3.5 - IDE Integration](#table-of-contents)
|
||||||
|
|
||||||
Here is a list of community-conitributed IDE plug-ins that integrate with OpenAPI Generator:
|
Here is a list of community-contributed IDE plug-ins that integrate with OpenAPI Generator:
|
||||||
|
|
||||||
- Eclipse: [Codewind OpenAPI Tools for Eclipse](https://www.eclipse.org/codewind/open-api-tools-for-eclipse.html) by [IBM](https://www.ibm.com)
|
- Eclipse: [Codewind OpenAPI Tools for Eclipse](https://www.eclipse.org/codewind/open-api-tools-for-eclipse.html) by [IBM](https://www.ibm.com)
|
||||||
- IntelliJ IDEA: [OpenAPI Generator](https://plugins.jetbrains.com/plugin/8433-openapi-generator) by [Jim Schubert](https://jimschubert.us/#/)
|
- IntelliJ IDEA: [OpenAPI Generator](https://plugins.jetbrains.com/plugin/8433-openapi-generator) by [Jim Schubert](https://jimschubert.us/#/)
|
||||||
@@ -650,12 +659,14 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
|||||||
- [Stingray](http://www.stingray.com)
|
- [Stingray](http://www.stingray.com)
|
||||||
- [Suva](https://www.suva.ch/)
|
- [Suva](https://www.suva.ch/)
|
||||||
- [Telstra](https://dev.telstra.com)
|
- [Telstra](https://dev.telstra.com)
|
||||||
|
- [The University of Aizu](https://www.u-aizu.ac.jp/en/)
|
||||||
- [TravelTime platform](https://www.traveltimeplatform.com/)
|
- [TravelTime platform](https://www.traveltimeplatform.com/)
|
||||||
- [TribalScale](https://www.tribalscale.com)
|
- [TribalScale](https://www.tribalscale.com)
|
||||||
- [TUI InfoTec GmbH](http://www.tui-infotec.com/)
|
- [TUI InfoTec GmbH](http://www.tui-infotec.com/)
|
||||||
- [Twitter](https://twitter.com)
|
- [Twitter](https://twitter.com)
|
||||||
- [unblu inc.](https://www.unblu.com/)
|
- [unblu inc.](https://www.unblu.com/)
|
||||||
- [Veamly](https://www.veamly.com/)
|
- [Veamly](https://www.veamly.com/)
|
||||||
|
- [VMWare](https://www.vmware.com/)
|
||||||
- [wbt-solutions](https://www.wbt-solutions.de/)
|
- [wbt-solutions](https://www.wbt-solutions.de/)
|
||||||
- [Woleet](https://www.woleet.io/)
|
- [Woleet](https://www.woleet.io/)
|
||||||
- [WSO2](https://wso2.com/)
|
- [WSO2](https://wso2.com/)
|
||||||
@@ -805,6 +816,14 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
|||||||
- 2021-01-18 - [「アプリ開発あるある」を疑うことから始まった、API Clientコードの自動生成【デブスト2020】](https://codezine.jp/article/detail/13406?p=2) by [CodeZine編集部](https://codezine.jp/author/1)
|
- 2021-01-18 - [「アプリ開発あるある」を疑うことから始まった、API Clientコードの自動生成【デブスト2020】](https://codezine.jp/article/detail/13406?p=2) by [CodeZine編集部](https://codezine.jp/author/1)
|
||||||
- 2021-02-05 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://blog.viadee.de/en/rest-api-roundtrip) by [Benjamin Klatt](https://twitter.com/benklatt) at [viadee](https://www.viadee.de/en/)
|
- 2021-02-05 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://blog.viadee.de/en/rest-api-roundtrip) by [Benjamin Klatt](https://twitter.com/benklatt) at [viadee](https://www.viadee.de/en/)
|
||||||
- 2021-02-17 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://medium.com/nerd-for-tech/rest-api-roundtrip-with-springdoc-and-openapi-generator-30bd27ccf698) by [cloud @viadee](https://cloud-viadee.medium.com/)
|
- 2021-02-17 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://medium.com/nerd-for-tech/rest-api-roundtrip-with-springdoc-and-openapi-generator-30bd27ccf698) by [cloud @viadee](https://cloud-viadee.medium.com/)
|
||||||
|
- 2021-03-08 - [OpenAPI Generator 工具的躺坑尝试](https://blog.csdn.net/u013019701/article/details/114531975) by [独家雨天](https://blog.csdn.net/u013019701) at [CSDN官方博客](https://blog.csdn.net/)
|
||||||
|
- 2021-03-16 - [如何基于 Swagger 使用 OpenAPI Generator 生成 JMeter 脚本?](https://cloud.tencent.com/developer/article/1802704) by [高楼Zee](https://cloud.tencent.com/developer/user/5836255) at [腾讯云专栏](https://cloud.tencent.com/developer/column)
|
||||||
|
- 2021-03-24 - [openapi-generator-cli による TypeScript 型定義](https://zenn.dev/takepepe/articles/openapi-generator-cli-ts) by [Takefumi Yoshii](https://zenn.dev/takepepe)
|
||||||
|
- 2021-03-28 - [Trying out NestJS part 4: Generate Typescript clients from OpenAPI documents](https://dev.to/arnaudcortisse/trying-out-nestjs-part-4-generate-typescript-clients-from-openapi-documents-28mk) by [Arnaud Cortisse](https://dev.to/arnaudcortisse)
|
||||||
|
- 2021-03-31 - [Open API Server Implementation Using OpenAPI Generator](https://www.baeldung.com/java-openapi-generator-server) at [Baeldung](https://www.baeldung.com/)
|
||||||
|
- 2021-03-31 - [使用OpenAPI Generator實現Open API Server](https://www.1ju.org/article/java-openapi-generator-server) at [億聚網](https://www.1ju.org/)
|
||||||
|
- 2022-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)
|
||||||
|
- 2022-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)
|
||||||
|
|
||||||
## [6 - About Us](#table-of-contents)
|
## [6 - About Us](#table-of-contents)
|
||||||
|
|
||||||
@@ -917,6 +936,7 @@ Here is a list of template creators:
|
|||||||
* Erlang Server: @galaxie
|
* Erlang Server: @galaxie
|
||||||
* F# (Giraffe) Server: @nmfisher
|
* F# (Giraffe) Server: @nmfisher
|
||||||
* Go Server: @guohuang
|
* Go Server: @guohuang
|
||||||
|
* Go (Echo) Server: @ph4r5h4d
|
||||||
* Go (Gin) Server: @kemokemo
|
* Go (Gin) Server: @kemokemo
|
||||||
* GraphQL Express Server: @renepardon
|
* GraphQL Express Server: @renepardon
|
||||||
* Haskell Servant: @algas
|
* Haskell Servant: @algas
|
||||||
@@ -1009,7 +1029,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
|||||||
| Elm | @eriktim (2018/09) |
|
| Elm | @eriktim (2018/09) |
|
||||||
| Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) |
|
| Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) |
|
||||||
| F# | @nmfisher (2019/05) |
|
| F# | @nmfisher (2019/05) |
|
||||||
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) |
|
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04) |
|
||||||
| GraphQL | @renepardon (2018/12) |
|
| GraphQL | @renepardon (2018/12) |
|
||||||
| Groovy | |
|
| Groovy | |
|
||||||
| Haskell | |
|
| Haskell | |
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ install:
|
|||||||
- git clone https://github.com/wing328/swagger-samples
|
- git clone https://github.com/wing328/swagger-samples
|
||||||
- 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-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: $PSVersionTable.PSVersion
|
- ps: $PSVersionTable.PSVersion
|
||||||
- ps: Install-Module Pester -Force -Scope CurrentUser
|
- ps: Install-Module -Name Pester -Force -Scope CurrentUser
|
||||||
build_script:
|
build_script:
|
||||||
- dotnet --info
|
- dotnet --info
|
||||||
# build C# aspnetcore 5.0 server
|
# build C# aspnetcore 5.0 server
|
||||||
@@ -43,6 +43,8 @@ build_script:
|
|||||||
- dotnet build samples\server\petstore\aspnetcore-3.0\Org.OpenAPITools.sln
|
- dotnet build samples\server\petstore\aspnetcore-3.0\Org.OpenAPITools.sln
|
||||||
# build C# aspnetcore 2.2 server
|
# build C# aspnetcore 2.2 server
|
||||||
- dotnet build samples\server\petstore\aspnetcore\Org.OpenAPITools.sln
|
- dotnet build samples\server\petstore\aspnetcore\Org.OpenAPITools.sln
|
||||||
|
# build C# API client (multiple frameworks)
|
||||||
|
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClientCoreAndNet47\Org.OpenAPITools.sln
|
||||||
# build C# API client (httpclient)
|
# build C# API client (httpclient)
|
||||||
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-httpclient\Org.OpenAPITools.sln
|
- dotnet build samples\client\petstore\csharp-netcore\OpenAPIClient-httpclient\Org.OpenAPITools.sln
|
||||||
# build C# API client (netcore)
|
# build C# API client (netcore)
|
||||||
@@ -66,6 +68,8 @@ build_script:
|
|||||||
# run the locally installed openapi-generator-gradle-plugin
|
# run the locally installed openapi-generator-gradle-plugin
|
||||||
- gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace
|
- gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace
|
||||||
test_script:
|
test_script:
|
||||||
|
# test c# API client (multiple frameworks)
|
||||||
|
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCoreAndNet47\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||||
# test c# API client (httpclient)
|
# test c# API client (httpclient)
|
||||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-httpclient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient-httpclient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||||
# test c# API client (netcore)
|
# test c# API client (netcore)
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ additionalProperties:
|
|||||||
useCompareNetObjects: true
|
useCompareNetObjects: true
|
||||||
disallowAdditionalPropertiesIfNotPresent: false
|
disallowAdditionalPropertiesIfNotPresent: false
|
||||||
useOneOfDiscriminatorLookup: true
|
useOneOfDiscriminatorLookup: true
|
||||||
targetFramework: netstandard2.1
|
targetFramework: netstandard2.0
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
generatorName: csharp-netcore
|
||||||
|
outputDir: samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/csharp-netcore
|
||||||
|
additionalProperties:
|
||||||
|
packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}'
|
||||||
|
targetFramework: netstandard2.1;netcoreapp3.0
|
||||||
|
useCompareNetObjects: "true"
|
||||||
@@ -2,6 +2,9 @@ generatorName: dart-dio-next
|
|||||||
outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake
|
outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
|
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
|
||||||
enablePostProcessFile: "true"
|
typeMappings:
|
||||||
|
Client: "ModelClient"
|
||||||
|
File: "ModelFile"
|
||||||
|
EnumClass: "ModelEnumClass"
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
|
|||||||
@@ -2,5 +2,9 @@ generatorName: dart-dio
|
|||||||
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake
|
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart-dio
|
templateDir: modules/openapi-generator/src/main/resources/dart-dio
|
||||||
|
typeMappings:
|
||||||
|
Client: "ModelClient"
|
||||||
|
File: "ModelFile"
|
||||||
|
EnumClass: "ModelEnumClass"
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
generatorName: dart-dio
|
|
||||||
outputDir: samples/client/petstore/dart-dio/petstore_client_lib
|
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart-dio
|
|
||||||
additionalProperties:
|
|
||||||
hideGenerationTimestamp: "true"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
generatorName: dart-jaguar
|
|
||||||
outputDir: samples/client/petstore/dart-jaguar/flutter_petstore/openapi
|
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
|
|
||||||
additionalProperties:
|
|
||||||
pubName: openapi
|
|
||||||
hideGenerationTimestamp: "true"
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
generatorName: dart-jaguar
|
|
||||||
outputDir: samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi
|
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml
|
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
|
|
||||||
additionalProperties:
|
|
||||||
serialization: proto
|
|
||||||
pubName: openapi
|
|
||||||
hideGenerationTimestamp: "true"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
generatorName: dart-jaguar
|
|
||||||
outputDir: samples/client/petstore/dart-jaguar/openapi
|
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
|
|
||||||
additionalProperties:
|
|
||||||
hideGenerationTimestamp: "true"
|
|
||||||
pubName: openapi
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
generatorName: dart-jaguar
|
|
||||||
outputDir: samples/client/petstore/dart-jaguar/openapi_proto
|
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml
|
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart-jaguar
|
|
||||||
additionalProperties:
|
|
||||||
serialization: proto
|
|
||||||
pubName: openapi
|
|
||||||
hideGenerationTimestamp: "true"
|
|
||||||
@@ -2,5 +2,8 @@ generatorName: dart
|
|||||||
outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib_fake
|
outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib_fake
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart2
|
templateDir: modules/openapi-generator/src/main/resources/dart2
|
||||||
|
typeMappings:
|
||||||
|
Client: "ModelClient"
|
||||||
|
File: "ModelFile"
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
generatorName: dart
|
|
||||||
outputDir: samples/client/petstore/dart2/petstore_client_lib
|
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart2
|
|
||||||
additionalProperties:
|
|
||||||
hideGenerationTimestamp: "true"
|
|
||||||
@@ -2,6 +2,9 @@ generatorName: dart
|
|||||||
outputDir: samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake
|
outputDir: samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/dart2
|
templateDir: modules/openapi-generator/src/main/resources/dart2
|
||||||
|
typeMappings:
|
||||||
|
Client: "ModelClient"
|
||||||
|
File: "ModelFile"
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
serializationLibrary: json_serializable
|
serializationLibrary: json_serializable
|
||||||
|
|||||||
6
bin/configs/go-echo-server-petstore-new.yaml
Normal file
6
bin/configs/go-echo-server-petstore-new.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
generatorName: go-echo-server
|
||||||
|
outputDir: samples/server/petstore/go-echo-server
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/go-echo-server
|
||||||
|
additionalProperties:
|
||||||
|
hideGenerationTimestamp: "true"
|
||||||
@@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/go-server
|
|||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
packageName: petstoreserver
|
packageName: petstoreserver
|
||||||
|
addResponseHeaders: true
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
generatorName: ktorm-schema
|
generatorName: ktorm-schema
|
||||||
outputDir: samples/schema/petstore/ktorm
|
outputDir: samples/schema/petstore/ktorm
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/ktorm-schema
|
templateDir: modules/openapi-generator/src/main/resources/ktorm-schema
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: true
|
hideGenerationTimestamp: true
|
||||||
importModelPackageName: org.openapitools.client.models
|
importModelPackageName: org.openapitools.client.models
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
generatorName: nim
|
generatorName: nim
|
||||||
outputDir: samples/client/petstore/nim
|
outputDir: samples/client/petstore/nim
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/nim-client
|
templateDir: modules/openapi-generator/src/main/resources/nim-client
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
packageName: petstore
|
packageName: petstore
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
generatorName: php-symfony
|
generatorName: php-symfony
|
||||||
outputDir: samples/server/petstore/php-symfony/SymfonyBundle-php
|
outputDir: samples/server/petstore/php-symfony/SymfonyBundle-php
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/php-symfony
|
templateDir: modules/openapi-generator/src/main/resources/php-symfony
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
generatorName: swift5
|
generatorName: swift5
|
||||||
outputDir: samples/client/petstore/swift5/default
|
outputDir: samples/client/petstore/swift5/default
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/swift5
|
templateDir: modules/openapi-generator/src/main/resources/swift5
|
||||||
generateAliasAsModel: true
|
generateAliasAsModel: true
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
|
|||||||
@@ -9,3 +9,4 @@ additionalProperties:
|
|||||||
podSummary: PetstoreClient
|
podSummary: PetstoreClient
|
||||||
projectName: PetstoreClient
|
projectName: PetstoreClient
|
||||||
podHomepage: https://github.com/openapitools/openapi-generator
|
podHomepage: https://github.com/openapitools/openapi-generator
|
||||||
|
useBacktickEscapes: true
|
||||||
|
|||||||
@@ -9,3 +9,5 @@ additionalProperties:
|
|||||||
podSummary: PetstoreClient
|
podSummary: PetstoreClient
|
||||||
projectName: PetstoreClient
|
projectName: PetstoreClient
|
||||||
podHomepage: https://github.com/openapitools/openapi-generator
|
podHomepage: https://github.com/openapitools/openapi-generator
|
||||||
|
useSPMFileStructure: true
|
||||||
|
useClasses: true
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
generatorName: typescript-axios
|
||||||
|
outputDir: samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
SCRIPT="$0"
|
SCRIPT="$0"
|
||||||
echo "# START SCRIPT: $SCRIPT"
|
echo "# START SCRIPT: $SCRIPT"
|
||||||
|
|
||||||
@@ -18,8 +20,8 @@ ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o sampl
|
|||||||
|
|
||||||
java $JAVA_OPTS -jar $executable $ags
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|
||||||
(cd "$root"/samples/meta-codegen/ && mvn -B package -Djacoco.skip=true -DskipTests=true -f pom.xml)
|
(./mvnw -B package -Djacoco.skip=true -DskipTests=true -f "$root"/samples/meta-codegen/pom.xml)
|
||||||
|
|
||||||
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen/usage $@"
|
ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/3_0/petstore.json -o samples/meta-codegen/usage $@"
|
||||||
|
|
||||||
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
|
java $JAVA_OPTS -cp ${root}/samples/meta-codegen/lib/target/myClientCodegen-openapi-generator-1.0.0.jar:$executable org.openapitools.codegen.OpenAPIGenerator $ags2
|
||||||
|
|||||||
@@ -11,15 +11,16 @@ logfile="/tmp/generator-fake-petstore-output.log"
|
|||||||
|
|
||||||
for GENERATOR in $(java -jar ${executable} list --short | sed -e 's/,/\'$'\n''/g')
|
for GENERATOR in $(java -jar ${executable} list --short | sed -e 's/,/\'$'\n''/g')
|
||||||
do
|
do
|
||||||
if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR} > ${logfile} 2>&1; then
|
# no longer test 2.0 spec as we migrated to 3.0 spec
|
||||||
echo "[OAS 2.0] Executed ${GENERATOR} successfully!"
|
#if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR} > ${logfile} 2>&1; then
|
||||||
else
|
# echo "[OAS 2.0] Executed ${GENERATOR} successfully!"
|
||||||
echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:"
|
#else
|
||||||
echo "java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR}"
|
# echo "ERROR: Failed to run '${GENERATOR}' generator. The command was:"
|
||||||
echo "ERROR: The output of the command was:"
|
# echo "java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/2.0/${GENERATOR}"
|
||||||
cat ${logfile}
|
# echo "ERROR: The output of the command was:"
|
||||||
exit 1
|
# cat ${logfile}
|
||||||
fi
|
# exit 1
|
||||||
|
#fi
|
||||||
|
|
||||||
if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/3.0/${GENERATOR} > ${logfile} 2>&1; then
|
if eval java -jar ${executable} generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ${GENERATOR} -o /tmp/openapi-generator-test-fake-petstore/3.0/${GENERATOR} > ${logfile} 2>&1; then
|
||||||
echo "[OAS 3.0] Executed ${GENERATOR} successfully!"
|
echo "[OAS 3.0] Executed ${GENERATOR} successfully!"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
# csharp-netcore test files and image for upload
|
# csharp-netcore test files and image for upload
|
||||||
|
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/JSONComposedSchemaTests.cs"
|
||||||
|
sha256: 95e40cace36e7cd1608fa494161f06291f4cfb8f859ec4196ae9939f520b152a
|
||||||
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
|
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs"
|
||||||
sha256: dae985015ba461297927d544a78267f2def35e07c3f14ca66468fd61e1fd1c26
|
sha256: dae985015ba461297927d544a78267f2def35e07c3f14ca66468fd61e1fd1c26
|
||||||
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png"
|
- filename: "samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/linux-logo.png"
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ The following environment variables are supported by their respective generators
|
|||||||
* `CPP_POST_PROCESS_FILE`
|
* `CPP_POST_PROCESS_FILE`
|
||||||
* `CSHARP_POST_PROCESS_FILE`
|
* `CSHARP_POST_PROCESS_FILE`
|
||||||
* `C_POST_PROCESS_FILE`
|
* `C_POST_PROCESS_FILE`
|
||||||
* `DART_POST_PROCESS`
|
|
||||||
* `DART_POST_PROCESS_FILE`
|
* `DART_POST_PROCESS_FILE`
|
||||||
* `FSHARP_POST_PROCESS_FILE`
|
* `FSHARP_POST_PROCESS_FILE`
|
||||||
* `GO_POST_PROCESS_FILE`
|
* `GO_POST_PROCESS_FILE`
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ The following generators are available:
|
|||||||
* [erlang-server](generators/erlang-server.md)
|
* [erlang-server](generators/erlang-server.md)
|
||||||
* [fsharp-functions (beta)](generators/fsharp-functions.md)
|
* [fsharp-functions (beta)](generators/fsharp-functions.md)
|
||||||
* [fsharp-giraffe-server (beta)](generators/fsharp-giraffe-server.md)
|
* [fsharp-giraffe-server (beta)](generators/fsharp-giraffe-server.md)
|
||||||
|
* [go-echo-server (beta)](generators/go-echo-server.md)
|
||||||
* [go-gin-server](generators/go-gin-server.md)
|
* [go-gin-server](generators/go-gin-server.md)
|
||||||
* [go-server](generators/go-server.md)
|
* [go-server](generators/go-server.md)
|
||||||
* [graphql-nodejs-express-server](generators/graphql-nodejs-express-server.md)
|
* [graphql-nodejs-express-server](generators/graphql-nodejs-express-server.md)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
||||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||||
|sourceFolder|source folder for generated code| |src|
|
|sourceFolder|source folder for generated code| |src|
|
||||||
|targetFramework|The target .NET framework version.|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net5.0**</dt><dd>.NET 5.0 compatible</dd></dl>|netstandard2.0|
|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible</dd><dt>**netstandard1.4**</dt><dd>.NET Standard 1.4 compatible</dd><dt>**netstandard1.5**</dt><dd>.NET Standard 1.5 compatible</dd><dt>**netstandard1.6**</dt><dd>.NET Standard 1.6 compatible</dd><dt>**netstandard2.0**</dt><dd>.NET Standard 2.0 compatible</dd><dt>**netstandard2.1**</dt><dd>.NET Standard 2.1 compatible</dd><dt>**netcoreapp2.0**</dt><dd>.NET Core 2.0 compatible</dd><dt>**netcoreapp2.1**</dt><dd>.NET Core 2.1 compatible</dd><dt>**netcoreapp3.0**</dt><dd>.NET Core 3.0 compatible</dd><dt>**netcoreapp3.1**</dt><dd>.NET Core 3.1 compatible</dd><dt>**net47**</dt><dd>.NET Framework 4.7 compatible</dd><dt>**net5.0**</dt><dd>.NET 5.0 compatible</dd></dl>|netstandard2.0|
|
||||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||||
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
||||||
|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.| |false|
|
|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.| |false|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
|
||||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||||
|sourceFolder|source folder for generated code| |src|
|
|sourceFolder|source folder for generated code| |src|
|
||||||
|targetFramework|The target .NET framework version.|<dl><dt>**v3.5**</dt><dd>.NET Framework 3.5 compatible</dd><dt>**v4.0**</dt><dd>.NET Framework 4.0 compatible</dd><dt>**v4.5**</dt><dd>.NET Framework 4.5 compatible</dd><dt>**v4.5.2**</dt><dd>.NET Framework 4.5.2+ compatible</dd><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible (DEPRECATED. Please use `csharp-netcore` generator instead)</dd><dt>**uwp**</dt><dd>Universal Windows Platform (DEPRECATED. Please use `csharp-netcore` generator instead)</dd></dl>|v4.5|
|
|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.0`|<dl><dt>**v3.5**</dt><dd>.NET Framework 3.5 compatible</dd><dt>**v4.0**</dt><dd>.NET Framework 4.0 compatible</dd><dt>**v4.5**</dt><dd>.NET Framework 4.5 compatible</dd><dt>**v4.5.2**</dt><dd>.NET Framework 4.5.2+ compatible</dd><dt>**netstandard1.3**</dt><dd>.NET Standard 1.3 compatible (DEPRECATED. Please use `csharp-netcore` generator instead)</dd><dt>**uwp**</dt><dd>Universal Windows Platform (DEPRECATED. Please use `csharp-netcore` generator instead)</dd></dl>|v4.5|
|
||||||
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
|
||||||
|useCompareNetObjects|Use KellermanSoftware.CompareNetObjects for deep recursive object comparison. WARNING: this option incurs potential performance impact.| |false|
|
|useCompareNetObjects|Use KellermanSoftware.CompareNetObjects for deep recursive object comparison. WARNING: this option incurs potential performance impact.| |false|
|
||||||
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
<li>String</li>
|
<li>String</li>
|
||||||
<li>bool</li>
|
<li>bool</li>
|
||||||
<li>double</li>
|
<li>double</li>
|
||||||
<li>dynamic</li>
|
|
||||||
<li>int</li>
|
<li>int</li>
|
||||||
<li>num</li>
|
<li>num</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|
|
||||||
| Type/Alias | Imports |
|
| Type/Alias | Imports |
|
||||||
| ---------- | ------- |
|
| ---------- | ------- |
|
||||||
|BuiltList|package:built_collection/built_collection.dart|
|
|
||||||
|BuiltMap|package:built_collection/built_collection.dart|
|
|
||||||
|BuiltSet|package:built_collection/built_collection.dart|
|
|
||||||
|JsonObject|package:built_value/json_object.dart|
|
|
||||||
|Uint8List|dart:typed_data|
|
|
||||||
|
|
||||||
|
|
||||||
## INSTANTIATION TYPES
|
## INSTANTIATION TYPES
|
||||||
@@ -49,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
<li>String</li>
|
<li>String</li>
|
||||||
<li>bool</li>
|
<li>bool</li>
|
||||||
<li>double</li>
|
<li>double</li>
|
||||||
<li>dynamic</li>
|
|
||||||
<li>int</li>
|
<li>int</li>
|
||||||
<li>num</li>
|
<li>num</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
<li>String</li>
|
<li>String</li>
|
||||||
<li>bool</li>
|
<li>bool</li>
|
||||||
<li>double</li>
|
<li>double</li>
|
||||||
<li>dynamic</li>
|
|
||||||
<li>int</li>
|
<li>int</li>
|
||||||
<li>num</li>
|
<li>num</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
<li>String</li>
|
<li>String</li>
|
||||||
<li>bool</li>
|
<li>bool</li>
|
||||||
<li>double</li>
|
<li>double</li>
|
||||||
<li>dynamic</li>
|
|
||||||
<li>int</li>
|
<li>int</li>
|
||||||
<li>num</li>
|
<li>num</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
206
docs/generators/go-echo-server.md
Normal file
206
docs/generators/go-echo-server.md
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
---
|
||||||
|
title: Config Options for go-echo-server
|
||||||
|
sidebar_label: go-echo-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.
|
||||||
|
|
||||||
|
| Option | Description | Values | Default |
|
||||||
|
| ------ | ----------- | ------ | ------- |
|
||||||
|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||||
|
|packageName|Go package name (convention: lowercase).| |openapi|
|
||||||
|
|packageVersion|Go package version.| |1.0.0|
|
||||||
|
|serverPort|The network port the generated server binds to| |8080|
|
||||||
|
|
||||||
|
## IMPORT MAPPING
|
||||||
|
|
||||||
|
| Type/Alias | Imports |
|
||||||
|
| ---------- | ------- |
|
||||||
|
|
||||||
|
|
||||||
|
## INSTANTIATION TYPES
|
||||||
|
|
||||||
|
| Type/Alias | Instantiated By |
|
||||||
|
| ---------- | --------------- |
|
||||||
|
|
||||||
|
|
||||||
|
## LANGUAGE PRIMITIVES
|
||||||
|
|
||||||
|
<ul class="column-ul">
|
||||||
|
<li>bool</li>
|
||||||
|
<li>byte</li>
|
||||||
|
<li>complex128</li>
|
||||||
|
<li>complex64</li>
|
||||||
|
<li>float32</li>
|
||||||
|
<li>float64</li>
|
||||||
|
<li>int</li>
|
||||||
|
<li>int32</li>
|
||||||
|
<li>int64</li>
|
||||||
|
<li>interface{}</li>
|
||||||
|
<li>map[string]interface{}</li>
|
||||||
|
<li>rune</li>
|
||||||
|
<li>string</li>
|
||||||
|
<li>uint</li>
|
||||||
|
<li>uint32</li>
|
||||||
|
<li>uint64</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
## RESERVED WORDS
|
||||||
|
|
||||||
|
<ul class="column-ul">
|
||||||
|
<li>bool</li>
|
||||||
|
<li>break</li>
|
||||||
|
<li>byte</li>
|
||||||
|
<li>case</li>
|
||||||
|
<li>chan</li>
|
||||||
|
<li>complex128</li>
|
||||||
|
<li>complex64</li>
|
||||||
|
<li>const</li>
|
||||||
|
<li>continue</li>
|
||||||
|
<li>default</li>
|
||||||
|
<li>defer</li>
|
||||||
|
<li>else</li>
|
||||||
|
<li>error</li>
|
||||||
|
<li>fallthrough</li>
|
||||||
|
<li>float32</li>
|
||||||
|
<li>float64</li>
|
||||||
|
<li>for</li>
|
||||||
|
<li>func</li>
|
||||||
|
<li>go</li>
|
||||||
|
<li>goto</li>
|
||||||
|
<li>if</li>
|
||||||
|
<li>import</li>
|
||||||
|
<li>int</li>
|
||||||
|
<li>int16</li>
|
||||||
|
<li>int32</li>
|
||||||
|
<li>int64</li>
|
||||||
|
<li>int8</li>
|
||||||
|
<li>interface</li>
|
||||||
|
<li>map</li>
|
||||||
|
<li>nil</li>
|
||||||
|
<li>package</li>
|
||||||
|
<li>range</li>
|
||||||
|
<li>return</li>
|
||||||
|
<li>rune</li>
|
||||||
|
<li>select</li>
|
||||||
|
<li>string</li>
|
||||||
|
<li>struct</li>
|
||||||
|
<li>switch</li>
|
||||||
|
<li>type</li>
|
||||||
|
<li>uint</li>
|
||||||
|
<li>uint16</li>
|
||||||
|
<li>uint32</li>
|
||||||
|
<li>uint64</li>
|
||||||
|
<li>uint8</li>
|
||||||
|
<li>uintptr</li>
|
||||||
|
<li>var</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
|
||||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|
|
||||||
| Option | Description | Values | Default |
|
| Option | Description | Values | Default |
|
||||||
| ------ | ----------- | ------ | ------- |
|
| ------ | ----------- | ------ | ------- |
|
||||||
|
|addResponseHeaders|To include response headers in ImplResponse| |false|
|
||||||
|enumClassPrefix|Prefix enum with class name| |false|
|
|enumClassPrefix|Prefix enum with class name| |false|
|
||||||
|featureCORS|Enable Cross-Origin Resource Sharing middleware| |false|
|
|featureCORS|Enable Cross-Origin Resource Sharing middleware| |false|
|
||||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|
|
||||||
| Option | Description | Values | Default |
|
| Option | Description | Values | Default |
|
||||||
| ------ | ----------- | ------ | ------- |
|
| ------ | ----------- | ------ | ------- |
|
||||||
|
|enumNameSuffix|Suffix that will be appended to all enum names.| ||
|
||||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||||
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper.</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|reqwest|
|
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper.</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|reqwest|
|
||||||
|packageName|Rust package name (convention: lowercase).| |openapi|
|
|packageName|Rust package name (convention: lowercase).| |openapi|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|apiPackage|package for generated api classes| |null|
|
|apiPackage|package for generated api classes| |null|
|
||||||
|artifactId|artifactId| |openapi-scala-akka-http-server|
|
|artifactId|artifactId| |openapi-scala-akka-http-server|
|
||||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||||
|
|asManagedSources|Resulting files cab be used as managed resources. No build files or default controllers will be generated| |false|
|
||||||
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (prefered for JDK 1.8+)</dd></dl>|java8|
|
||||||
|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|
|
|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|
|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine are available.| |null|
|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine are available.| |null|
|
||||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||||
|
|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|
|
|swiftUseApiNamespace|Flag to make all the API classes inner-class of {{projectName}}API| |null|
|
||||||
|
|useBacktickEscapes|Escape reserved words using backticks (default: false)| |false|
|
||||||
|
|useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null|
|
||||||
|
|
||||||
## IMPORT MAPPING
|
## IMPORT MAPPING
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<version>5.0.0</version>
|
<!-- RELEASE_VERSION -->
|
||||||
|
<version>5.1.0</version>
|
||||||
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
|||||||
@@ -910,9 +910,9 @@ x-content-type: application/json
|
|||||||
|
|
||||||
### Rust-server
|
### Rust-server
|
||||||
|
|
||||||
#### x-responseId
|
#### x-response-id
|
||||||
|
|
||||||
Each response may specify a unique `x-responseId`. `rust-server` will use this to name the corresponding enum variant in the code. e.g.
|
Each response may specify a unique `x-response-id`. `rust-server` will use this to name the corresponding enum variant in the code. e.g.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
paths:
|
paths:
|
||||||
@@ -921,7 +921,7 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: OK
|
description: OK
|
||||||
x-responseId: Pong
|
x-response-id: Pong
|
||||||
```
|
```
|
||||||
|
|
||||||
### MySQL Schema
|
### MySQL Schema
|
||||||
|
|||||||
120
docs/usage.md
120
docs/usage.md
@@ -10,12 +10,13 @@ This page demonstrates navigating the options via CLI. Commands are presented he
|
|||||||
|
|
||||||
The `help` option lists all commands available to the CLI.
|
The `help` option lists all commands available to the CLI.
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
openapi-generator-cli help
|
openapi-generator-cli help
|
||||||
usage: openapi-generator-cli <command> [<args>]
|
usage: openapi-generator-cli <command> [<args>]
|
||||||
|
|
||||||
The most commonly used openapi-generator-cli commands are:
|
The most commonly used openapi-generator-cli commands are:
|
||||||
author Utilities for authoring generators or customizing templates.
|
author Utilities for authoring generators or customizing templates.
|
||||||
|
batch Generate code in batch via external configs.
|
||||||
config-help Config help for chosen lang
|
config-help Config help for chosen lang
|
||||||
generate Generate code with the specified generator.
|
generate Generate code with the specified generator.
|
||||||
help Display help information about openapi-generator
|
help Display help information about openapi-generator
|
||||||
@@ -30,26 +31,28 @@ command.
|
|||||||
|
|
||||||
## version
|
## version
|
||||||
|
|
||||||
The version command provides version information, returning either the semver version by default or the git sha when passed `--sha`.
|
The version command provides version information, returning either the version by default, the git commit sha when passed `--sha`, or verbose output when passed `--full`.
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli version - Show version information
|
openapi-generator-cli version - Show version information used in tooling
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
openapi-generator-cli version [--sha]
|
openapi-generator-cli version [--full] [--sha]
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
--full
|
||||||
|
Full version details
|
||||||
|
|
||||||
--sha
|
--sha
|
||||||
Git commit SHA version
|
Git commit SHA version
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## list
|
## list
|
||||||
|
|
||||||
The `list` command outputs a formatted list of every available generator. Pass the `-s/--short` option if you would like a CSV output for easy parsing.
|
The `list` command outputs a formatted list of every available generator. Pass the `-s/--short` option if you would like a CSV output for easy parsing.
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
openapi-generator-cli help list
|
openapi-generator-cli help list
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli list - Lists the available generators
|
openapi-generator-cli list - Lists the available generators
|
||||||
@@ -66,7 +69,6 @@ OPTIONS
|
|||||||
|
|
||||||
-s, --short
|
-s, --short
|
||||||
shortened output (suitable for scripting)
|
shortened output (suitable for scripting)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@@ -81,26 +83,49 @@ For the full list of generators, refer to the [Generators List](./generators.md)
|
|||||||
|
|
||||||
The `config-help` option provides details about
|
The `config-help` option provides details about
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
openapi-generator-cli help config-help
|
openapi-generator-cli help config-help
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli config-help - Config help for chosen lang
|
openapi-generator-cli config-help - Config help for chosen lang
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
openapi-generator-cli config-help
|
openapi-generator-cli config-help
|
||||||
[(-f <output format> | --format <output format>)]
|
[(-f <output format> | --format <output format>)] [--feature-set]
|
||||||
|
[--full-details]
|
||||||
[(-g <generator name> | --generator-name <generator name>)]
|
[(-g <generator name> | --generator-name <generator name>)]
|
||||||
[--markdown-header] [--named-header]
|
[--import-mappings] [--instantiation-types]
|
||||||
[(-o <output location> | --output <output location>)]
|
[--language-specific-primitive] [--markdown-header] [--named-header]
|
||||||
|
[(-o <output location> | --output <output location>)] [--reserved-words]
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-f <output format>, --format <output format>
|
-f <output format>, --format <output format>
|
||||||
Write output files in the desired format. Options are 'text',
|
Write output files in the desired format. Options are 'text',
|
||||||
'markdown' or 'yamlsample'. Default is 'text'.
|
'markdown' or 'yamlsample'. Default is 'text'.
|
||||||
|
|
||||||
|
--feature-set
|
||||||
|
displays feature set as supported by the generator
|
||||||
|
|
||||||
|
--full-details
|
||||||
|
displays CLI options as well as other configs/mappings (implies
|
||||||
|
--instantiation-types, --reserved-words,
|
||||||
|
--language-specific-primitives, --import-mappings,
|
||||||
|
--supporting-files)
|
||||||
|
|
||||||
-g <generator name>, --generator-name <generator name>
|
-g <generator name>, --generator-name <generator name>
|
||||||
generator to get config help for
|
generator to get config help for
|
||||||
|
|
||||||
|
--import-mappings
|
||||||
|
displays the default import mappings (types and aliases, and what
|
||||||
|
imports they will pull into the template)
|
||||||
|
|
||||||
|
--instantiation-types
|
||||||
|
displays types used to instantiate simple type/alias names
|
||||||
|
|
||||||
|
--language-specific-primitive
|
||||||
|
displays the language specific primitives (types which require no
|
||||||
|
additional imports, or which may conflict with user defined model
|
||||||
|
names)
|
||||||
|
|
||||||
--markdown-header
|
--markdown-header
|
||||||
When format=markdown, include this option to write out markdown
|
When format=markdown, include this option to write out markdown
|
||||||
headers (e.g. for docusaurus).
|
headers (e.g. for docusaurus).
|
||||||
@@ -112,6 +137,9 @@ OPTIONS
|
|||||||
Optionally write help to this location, otherwise default is
|
Optionally write help to this location, otherwise default is
|
||||||
standard output
|
standard output
|
||||||
|
|
||||||
|
--reserved-words
|
||||||
|
displays the reserved words which may result in renamed model or
|
||||||
|
property names
|
||||||
```
|
```
|
||||||
|
|
||||||
The option of note is `-g/--generator-name` (other options are exposed for tooling).
|
The option of note is `-g/--generator-name` (other options are exposed for tooling).
|
||||||
@@ -153,7 +181,7 @@ To pass these go client generator-specific options to the `generate` command for
|
|||||||
|
|
||||||
The `meta` command creates a new Java class and template files, used for creating your own custom templates.
|
The `meta` command creates a new Java class and template files, used for creating your own custom templates.
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
openapi-generator-cli help meta
|
openapi-generator-cli help meta
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli meta - MetaGenerator. Generator for creating a new
|
openapi-generator-cli meta - MetaGenerator. Generator for creating a new
|
||||||
@@ -161,11 +189,15 @@ NAME
|
|||||||
the language you specify, and includes default templates to include.
|
the language you specify, and includes default templates to include.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
openapi-generator-cli meta [(-n <name> | --name <name>)]
|
openapi-generator-cli meta [(-l <language> | --language <language>)]
|
||||||
|
[(-n <name> | --name <name>)]
|
||||||
[(-o <output directory> | --output <output directory>)]
|
[(-o <output directory> | --output <output directory>)]
|
||||||
[(-p <package> | --package <package>)] [(-t <type> | --type <type>)]
|
[(-p <package> | --package <package>)] [(-t <type> | --type <type>)]
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
-l <language>, --language <language>
|
||||||
|
the implementation language for the generator class
|
||||||
|
|
||||||
-n <name>, --name <name>
|
-n <name>, --name <name>
|
||||||
the human-readable name of the generator
|
the human-readable name of the generator
|
||||||
|
|
||||||
@@ -186,7 +218,7 @@ For an in-depth example of using the `meta` command, see [Customization](./custo
|
|||||||
|
|
||||||
The `validate` command allows you to validate an input specification, optionally providing recommendations for error fixes or other improvements (if available).
|
The `validate` command allows you to validate an input specification, optionally providing recommendations for error fixes or other improvements (if available).
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
openapi-generator-cli help validate
|
openapi-generator-cli help validate
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli validate - Validate specification
|
openapi-generator-cli validate - Validate specification
|
||||||
@@ -200,7 +232,6 @@ OPTIONS
|
|||||||
location of the OpenAPI spec, as URL or file (required)
|
location of the OpenAPI spec, as URL or file (required)
|
||||||
|
|
||||||
--recommend
|
--recommend
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Valid Spec Example (using [petstore-v3.0.yaml](https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml))
|
Valid Spec Example (using [petstore-v3.0.yaml](https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml))
|
||||||
@@ -250,7 +281,7 @@ An example bash completion script can be found in the repo at [scripts/openapi-g
|
|||||||
The `generate` command is the workhorse of the generator toolset. As such, it has _many_ more options available than the previous commands. The abbreviated options are below, but you may expand the full descriptions.
|
The `generate` command is the workhorse of the generator toolset. As such, it has _many_ more options available than the previous commands. The abbreviated options are below, but you may expand the full descriptions.
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
openapi-generator-cli help generate
|
openapi-generator-cli help generate
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli generate - Generate code with the specified
|
openapi-generator-cli generate - Generate code with the specified
|
||||||
@@ -269,23 +300,24 @@ SYNOPSIS
|
|||||||
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
|
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
|
||||||
[--global-property <global properties>...] [--group-id <group id>]
|
[--global-property <global properties>...] [--group-id <group id>]
|
||||||
[--http-user-agent <http user agent>]
|
[--http-user-agent <http user agent>]
|
||||||
(-i <spec file> | --input-spec <spec file>)
|
[(-i <spec file> | --input-spec <spec file>)]
|
||||||
[--ignore-file-override <ignore file override location>]
|
[--ignore-file-override <ignore file override location>]
|
||||||
[--import-mappings <import mappings>...]
|
[--import-mappings <import mappings>...]
|
||||||
[--instantiation-types <instantiation types>...]
|
[--instantiation-types <instantiation types>...]
|
||||||
[--invoker-package <invoker package>]
|
[--invoker-package <invoker package>]
|
||||||
[--language-specific-primitives <language specific primitives>...]
|
[--language-specific-primitives <language specific primitives>...]
|
||||||
[--library <library>] [--log-to-stderr] [--minimal-update]
|
[--legacy-discriminator-behavior] [--library <library>]
|
||||||
|
[--log-to-stderr] [--minimal-update]
|
||||||
[--model-name-prefix <model name prefix>]
|
[--model-name-prefix <model name prefix>]
|
||||||
[--model-name-suffix <model name suffix>]
|
[--model-name-suffix <model name suffix>]
|
||||||
[--model-package <model package>]
|
[--model-package <model package>]
|
||||||
[(-o <output directory> | --output <output directory>)]
|
[(-o <output directory> | --output <output directory>)] [(-p <additional properties> | --additional-properties <additional properties>)...]
|
||||||
[(-p <additional properties> | --additional-properties <additional properties>)...]
|
|
||||||
[--package-name <package name>] [--release-note <release note>]
|
[--package-name <package name>] [--release-note <release note>]
|
||||||
[--remove-operation-id-prefix]
|
[--remove-operation-id-prefix]
|
||||||
[--reserved-words-mappings <reserved word mappings>...]
|
[--reserved-words-mappings <reserved word mappings>...]
|
||||||
[(-s | --skip-overwrite)] [--server-variables <server variables>...]
|
[(-s | --skip-overwrite)] [--server-variables <server variables>...]
|
||||||
[--skip-validate-spec] [--strict-spec <true/false strict behavior>]
|
[--skip-operation-example] [--skip-validate-spec]
|
||||||
|
[--strict-spec <true/false strict behavior>]
|
||||||
[(-t <template directory> | --template-dir <template directory>)]
|
[(-t <template directory> | --template-dir <template directory>)]
|
||||||
[--type-mappings <type mappings>...] [(-v | --verbose)]
|
[--type-mappings <type mappings>...] [(-v | --verbose)]
|
||||||
```
|
```
|
||||||
@@ -293,7 +325,7 @@ SYNOPSIS
|
|||||||
<details>
|
<details>
|
||||||
<summary>generate OPTIONS</summary>
|
<summary>generate OPTIONS</summary>
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-a <authorization>, --auth <authorization>
|
-a <authorization>, --auth <authorization>
|
||||||
adds authorization headers when fetching the OpenAPI definitions
|
adds authorization headers when fetching the OpenAPI definitions
|
||||||
@@ -303,7 +335,7 @@ OPTIONS
|
|||||||
--api-name-suffix <api name suffix>
|
--api-name-suffix <api name suffix>
|
||||||
Suffix that will be appended to all API names ('tags'). Default:
|
Suffix that will be appended to all API names ('tags'). Default:
|
||||||
Api. e.g. Pet => PetApi. Note: Only ruby, python, jaxrs generators
|
Api. e.g. Pet => PetApi. Note: Only ruby, python, jaxrs generators
|
||||||
suppport this feature at the moment.
|
support this feature at the moment.
|
||||||
|
|
||||||
--api-package <api package>
|
--api-package <api package>
|
||||||
package for generated api classes
|
package for generated api classes
|
||||||
@@ -367,7 +399,8 @@ OPTIONS
|
|||||||
'OpenAPI-Generator/{packageVersion}/{language}'
|
'OpenAPI-Generator/{packageVersion}/{language}'
|
||||||
|
|
||||||
-i <spec file>, --input-spec <spec file>
|
-i <spec file>, --input-spec <spec file>
|
||||||
location of the OpenAPI spec, as URL or file (required)
|
location of the OpenAPI spec, as URL or file (required if not loaded
|
||||||
|
via config using -c)
|
||||||
|
|
||||||
--ignore-file-override <ignore file override location>
|
--ignore-file-override <ignore file override location>
|
||||||
Specifies an override location for the .openapi-generator-ignore
|
Specifies an override location for the .openapi-generator-ignore
|
||||||
@@ -394,13 +427,18 @@ OPTIONS
|
|||||||
String,boolean,Boolean,Double. You can also have multiple
|
String,boolean,Boolean,Double. You can also have multiple
|
||||||
occurrences of this option.
|
occurrences of this option.
|
||||||
|
|
||||||
|
--legacy-discriminator-behavior
|
||||||
|
Set to false for generators with better support for discriminators.
|
||||||
|
(Python, Java, Go, PowerShell, C#have this enabled by default).
|
||||||
|
|
||||||
--library <library>
|
--library <library>
|
||||||
library template (sub-template)
|
library template (sub-template)
|
||||||
|
|
||||||
--log-to-stderr
|
--log-to-stderr
|
||||||
write all log messages (not just errors) to STDOUT. Useful for
|
write all log messages (not just errors) to STDOUT. Useful for
|
||||||
piping the JSON output of debug options (e.g. `--global-property debugOperations=true`)
|
piping the JSON output of debug options (e.g. `--global-property
|
||||||
to an external parser directly while testing a generator.
|
debugOperations`) to an external parser directly while testing a
|
||||||
|
generator.
|
||||||
|
|
||||||
--minimal-update
|
--minimal-update
|
||||||
Only write output files that have changed.
|
Only write output files that have changed.
|
||||||
@@ -445,6 +483,9 @@ OPTIONS
|
|||||||
sets server variables overrides for spec documents which support
|
sets server variables overrides for spec documents which support
|
||||||
variable templating of servers.
|
variable templating of servers.
|
||||||
|
|
||||||
|
--skip-operation-example
|
||||||
|
Skip examples defined in operations to avoid out of memory errors.
|
||||||
|
|
||||||
--skip-validate-spec
|
--skip-validate-spec
|
||||||
Skips the default behavior of validating an input specification.
|
Skips the default behavior of validating an input specification.
|
||||||
|
|
||||||
@@ -464,7 +505,6 @@ OPTIONS
|
|||||||
|
|
||||||
-v, --verbose
|
-v, --verbose
|
||||||
verbose mode
|
verbose mode
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
@@ -604,19 +644,22 @@ The `batch` command allows you to move all CLI arguments supported by the `gener
|
|||||||
*NOTE*: This command supports an additional `!include` property which may point to another "shared" file, the base path to which can be
|
*NOTE*: This command supports an additional `!include` property which may point to another "shared" file, the base path to which can be
|
||||||
modified by `--includes-base-dir`. Starting with 5.0.0, the `!batch` command supports multiple `!include` properties, either sequential or nested. In order to support multiple `!include` properties in a JSON file, the property name can have a suffix, e.g. `!include1`, `!include2`, etc. The suffix have no meaning other than providing unique property names.
|
modified by `--includes-base-dir`. Starting with 5.0.0, the `!batch` command supports multiple `!include` properties, either sequential or nested. In order to support multiple `!include` properties in a JSON file, the property name can have a suffix, e.g. `!include1`, `!include2`, etc. The suffix have no meaning other than providing unique property names.
|
||||||
|
|
||||||
```bash
|
```text
|
||||||
openapi-generator-cli help batch
|
openapi-generator-cli help batch
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli batch - Generate code in batch via external
|
openapi-generator-cli batch - Generate code in batch via external
|
||||||
configs.
|
configs.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
openapi-generator-cli batch [--fail-fast]
|
openapi-generator-cli batch [--clean] [--fail-fast]
|
||||||
[--includes-base-dir <includes>] [(-r <threads> | --threads <threads>)]
|
[--includes-base-dir <includes>] [(-r <threads> | --threads <threads>)]
|
||||||
[--root-dir <root>] [--timeout <timeout>] [(-v | --verbose)] [--]
|
[--root-dir <root>] [--timeout <timeout>] [(-v | --verbose)] [--]
|
||||||
<configs>...
|
<configs>...
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
--clean
|
||||||
|
clean output of previously written files before generation
|
||||||
|
|
||||||
--fail-fast
|
--fail-fast
|
||||||
fail fast on any errors
|
fail fast on any errors
|
||||||
|
|
||||||
@@ -682,7 +725,7 @@ openapi-generator-cli batch *.yaml
|
|||||||
|
|
||||||
This command group contains utilities for authoring generators or customizing templates.
|
This command group contains utilities for authoring generators or customizing templates.
|
||||||
|
|
||||||
```
|
```text
|
||||||
openapi-generator-cli help author
|
openapi-generator-cli help author
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli author - Utilities for authoring generators or
|
openapi-generator-cli author - Utilities for authoring generators or
|
||||||
@@ -690,9 +733,9 @@ NAME
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
openapi-generator-cli author
|
openapi-generator-cli author
|
||||||
openapi-generator-cli author template [(-v | --verbose)]
|
openapi-generator-cli author template [--library <library>]
|
||||||
|
[(-v | --verbose)]
|
||||||
[(-o <output directory> | --output <output directory>)]
|
[(-o <output directory> | --output <output directory>)]
|
||||||
[--library <library>]
|
|
||||||
(-g <generator name> | --generator-name <generator name>)
|
(-g <generator name> | --generator-name <generator name>)
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
@@ -708,13 +751,13 @@ COMMANDS
|
|||||||
template
|
template
|
||||||
Retrieve templates for local modification
|
Retrieve templates for local modification
|
||||||
|
|
||||||
|
With --library option, library template (sub-template)
|
||||||
|
|
||||||
With --verbose option, verbose mode
|
With --verbose option, verbose mode
|
||||||
|
|
||||||
With --output option, where to write the template files (defaults to
|
With --output option, where to write the template files (defaults to
|
||||||
'out')
|
'out')
|
||||||
|
|
||||||
With --library option, library template (sub-template)
|
|
||||||
|
|
||||||
With --generator-name option, generator to use (see list command for
|
With --generator-name option, generator to use (see list command for
|
||||||
list)
|
list)
|
||||||
```
|
```
|
||||||
@@ -723,7 +766,8 @@ COMMANDS
|
|||||||
|
|
||||||
This command allows user to extract templates from the CLI jar which simplifies customization efforts.
|
This command allows user to extract templates from the CLI jar which simplifies customization efforts.
|
||||||
|
|
||||||
```
|
```text
|
||||||
|
openapi-generator-cli help author template
|
||||||
NAME
|
NAME
|
||||||
openapi-generator-cli author template - Retrieve templates for local
|
openapi-generator-cli author template - Retrieve templates for local
|
||||||
modification
|
modification
|
||||||
@@ -753,12 +797,12 @@ Example:
|
|||||||
|
|
||||||
Extract Java templates, limiting to the `webclient` library.
|
Extract Java templates, limiting to the `webclient` library.
|
||||||
|
|
||||||
```
|
```bash
|
||||||
openapi-generator-cli author template -g java --library webclient
|
openapi-generator-cli author template -g java --library webclient
|
||||||
```
|
```
|
||||||
|
|
||||||
Extract all Java templates:
|
Extract all Java templates:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
openapi-generator-cli author template -g java
|
openapi-generator-cli author template -g java
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
FROM java:8-jre-alpine
|
FROM openjdk:11.0-jre-buster
|
||||||
|
|
||||||
RUN apk add --no-cache bash
|
|
||||||
|
|
||||||
ADD target/openapi-generator-cli.jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar
|
ADD target/openapi-generator-cli.jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ public class Generate extends OpenApiGeneratorCommand {
|
|||||||
title = "type mappings",
|
title = "type mappings",
|
||||||
description = "sets mappings between OpenAPI spec types and generated code types "
|
description = "sets mappings between OpenAPI spec types and generated code types "
|
||||||
+ "in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: array=List,map=Map,string=String."
|
+ "in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: array=List,map=Map,string=String."
|
||||||
+ " You can also have multiple occurrences of this option.")
|
+ " You can also have multiple occurrences of this option."
|
||||||
|
+ " To map a specified format, use type+format, e.g. string+password=EncryptedString will map `type: string, format: password` to `EncryptedString`.")
|
||||||
private List<String> typeMappings = new ArrayList<>();
|
private List<String> typeMappings = new ArrayList<>();
|
||||||
|
|
||||||
@Option(
|
@Option(
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ import java.net.URISyntaxException;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents those settings applied to a generation workflow.
|
* Represents those settings applied to a generation workflow.
|
||||||
@@ -67,7 +68,7 @@ public class WorkflowSettings {
|
|||||||
private String templateDir;
|
private String templateDir;
|
||||||
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
|
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
|
||||||
private String ignoreFileOverride;
|
private String ignoreFileOverride;
|
||||||
private ImmutableMap<String, String> globalProperties = DEFAULT_GLOBAL_PROPERTIES;
|
private ImmutableMap<String, ?> globalProperties = DEFAULT_GLOBAL_PROPERTIES;
|
||||||
|
|
||||||
private WorkflowSettings(Builder builder) {
|
private WorkflowSettings(Builder builder) {
|
||||||
this.inputSpec = builder.inputSpec;
|
this.inputSpec = builder.inputSpec;
|
||||||
@@ -283,7 +284,15 @@ public class WorkflowSettings {
|
|||||||
* @return the system properties
|
* @return the system properties
|
||||||
*/
|
*/
|
||||||
public Map<String, String> getGlobalProperties() {
|
public Map<String, String> getGlobalProperties() {
|
||||||
return globalProperties;
|
return globalProperties.entrySet().stream()
|
||||||
|
.collect(Collectors.toMap(Map.Entry::getKey, e -> {
|
||||||
|
if (e.getValue() instanceof List) {
|
||||||
|
return ((List<?>) e.getValue()).stream()
|
||||||
|
.map(Object::toString)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
}
|
||||||
|
return String.valueOf(e.getValue());
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package org.openapitools.codegen.meta;
|
package org.openapitools.codegen.meta;
|
||||||
|
|
||||||
import org.openapitools.codegen.meta.features.*;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.testng.annotations.Test;
|
|||||||
import static org.testng.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
public class ValidationRuleTest {
|
public class ValidationRuleTest {
|
||||||
class Sample {
|
static class Sample {
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public Sample(String name) {
|
public Sample(String name) {
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ apply plugin: 'org.openapi.generator'
|
|||||||
|typeMappings
|
|typeMappings
|
||||||
|Map(String,String)
|
|Map(String,String)
|
||||||
|None
|
|None
|
||||||
|Sets mappings between OpenAPI spec types and generated code types.
|
|Sets mappings between OpenAPI spec types and generated code types in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: `array=List,map=Map,string=String`. You can also have multiple occurrences of this option. To map a specified format, use type+format, e.g. string+password=EncryptedString will map `type: string, format: password` to `EncryptedString`.
|
||||||
|
|
||||||
|additionalProperties
|
|additionalProperties
|
||||||
|Map(String,Any)
|
|Map(String,Any)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# RELEASE_VERSION
|
# RELEASE_VERSION
|
||||||
openApiGeneratorVersion=5.1.0
|
openApiGeneratorVersion=5.1.1-SNAPSHOT
|
||||||
# /RELEASE_VERSION
|
# /RELEASE_VERSION
|
||||||
|
|
||||||
# BEGIN placeholders
|
# BEGIN placeholders
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# RELEASE_VERSION
|
# RELEASE_VERSION
|
||||||
openApiGeneratorVersion=5.1.0-SNAPSHOT
|
openApiGeneratorVersion=5.1.1-SNAPSHOT
|
||||||
# /RELEASE_VERSION
|
# /RELEASE_VERSION
|
||||||
|
|||||||
@@ -81,9 +81,8 @@ open class GenerateTask : DefaultTask() {
|
|||||||
val outputDir = project.objects.property<String>()
|
val outputDir = project.objects.property<String>()
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@get:Internal
|
|
||||||
@set:Option(option = "input", description = "The input specification.")
|
@set:Option(option = "input", description = "The input specification.")
|
||||||
@Input
|
@Internal
|
||||||
var input: String? = null
|
var input: String? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
inputSpec.set(value)
|
inputSpec.set(value)
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ mvn clean compile
|
|||||||
| `configOptions` | N/A | a **map** of language-specific parameters. To show a full list of generator-specified parameters (options), please use `configHelp` (explained below)
|
| `configOptions` | N/A | a **map** of language-specific parameters. To show a full list of generator-specified parameters (options), please use `configHelp` (explained below)
|
||||||
| `instantiationTypes` | `openapi.generator.maven.plugin.instantiationTypes` | sets instantiation type mappings in the format of type=instantiatedType,type=instantiatedType. For example (in Java): `array=ArrayList,map=HashMap`. In other words array types will get instantiated as ArrayList in generated code. You can also have multiple occurrences of this option
|
| `instantiationTypes` | `openapi.generator.maven.plugin.instantiationTypes` | sets instantiation type mappings in the format of type=instantiatedType,type=instantiatedType. For example (in Java): `array=ArrayList,map=HashMap`. In other words array types will get instantiated as ArrayList in generated code. You can also have multiple occurrences of this option
|
||||||
| `importMappings` | `openapi.generator.maven.plugin.importMappings` | specifies mappings between a given class and the import that should be used for that class in the format of type=import,type=import. You can also have multiple occurrences of this option
|
| `importMappings` | `openapi.generator.maven.plugin.importMappings` | specifies mappings between a given class and the import that should be used for that class in the format of type=import,type=import. You can also have multiple occurrences of this option
|
||||||
| `typeMappings` | `openapi.generator.maven.plugin.typeMappings` | sets mappings between OpenAPI spec types and generated code types in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: `array=List,map=Map,string=String`. You can also have multiple occurrences of this option
|
| `typeMappings` | `openapi.generator.maven.plugin.typeMappings` | sets mappings between OpenAPI spec types and generated code types in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: `array=List,map=Map,string=String`. You can also have multiple occurrences of this option. To map a specified format, use type+format, e.g. string+password=EncryptedString will map `type: string, format: password` to `EncryptedString`.
|
||||||
| `languageSpecificPrimitives` | `openapi.generator.maven.plugin.languageSpecificPrimitives` | specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: `String,boolean,Boolean,Double`. You can also have multiple occurrences of this option
|
| `languageSpecificPrimitives` | `openapi.generator.maven.plugin.languageSpecificPrimitives` | specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: `String,boolean,Boolean,Double`. You can also have multiple occurrences of this option
|
||||||
| `additionalProperties` | `openapi.generator.maven.plugin.additionalProperties` | sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. You can also have multiple occurrences of this option
|
| `additionalProperties` | `openapi.generator.maven.plugin.additionalProperties` | sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. You can also have multiple occurrences of this option
|
||||||
| `serverVariableOverrides` | `openapi.generator.maven.plugin.serverVariableOverrides` | A map of server variable overrides for specs that support server URL templating
|
| `serverVariableOverrides` | `openapi.generator.maven.plugin.serverVariableOverrides` | A map of server variable overrides for specs that support server URL templating
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.google.common.io.CharSource;
|
|||||||
import io.swagger.v3.parser.util.ClasspathHelper;
|
import io.swagger.v3.parser.util.ClasspathHelper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecution;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
@@ -423,6 +424,9 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
@Parameter(property = "codegen.configHelp")
|
@Parameter(property = "codegen.configHelp")
|
||||||
private boolean configHelp = false;
|
private boolean configHelp = false;
|
||||||
|
|
||||||
|
@Parameter(defaultValue = "${mojoExecution}", readonly = true)
|
||||||
|
private MojoExecution mojo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project being built.
|
* The project being built.
|
||||||
*/
|
*/
|
||||||
@@ -847,7 +851,7 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
name = Files.getNameWithoutExtension(segments[segments.length - 1]);
|
name = Files.getNameWithoutExtension(segments[segments.length - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + name + ".sha256");
|
return new File(output.getPath() + File.separator + ".openapi-generator" + File.separator + name + "-" + mojo.getExecutionId() + ".sha256");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCompileSourceRoot() {
|
private String getCompileSourceRoot() {
|
||||||
|
|||||||
@@ -16,10 +16,20 @@
|
|||||||
|
|
||||||
package org.openapitools.codegen.plugin;
|
package org.openapitools.codegen.plugin;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
|
import org.apache.maven.execution.MavenSession;
|
||||||
|
import org.apache.maven.plugin.MojoExecution;
|
||||||
|
import org.apache.maven.project.MavenProject;
|
||||||
|
import org.apache.maven.project.ProjectBuilder;
|
||||||
|
import org.apache.maven.project.ProjectBuildingRequest;
|
||||||
|
import org.eclipse.aether.DefaultRepositorySystemSession;
|
||||||
import org.openapitools.codegen.plugin.stubs.StubUtility;
|
import org.openapitools.codegen.plugin.stubs.StubUtility;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class CodeGenMojoTest extends BaseTestCase {
|
public class CodeGenMojoTest extends BaseTestCase {
|
||||||
@@ -30,8 +40,8 @@ public class CodeGenMojoTest extends BaseTestCase {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testCommonConfiguration() throws Exception {
|
public void testCommonConfiguration() throws Exception {
|
||||||
File testPom = StubUtility.basedPath(getUnitTestDir().toFile(), "common-maven", "common-maven.xml").toFile();
|
File folder = Files.createTempDirectory("test").toFile();
|
||||||
final CodeGenMojo mojo = (CodeGenMojo) lookupMojo("generate", testPom);
|
CodeGenMojo mojo = loadMojo(folder, "src/test/resources/default");
|
||||||
mojo.execute();
|
mojo.execute();
|
||||||
assertEquals("java", getVariableValueFromObject(mojo, "generatorName"));
|
assertEquals("java", getVariableValueFromObject(mojo, "generatorName"));
|
||||||
assertEquals("jersey2", getVariableValueFromObject(mojo, "library"));
|
assertEquals("jersey2", getVariableValueFromObject(mojo, "library"));
|
||||||
@@ -43,4 +53,49 @@ public class CodeGenMojoTest extends BaseTestCase {
|
|||||||
assertNotNull(configOptions);
|
assertNotNull(configOptions);
|
||||||
assertEquals("joda", configOptions.get("dateLibrary"));
|
assertEquals("joda", configOptions.get("dateLibrary"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testHashGenerationFileContainsExecutionId() throws Exception {
|
||||||
|
// GIVEN
|
||||||
|
Path folder = Files.createTempDirectory("test");
|
||||||
|
CodeGenMojo mojo = loadMojo(folder.toFile(), "src/test/resources/default", "executionId");
|
||||||
|
|
||||||
|
// WHEN
|
||||||
|
mojo.execute();
|
||||||
|
|
||||||
|
// THEN
|
||||||
|
Path hashFolder = folder.resolve("target/generated-sources/common-maven/remote-openapi/.openapi-generator");
|
||||||
|
assertTrue(hashFolder.resolve("petstore.yaml-executionId.sha256").toFile().exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CodeGenMojo loadMojo(File temporaryFolder, String projectRoot) throws Exception {
|
||||||
|
return loadMojo(temporaryFolder, projectRoot, "default");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CodeGenMojo loadMojo(File temporaryFolder, String projectRoot, String executionId) throws Exception {
|
||||||
|
File file = new File(projectRoot);
|
||||||
|
FileUtils.copyDirectory(file, temporaryFolder);
|
||||||
|
MavenProject project = readMavenProject(temporaryFolder);
|
||||||
|
MavenSession session = newMavenSession(project);
|
||||||
|
MojoExecution execution = newMojoExecution("generate");
|
||||||
|
MojoExecution executionWithId = copyWithExecutionId(executionId, execution);
|
||||||
|
return (CodeGenMojo) lookupConfiguredMojo(session, executionWithId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MojoExecution copyWithExecutionId(String executionId, MojoExecution execution) {
|
||||||
|
MojoExecution executionWithId = new MojoExecution(execution.getMojoDescriptor(), executionId);
|
||||||
|
executionWithId.setConfiguration(execution.getConfiguration());
|
||||||
|
return executionWithId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected MavenProject readMavenProject(File basedir)
|
||||||
|
throws Exception {
|
||||||
|
File pom = new File(basedir, "pom.xml");
|
||||||
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
|
||||||
|
request.setBaseDirectory(basedir);
|
||||||
|
ProjectBuildingRequest configuration = request.getProjectBuildingRequest();
|
||||||
|
configuration.setRepositorySession(new DefaultRepositorySystemSession());
|
||||||
|
MavenProject project = lookup(ProjectBuilder.class).build(pom, configuration).getProject();
|
||||||
|
assertNotNull(project);
|
||||||
|
return project;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -29,8 +29,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<project implementation="org.openapitools.codegen.plugin.stubs.CommonMavenProjectStub"/>
|
<inputSpec>${basedir}/petstore.yaml</inputSpec>
|
||||||
<inputSpec>${basedir}/src/test/resources/unit/common-maven/petstore.yaml</inputSpec>
|
|
||||||
<generatorName>java</generatorName>
|
<generatorName>java</generatorName>
|
||||||
<configOptions>
|
<configOptions>
|
||||||
<dateLibrary>joda</dateLibrary>
|
<dateLibrary>joda</dateLibrary>
|
||||||
@@ -43,7 +42,7 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>default</id>
|
<id>executionId</id>
|
||||||
<phase>generate-sources</phase>
|
<phase>generate-sources</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>generate</goal>
|
<goal>generate</goal>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class OpenAPI2SpringBoot implements CommandLineRunner {
|
|||||||
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
new SpringApplication(OpenAPI2SpringBoot.class).run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExitException extends RuntimeException implements ExitCodeGenerator {
|
static class ExitException extends RuntimeException implements ExitCodeGenerator {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package org.openapitools.codegen.online.service;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import io.swagger.parser.OpenAPIParser;
|
import io.swagger.parser.OpenAPIParser;
|
||||||
import io.swagger.v3.core.util.Json;
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.parser.core.models.AuthorizationValue;
|
import io.swagger.v3.parser.core.models.AuthorizationValue;
|
||||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.util.zip.ZipOutputStream;
|
|||||||
/**
|
/**
|
||||||
* This utility compresses a list of files to standard ZIP format file. It is able to compresses all
|
* This utility compresses a list of files to standard ZIP format file. It is able to compresses all
|
||||||
* sub files and sub directories, recursively.
|
* sub files and sub directories, recursively.
|
||||||
*
|
*
|
||||||
* @author Ha Minh Nam
|
* @author Ha Minh Nam
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -42,7 +42,7 @@ public class ZipUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Compresses a collection of files to a destination zip file.
|
* Compresses a collection of files to a destination zip file.
|
||||||
*
|
*
|
||||||
* @param listFiles A collection of files and directories
|
* @param listFiles A collection of files and directories
|
||||||
* @param destZipFile The path of the destination zip file
|
* @param destZipFile The path of the destination zip file
|
||||||
* @throws FileNotFoundException if file not found
|
* @throws FileNotFoundException if file not found
|
||||||
@@ -67,7 +67,7 @@ public class ZipUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a directory to the current zip output stream.
|
* Adds a directory to the current zip output stream.
|
||||||
*
|
*
|
||||||
* @param folder the directory to be added
|
* @param folder the directory to be added
|
||||||
* @param parentFolder the path of parent directory
|
* @param parentFolder the path of parent directory
|
||||||
* @param zos the current zip output stream
|
* @param zos the current zip output stream
|
||||||
@@ -99,7 +99,7 @@ public class ZipUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a file to the current zip output stream.
|
* Adds a file to the current zip output stream.
|
||||||
*
|
*
|
||||||
* @param file the file to be added
|
* @param file the file to be added
|
||||||
* @param zos the current zip output stream
|
* @param zos the current zip output stream
|
||||||
* @throws FileNotFoundException if file not found
|
* @throws FileNotFoundException if file not found
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<groupId>org.openapitools</groupId>
|
<groupId>org.openapitools</groupId>
|
||||||
<artifactId>openapi-generator-project</artifactId>
|
<artifactId>openapi-generator-project</artifactId>
|
||||||
<!-- RELEASE_VERSION -->
|
<!-- RELEASE_VERSION -->
|
||||||
<version>5.1.0</version>
|
<version>5.1.1-SNAPSHOT</version>
|
||||||
<!-- /RELEASE_VERSION -->
|
<!-- /RELEASE_VERSION -->
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class CliOption {
|
|||||||
public String getOptValue() {
|
public String getOptValue() {
|
||||||
return this.optValue;
|
return this.optValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOptValue(String optValue) {
|
public void setOptValue(String optValue) {
|
||||||
if (this.enumValues!=null && this.enumValues.containsKey(optValue)) {
|
if (this.enumValues!=null && this.enumValues.containsKey(optValue)) {
|
||||||
this.optValue = optValue;
|
this.optValue = optValue;
|
||||||
@@ -106,7 +106,7 @@ public class CliOption {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new boolean command line option with a default of false
|
* Create new boolean command line option with a default of false
|
||||||
*
|
*
|
||||||
* @param opt Option name
|
* @param opt Option name
|
||||||
* @param description Option description
|
* @param description Option description
|
||||||
* @return the CliOption created
|
* @return the CliOption created
|
||||||
@@ -117,7 +117,7 @@ public class CliOption {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new boolean command line option with the provided value as default
|
* Create new boolean command line option with the provided value as default
|
||||||
*
|
*
|
||||||
* @param opt Option name
|
* @param opt Option name
|
||||||
* @param description Option description
|
* @param description Option description
|
||||||
* @param defaultValue the default value to use if option not specified
|
* @param defaultValue the default value to use if option not specified
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ public interface CodegenConfig {
|
|||||||
List<CodegenSecurity> fromSecurity(Map<String, SecurityScheme> schemas);
|
List<CodegenSecurity> fromSecurity(Map<String, SecurityScheme> schemas);
|
||||||
|
|
||||||
List<CodegenServer> fromServers(List<Server> servers);
|
List<CodegenServer> fromServers(List<Server> servers);
|
||||||
|
|
||||||
List<CodegenServerVariable> fromServerVariables(Map<String, ServerVariable> variables);
|
List<CodegenServerVariable> fromServerVariables(Map<String, ServerVariable> variables);
|
||||||
|
|
||||||
Set<String> defaultIncludes();
|
Set<String> defaultIncludes();
|
||||||
|
|
||||||
Map<String, String> typeMapping();
|
Map<String, String> typeMapping();
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class CodegenConstants {
|
|||||||
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 MODEL_PROPERTY_NAMING_DESC = "Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name";
|
||||||
|
|
||||||
public static final String DOTNET_FRAMEWORK = "targetFramework";
|
public static final String DOTNET_FRAMEWORK = "targetFramework";
|
||||||
public static final String DOTNET_FRAMEWORK_DESC = "The target .NET framework version.";
|
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 TEMPLATING_ENGINE = "templatingEngine";
|
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 final String TEMPLATING_ENGINE_DESC = "The templating engine plugin to use: \"mustache\" (default) or \"handlebars\" (beta)";
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.openapitools.codegen;
|
package org.openapitools.codegen;
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
|
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
public String name;
|
public String name;
|
||||||
// The language-specific name of the class that implements this schema.
|
// The language-specific name of the class that implements this schema.
|
||||||
// The name of the class is derived from the OpenAPI schema name with formatting rules applied.
|
// The name of the class is derived from the OpenAPI schema name with formatting rules applied.
|
||||||
// The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
|
// The classname is derived from the OpenAPI schema name, with sanitization and escaping rules applied.
|
||||||
public String classname;
|
public String classname;
|
||||||
// The value of the 'title' attribute in the OpenAPI document.
|
// The value of the 'title' attribute in the OpenAPI document.
|
||||||
public String title;
|
public String title;
|
||||||
@@ -109,7 +109,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
/**
|
/**
|
||||||
* The type of the value for the additionalProperties keyword in the OAS document.
|
* The type of the value for the additionalProperties keyword in the OAS document.
|
||||||
* Used in map like objects, including composed schemas.
|
* Used in map like objects, including composed schemas.
|
||||||
*
|
*
|
||||||
* In most programming languages, the additional (undeclared) properties are stored
|
* In most programming languages, the additional (undeclared) properties are stored
|
||||||
* in a map data structure, such as HashMap in Java, map in golang, or a dict in Python.
|
* in a map data structure, such as HashMap in Java, map in golang, or a dict in Python.
|
||||||
* There are multiple ways to implement the additionalProperties keyword, depending
|
* There are multiple ways to implement the additionalProperties keyword, depending
|
||||||
@@ -122,7 +122,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
*
|
*
|
||||||
* For example, in the OAS schema below, the schema has a declared 'id' property
|
* For example, in the OAS schema below, the schema has a declared 'id' property
|
||||||
* and additional, undeclared properties of type 'integer' are allowed.
|
* and additional, undeclared properties of type 'integer' are allowed.
|
||||||
*
|
*
|
||||||
* type: object
|
* type: object
|
||||||
* properties:
|
* properties:
|
||||||
* id:
|
* id:
|
||||||
@@ -232,7 +232,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
* Return true if the classname property is sanitized, false if it is the same as the OpenAPI schema name.
|
* Return true if the classname property is sanitized, false if it is the same as the OpenAPI schema name.
|
||||||
* The OpenAPI schema name may be any valid JSON schema name, including non-ASCII characters.
|
* The OpenAPI schema name may be any valid JSON schema name, including non-ASCII characters.
|
||||||
* The name of the class may have to be sanitized with character escaping.
|
* The name of the class may have to be sanitized with character escaping.
|
||||||
*
|
*
|
||||||
* @return true if the classname property is sanitized
|
* @return true if the classname property is sanitized
|
||||||
*/
|
*/
|
||||||
public boolean getIsClassnameSanitized() {
|
public boolean getIsClassnameSanitized() {
|
||||||
@@ -273,7 +273,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the discriminator for this schema object, or null if no discriminator has been specified.
|
* Returns the discriminator for this schema object, or null if no discriminator has been specified.
|
||||||
*
|
*
|
||||||
* The list of all possible schema discriminator mapping values is obtained
|
* The list of all possible schema discriminator mapping values is obtained
|
||||||
* from explicit discriminator mapping values in the OpenAPI document, and from
|
* from explicit discriminator mapping values in the OpenAPI document, and from
|
||||||
* inherited discriminators through oneOf, allOf, anyOf.
|
* inherited discriminators through oneOf, allOf, anyOf.
|
||||||
@@ -283,7 +283,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
* 'objectType' properties are 'Dog' and 'Cat'.
|
* 'objectType' properties are 'Dog' and 'Cat'.
|
||||||
* The allowed discriminator mapping value for the Dog schema is 'Dog'.
|
* The allowed discriminator mapping value for the Dog schema is 'Dog'.
|
||||||
* The allowed discriminator mapping value for the Cat schema is 'Dog'.
|
* The allowed discriminator mapping value for the Cat schema is 'Dog'.
|
||||||
*
|
*
|
||||||
* Pet:
|
* Pet:
|
||||||
* type: object
|
* type: object
|
||||||
* discriminator:
|
* discriminator:
|
||||||
@@ -307,7 +307,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
* properties:
|
* properties:
|
||||||
* p2:
|
* p2:
|
||||||
* type: string
|
* type: string
|
||||||
*
|
*
|
||||||
* @return the discriminator.
|
* @return the discriminator.
|
||||||
*/
|
*/
|
||||||
public CodegenDiscriminator getDiscriminator() {
|
public CodegenDiscriminator getDiscriminator() {
|
||||||
@@ -323,7 +323,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
|||||||
* In the OpenAPI document, the discriminator may be specified in the local schema or
|
* In the OpenAPI document, the discriminator may be specified in the local schema or
|
||||||
* it may be inherited, such as through a 'allOf' schema which references another schema
|
* it may be inherited, such as through a 'allOf' schema which references another schema
|
||||||
* that has a discriminator, recursively.
|
* that has a discriminator, recursively.
|
||||||
*
|
*
|
||||||
* @return the name of the discriminator property.
|
* @return the name of the discriminator property.
|
||||||
*/
|
*/
|
||||||
public String getDiscriminatorName() {
|
public String getDiscriminatorName() {
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ public class CodegenOperation {
|
|||||||
isArray, isMultipart,
|
isArray, isMultipart,
|
||||||
isResponseBinary = false, isResponseFile = false, hasReference = false,
|
isResponseBinary = false, isResponseFile = false, hasReference = false,
|
||||||
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
||||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems;
|
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false;
|
||||||
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
|
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
|
||||||
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
|
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse;
|
||||||
public CodegenDiscriminator discriminator;
|
public CodegenDiscriminator discriminator;
|
||||||
public List<Map<String, String>> consumes, produces, prioritizedContentTypes;
|
public List<Map<String, String>> consumes, produces, prioritizedContentTypes;
|
||||||
public List<CodegenServer> servers = new ArrayList<CodegenServer>();
|
public List<CodegenServer> servers = new ArrayList<CodegenServer>();
|
||||||
@@ -168,6 +168,15 @@ public class CodegenOperation {
|
|||||||
return nonempty(examples);
|
return nonempty(examples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there's a default response
|
||||||
|
*
|
||||||
|
* @return true if responses contain a default response, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean getHasDefaultResponse() {
|
||||||
|
return responses.stream().filter(response -> response.isDefault).findFirst().isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if act as Restful index method
|
* Check if act as Restful index method
|
||||||
*
|
*
|
||||||
@@ -270,6 +279,7 @@ public class CodegenOperation {
|
|||||||
sb.append(", isResponseBinary=").append(isResponseBinary);
|
sb.append(", isResponseBinary=").append(isResponseBinary);
|
||||||
sb.append(", isResponseFile=").append(isResponseFile);
|
sb.append(", isResponseFile=").append(isResponseFile);
|
||||||
sb.append(", hasReference=").append(hasReference);
|
sb.append(", hasReference=").append(hasReference);
|
||||||
|
sb.append(", hasDefaultResponse=").append(hasDefaultResponse);
|
||||||
sb.append(", isRestfulIndex=").append(isRestfulIndex);
|
sb.append(", isRestfulIndex=").append(isRestfulIndex);
|
||||||
sb.append(", isRestfulShow=").append(isRestfulShow);
|
sb.append(", isRestfulShow=").append(isRestfulShow);
|
||||||
sb.append(", isRestfulCreate=").append(isRestfulCreate);
|
sb.append(", isRestfulCreate=").append(isRestfulCreate);
|
||||||
@@ -343,6 +353,7 @@ public class CodegenOperation {
|
|||||||
isResponseBinary == that.isResponseBinary &&
|
isResponseBinary == that.isResponseBinary &&
|
||||||
isResponseFile == that.isResponseFile &&
|
isResponseFile == that.isResponseFile &&
|
||||||
hasReference == that.hasReference &&
|
hasReference == that.hasReference &&
|
||||||
|
hasDefaultResponse == that.hasDefaultResponse &&
|
||||||
isRestfulIndex == that.isRestfulIndex &&
|
isRestfulIndex == that.isRestfulIndex &&
|
||||||
isRestfulShow == that.isRestfulShow &&
|
isRestfulShow == that.isRestfulShow &&
|
||||||
isRestfulCreate == that.isRestfulCreate &&
|
isRestfulCreate == that.isRestfulCreate &&
|
||||||
@@ -400,7 +411,7 @@ public class CodegenOperation {
|
|||||||
|
|
||||||
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
|
return Objects.hash(responseHeaders, hasAuthMethods, hasConsumes, hasProduces, hasParams, hasOptionalParams,
|
||||||
hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
|
hasRequiredParams, returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
|
||||||
isArray, isMultipart, isResponseBinary, isResponseFile, hasReference, isRestfulIndex,
|
isArray, isMultipart, isResponseBinary, isResponseFile, hasReference, hasDefaultResponse, isRestfulIndex,
|
||||||
isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestful, isDeprecated,
|
isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, isRestful, isDeprecated,
|
||||||
isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod, returnBaseType,
|
isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod, returnBaseType,
|
||||||
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes,
|
returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse, discriminator, consumes,
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
|||||||
public Map<String, Object> allowableValues;
|
public Map<String, Object> allowableValues;
|
||||||
// If 'additionalProperties' is not set, items is null.
|
// If 'additionalProperties' is not set, items is null.
|
||||||
// If 'additionalProperties' is set to a type or refers to a type, 'items' provides the type information for
|
// If 'additionalProperties' is set to a type or refers to a type, 'items' provides the type information for
|
||||||
// the undeclared properties.
|
// the undeclared properties.
|
||||||
public CodegenProperty items;
|
public CodegenProperty items;
|
||||||
public CodegenProperty additionalProperties;
|
public CodegenProperty additionalProperties;
|
||||||
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)
|
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>(); // all properties (without parent's properties)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ package org.openapitools.codegen;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ public class CodegenSecurity {
|
|||||||
public String keyParamName;
|
public String keyParamName;
|
||||||
public Boolean isKeyInQuery, isKeyInHeader, isKeyInCookie;
|
public Boolean isKeyInQuery, isKeyInHeader, isKeyInCookie;
|
||||||
// Oauth specific
|
// Oauth specific
|
||||||
public String flow, authorizationUrl, tokenUrl;
|
public String flow, authorizationUrl, tokenUrl, refreshUrl;
|
||||||
public List<Map<String, Object>> scopes;
|
public List<Map<String, Object>> scopes;
|
||||||
public Boolean isCode, isPassword, isApplication, isImplicit;
|
public Boolean isCode, isPassword, isApplication, isImplicit;
|
||||||
|
|
||||||
@@ -67,6 +66,7 @@ public class CodegenSecurity {
|
|||||||
filteredSecurity.flow = flow;
|
filteredSecurity.flow = flow;
|
||||||
filteredSecurity.tokenUrl = tokenUrl;
|
filteredSecurity.tokenUrl = tokenUrl;
|
||||||
filteredSecurity.authorizationUrl = authorizationUrl;
|
filteredSecurity.authorizationUrl = authorizationUrl;
|
||||||
|
filteredSecurity.refreshUrl = refreshUrl;
|
||||||
// It is not possible to deep copy the extensions, as we have no idea what types they are.
|
// It is not possible to deep copy the extensions, as we have no idea what types they are.
|
||||||
// So the filtered method *will* refer to the original extensions, if any.
|
// So the filtered method *will* refer to the original extensions, if any.
|
||||||
filteredSecurity.vendorExtensions = new HashMap<String, Object>(vendorExtensions);
|
filteredSecurity.vendorExtensions = new HashMap<String, Object>(vendorExtensions);
|
||||||
@@ -110,6 +110,7 @@ public class CodegenSecurity {
|
|||||||
Objects.equals(flow, that.flow) &&
|
Objects.equals(flow, that.flow) &&
|
||||||
Objects.equals(authorizationUrl, that.authorizationUrl) &&
|
Objects.equals(authorizationUrl, that.authorizationUrl) &&
|
||||||
Objects.equals(tokenUrl, that.tokenUrl) &&
|
Objects.equals(tokenUrl, that.tokenUrl) &&
|
||||||
|
Objects.equals(refreshUrl, that.refreshUrl) &&
|
||||||
Objects.equals(scopes, that.scopes) &&
|
Objects.equals(scopes, that.scopes) &&
|
||||||
Objects.equals(isCode, that.isCode) &&
|
Objects.equals(isCode, that.isCode) &&
|
||||||
Objects.equals(isPassword, that.isPassword) &&
|
Objects.equals(isPassword, that.isPassword) &&
|
||||||
@@ -123,7 +124,7 @@ public class CodegenSecurity {
|
|||||||
return Objects.hash(name, type, scheme, isBasic, isOAuth, isApiKey,
|
return Objects.hash(name, type, scheme, isBasic, isOAuth, isApiKey,
|
||||||
isBasicBasic, isHttpSignature, isBasicBearer, bearerFormat, vendorExtensions,
|
isBasicBasic, isHttpSignature, isBasicBearer, bearerFormat, vendorExtensions,
|
||||||
keyParamName, isKeyInQuery, isKeyInHeader, isKeyInCookie, flow,
|
keyParamName, isKeyInQuery, isKeyInHeader, isKeyInCookie, flow,
|
||||||
authorizationUrl, tokenUrl, scopes, isCode, isPassword, isApplication, isImplicit);
|
authorizationUrl, tokenUrl, refreshUrl, scopes, isCode, isPassword, isApplication, isImplicit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -147,6 +148,7 @@ public class CodegenSecurity {
|
|||||||
sb.append(", flow='").append(flow).append('\'');
|
sb.append(", flow='").append(flow).append('\'');
|
||||||
sb.append(", authorizationUrl='").append(authorizationUrl).append('\'');
|
sb.append(", authorizationUrl='").append(authorizationUrl).append('\'');
|
||||||
sb.append(", tokenUrl='").append(tokenUrl).append('\'');
|
sb.append(", tokenUrl='").append(tokenUrl).append('\'');
|
||||||
|
sb.append(", refreshUrl='").append(refreshUrl).append('\'');
|
||||||
sb.append(", scopes=").append(scopes);
|
sb.append(", scopes=").append(scopes);
|
||||||
sb.append(", isCode=").append(isCode);
|
sb.append(", isCode=").append(isCode);
|
||||||
sb.append(", isPassword=").append(isPassword);
|
sb.append(", isPassword=").append(isPassword);
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a map from model name to Schema for efficient lookup.
|
* Return a map from model name to Schema for efficient lookup.
|
||||||
*
|
*
|
||||||
* @return map from model name to Schema.
|
* @return map from model name to Schema.
|
||||||
*/
|
*/
|
||||||
protected Map<String, Schema> getModelNameToSchemaCache() {
|
protected Map<String, Schema> getModelNameToSchemaCache() {
|
||||||
@@ -813,11 +813,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
schemas.put(opId, requestSchema);
|
schemas.put(opId, requestSchema);
|
||||||
}
|
}
|
||||||
// process all response bodies
|
// process all response bodies
|
||||||
for (Map.Entry<String, ApiResponse> ar : op.getValue().getResponses().entrySet()) {
|
if (op.getValue().getResponses() != null) {
|
||||||
ApiResponse a = ModelUtils.getReferencedApiResponse(openAPI, ar.getValue());
|
for (Map.Entry<String, ApiResponse> ar : op.getValue().getResponses().entrySet()) {
|
||||||
Schema responseSchema = ModelUtils.getSchemaFromResponse(a);
|
ApiResponse a = ModelUtils.getReferencedApiResponse(openAPI, ar.getValue());
|
||||||
if (responseSchema != null) {
|
Schema responseSchema = ModelUtils.getSchemaFromResponse(a);
|
||||||
schemas.put(opId + ar.getKey(), responseSchema);
|
if (responseSchema != null) {
|
||||||
|
schemas.put(opId + ar.getKey(), responseSchema);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2041,6 +2043,10 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
private String getPrimitiveType(Schema schema) {
|
private String getPrimitiveType(Schema schema) {
|
||||||
if (schema == null) {
|
if (schema == null) {
|
||||||
throw new RuntimeException("schema cannot be null in getPrimitiveType");
|
throw new RuntimeException("schema cannot be null in getPrimitiveType");
|
||||||
|
} else if (typeMapping.containsKey(schema.getType() + "+" + schema.getFormat())) {
|
||||||
|
// allows custom type_format mapping.
|
||||||
|
// use {type}+{format}
|
||||||
|
return typeMapping.get(schema.getType() + "+" + schema.getFormat());
|
||||||
} else if (ModelUtils.isNullType(schema)) {
|
} else if (ModelUtils.isNullType(schema)) {
|
||||||
// The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x,
|
// The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x,
|
||||||
// though this tooling supports it.
|
// though this tooling supports it.
|
||||||
@@ -2615,35 +2621,47 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){
|
private void setAddProps(Schema schema, IJsonSchemaValidationProperties property){
|
||||||
|
if (schema.equals(new Schema())) {
|
||||||
|
// if we are trying to set additionalProperties on an empty schema stop recursing
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean additionalPropertiesIsAnyType = false;
|
||||||
CodegenModel m = null;
|
CodegenModel m = null;
|
||||||
if (property instanceof CodegenModel) {
|
if (property instanceof CodegenModel) {
|
||||||
m = (CodegenModel) property;
|
m = (CodegenModel) property;
|
||||||
}
|
}
|
||||||
|
CodegenProperty addPropProp = null;
|
||||||
boolean isAdditionalPropertiesTrue = false;
|
boolean isAdditionalPropertiesTrue = false;
|
||||||
if (schema.getAdditionalProperties() == null) {
|
if (schema.getAdditionalProperties() == null) {
|
||||||
if (!disallowAdditionalPropertiesIfNotPresent) {
|
if (!disallowAdditionalPropertiesIfNotPresent) {
|
||||||
isAdditionalPropertiesTrue = true;
|
isAdditionalPropertiesTrue = true;
|
||||||
CodegenProperty cp = fromProperty("", new Schema());
|
addPropProp = fromProperty("", new Schema());
|
||||||
property.setAdditionalProperties(cp);
|
additionalPropertiesIsAnyType = true;
|
||||||
property.setAdditionalPropertiesIsAnyType(true);
|
|
||||||
}
|
}
|
||||||
} else if (schema.getAdditionalProperties() instanceof Boolean) {
|
} else if (schema.getAdditionalProperties() instanceof Boolean) {
|
||||||
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
|
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
|
||||||
isAdditionalPropertiesTrue = true;
|
isAdditionalPropertiesTrue = true;
|
||||||
CodegenProperty cp = fromProperty("", new Schema());
|
addPropProp = fromProperty("", new Schema());
|
||||||
property.setAdditionalProperties(cp);
|
additionalPropertiesIsAnyType = true;
|
||||||
property.setAdditionalPropertiesIsAnyType(true);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CodegenProperty cp = fromProperty("", (Schema) schema.getAdditionalProperties());
|
addPropProp = fromProperty("", (Schema) schema.getAdditionalProperties());
|
||||||
property.setAdditionalProperties(cp);
|
|
||||||
if (isAnyTypeSchema((Schema) schema.getAdditionalProperties())) {
|
if (isAnyTypeSchema((Schema) schema.getAdditionalProperties())) {
|
||||||
property.setAdditionalPropertiesIsAnyType(true);
|
additionalPropertiesIsAnyType = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (additionalPropertiesIsAnyType) {
|
||||||
|
property.setAdditionalPropertiesIsAnyType(true);
|
||||||
|
}
|
||||||
if (m != null && isAdditionalPropertiesTrue) {
|
if (m != null && isAdditionalPropertiesTrue) {
|
||||||
m.isAdditionalPropertiesTrue = true;
|
m.isAdditionalPropertiesTrue = true;
|
||||||
}
|
}
|
||||||
|
if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (addPropProp != null) {
|
||||||
|
property.setAdditionalProperties(addPropProp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2688,14 +2706,14 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
String modelName = ModelUtils.getSimpleRef(oneOf.get$ref());
|
String modelName = ModelUtils.getSimpleRef(oneOf.get$ref());
|
||||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, openAPI);
|
CodegenProperty thisCp = discriminatorFound(composedSchemaName, oneOf, discPropName, openAPI);
|
||||||
if (thisCp == null) {
|
if (thisCp == null) {
|
||||||
throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing " + discPropName);
|
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced OneOf schema '" + modelName + "' is missing " + discPropName);
|
||||||
}
|
}
|
||||||
if (cp.dataType == null) {
|
if (cp.dataType == null) {
|
||||||
cp = thisCp;
|
cp = thisCp;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cp != thisCp) {
|
if (cp != thisCp) {
|
||||||
throw new RuntimeException("'" + 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("'" + 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cp;
|
return cp;
|
||||||
@@ -2707,14 +2725,14 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
String modelName = ModelUtils.getSimpleRef(anyOf.get$ref());
|
String modelName = ModelUtils.getSimpleRef(anyOf.get$ref());
|
||||||
CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, openAPI);
|
CodegenProperty thisCp = discriminatorFound(composedSchemaName, anyOf, discPropName, openAPI);
|
||||||
if (thisCp == null) {
|
if (thisCp == null) {
|
||||||
throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing " + discPropName);
|
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced AnyOf schema '" + modelName + "' is missing " + discPropName);
|
||||||
}
|
}
|
||||||
if (cp.dataType == null) {
|
if (cp.dataType == null) {
|
||||||
cp = thisCp;
|
cp = thisCp;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cp != thisCp) {
|
if (cp != thisCp) {
|
||||||
throw new RuntimeException("'" + 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("'" + 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cp;
|
return cp;
|
||||||
@@ -2773,7 +2791,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (discriminatorsPropNames.size() > 1) {
|
if (discriminatorsPropNames.size() > 1) {
|
||||||
throw new RuntimeException("The oneOf schemas have conflicting discriminator property names. " +
|
LOGGER.warn("The oneOf schemas have conflicting discriminator property names. " +
|
||||||
"oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
|
"oneOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
|
||||||
}
|
}
|
||||||
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
|
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getOneOf().size() && discriminatorsPropNames.size() == 1) {
|
||||||
@@ -2802,7 +2820,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (discriminatorsPropNames.size() > 1) {
|
if (discriminatorsPropNames.size() > 1) {
|
||||||
throw new RuntimeException("The anyOf schemas have conflicting discriminator property names. " +
|
LOGGER.warn("The anyOf schemas have conflicting discriminator property names. " +
|
||||||
"anyOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
|
"anyOf schemas must have the same property name, but found " + String.join(", ", discriminatorsPropNames));
|
||||||
}
|
}
|
||||||
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
|
if (foundDisc != null && (hasDiscriminatorCnt + hasNullTypeCnt) == composedSchema.getAnyOf().size() && discriminatorsPropNames.size() == 1) {
|
||||||
@@ -2852,7 +2870,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
// schemas also has inline composed schemas
|
// 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
|
// 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
|
// schema and make it a $ref schema in the oneOf/anyOf location
|
||||||
throw new RuntimeException("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 '" + 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");
|
||||||
}
|
}
|
||||||
CodegenProperty df = discriminatorFound(composedSchemaName, sc, discPropName, openAPI);
|
CodegenProperty df = discriminatorFound(composedSchemaName, sc, discPropName, openAPI);
|
||||||
String modelName = ModelUtils.getSimpleRef(ref);
|
String modelName = ModelUtils.getSimpleRef(ref);
|
||||||
@@ -2872,7 +2890,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required";
|
msgSuffix += spacer + "invalid optional definition of " + discPropName + ", include it in required";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new RuntimeException("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. " + msgSuffix);
|
LOGGER.warn("'" + composedSchemaName + "' defines discriminator '" + discPropName + "', but the referenced schema '" + modelName + "' is incorrect. " + msgSuffix);
|
||||||
}
|
}
|
||||||
MappedModel mm = new MappedModel(modelName, toModelName(modelName));
|
MappedModel mm = new MappedModel(modelName, toModelName(modelName));
|
||||||
descendentSchemas.add(mm);
|
descendentSchemas.add(mm);
|
||||||
@@ -3078,7 +3096,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert OAS Property object to Codegen Property object.
|
* Convert OAS Property object to Codegen Property object.
|
||||||
*
|
*
|
||||||
* The return value is cached. An internal cache is looked up to determine
|
* The return value is cached. An internal cache is looked up to determine
|
||||||
* if the CodegenProperty return value has already been instantiated for
|
* if the CodegenProperty return value has already been instantiated for
|
||||||
* the (String name, Schema p) arguments.
|
* the (String name, Schema p) arguments.
|
||||||
@@ -4711,13 +4729,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* of the 'additionalProperties' keyword. Some language generator use class inheritance
|
* of the 'additionalProperties' keyword. Some language generator use class inheritance
|
||||||
* to implement additional properties. For example, in Java the generated model class
|
* to implement additional properties. For example, in Java the generated model class
|
||||||
* has 'extends HashMap' to represent the additional properties.
|
* has 'extends HashMap' to represent the additional properties.
|
||||||
*
|
*
|
||||||
* TODO: it's not a good idea to use single class inheritance to implement
|
* TODO: it's not a good idea to use single class inheritance to implement
|
||||||
* additionalProperties. That may work for non-composed schemas, but that does not
|
* additionalProperties. That may work for non-composed schemas, but that does not
|
||||||
* work for composed 'allOf' schemas. For example, in Java, if additionalProperties
|
* work for composed 'allOf' schemas. For example, in Java, if additionalProperties
|
||||||
* is set to true (which it should be by default, per OAS spec), then the generated
|
* is set to true (which it should be by default, per OAS spec), then the generated
|
||||||
* code has extends HashMap. That wouldn't work for composed 'allOf' schemas.
|
* code has extends HashMap. That wouldn't work for composed 'allOf' schemas.
|
||||||
*
|
*
|
||||||
* @param model the codegen representation of the OAS schema.
|
* @param model the codegen representation of the OAS schema.
|
||||||
* @param name the name of the model.
|
* @param name the name of the model.
|
||||||
* @param schema the input OAS schema.
|
* @param schema the input OAS schema.
|
||||||
@@ -5585,6 +5603,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
private void setOauth2Info(CodegenSecurity codegenSecurity, OAuthFlow flow) {
|
private void setOauth2Info(CodegenSecurity codegenSecurity, OAuthFlow flow) {
|
||||||
codegenSecurity.authorizationUrl = flow.getAuthorizationUrl();
|
codegenSecurity.authorizationUrl = flow.getAuthorizationUrl();
|
||||||
codegenSecurity.tokenUrl = flow.getTokenUrl();
|
codegenSecurity.tokenUrl = flow.getTokenUrl();
|
||||||
|
codegenSecurity.refreshUrl = flow.getRefreshUrl();
|
||||||
|
|
||||||
if (flow.getScopes() != null && !flow.getScopes().isEmpty()) {
|
if (flow.getScopes() != null && !flow.getScopes().isEmpty()) {
|
||||||
List<Map<String, Object>> scopes = new ArrayList<>();
|
List<Map<String, Object>> scopes = new ArrayList<>();
|
||||||
@@ -6157,6 +6176,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property){
|
private void addVarsRequiredVarsAdditionalProps(Schema schema, IJsonSchemaValidationProperties property){
|
||||||
|
setAddProps(schema, property);
|
||||||
if (!"object".equals(schema.getType())) {
|
if (!"object".equals(schema.getType())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -6178,7 +6198,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
property.setHasRequired(true);
|
property.setHasRequired(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setAddProps(schema, property);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addJsonSchemaForBodyRequestInCaseItsNotPresent(CodegenParameter codegenParameter, RequestBody body) {
|
private void addJsonSchemaForBodyRequestInCaseItsNotPresent(CodegenParameter codegenParameter, RequestBody body) {
|
||||||
@@ -6600,7 +6619,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the additionalProperties Schema for the specified input schema.
|
* Returns the additionalProperties Schema for the specified input schema.
|
||||||
*
|
*
|
||||||
* The additionalProperties keyword is used to control the handling of additional, undeclared
|
* The additionalProperties keyword is used to control the handling of additional, undeclared
|
||||||
* properties, that is, properties whose names are not listed in the properties keyword.
|
* properties, that is, properties whose names are not listed in the properties keyword.
|
||||||
* The additionalProperties keyword may be either a boolean or an object.
|
* The additionalProperties keyword may be either a boolean or an object.
|
||||||
@@ -6608,7 +6627,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
* By default when the additionalProperties keyword is not specified in the input schema,
|
* By default when the additionalProperties keyword is not specified in the input schema,
|
||||||
* any additional properties are allowed. This is equivalent to setting additionalProperties
|
* any additional properties are allowed. This is equivalent to setting additionalProperties
|
||||||
* to the boolean value True or setting additionalProperties: {}
|
* to the boolean value True or setting additionalProperties: {}
|
||||||
*
|
*
|
||||||
* @param schema the input schema that may or may not have the additionalProperties keyword.
|
* @param schema the input schema that may or may not have the additionalProperties keyword.
|
||||||
* @return the Schema of the additionalProperties. The null value is returned if no additional
|
* @return the Schema of the additionalProperties. The null value is returned if no additional
|
||||||
* properties are allowed.
|
* properties are allowed.
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import io.swagger.v3.oas.models.parameters.Parameter;
|
|||||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.openapitools.codegen.utils.ModelUtils;
|
import org.openapitools.codegen.utils.ModelUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import java.util.*;
|
|||||||
* </ul>
|
* </ul>
|
||||||
* <p>
|
* <p>
|
||||||
* The corresponding {@code add...} method on the passed configurator is called for each key-value pair (or value).
|
* The corresponding {@code add...} method on the passed configurator is called for each key-value pair (or value).
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
public final class CodegenConfiguratorUtils {
|
public final class CodegenConfiguratorUtils {
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ public final class CodegenConfiguratorUtils {
|
|||||||
applyInstantiationTypesKvp(propString, configurator);
|
applyInstantiationTypesKvp(propString, configurator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void applyInstantiationTypesKvp(String instantiationTypes, CodegenConfigurator configurator) {
|
public static void applyInstantiationTypesKvp(String instantiationTypes, CodegenConfigurator configurator) {
|
||||||
final Map<String, String> map = createMapFromKeyValuePairs(instantiationTypes);
|
final Map<String, String> map = createMapFromKeyValuePairs(instantiationTypes);
|
||||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
@@ -143,9 +143,9 @@ public final class CodegenConfiguratorUtils {
|
|||||||
final Map<String, String> map = createMapFromKeyValuePairs(reservedWordMappings);
|
final Map<String, String> map = createMapFromKeyValuePairs(reservedWordMappings);
|
||||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
configurator.addAdditionalReservedWordMapping(entry.getKey(), entry.getValue());
|
configurator.addAdditionalReservedWordMapping(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<String> createSetFromCsvList(String csvProperty) {
|
private static Set<String> createSetFromCsvList(String csvProperty) {
|
||||||
final List<String> values = OptionUtils.splitCommaSeparatedList(csvProperty);
|
final List<String> values = OptionUtils.splitCommaSeparatedList(csvProperty);
|
||||||
return new HashSet<String>(values);
|
return new HashSet<String>(values);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import java.util.Properties;
|
|||||||
*
|
*
|
||||||
* This provides a set of properties specific to the executing thread, such that the generator may not modify system properties
|
* This provides a set of properties specific to the executing thread, such that the generator may not modify system properties
|
||||||
* consumed by other threads.
|
* consumed by other threads.
|
||||||
*
|
*
|
||||||
* @author gndrm
|
* @author gndrm
|
||||||
* @since 2018
|
* @since 2018
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
|
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
|
|
||||||
public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig {
|
public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
@@ -399,7 +399,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
// check to see if model name is same as the property name
|
// check to see if model name is same as the property name
|
||||||
// which will result in compilation error
|
// which will result in compilation error
|
||||||
// if found, prepend with _ to workaround the limitation
|
// if found, prepend with _ to workaround the limitation
|
||||||
if (var.name.equalsIgnoreCase(cm.name)) {
|
if (var.name.equalsIgnoreCase(cm.classname)) {
|
||||||
var.name = "_" + var.name;
|
var.name = "_" + var.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -500,6 +500,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Comment out the following as model.dataType is always the model name, eg. OuterIntegerEnum,
|
||||||
|
* and this will fix the integer enum via #9035.
|
||||||
|
* Only x-enum-byte is used in the template but it won't work due to the bug mentioned above.
|
||||||
|
* A better solution is to introduce isLong, isInteger, etc in the DefaultCodegen
|
||||||
|
* so that there is no need for each generator to post-process model enums.
|
||||||
|
*
|
||||||
// We're looping all models here.
|
// We're looping all models here.
|
||||||
if (model.isEnum) {
|
if (model.isEnum) {
|
||||||
// We now need to make allowableValues.enumVars look like the context of CodegenProperty
|
// We now need to make allowableValues.enumVars look like the context of CodegenProperty
|
||||||
@@ -543,7 +549,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
if (!newEnumVars.isEmpty()) {
|
if (!newEnumVars.isEmpty()) {
|
||||||
model.allowableValues.put("enumVars", newEnumVars);
|
model.allowableValues.put("enumVars", newEnumVars);
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn("Expected to retrieve model %s by name, but no model was found. Check your -Dmodels inclusions.", openAPIName);
|
LOGGER.warn("Expected to retrieve model %s by name, but no model was found. Check your -Dmodels inclusions.", openAPIName);
|
||||||
}
|
}
|
||||||
@@ -570,7 +576,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
var.isString = false;
|
var.isString = false;
|
||||||
var.isLong = false;
|
var.isLong = false;
|
||||||
var.isInteger = false;
|
var.isInteger = false;
|
||||||
} else if ("int32".equals(var.dataFormat)) {
|
} else if ("int".equals(var.dataType) || "int32".equals(var.dataFormat)) {
|
||||||
var.isInteger = true;
|
var.isInteger = true;
|
||||||
var.isString = false;
|
var.isString = false;
|
||||||
var.isLong = false;
|
var.isLong = false;
|
||||||
@@ -1263,8 +1269,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.info("Successfully executed: " + command);
|
LOGGER.info("Successfully executed: " + command);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||||
|
// Restore interrupted state
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -330,8 +331,10 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.info("Successfully executed: " + command);
|
LOGGER.info("Successfully executed: " + command);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||||
|
// Restore interrupted state
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.openapitools.codegen.languages;
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import io.swagger.v3.oas.models.Operation;
|
import io.swagger.v3.oas.models.Operation;
|
||||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||||
@@ -17,6 +18,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -50,9 +52,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
protected String apiTestPath = "test" + File.separator;
|
protected String apiTestPath = "test" + File.separator;
|
||||||
protected String modelTestPath = "test" + File.separator;
|
protected String modelTestPath = "test" + File.separator;
|
||||||
|
|
||||||
// Names that must not be used as model names because they clash with existing
|
protected Map<String, String> imports = new HashMap<>();
|
||||||
// default imports (dart:io, dart:async, package:http etc.) but are not basic dataTypes.
|
|
||||||
protected Set<String> additionalReservedWords;
|
|
||||||
|
|
||||||
public AbstractDartCodegen() {
|
public AbstractDartCodegen() {
|
||||||
super();
|
super();
|
||||||
@@ -111,13 +111,13 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
}
|
}
|
||||||
setReservedWordsLowerCase(reservedWordsList);
|
setReservedWordsLowerCase(reservedWordsList);
|
||||||
|
|
||||||
|
// These types return isPrimitive=true in templates
|
||||||
languageSpecificPrimitives = Sets.newHashSet(
|
languageSpecificPrimitives = Sets.newHashSet(
|
||||||
"String",
|
"String",
|
||||||
"bool",
|
"bool",
|
||||||
"int",
|
"int",
|
||||||
"num",
|
"num",
|
||||||
"double",
|
"double"
|
||||||
"dynamic"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
typeMapping = new HashMap<>();
|
typeMapping = new HashMap<>();
|
||||||
@@ -148,29 +148,31 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
typeMapping.put("object", "Object");
|
typeMapping.put("object", "Object");
|
||||||
typeMapping.put("AnyType", "Object");
|
typeMapping.put("AnyType", "Object");
|
||||||
|
|
||||||
// DataTypes of the above values which are automatically imported.
|
// Data types of the above values which are automatically imported
|
||||||
// They are also not allowed to be model names.
|
|
||||||
defaultIncludes = Sets.newHashSet(
|
defaultIncludes = Sets.newHashSet(
|
||||||
"String",
|
"String",
|
||||||
"bool",
|
"bool",
|
||||||
"int",
|
"int",
|
||||||
"num",
|
"num",
|
||||||
"double",
|
"double",
|
||||||
"dynamic",
|
|
||||||
"List",
|
"List",
|
||||||
"Set",
|
"Set",
|
||||||
"Map",
|
"Map",
|
||||||
"DateTime",
|
"DateTime",
|
||||||
"Object",
|
"Object"
|
||||||
"MultipartFile"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
additionalReservedWords = Sets.newHashSet(
|
imports.put("String", "dart:core");
|
||||||
"File",
|
imports.put("bool", "dart:core");
|
||||||
"Client",
|
imports.put("int", "dart:core");
|
||||||
"Future",
|
imports.put("num", "dart:core");
|
||||||
"Response"
|
imports.put("double", "dart:core");
|
||||||
);
|
imports.put("List", "dart:core");
|
||||||
|
imports.put("Set", "dart:core");
|
||||||
|
imports.put("Map", "dart:core");
|
||||||
|
imports.put("DateTime", "dart:core");
|
||||||
|
imports.put("Object", "dart:core");
|
||||||
|
imports.put("MultipartFile", "package:http/http.dart");
|
||||||
|
|
||||||
cliOptions.add(new CliOption(PUB_LIBRARY, "Library name in generated code"));
|
cliOptions.add(new CliOption(PUB_LIBRARY, "Library name in generated code"));
|
||||||
cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec"));
|
cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec"));
|
||||||
@@ -181,7 +183,6 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
cliOptions.add(new CliOption(PUB_HOMEPAGE, "Homepage in generated pubspec"));
|
cliOptions.add(new CliOption(PUB_HOMEPAGE, "Homepage in generated pubspec"));
|
||||||
cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums"));
|
cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums"));
|
||||||
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "Source folder for generated code"));
|
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "Source folder for generated code"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -278,13 +279,17 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean needToImport(String type) {
|
||||||
|
// Import everything, unless it is from dart:core.
|
||||||
|
return StringUtils.isNotBlank(type) && (!imports.containsKey(type) || !imports.get(type).equals("dart:core"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isReservedWord(String word) {
|
protected boolean isReservedWord(String word) {
|
||||||
// consider everything as reserved that is either a keyword,
|
// consider everything as reserved that is either a keyword,
|
||||||
// a default included type, or a type include through some library
|
// a default included type, or a type include through some library
|
||||||
return super.isReservedWord(word) ||
|
return super.isReservedWord(word) || defaultIncludes().contains(word);
|
||||||
defaultIncludes().contains(word) ||
|
|
||||||
additionalReservedWords.contains(word);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -366,32 +371,46 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toModelName(final String name) {
|
public String toModelName(final String name) {
|
||||||
String nameWithPrefixSuffix = sanitizeName(name);
|
String sanitizedName = sanitizeName(name);
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
||||||
// add '_' so that model name can be camelized correctly
|
// add '_' so that model name can be camelized correctly
|
||||||
nameWithPrefixSuffix = modelNamePrefix + "_" + nameWithPrefixSuffix;
|
sanitizedName = modelNamePrefix + "_" + sanitizedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(modelNameSuffix)) {
|
if (!StringUtils.isEmpty(modelNameSuffix)) {
|
||||||
// add '_' so that model name can be camelized correctly
|
// add '_' so that model name can be camelized correctly
|
||||||
nameWithPrefixSuffix = nameWithPrefixSuffix + "_" + modelNameSuffix;
|
sanitizedName = sanitizedName + "_" + modelNameSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
// camelize the model name
|
// camelize the model name
|
||||||
// phone_number => PhoneNumber
|
// phone_number => PhoneNumber
|
||||||
final String camelizedName = camelize(nameWithPrefixSuffix);
|
final String camelizedName = camelize(sanitizedName);
|
||||||
|
|
||||||
|
// Check if there is a mapping that can be used
|
||||||
|
if (typeMapping().containsKey(camelizedName)) {
|
||||||
|
String typeName = typeMapping().get(camelizedName);
|
||||||
|
if (imports.containsKey(typeName)) {
|
||||||
|
// Anything with an import mapping is likely
|
||||||
|
// generator specific and can not be used as model name.
|
||||||
|
final String modelName = "Model" + camelizedName;
|
||||||
|
LOGGER.warn("{} (existing type) cannot be used as model name. Renamed to {}", camelizedName, modelName);
|
||||||
|
return modelName;
|
||||||
|
}
|
||||||
|
return typeName;
|
||||||
|
}
|
||||||
|
|
||||||
// model name cannot use reserved keyword, e.g. return
|
// model name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(camelizedName)) {
|
if (isReservedWord(camelizedName)) {
|
||||||
final String modelName = "Model" + 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;
|
return modelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// model name starts with number
|
// model name starts with number
|
||||||
if (camelizedName.matches("^\\d.*")) {
|
if (camelizedName.matches("^\\d.*")) {
|
||||||
final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize)
|
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;
|
return modelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,13 +489,10 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
public String getSchemaType(Schema p) {
|
public String getSchemaType(Schema p) {
|
||||||
String openAPIType = super.getSchemaType(p);
|
String openAPIType = super.getSchemaType(p);
|
||||||
if (openAPIType == null) {
|
if (openAPIType == null) {
|
||||||
LOGGER.error("No Type defined for Schema " + p);
|
LOGGER.error("No Type defined for Schema {}", p);
|
||||||
}
|
}
|
||||||
if (typeMapping.containsKey(openAPIType)) {
|
if (typeMapping().containsKey(openAPIType)) {
|
||||||
return typeMapping.get(openAPIType);
|
return typeMapping().get(openAPIType);
|
||||||
}
|
|
||||||
if (languageSpecificPrimitives.contains(openAPIType)) {
|
|
||||||
return openAPIType;
|
|
||||||
}
|
}
|
||||||
return toModelName(openAPIType);
|
return toModelName(openAPIType);
|
||||||
}
|
}
|
||||||
@@ -600,14 +616,15 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
// method name cannot use reserved keyword, e.g. return
|
// method name cannot use reserved keyword, e.g. return
|
||||||
if (isReservedWord(operationId)) {
|
if (isReservedWord(operationId)) {
|
||||||
String newOperationId = camelize("call_" + operationId, true);
|
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;
|
return newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true);
|
String newOperationId = camelize("call_" + operationId, true);
|
||||||
operationId = camelize("call_" + operationId, true);
|
LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId);
|
||||||
|
operationId = newOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return operationId;
|
return operationId;
|
||||||
@@ -684,36 +701,11 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.info("Successfully executed: {}", command);
|
LOGGER.info("Successfully executed: {}", command);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||||
|
// Restore interrupted state
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postProcess() {
|
|
||||||
if (isEnablePostProcessFile()) {
|
|
||||||
// Using the condition here to have way to still disable this
|
|
||||||
// for older Dart generators in CI by default.
|
|
||||||
|
|
||||||
// Post processing the whole dart output is much faster then individual files.
|
|
||||||
// Setting this variable to "dart format" is the suggested way of doing this.
|
|
||||||
final String dartPostProcess = System.getenv("DART_POST_PROCESS");
|
|
||||||
if (!StringUtils.isEmpty(dartPostProcess)) {
|
|
||||||
final String command = dartPostProcess + " " + getOutputDir();
|
|
||||||
try {
|
|
||||||
Process p = Runtime.getRuntime().exec(command);
|
|
||||||
int exitValue = p.waitFor();
|
|
||||||
if (exitValue != 0) {
|
|
||||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
|
||||||
} else {
|
|
||||||
LOGGER.info("Successfully executed: {}", command);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.postProcess();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||||
|
|
||||||
@@ -91,7 +90,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
|||||||
instantiationTypes.put("array", "ARRAYED_LIST");
|
instantiationTypes.put("array", "ARRAYED_LIST");
|
||||||
instantiationTypes.put("list", "ARRAYED_LIST");
|
instantiationTypes.put("list", "ARRAYED_LIST");
|
||||||
instantiationTypes.put("map", "STRING_TABLE");
|
instantiationTypes.put("map", "STRING_TABLE");
|
||||||
|
|
||||||
importMapping.put("List", "LIST");
|
importMapping.put("List", "LIST");
|
||||||
importMapping.put("Set", "SET");
|
importMapping.put("Set", "SET");
|
||||||
importMapping.put("file", "FILE");
|
importMapping.put("file", "FILE");
|
||||||
@@ -153,7 +152,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
|||||||
name = escapeReservedWord(name);
|
name = escapeReservedWord(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for reserved word or word starting with number, append
|
// for reserved word or word starting with number, append
|
||||||
if (name.matches("^\\d.*")) {
|
if (name.matches("^\\d.*")) {
|
||||||
name = escapeReservedWord(name);
|
name = escapeReservedWord(name);
|
||||||
}
|
}
|
||||||
@@ -349,7 +348,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
|||||||
+ camelize("call_" + operationId));
|
+ camelize("call_" + operationId));
|
||||||
sanitizedOperationId = "call_" + sanitizedOperationId;
|
sanitizedOperationId = "call_" + sanitizedOperationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// operationId starts with a number
|
// operationId starts with a number
|
||||||
if (operationId.matches("^\\d.*")) {
|
if (operationId.matches("^\\d.*")) {
|
||||||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true);
|
||||||
|
|||||||
@@ -30,9 +30,8 @@ import org.openapitools.codegen.utils.ModelUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.lang.Exception;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
@@ -1124,8 +1123,10 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.info("Successfully executed: " + command);
|
LOGGER.info("Successfully executed: " + command);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||||
|
// Restore interrupted state
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||||
@@ -310,16 +311,17 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toApiFilename(String name) {
|
public String toApiFilename(String name) {
|
||||||
|
final String apiName;
|
||||||
// replace - with _ e.g. created-at => created_at
|
// replace - with _ e.g. created-at => created_at
|
||||||
name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
String api = name.replaceAll("-", "_");
|
||||||
|
|
||||||
// e.g. PetApi.go => pet_api.go
|
// e.g. PetApi.go => pet_api.go
|
||||||
name = "api_" + underscore(name);
|
api = "api_" + underscore(api);
|
||||||
if (isReservedFilename(name)) {
|
if (isReservedFilename(api)) {
|
||||||
LOGGER.warn(name + ".go with suffix (reserved word) cannot be used as filename. Renamed to " + name + "_.go");
|
LOGGER.warn(name + ".go with suffix (reserved word) cannot be used as filename. Renamed to " + api + "_.go");
|
||||||
name += "_";
|
api += "_";
|
||||||
}
|
}
|
||||||
return name;
|
apiName = api;
|
||||||
|
return apiName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -594,7 +596,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
|||||||
// The 'go-experimental/model.mustache' template conditionally generates accessor methods.
|
// The 'go-experimental/model.mustache' template conditionally generates accessor methods.
|
||||||
// For primitive types and custom types (e.g. interface{}, map[string]interface{}...),
|
// For primitive types and custom types (e.g. interface{}, map[string]interface{}...),
|
||||||
// the generated code has a wrapper type and a Get() function to access the underlying type.
|
// the generated code has a wrapper type and a Get() function to access the underlying type.
|
||||||
// For containers (e.g. Array, Map), the generated code returns the type directly.
|
// For containers (e.g. Array, Map), the generated code returns the type directly.
|
||||||
if (property.isContainer || property.isFreeFormObject || property.isAnyType) {
|
if (property.isContainer || property.isFreeFormObject || property.isAnyType) {
|
||||||
property.vendorExtensions.put("x-golang-is-container", true);
|
property.vendorExtensions.put("x-golang-is-container", true);
|
||||||
}
|
}
|
||||||
@@ -787,6 +789,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toDefaultValue(Schema schema) {
|
public String toDefaultValue(Schema schema) {
|
||||||
|
schema = ModelUtils.unaliasSchema(this.openAPI, schema);
|
||||||
if (schema.getDefault() != null) {
|
if (schema.getDefault() != null) {
|
||||||
return schema.getDefault().toString();
|
return schema.getDefault().toString();
|
||||||
} else {
|
} else {
|
||||||
@@ -805,7 +808,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
|||||||
return; // skip if GO_POST_PROCESS_FILE env variable is not defined
|
return; // skip if GO_POST_PROCESS_FILE env variable is not defined
|
||||||
}
|
}
|
||||||
|
|
||||||
// only procees the following type (or we can simply rely on the file extension to check if it's a Go file)
|
// only process the following type (or we can simply rely on the file extension to check if it's a Go file)
|
||||||
Set<String> supportedFileType = new HashSet<String>(
|
Set<String> supportedFileType = new HashSet<String>(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
"supporting-mustache",
|
"supporting-mustache",
|
||||||
@@ -830,8 +833,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.info("Successfully executed: " + command);
|
LOGGER.info("Successfully executed: " + command);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||||
|
// Restore interrupted state
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -274,12 +275,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(SUPPORT_JAVA6)) {
|
if (additionalProperties.containsKey(SUPPORT_JAVA6)) {
|
||||||
this.setSupportJava6(Boolean.valueOf(additionalProperties.get(SUPPORT_JAVA6).toString()));
|
this.setSupportJava6(Boolean.parseBoolean(additionalProperties.get(SUPPORT_JAVA6).toString()));
|
||||||
}
|
}
|
||||||
additionalProperties.put(SUPPORT_JAVA6, supportJava6);
|
additionalProperties.put(SUPPORT_JAVA6, supportJava6);
|
||||||
|
|
||||||
if (additionalProperties.containsKey(DISABLE_HTML_ESCAPING)) {
|
if (additionalProperties.containsKey(DISABLE_HTML_ESCAPING)) {
|
||||||
this.setDisableHtmlEscaping(Boolean.valueOf(additionalProperties.get(DISABLE_HTML_ESCAPING).toString()));
|
this.setDisableHtmlEscaping(Boolean.parseBoolean(additionalProperties.get(DISABLE_HTML_ESCAPING).toString()));
|
||||||
}
|
}
|
||||||
additionalProperties.put(DISABLE_HTML_ESCAPING, disableHtmlEscaping);
|
additionalProperties.put(DISABLE_HTML_ESCAPING, disableHtmlEscaping);
|
||||||
|
|
||||||
@@ -289,7 +290,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
additionalProperties.put(BOOLEAN_GETTER_PREFIX, booleanGetterPrefix);
|
additionalProperties.put(BOOLEAN_GETTER_PREFIX, booleanGetterPrefix);
|
||||||
|
|
||||||
if (additionalProperties.containsKey(IGNORE_ANYOF_IN_ENUM)) {
|
if (additionalProperties.containsKey(IGNORE_ANYOF_IN_ENUM)) {
|
||||||
this.setIgnoreAnyOfInEnum(Boolean.valueOf(additionalProperties.get(IGNORE_ANYOF_IN_ENUM).toString()));
|
this.setIgnoreAnyOfInEnum(Boolean.parseBoolean(additionalProperties.get(IGNORE_ANYOF_IN_ENUM).toString()));
|
||||||
}
|
}
|
||||||
additionalProperties.put(IGNORE_ANYOF_IN_ENUM, ignoreAnyOfInEnum);
|
additionalProperties.put(IGNORE_ANYOF_IN_ENUM, ignoreAnyOfInEnum);
|
||||||
|
|
||||||
@@ -426,17 +427,17 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING)) {
|
if (additionalProperties.containsKey(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING)) {
|
||||||
this.setSerializeBigDecimalAsString(Boolean.valueOf(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING).toString()));
|
this.setSerializeBigDecimalAsString(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string
|
// need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string
|
||||||
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
|
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
|
||||||
|
|
||||||
if (additionalProperties.containsKey(FULL_JAVA_UTIL)) {
|
if (additionalProperties.containsKey(FULL_JAVA_UTIL)) {
|
||||||
this.setFullJavaUtil(Boolean.valueOf(additionalProperties.get(FULL_JAVA_UTIL).toString()));
|
this.setFullJavaUtil(Boolean.parseBoolean(additionalProperties.get(FULL_JAVA_UTIL).toString()));
|
||||||
}
|
}
|
||||||
if (additionalProperties.containsKey(DISCRIMINATOR_CASE_SENSITIVE)) {
|
if (additionalProperties.containsKey(DISCRIMINATOR_CASE_SENSITIVE)) {
|
||||||
this.setDiscriminatorCaseSensitive(Boolean.valueOf(additionalProperties.get(DISCRIMINATOR_CASE_SENSITIVE).toString()));
|
this.setDiscriminatorCaseSensitive(Boolean.parseBoolean(additionalProperties.get(DISCRIMINATOR_CASE_SENSITIVE).toString()));
|
||||||
} else {
|
} else {
|
||||||
// By default, the discriminator lookup should be case sensitive. There is nothing in the OpenAPI specification
|
// By default, the discriminator lookup should be case sensitive. There is nothing in the OpenAPI specification
|
||||||
// that indicates the lookup should be case insensitive. However, some implementations perform
|
// that indicates the lookup should be case insensitive. However, some implementations perform
|
||||||
@@ -452,12 +453,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
additionalProperties.put("javaUtilPrefix", javaUtilPrefix);
|
additionalProperties.put("javaUtilPrefix", javaUtilPrefix);
|
||||||
|
|
||||||
if (additionalProperties.containsKey(WITH_XML)) {
|
if (additionalProperties.containsKey(WITH_XML)) {
|
||||||
this.setWithXml(Boolean.valueOf(additionalProperties.get(WITH_XML).toString()));
|
this.setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString()));
|
||||||
}
|
}
|
||||||
additionalProperties.put(WITH_XML, withXml);
|
additionalProperties.put(WITH_XML, withXml);
|
||||||
|
|
||||||
if (additionalProperties.containsKey(OPENAPI_NULLABLE)) {
|
if (additionalProperties.containsKey(OPENAPI_NULLABLE)) {
|
||||||
this.setOpenApiNullable(Boolean.valueOf(additionalProperties.get(OPENAPI_NULLABLE).toString()));
|
this.setOpenApiNullable(Boolean.parseBoolean(additionalProperties.get(OPENAPI_NULLABLE).toString()));
|
||||||
}
|
}
|
||||||
additionalProperties.put(OPENAPI_NULLABLE, openApiNullable);
|
additionalProperties.put(OPENAPI_NULLABLE, openApiNullable);
|
||||||
|
|
||||||
@@ -941,6 +942,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
return super.toDefaultValue(schema);
|
return super.toDefaultValue(schema);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
} else if (ModelUtils.isComposedSchema(schema)) {
|
||||||
|
if (schema.getDefault() != null) {
|
||||||
|
return super.toDefaultValue(schema);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.toDefaultValue(schema);
|
return super.toDefaultValue(schema);
|
||||||
@@ -1430,6 +1436,27 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postProcessParameter(CodegenParameter p) {
|
||||||
|
// we use a custom version of this function to remove the l, d, and f suffixes from Long/Double/Float
|
||||||
|
// defaultValues
|
||||||
|
// remove the l because our users will use Long.parseLong(String defaultValue)
|
||||||
|
// remove the d because our users will use Double.parseDouble(String defaultValue)
|
||||||
|
// remove the f because our users will use Float.parseFloat(String defaultValue)
|
||||||
|
// NOTE: for CodegenParameters we DO need these suffixes because those defaultValues are used as java value
|
||||||
|
// literals assigned to Long/Double/Float
|
||||||
|
if (p.defaultValue == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean fixLong = (p.isLong && "l".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||||
|
Boolean fixDouble = (p.isDouble && "d".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||||
|
Boolean fixFloat = (p.isFloat && "f".equals(p.defaultValue.substring(p.defaultValue.length()-1)));
|
||||||
|
if (fixLong || fixDouble || fixFloat) {
|
||||||
|
p.defaultValue = p.defaultValue.substring(0, p.defaultValue.length()-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
||||||
// This generator uses inline classes to define enums, which breaks when
|
// This generator uses inline classes to define enums, which breaks when
|
||||||
// dealing with models that have subTypes. To clean this up, we will analyze
|
// dealing with models that have subTypes. To clean this up, we will analyze
|
||||||
@@ -1813,8 +1840,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.info("Successfully executed: " + command);
|
LOGGER.info("Successfully executed: " + command);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||||
|
// Restore interrupted state
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1847,7 +1876,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
|||||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||||
if (!supportsAdditionalPropertiesWithComposedSchema) {
|
if (!supportsAdditionalPropertiesWithComposedSchema) {
|
||||||
// The additional (undeclared) propertiees are modeled in Java as a HashMap.
|
// The additional (undeclared) propertiees are modeled in Java as a HashMap.
|
||||||
//
|
//
|
||||||
// 1. supportsAdditionalPropertiesWithComposedSchema is set to false:
|
// 1. supportsAdditionalPropertiesWithComposedSchema is set to false:
|
||||||
// The generated model class extends from the HashMap. That does not work
|
// The generated model class extends from the HashMap. That does not work
|
||||||
// with composed schemas that also use a discriminator because the model class
|
// with composed schemas that also use a discriminator because the model class
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user