mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-05 12:46:14 +00:00
Compare commits
47 Commits
v7.16.0
...
ts-angular
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a61bc4b8b6 | ||
|
|
c680f39ad7 | ||
|
|
c1247a5c17 | ||
|
|
6feb32c4b5 | ||
|
|
0229b7a947 | ||
|
|
dc1e932c0e | ||
|
|
211f51702d | ||
|
|
a4a24a8168 | ||
|
|
cbb27163a0 | ||
|
|
fdbabee87e | ||
|
|
cdd120d976 | ||
|
|
9d110fcb6b | ||
|
|
57324efd48 | ||
|
|
21d29dacc2 | ||
|
|
c27f9c3ebc | ||
|
|
486e0c5e61 | ||
|
|
4bedcb754b | ||
|
|
89b0bc48fa | ||
|
|
0b9172ef5c | ||
|
|
b199901aab | ||
|
|
941a5ccf13 | ||
|
|
5f13c53825 | ||
|
|
1240d103ff | ||
|
|
42af4f9529 | ||
|
|
81a3488556 | ||
|
|
08da0abfca | ||
|
|
fb277f82d5 | ||
|
|
6b1b5cc4c5 | ||
|
|
fd84c8fbd6 | ||
|
|
f092f72cc5 | ||
|
|
37cac71f87 | ||
|
|
b8d805980a | ||
|
|
b49ec6e033 | ||
|
|
4352a2fcd0 | ||
|
|
6f3dacafc4 | ||
|
|
2d2e1c41c4 | ||
|
|
a955bead08 | ||
|
|
d7b79a26c6 | ||
|
|
1d7d399ec2 | ||
|
|
4121803442 | ||
|
|
602549cb36 | ||
|
|
1c082c7287 | ||
|
|
7ab9364094 | ||
|
|
28e7e7f2eb | ||
|
|
e8a688a724 | ||
|
|
ddb15d4b9d | ||
|
|
885ea07b17 |
2
.github/ISSUE_TEMPLATE.md
vendored
2
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,6 +1,6 @@
|
||||
<!--
|
||||
Please follow the issue template below for bug reports and feature requests.
|
||||
Also please indicate in the issue title which language/library is concerned. Eg: [JAVA] Bug generating foo with bar
|
||||
Also please indicate in the issue title which language/library is concerned. E.g.: [JAVA] Bug generating foo with bar
|
||||
-->
|
||||
|
||||
##### Description
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -18,7 +18,7 @@ assignees: ''
|
||||
|
||||
<!--
|
||||
Please follow the issue template below for bug reports.
|
||||
Also please indicate in the issue title which language/library is concerned. Eg: [BUG][JAVA] Bug generating foo with bar
|
||||
Also please indicate in the issue title which language/library is concerned. E.g.: [BUG][JAVA] Bug generating foo with bar
|
||||
-->
|
||||
|
||||
##### Description
|
||||
|
||||
6
.github/workflows/linux.yaml
vendored
6
.github/workflows/linux.yaml
vendored
@@ -44,12 +44,12 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
- uses: gradle/actions/setup-gradle@v5
|
||||
with:
|
||||
gradle-version: '8.14.3'
|
||||
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.18.0
|
||||
uses: s4u/setup-maven-action@v1.19.0
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
maven-version: 3.8.8
|
||||
@@ -91,7 +91,7 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v5
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.18.0
|
||||
uses: s4u/setup-maven-action@v1.19.0
|
||||
with:
|
||||
java-version: 11
|
||||
maven-version: 3.8.8
|
||||
|
||||
51
.github/workflows/samples-javascript.yaml
vendored
Normal file
51
.github/workflows/samples-javascript.yaml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Samples JS clients
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
#- samples/client/petstore/javascript-flowtyped/**
|
||||
- samples/client/petstore/javascript-es6/**
|
||||
- samples/client/petstore/javascript-promise-es6/**
|
||||
pull_request:
|
||||
paths:
|
||||
#- samples/client/petstore/javascript-flowtyped/**
|
||||
- samples/client/petstore/javascript-es6/**
|
||||
- samples/client/petstore/javascript-promise-es6/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build projects
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node:
|
||||
- "18.x"
|
||||
- "20.x"
|
||||
sample:
|
||||
# clients
|
||||
- samples/client/petstore/javascript-es6/
|
||||
- samples/client/petstore/javascript-promise-es6/
|
||||
services:
|
||||
petstore-api:
|
||||
image: swaggerapi/petstore
|
||||
ports:
|
||||
- 80:8080
|
||||
env:
|
||||
SWAGGER_HOST: http://petstore.swagger.io
|
||||
SWAGGER_BASE_PATH: /v2
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Add hosts to /etc/hosts
|
||||
run: |
|
||||
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'npm' # Or 'yarn'
|
||||
- name: npm install
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: npm install
|
||||
- name: npm test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: npm test
|
||||
5
.github/workflows/samples-jaxrs.yaml
vendored
5
.github/workflows/samples-jaxrs.yaml
vendored
@@ -20,10 +20,7 @@ jobs:
|
||||
- samples/server/petstore/jaxrs/jersey2-useTags
|
||||
- samples/server/petstore/jaxrs-jersey
|
||||
- samples/server/petstore/jaxrs-spec
|
||||
- samples/server/petstore/jaxrs-spec-interface
|
||||
- samples/server/petstore/jaxrs-spec-interface-response
|
||||
- samples/server/petstore/jaxrs-jersey
|
||||
- samples/server/petstore/jaxrs-spec
|
||||
- samples/server/petstore/jaxrs-spec-withxml
|
||||
- samples/server/petstore/jaxrs-spec-interface
|
||||
- samples/server/petstore/jaxrs-spec-interface-response
|
||||
- samples/server/petstore/jaxrs-datelib-j8
|
||||
|
||||
142
.github/workflows/samples-typescript-client.yaml
vendored
Normal file
142
.github/workflows/samples-typescript-client.yaml
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
name: Samples TS clients
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/client/others/typescript-angular/**
|
||||
# comment out angular released before Nov 2023
|
||||
#- samples/client/petstore/typescript-angular-v12-provided-in-root/**
|
||||
#- samples/client/petstore/typescript-angular-v13-provided-in-root/**
|
||||
#- samples/client/petstore/typescript-angular-v14-provided-in-root/**
|
||||
#- samples/client/petstore/typescript-angular-v15-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v16-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v17-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v18-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v19-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v20-provided-in-root/**
|
||||
- samples/openapi3/client/petstore/typescript/builds/default/**
|
||||
# comment out due to build failure
|
||||
#- samples/openapi3/client/petstore/typescript/tests/default/**
|
||||
- samples/openapi3/client/petstore/typescript/builds/jquery/**
|
||||
# comment out due to build failure
|
||||
#- samples/openapi3/client/petstore/typescript/tests/jquery/**
|
||||
- samples/openapi3/client/petstore/typescript/builds/object_params/**
|
||||
# comment out due to build failure
|
||||
#- samples/openapi3/client/petstore/typescript/tests/object_params/**
|
||||
#- samples/openapi3/client/petstore/typescript/builds/inversify/**
|
||||
#- samples/openapi3/client/petstore/typescript/tests/inversify/**
|
||||
#- samples/openapi3/client/petstore/typescript/tests/deno/**
|
||||
- samples/openapi3/client/petstore/typescript/builds/browser/**
|
||||
# comment out due to build failure
|
||||
#- samples/openapi3/client/petstore/typescript/tests/browser/**
|
||||
#- samples/openapi3/client/petstore/typescript/builds/nullable-enum/**
|
||||
- samples/client/petstore/typescript-fetch/builds/default/**
|
||||
- samples/client/petstore/typescript-fetch/builds/es6-target/**
|
||||
- samples/client/petstore/typescript-fetch/builds/with-npm-version/**
|
||||
- samples/client/petstore/typescript-fetch/tests/default/**
|
||||
# comment out due to build failure
|
||||
#- samples/client/petstore/typescript-node/npm/**
|
||||
- samples/client/petstore/typescript-rxjs/builds/with-npm-version/**
|
||||
- samples/client/petstore/typescript-axios/builds/with-npm-version/**
|
||||
# comment out due to build failure
|
||||
#- samples/client/petstore/typescript-axios/tests/default/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/client/others/typescript-angular/**
|
||||
#- samples/client/petstore/typescript-angular-v12-provided-in-root/**
|
||||
#- samples/client/petstore/typescript-angular-v13-provided-in-root/**
|
||||
#- samples/client/petstore/typescript-angular-v14-provided-in-root/**
|
||||
#- samples/client/petstore/typescript-angular-v15-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v16-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v17-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v18-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v19-provided-in-root/**
|
||||
- samples/client/petstore/typescript-angular-v20-provided-in-root/**
|
||||
- samples/openapi3/client/petstore/typescript/builds/default/**
|
||||
#- samples/openapi3/client/petstore/typescript/tests/default/**
|
||||
- samples/openapi3/client/petstore/typescript/builds/jquery/**
|
||||
#- samples/openapi3/client/petstore/typescript/tests/jquery/**
|
||||
- samples/openapi3/client/petstore/typescript/builds/object_params/**
|
||||
#- samples/openapi3/client/petstore/typescript/tests/object_params/**
|
||||
#- samples/openapi3/client/petstore/typescript/builds/inversify/**
|
||||
#- samples/openapi3/client/petstore/typescript/tests/inversify/**
|
||||
#- samples/openapi3/client/petstore/typescript/tests/deno/**
|
||||
- samples/openapi3/client/petstore/typescript/builds/browser/**
|
||||
#- samples/openapi3/client/petstore/typescript/tests/browser/**
|
||||
#- samples/openapi3/client/petstore/typescript/builds/nullable-enum/**
|
||||
- samples/client/petstore/typescript-fetch/builds/default/**
|
||||
- samples/client/petstore/typescript-fetch/builds/es6-target/**
|
||||
- samples/client/petstore/typescript-fetch/builds/with-npm-version/**
|
||||
- samples/client/petstore/typescript-fetch/tests/default/**
|
||||
#- samples/client/petstore/typescript-node/npm/**
|
||||
- samples/client/petstore/typescript-rxjs/builds/with-npm-version/**
|
||||
- samples/client/petstore/typescript-axios/builds/with-npm-version/**
|
||||
#- samples/client/petstore/typescript-axios/tests/default/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build projects
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
petstore-api:
|
||||
image: swaggerapi/petstore
|
||||
ports:
|
||||
- 80:8080
|
||||
env:
|
||||
SWAGGER_HOST: http://petstore.swagger.io
|
||||
SWAGGER_BASE_PATH: /v2
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node:
|
||||
#- "18.x"
|
||||
- "20.x"
|
||||
sample:
|
||||
- samples/client/others/typescript-angular/
|
||||
#- samples/client/petstore/typescript-angular-v12-provided-in-root/
|
||||
#- samples/client/petstore/typescript-angular-v13-provided-in-root/
|
||||
#- samples/client/petstore/typescript-angular-v14-provided-in-root/
|
||||
#- samples/client/petstore/typescript-angular-v15-provided-in-root/
|
||||
- samples/client/petstore/typescript-angular-v16-provided-in-root/
|
||||
- samples/client/petstore/typescript-angular-v17-provided-in-root/
|
||||
- samples/client/petstore/typescript-angular-v18-provided-in-root/
|
||||
- samples/client/petstore/typescript-angular-v19-provided-in-root/
|
||||
- samples/client/petstore/typescript-angular-v20-provided-in-root/
|
||||
- samples/openapi3/client/petstore/typescript/builds/default/
|
||||
#- samples/openapi3/client/petstore/typescript/tests/default/
|
||||
- samples/openapi3/client/petstore/typescript/builds/jquery/
|
||||
#- samples/openapi3/client/petstore/typescript/tests/jquery/
|
||||
- samples/openapi3/client/petstore/typescript/builds/object_params/
|
||||
#- samples/openapi3/client/petstore/typescript/tests/object_params/
|
||||
#- samples/openapi3/client/petstore/typescript/builds/inversify/
|
||||
#- samples/openapi3/client/petstore/typescript/tests/inversify/
|
||||
#- samples/openapi3/client/petstore/typescript/tests/deno/
|
||||
- samples/openapi3/client/petstore/typescript/builds/browser/
|
||||
#- samples/openapi3/client/petstore/typescript/tests/browser/
|
||||
#- samples/openapi3/client/petstore/typescript/builds/nullable-enum/
|
||||
- samples/client/petstore/typescript-fetch/builds/default/
|
||||
- samples/client/petstore/typescript-fetch/builds/es6-target/
|
||||
- samples/client/petstore/typescript-fetch/builds/with-npm-version/
|
||||
- samples/client/petstore/typescript-fetch/tests/default/
|
||||
#- samples/client/petstore/typescript-node/npm/
|
||||
- samples/client/petstore/typescript-rxjs/builds/with-npm-version/
|
||||
- samples/client/petstore/typescript-axios/builds/with-npm-version/
|
||||
#- samples/client/petstore/typescript-axios/tests/default/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Add hosts to /etc/hosts
|
||||
run: |
|
||||
sudo echo "127.0.0.1 petstore.swagger.io" | sudo tee -a /etc/hosts
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: '17' # Specify your desired Java version
|
||||
distribution: 'temurin' # Or 'adopt', 'oracle', etc.
|
||||
cache: maven # Cache Maven dependencies for faster builds
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'npm' # Or 'yarn'
|
||||
- name: mvn integration-test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: mvn integration-test
|
||||
34
.github/workflows/samples-typescript-server.yaml
vendored
Normal file
34
.github/workflows/samples-typescript-server.yaml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Samples TS servers
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- samples/server/petstore/typescript-nestjs-server/**
|
||||
pull_request:
|
||||
paths:
|
||||
- samples/server/petstore/typescript-nestjs-server/**
|
||||
jobs:
|
||||
build:
|
||||
name: Build projects
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node:
|
||||
- "18.x"
|
||||
- "20.x"
|
||||
sample:
|
||||
- samples/server/petstore/typescript-nestjs-server/
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: 'npm' # Or 'yarn'
|
||||
- name: npm install
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: npm install
|
||||
- name: npm test
|
||||
working-directory: ${{ matrix.sample }}
|
||||
run: npm test
|
||||
2
.github/workflows/windows.yaml
vendored
2
.github/workflows/windows.yaml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
- name: Setup Maven
|
||||
uses: s4u/setup-maven-action@v1.18.0
|
||||
uses: s4u/setup-maven-action@v1.19.0
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
maven-version: 3.8.8
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -49,6 +49,8 @@ nb-configuration.xml
|
||||
*.xml~
|
||||
*.t~
|
||||
|
||||
**/.angular
|
||||
|
||||
/target
|
||||
/generated-files
|
||||
test-output/
|
||||
|
||||
@@ -62,55 +62,51 @@ elif [ "$NODE_INDEX" = "3" ]; then
|
||||
|
||||
echo "Running node $NODE_INDEX ... "
|
||||
|
||||
# Install node@stable (for angular 6)
|
||||
set +e
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
|
||||
export NVM_DIR="/opt/circleci/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
#nvm install stable
|
||||
# install v16 instead of the latest stable version
|
||||
nvm install 18
|
||||
nvm alias default 18
|
||||
node --version
|
||||
## Install node@stable (for angular 6)
|
||||
#set +e
|
||||
#curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
|
||||
#export NVM_DIR="/opt/circleci/.nvm"
|
||||
#[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
##nvm install stable
|
||||
## install v16 instead of the latest stable version
|
||||
#nvm install 18
|
||||
#nvm alias default 18
|
||||
#node --version
|
||||
|
||||
# Each step uses the same `$BASH_ENV`, so need to modify it
|
||||
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
|
||||
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
|
||||
## Each step uses the same `$BASH_ENV`, so need to modify it
|
||||
#echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
|
||||
#echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
|
||||
|
||||
(cd samples/client/others/typescript-angular && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-angular-v12-provided-in-root && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-angular-v13-provided-in-root && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-angular-v14-provided-in-root && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-angular-v15-provided-in-root && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-angular-v16-provided-in-root && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-angular-v17-provided-in-root && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-angular-v18-provided-in-root && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-angular-v19-provided-in-root && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/builds/default && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/tests/default && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/builds/jquery && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/tests/jquery && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/builds/object_params && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/tests/object_params && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/builds/inversify && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/tests/inversify && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/tests/deno && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/builds/browser && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/tests/browser && mvn integration-test)
|
||||
(cd samples/openapi3/client/petstore/typescript/builds/nullable-enum && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-fetch/builds/default && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-fetch/builds/es6-target && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-fetch/builds/with-npm-version && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-fetch/tests/default && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-node/npm && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-rxjs/builds/with-npm-version && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-axios/builds/with-npm-version && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-axios/tests/default && mvn integration-test)
|
||||
(cd samples/client/petstore/typescript-axios/tests/with-complex-headers && mvn integration-test)
|
||||
(cd samples/client/petstore/javascript-flowtyped && mvn integration-test)
|
||||
(cd samples/client/petstore/javascript-es6 && mvn integration-test)
|
||||
(cd samples/client/petstore/javascript-promise-es6 && mvn integration-test)
|
||||
(cd samples/server/petstore/typescript-nestjs-server && mvn integration-test)
|
||||
#(cd samples/client/others/typescript-angular && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-angular-v12-provided-in-root && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-angular-v13-provided-in-root && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-angular-v14-provided-in-root && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-angular-v15-provided-in-root && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-angular-v16-provided-in-root && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-angular-v17-provided-in-root && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-angular-v18-provided-in-root && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-angular-v19-provided-in-root && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/builds/default && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/tests/default && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/builds/jquery && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/tests/jquery && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/builds/object_params && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/tests/object_params && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/builds/inversify && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/tests/inversify && mvn integration-test)
|
||||
##(cd samples/openapi3/client/petstore/typescript/tests/deno && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/builds/browser && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/tests/browser && mvn integration-test)
|
||||
#(cd samples/openapi3/client/petstore/typescript/builds/nullable-enum && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-fetch/builds/default && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-fetch/builds/es6-target && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-fetch/builds/with-npm-version && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-fetch/tests/default && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-node/npm && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-rxjs/builds/with-npm-version && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-axios/builds/with-npm-version && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-axios/tests/default && mvn integration-test)
|
||||
#(cd samples/client/petstore/typescript-axios/tests/with-complex-headers && mvn integration-test)
|
||||
|
||||
else
|
||||
echo "Running node $NODE_INDEX ..."
|
||||
|
||||
10
bin/configs/jaxrs-spec-withxml.yaml
Normal file
10
bin/configs/jaxrs-spec-withxml.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
generatorName: jaxrs-spec
|
||||
outputDir: samples/server/petstore/jaxrs-spec-withxml/
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/jaxrs-spec/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/JavaJaxRS/spec
|
||||
additionalProperties:
|
||||
artifactId: jaxrs-spec-withxml-petstore-server
|
||||
serializableModel: "true"
|
||||
hideGenerationTimestamp: "true"
|
||||
generateBuilders: "true"
|
||||
withXml: true
|
||||
9
bin/configs/typescript-angular-v19-provided-in-root.yaml
Normal file
9
bin/configs/typescript-angular-v19-provided-in-root.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: typescript-angular
|
||||
outputDir: samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
|
||||
additionalProperties:
|
||||
ngVersion: 19.0.0
|
||||
supportsES6: true
|
||||
enumNameMappings:
|
||||
delivered: SHIPPED
|
||||
9
bin/configs/typescript-angular-v20-provided-in-root.yaml
Normal file
9
bin/configs/typescript-angular-v20-provided-in-root.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
generatorName: typescript-angular
|
||||
outputDir: samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
|
||||
additionalProperties:
|
||||
ngVersion: 20.0.0
|
||||
supportsES6: true
|
||||
enumNameMappings:
|
||||
delivered: SHIPPED
|
||||
@@ -0,0 +1,7 @@
|
||||
generatorName: typescript-fetch
|
||||
outputDir: samples/client/others/typescript-fetch/infinite-recursion-issue
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/typescript-fetch/infinite-recursion-issue.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
|
||||
additionalProperties:
|
||||
enumPropertyNaming: "original"
|
||||
enumUnknownDefaultCase: true
|
||||
@@ -5,7 +5,7 @@ Running `./save_dart_keywords.sh` from this directory will generate `dart-keywor
|
||||
|
||||
## When should the keywords be generated?
|
||||
|
||||
`save_dart_keywords.sh` should be run when a new version of Dart is release to update the keywords file.
|
||||
`save_dart_keywords.sh` should be run when a new version of Dart is released to update the keywords file.
|
||||
|
||||
The last Dart version that was used to generate the keywords can be found in `dart-version.txt`.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ title: Debugging
|
||||
|
||||
## Generation
|
||||
|
||||
As a user there may be times when generated outputs don't match your expectations it's unclear why. The CLI supports a `--dry-run` option which may be used to inspect the anticipated file operations without making changes to the file system.
|
||||
As a user there may be times when generated outputs don't match your expectations and it's unclear why. The CLI supports a `--dry-run` option which may be used to inspect the anticipated file operations without making changes to the file system.
|
||||
|
||||
Suppose you generate using the `--minimal-update` option, and you notice on subsequent generations of a client that no files have changed. This is by design.
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|sourceFolder|source folder for generated code| |src/main/java|
|
||||
|springApiVersion|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).| |null|
|
||||
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|
||||
|title|server title name or client service name| |OpenAPI Spring|
|
||||
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|
||||
@@ -132,6 +133,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
|
||||
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
|
||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null
|
||||
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
---
|
||||
title: Documentation for the postman Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | postman | pass this to the generate command after -g |
|
||||
| generator stability | BETA | |
|
||||
| generator type | DOCUMENTATION | |
|
||||
| generator default templating engine | mustache | |
|
||||
| helpTxt | Generates a postman JSON file | |
|
||||
|
||||
## CONFIG OPTIONS
|
||||
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 |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|folderStrategy|whether to create folders according to the spec’s paths or tags| |null|
|
||||
|pathParamsAsVariables|whether to create Postman variables for path parameters| |false|
|
||||
|postmanGuid|whether to convert placeholders (i.e. {{UNIQUE_REFERENCE}}) into Postman formula {{$guid}}| |null|
|
||||
|postmanGuidPlaceholderName|name of the placeholder (i.e. {{UNIQUE_REFERENCE}}) to replace with Postman formula {{$guid}}| |null|
|
||||
|postmanIsoTimestamp|whether to convert placeholders (i.e. {{ISO_TIMESTAMP}}) into Postman formula {{$isoTimestamp}}| |null|
|
||||
|postmanIsoTimestampPlaceholderName|name of the placeholder (i.e. {{ISO_TIMESTAMP}}) to replace with Postman formula {{$isoTimestamp}}| |null|
|
||||
|postmanVariables|whether to convert placeholders (i.e. {{VAR_1}}) into Postman variables| |null|
|
||||
|requestParameterGeneration|whether to generate the request parameters based on the schema or the examples| |null|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
|
||||
| Type/Alias | Instantiated By |
|
||||
| ---------- | --------------- |
|
||||
|
||||
|
||||
## LANGUAGE PRIMITIVES
|
||||
|
||||
<ul class="column-ul">
|
||||
</ul>
|
||||
|
||||
## RESERVED WORDS
|
||||
|
||||
<ul class="column-ul">
|
||||
</ul>
|
||||
|
||||
## FEATURE SET
|
||||
|
||||
|
||||
### Client Modification Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|BasePath|✗|ToolingExtension
|
||||
|Authorizations|✗|ToolingExtension
|
||||
|UserAgent|✗|ToolingExtension
|
||||
|MockServer|✗|ToolingExtension
|
||||
|
||||
### Data Type Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|Custom|✗|OAS2,OAS3
|
||||
|Int32|✓|OAS2,OAS3
|
||||
|Int64|✓|OAS2,OAS3
|
||||
|Float|✓|OAS2,OAS3
|
||||
|Double|✓|OAS2,OAS3
|
||||
|Decimal|✓|ToolingExtension
|
||||
|String|✓|OAS2,OAS3
|
||||
|Byte|✓|OAS2,OAS3
|
||||
|Binary|✓|OAS2,OAS3
|
||||
|Boolean|✓|OAS2,OAS3
|
||||
|Date|✓|OAS2,OAS3
|
||||
|DateTime|✓|OAS2,OAS3
|
||||
|Password|✓|OAS2,OAS3
|
||||
|File|✓|OAS2
|
||||
|Uuid|✗|
|
||||
|Array|✓|OAS2,OAS3
|
||||
|Null|✗|OAS3
|
||||
|AnyType|✗|OAS2,OAS3
|
||||
|Object|✓|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
|
||||
|allOf|✗|OAS2,OAS3
|
||||
|anyOf|✗|OAS3
|
||||
|oneOf|✗|OAS3
|
||||
|not|✗|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
|
||||
|SignatureAuth|✗|OAS3
|
||||
|
||||
### Wire Format Feature
|
||||
| Name | Supported | Defined By |
|
||||
| ---- | --------- | ---------- |
|
||||
|JSON|✓|OAS2,OAS3
|
||||
|XML|✓|OAS2,OAS3
|
||||
|PROTOBUF|✗|ToolingExtension
|
||||
|Custom|✗|OAS2,OAS3
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|packageName|Rust package name (convention: lowercase).| |openapi|
|
||||
|packageVersion|Rust package version.| |1.0.0|
|
||||
|preferUnsignedInt|Prefer unsigned integers where minimum value is >= 0| |false|
|
||||
|reqwestDefaultFeatures|Default features for the reqwest dependency (comma-separated). Use empty for no defaults. This option is for 'reqwest' and 'reqwest-trait' library only.| |native-tls|
|
||||
|supportAsync|If set, generate async function call instead. This option is for 'reqwest' library only| |true|
|
||||
|supportMiddleware|If set, add support for reqwest-middleware. This option is for 'reqwest' and 'reqwest-trait' library only| |false|
|
||||
|supportMultipleResponses|If set, return type wraps an enum of all possible 2xx schemas. This option is for 'reqwest' and 'reqwest-trait' library only| |false|
|
||||
|
||||
@@ -88,6 +88,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|sourceFolder|source folder for generated code| |src/main/java|
|
||||
|springApiVersion|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).| |null|
|
||||
|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi|
|
||||
|title|server title name or client service name| |OpenAPI Spring|
|
||||
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).| |false|
|
||||
@@ -125,6 +126,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
|
||||
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
|
||||
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
|
||||
|x-spring-api-version|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).|OPERATION|null
|
||||
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.16.0
|
||||
openApiGeneratorVersion=7.17.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=7.16.0
|
||||
openApiGeneratorVersion=7.17.0-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
@@ -456,4 +456,31 @@ public class CodegenConstants {
|
||||
public static final String USE_DEFAULT_VALUES_FOR_REQUIRED_VARS = "useDefaultValuesForRequiredVars";
|
||||
|
||||
public static final String DEFAULT_TO_EMPTY_CONTAINER = "defaultToEmptyContainer";
|
||||
|
||||
// Vendor extensions
|
||||
public static final String X_INTERNAL = "x-internal";
|
||||
public static final String X_PARENT = "x-parent";
|
||||
public static final String X_COMPOSED_DATA_TYPE = "x-composed-data-type";
|
||||
public static final String X_BASE_NAME = "x-base-name";
|
||||
public static final String X_IS_VALUE_TYPE = "x-is-value-type";
|
||||
public static final String X_IS_REFERENCE_TYPE = "x-is-reference-type";
|
||||
public static final String X_IS_NULLABLE_TYPE = "x-is-nullable-type";
|
||||
public static final String X_IS_BASE_OR_NEW_DISCRIMINATOR = "x-is-base-or-new-discriminator";
|
||||
public static final String X_ENUM_BYTE = "x-enum-byte";
|
||||
public static final String X_HTTP_STATUS = "x-http-status";
|
||||
public static final String X_HTTP_STATUSES_WITH_RETURN = "x-http-statuses-with-return";
|
||||
public static final String X_SET_COOKIE = "x-set-cookie";
|
||||
public static final String X_DUPLICATES = "x-duplicates";
|
||||
public static final String X_HTTP_STATUS_IS_DEFAULT = "x-http-status-is-default";
|
||||
public static final String X_ONLY_DEFAULT = "x-only-default";
|
||||
public static final String X_HTTP_STATUS_RANGE = "x-http-status-range";
|
||||
public static final String X_NOT_NULLABLE_REFERENCE_TYPES = "x-not-nullable-reference-types";
|
||||
public static final String X_HAS_NOT_NULLABLE_REFERENCE_TYPES = "x-has-not-nullable-reference-types";
|
||||
public static final String X_NULLABLE_VALUE_TYPE = "x-nullable-value-type";
|
||||
public static final String X_NULLABLE_TYPE = "x-nullable-type";
|
||||
public static final String X_CSHARP_VALUE_TYPE = "x-csharp-value-type";
|
||||
public static final String X_REGEX = "x-regex";
|
||||
public static final String X_MODIFIERS = "x-modifiers";
|
||||
public static final String X_MODIFIER_PREFIX = "x-modifier-";
|
||||
public static final String X_MODEL_IS_MUTABLE = "x-model-is-mutable";
|
||||
}
|
||||
|
||||
@@ -88,8 +88,7 @@ import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.openapitools.codegen.CodegenConstants.DEFAULT_TO_EMPTY_CONTAINER;
|
||||
import static org.openapitools.codegen.CodegenConstants.UNSUPPORTED_V310_SPEC_MSG;
|
||||
import static org.openapitools.codegen.CodegenConstants.*;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
@@ -5197,7 +5196,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
String method = p.getKey();
|
||||
Operation op = p.getValue();
|
||||
|
||||
if (op.getExtensions() != null && Boolean.TRUE.equals(op.getExtensions().get("x-internal"))) {
|
||||
if (op.getExtensions() != null && Boolean.TRUE.equals(op.getExtensions().get(X_INTERNAL))) {
|
||||
// skip operation if x-internal sets to true
|
||||
LOGGER.info("Operation ({} {} - {}) not generated since x-internal is set to true",
|
||||
method, expression, op.getOperationId());
|
||||
|
||||
@@ -61,6 +61,7 @@ import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.removeStart;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_INTERNAL;
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -486,7 +487,7 @@ public class DefaultGenerator implements Generator {
|
||||
|
||||
Schema schema = ModelUtils.getSchemas(this.openAPI).get(name);
|
||||
|
||||
if (schema.getExtensions() != null && Boolean.TRUE.equals(schema.getExtensions().get("x-internal"))) {
|
||||
if (schema.getExtensions() != null && Boolean.TRUE.equals(schema.getExtensions().get(X_INTERNAL))) {
|
||||
LOGGER.info("Model {} not generated since x-internal is set to true", name);
|
||||
continue;
|
||||
} else if (ModelUtils.isFreeFormObject(schema, openAPI)) { // check to see if it's a free-form object
|
||||
@@ -1564,7 +1565,7 @@ public class DefaultGenerator implements Generator {
|
||||
final List<SecurityRequirement> globalSecurities = openAPI.getSecurity();
|
||||
for (Tag tag : tags) {
|
||||
try {
|
||||
if (operation.getExtensions() != null && Boolean.TRUE.equals(operation.getExtensions().get("x-internal"))) {
|
||||
if (operation.getExtensions() != null && Boolean.TRUE.equals(operation.getExtensions().get(X_INTERNAL))) {
|
||||
// skip operation if x-internal sets to true
|
||||
LOGGER.info("Operation ({} {} - {}) not generated since x-internal is set to true",
|
||||
httpMethod, resourcePath, operation.getOperationId());
|
||||
|
||||
@@ -37,6 +37,8 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.CodegenConstants.X_INTERNAL;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_PARENT;
|
||||
import static org.openapitools.codegen.utils.ModelUtils.simplifyOneOfAnyOfWithOnlyOneNonNullSubSchema;
|
||||
import static org.openapitools.codegen.utils.StringUtils.getUniqueString;
|
||||
|
||||
@@ -127,7 +129,6 @@ public class OpenAPINormalizer {
|
||||
|
||||
// when set to true, remove x-internal: true from models, operations
|
||||
final String REMOVE_X_INTERNAL = "REMOVE_X_INTERNAL";
|
||||
final String X_INTERNAL = "x-internal";
|
||||
boolean removeXInternal;
|
||||
|
||||
// when set (e.g. operationId:getPetById|addPet), filter out (or remove) everything else
|
||||
@@ -431,17 +432,17 @@ public class OpenAPINormalizer {
|
||||
for (Operation operation : operations) {
|
||||
if (operationIdFilters.size() > 0) {
|
||||
if (operationIdFilters.contains(operation.getOperationId())) {
|
||||
operation.addExtension("x-internal", false);
|
||||
operation.addExtension(X_INTERNAL, false);
|
||||
} else {
|
||||
LOGGER.info("operation `{}` marked as internal only (x-internal: true) by the operationId FILTER", operation.getOperationId());
|
||||
operation.addExtension("x-internal", true);
|
||||
operation.addExtension(X_INTERNAL, true);
|
||||
}
|
||||
} else if (!tagFilters.isEmpty()) {
|
||||
if (operation.getTags().stream().anyMatch(tagFilters::contains)) {
|
||||
operation.addExtension("x-internal", false);
|
||||
operation.addExtension(X_INTERNAL, false);
|
||||
} else {
|
||||
LOGGER.info("operation `{}` marked as internal only (x-internal: true) by the tag FILTER", operation.getOperationId());
|
||||
operation.addExtension("x-internal", true);
|
||||
operation.addExtension(X_INTERNAL, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,15 +724,17 @@ public class OpenAPINormalizer {
|
||||
if (skipNormalization(schema, visitedSchemas)) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
if (ModelUtils.isNullTypeSchema(openAPI, schema)) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
markSchemaAsVisited(schema, visitedSchemas);
|
||||
|
||||
if (ModelUtils.isArraySchema(schema)) { // array
|
||||
Schema result = normalizeArraySchema(schema);
|
||||
normalizeSchema(result.getItems(), visitedSchemas);
|
||||
return result;
|
||||
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
|
||||
normalizeMapSchema(schema);
|
||||
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
|
||||
} else if (ModelUtils.isOneOf(schema)) { // oneOf
|
||||
return normalizeOneOf(schema, visitedSchemas);
|
||||
} else if (ModelUtils.isAnyOf(schema)) { // anyOf
|
||||
@@ -768,6 +771,9 @@ public class OpenAPINormalizer {
|
||||
return schema;
|
||||
} else if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
|
||||
normalizeProperties(schema.getProperties(), visitedSchemas);
|
||||
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
|
||||
normalizeMapSchema(schema);
|
||||
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
|
||||
} else if (schema instanceof BooleanSchema) {
|
||||
normalizeBooleanSchema(schema, visitedSchemas);
|
||||
} else if (schema instanceof IntegerSchema) {
|
||||
@@ -849,6 +855,20 @@ public class OpenAPINormalizer {
|
||||
}
|
||||
for (Map.Entry<String, Schema> propertiesEntry : properties.entrySet()) {
|
||||
Schema property = propertiesEntry.getValue();
|
||||
|
||||
// remove x-internal if needed (same logic as normalizeComponentsSchemas)
|
||||
if (property.getExtensions() != null && getRule(REMOVE_X_INTERNAL)) {
|
||||
Object xInternalValue = property.getExtensions().get(X_INTERNAL);
|
||||
boolean isInternal = false;
|
||||
if (xInternalValue instanceof Boolean) {
|
||||
isInternal = (Boolean) xInternalValue;
|
||||
} else if (xInternalValue instanceof String) {
|
||||
isInternal = Boolean.parseBoolean((String) xInternalValue);
|
||||
}
|
||||
if (isInternal) {
|
||||
property.getExtensions().remove(X_INTERNAL);
|
||||
}
|
||||
}
|
||||
Schema newProperty = normalizeSchema(property, new HashSet<>());
|
||||
propertiesEntry.setValue(newProperty);
|
||||
}
|
||||
@@ -1011,6 +1031,7 @@ public class OpenAPINormalizer {
|
||||
if (schema.getAnyOf() == null) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
for (int i = 0; i < schema.getAnyOf().size(); i++) {
|
||||
// normalize anyOf sub schemas one by one
|
||||
Object item = schema.getAnyOf().get(i);
|
||||
@@ -1083,10 +1104,10 @@ public class OpenAPINormalizer {
|
||||
refSchema.setExtensions(new HashMap<>());
|
||||
}
|
||||
|
||||
if (refSchema.getExtensions().containsKey("x-parent")) {
|
||||
if (refSchema.getExtensions().containsKey(X_PARENT)) {
|
||||
// doing nothing as x-parent already exists
|
||||
} else {
|
||||
refSchema.getExtensions().put("x-parent", true);
|
||||
refSchema.getExtensions().put(X_PARENT, true);
|
||||
}
|
||||
|
||||
LOGGER.debug("processUseAllOfRefAsParent added `x-parent: true` to {}", refSchema);
|
||||
@@ -1108,7 +1129,7 @@ public class OpenAPINormalizer {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Boolean.parseBoolean(String.valueOf(operation.getExtensions().get("x-internal")))) {
|
||||
if (Boolean.parseBoolean(String.valueOf(operation.getExtensions().get(X_INTERNAL)))) {
|
||||
operation.getExtensions().remove(X_INTERNAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public enum VendorExtension {
|
||||
X_KOTLIN_IMPLEMENTS("x-kotlin-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implement", "empty array"),
|
||||
X_KOTLIN_IMPLEMENTS_FIELDS("x-kotlin-implements-fields", ExtensionLevel.MODEL, "Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`", "empty array"),
|
||||
X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.", "false"),
|
||||
X_SPRING_API_VERSION("x-spring-api-version", ExtensionLevel.OPERATION, "Value for 'version' attribute in @RequestMapping (for Spring 7 and above).", null),
|
||||
X_SPRING_PROVIDE_ARGS("x-spring-provide-args", ExtensionLevel.OPERATION, "Allows adding additional hidden parameters in the API specification to allow access to content such as header values or properties", "empty array"),
|
||||
X_DISCRIMINATOR_VALUE("x-discriminator-value", ExtensionLevel.MODEL, "Used with model inheritance to specify value for discriminator that identifies current model", ""),
|
||||
X_SETTER_EXTRA_ANNOTATION("x-setter-extra-annotation", ExtensionLevel.FIELD, "Custom annotation that can be specified over java setter for specific field", "When field is array & uniqueItems, then this extension is used to add `@JsonDeserialize(as = LinkedHashSet.class)` over setter, otherwise no value"),
|
||||
@@ -26,8 +27,7 @@ public enum VendorExtension {
|
||||
X_OPERATION_EXTRA_ANNOTATION("x-operation-extra-annotation", ExtensionLevel.OPERATION, "List of custom annotations to be added to operation", null),
|
||||
X_VERSION_PARAM("x-version-param", ExtensionLevel.OPERATION_PARAMETER, "Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false", null),
|
||||
X_PATTERN_MESSAGE("x-pattern-message", Arrays.asList(ExtensionLevel.FIELD, ExtensionLevel.OPERATION_PARAMETER), "Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable", null),
|
||||
X_ZERO_BASED_ENUM("x-zero-based-enum", ExtensionLevel.MODEL, "When used on an enum, the index will not be generated and the default numbering will be used, zero-based", "false"),
|
||||
;
|
||||
X_ZERO_BASED_ENUM("x-zero-based-enum", ExtensionLevel.MODEL, "When used on an enum, the index will not be generated and the default numbering will be used, zero-based", "false");
|
||||
|
||||
private final String name;
|
||||
private final List<ExtensionLevel> levels;
|
||||
|
||||
@@ -46,6 +46,7 @@ import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.CodegenConstants.*;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.ModelUtils.getSchemaItems;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
@@ -116,6 +117,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
// A cache to efficiently lookup schema `toModelName()` based on the schema Key
|
||||
private final Map<String, String> schemaKeyToModelNameCache = new HashMap<>();
|
||||
|
||||
// A cache to efficiently lookup CodegenModel `fromModel(codegenModelName, parentModelSchema)` based on the pair of model name and schema
|
||||
private final Map<Map.Entry<String, Schema>, CodegenModel> codegenModelNameAndSchemaKeyToCodegenModelCache = new HashMap<>();
|
||||
|
||||
public AbstractCSharpCodegen() {
|
||||
super();
|
||||
|
||||
@@ -543,7 +547,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
if (dataTypeSet.contains(oneOfProperty.dataType)) {
|
||||
// add "x-duplicated-data-type" to indicate if the dataType already occurs before
|
||||
// in other sub-schemas of allOf/anyOf/oneOf
|
||||
oneOfProperty.vendorExtensions.putIfAbsent("x-composed-data-type", true);
|
||||
oneOfProperty.vendorExtensions.putIfAbsent(X_COMPOSED_DATA_TYPE, true);
|
||||
} else {
|
||||
dataTypeSet.add(oneOfProperty.dataType);
|
||||
}
|
||||
@@ -557,7 +561,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
if (dataTypeSet.contains(anyOfProperty.dataType)) {
|
||||
// add "x-duplicated-data-type" to indicate if the dataType already occurs before
|
||||
// in other sub-schemas of allOf/anyOf/oneOf
|
||||
anyOfProperty.vendorExtensions.putIfAbsent("x-composed-data-type", true);
|
||||
anyOfProperty.vendorExtensions.putIfAbsent(X_COMPOSED_DATA_TYPE, true);
|
||||
} else {
|
||||
dataTypeSet.add(anyOfProperty.dataType);
|
||||
}
|
||||
@@ -619,7 +623,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
continue;
|
||||
}
|
||||
|
||||
model.vendorExtensions.put("x-model-is-mutable", modelIsMutable(model, null));
|
||||
model.vendorExtensions.put(X_MODEL_IS_MUTABLE, modelIsMutable(model, null));
|
||||
|
||||
CodegenComposedSchemas composedSchemas = model.getComposedSchemas();
|
||||
if (composedSchemas != null) {
|
||||
@@ -639,7 +643,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
patchProperty(enumRefs, model, property);
|
||||
property.name = patchPropertyName(model, property, camelize(property.baseType), composedPropertyNames);
|
||||
property.isNullable = true;
|
||||
property.vendorExtensions.put("x-base-name", model.name.substring(model.name.lastIndexOf('_') + 1));
|
||||
property.vendorExtensions.put(X_BASE_NAME, model.name.substring(model.name.lastIndexOf('_') + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +654,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
patchProperty(enumRefs, model, property);
|
||||
property.name = patchPropertyName(model, property, camelize(property.baseType), composedPropertyNames);
|
||||
property.isNullable = true;
|
||||
property.vendorExtensions.put("x-base-name", model.name.substring(model.name.lastIndexOf('_') + 1));
|
||||
property.vendorExtensions.put(X_BASE_NAME, model.name.substring(model.name.lastIndexOf('_') + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -784,10 +788,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
|
||||
private void patchPropertyVendorExtensions(CodegenProperty property) {
|
||||
boolean isValueType = isValueType(property);
|
||||
property.vendorExtensions.put("x-is-value-type", isValueType);
|
||||
property.vendorExtensions.put("x-is-reference-type", !isValueType);
|
||||
property.vendorExtensions.put("x-is-nullable-type", this.getNullableReferencesTypes() || isValueType);
|
||||
property.vendorExtensions.put("x-is-base-or-new-discriminator", (property.isDiscriminator && !property.isInherited) || (property.isDiscriminator && property.isNew));
|
||||
property.vendorExtensions.put(X_IS_VALUE_TYPE, isValueType);
|
||||
property.vendorExtensions.put(X_IS_REFERENCE_TYPE, !isValueType);
|
||||
property.vendorExtensions.put(X_IS_NULLABLE_TYPE, this.getNullableReferencesTypes() || isValueType);
|
||||
property.vendorExtensions.put(X_IS_BASE_OR_NEW_DISCRIMINATOR, (property.isDiscriminator && !property.isInherited) || (property.isDiscriminator && property.isNew));
|
||||
}
|
||||
|
||||
protected void patchPropertyIsInherited(CodegenModel model, CodegenProperty property) {
|
||||
@@ -888,7 +892,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
// Because C# uses nullable primitives for datatype, and datatype is used in DefaultCodegen for determining enum-ness, guard against weirdness here.
|
||||
if (var.isEnum) {
|
||||
if ("byte".equals(var.dataFormat)) {// C# Actually supports byte and short enums.
|
||||
var.vendorExtensions.put("x-enum-byte", true);
|
||||
var.vendorExtensions.put(X_ENUM_BYTE, true);
|
||||
var.isString = false;
|
||||
var.isLong = false;
|
||||
var.isInteger = false;
|
||||
@@ -909,7 +913,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
}
|
||||
|
||||
private void postProcessResponseCode(CodegenResponse response, String status, Set<String> httpStatusesWithReturn) {
|
||||
response.vendorExtensions.put("x-http-status", status);
|
||||
response.vendorExtensions.put(X_HTTP_STATUS, status);
|
||||
if (response.dataType != null) {
|
||||
httpStatusesWithReturn.add(status);
|
||||
}
|
||||
@@ -942,11 +946,11 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
}
|
||||
|
||||
private void postProcessOperations(OperationMap operations, List<ModelMap> allModels) {
|
||||
Set<String> httpStatusesWithReturn = additionalProperties.get("x-http-statuses-with-return") instanceof Set<?>
|
||||
? (Set<String>) additionalProperties.get("x-http-statuses-with-return")
|
||||
Set<String> httpStatusesWithReturn = additionalProperties.get(X_HTTP_STATUSES_WITH_RETURN) instanceof Set<?>
|
||||
? (Set<String>) additionalProperties.get(X_HTTP_STATUSES_WITH_RETURN)
|
||||
: new HashSet<String>();
|
||||
|
||||
additionalProperties.put("x-http-statuses-with-return", httpStatusesWithReturn);
|
||||
additionalProperties.put(X_HTTP_STATUSES_WITH_RETURN, httpStatusesWithReturn);
|
||||
|
||||
HashMap<String, CodegenModel> modelMaps = ModelMap.toCodegenModelMap(allModels);
|
||||
|
||||
@@ -955,7 +959,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
for (CodegenOperation operation : ops) {
|
||||
String duplicates = duplicateOf.get(operation.operationId);
|
||||
if (duplicates != null) {
|
||||
operation.vendorExtensions.put("x-duplicates", duplicates);
|
||||
operation.vendorExtensions.put(X_DUPLICATES, duplicates);
|
||||
} else {
|
||||
duplicateOf.put(operation.operationId, operations.getClassname());
|
||||
}
|
||||
@@ -964,13 +968,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
|
||||
if (response.returnProperty != null) {
|
||||
Boolean isValueType = isValueType(response.returnProperty);
|
||||
response.vendorExtensions.put("x-is-value-type", isValueType);
|
||||
response.vendorExtensions.put("x-is-reference-type", !isValueType);
|
||||
response.vendorExtensions.put(X_IS_VALUE_TYPE, isValueType);
|
||||
response.vendorExtensions.put(X_IS_REFERENCE_TYPE, !isValueType);
|
||||
}
|
||||
|
||||
if (response.headers != null && response.headers.stream().anyMatch(h -> h.baseName.equals("Set-Cookie"))) {
|
||||
response.vendorExtensions.put("x-set-cookie", true);
|
||||
operation.vendorExtensions.put("x-set-cookie", true);
|
||||
response.vendorExtensions.put(X_SET_COOKIE, true);
|
||||
operation.vendorExtensions.put(X_SET_COOKIE, true);
|
||||
}
|
||||
|
||||
String code = response.code.toLowerCase(Locale.ROOT);
|
||||
@@ -978,9 +982,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
case "default":
|
||||
case "0":
|
||||
postProcessResponseCode(response, "Default", httpStatusesWithReturn);
|
||||
response.vendorExtensions.put("x-http-status-is-default", true);
|
||||
response.vendorExtensions.put(X_HTTP_STATUS_IS_DEFAULT, true);
|
||||
if ((long) operation.responses.size() == 1) {
|
||||
response.vendorExtensions.put("x-only-default", true);
|
||||
response.vendorExtensions.put(X_ONLY_DEFAULT, true);
|
||||
}
|
||||
break;
|
||||
case "100":
|
||||
@@ -1161,23 +1165,23 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
postProcessResponseCode(response, "NetworkAuthenticationRequired", httpStatusesWithReturn);
|
||||
break;
|
||||
case "1xx":
|
||||
response.vendorExtensions.put("x-http-status-range", 1);
|
||||
response.vendorExtensions.put(X_HTTP_STATUS_RANGE, 1);
|
||||
postProcessResponseCode(response, "HttpStatusCode1XX", httpStatusesWithReturn);
|
||||
break;
|
||||
case "2xx":
|
||||
response.vendorExtensions.put("x-http-status-range", 2);
|
||||
response.vendorExtensions.put(X_HTTP_STATUS_RANGE, 2);
|
||||
postProcessResponseCode(response, "HttpStatusCode2XX", httpStatusesWithReturn);
|
||||
break;
|
||||
case "3xx":
|
||||
response.vendorExtensions.put("x-http-status-range", 3);
|
||||
response.vendorExtensions.put(X_HTTP_STATUS_RANGE, 3);
|
||||
postProcessResponseCode(response, "HttpStatusCode3XX", httpStatusesWithReturn);
|
||||
break;
|
||||
case "4xx":
|
||||
response.vendorExtensions.put("x-http-status-range", 4);
|
||||
response.vendorExtensions.put(X_HTTP_STATUS_RANGE, 4);
|
||||
postProcessResponseCode(response, "HttpStatusCode4XX", httpStatusesWithReturn);
|
||||
break;
|
||||
case "5xx":
|
||||
response.vendorExtensions.put("x-http-status-range", 5);
|
||||
response.vendorExtensions.put(X_HTTP_STATUS_RANGE, 5);
|
||||
postProcessResponseCode(response, "HttpStatusCode5XX", httpStatusesWithReturn);
|
||||
break;
|
||||
default:
|
||||
@@ -1278,9 +1282,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
patchParameter(model, parameter);
|
||||
}
|
||||
|
||||
List<CodegenParameter> referenceTypes = operation.allParams.stream().filter(p -> p.vendorExtensions.get("x-is-value-type") == null && !p.isNullable).collect(Collectors.toList());
|
||||
operation.vendorExtensions.put("x-not-nullable-reference-types", referenceTypes);
|
||||
operation.vendorExtensions.put("x-has-not-nullable-reference-types", referenceTypes.size() > 0);
|
||||
List<CodegenParameter> referenceTypes = operation.allParams.stream().filter(p -> p.vendorExtensions.get(X_IS_VALUE_TYPE) == null && !p.isNullable).collect(Collectors.toList());
|
||||
operation.vendorExtensions.put(X_NOT_NULLABLE_REFERENCE_TYPES, referenceTypes);
|
||||
operation.vendorExtensions.put(X_HAS_NOT_NULLABLE_REFERENCE_TYPES, referenceTypes.size() > 0);
|
||||
processOperation(operation);
|
||||
|
||||
// Remove constant params from allParams list and add to constantParams
|
||||
@@ -1291,7 +1295,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
|
||||
protected void patchVendorExtensionNullableValueType(CodegenParameter parameter) {
|
||||
if (parameter.isNullable && !parameter.isContainer && (this.getValueTypes().contains(parameter.dataType) || parameter.isEnum)) {
|
||||
parameter.vendorExtensions.put("x-nullable-value-type", true);
|
||||
parameter.vendorExtensions.put(X_NULLABLE_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1307,15 +1311,15 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
*/
|
||||
protected void patchVendorExtensionNullableValueTypeLegacy(CodegenParameter parameter) {
|
||||
if (parameter.isNullable && !parameter.isContainer && (this.getNullableTypes().contains(parameter.dataType) || parameter.isEnum)) {
|
||||
parameter.vendorExtensions.put("x-nullable-value-type", true);
|
||||
parameter.vendorExtensions.put(X_NULLABLE_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void patchParameter(CodegenModel model, CodegenParameter parameter) {
|
||||
patchVendorExtensionNullableValueType(parameter);
|
||||
|
||||
if (this.getNullableReferencesTypes() || (parameter.vendorExtensions.get("x-nullable-value-type") != null)) {
|
||||
parameter.vendorExtensions.put("x-nullable-type", true);
|
||||
if (this.getNullableReferencesTypes() || (parameter.vendorExtensions.get(X_NULLABLE_VALUE_TYPE) != null)) {
|
||||
parameter.vendorExtensions.put(X_NULLABLE_TYPE, true);
|
||||
}
|
||||
|
||||
if (!isSupportNullable()) {
|
||||
@@ -1362,12 +1366,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
parameter.isEnum = true;
|
||||
parameter.allowableValues = model.allowableValues;
|
||||
parameter.isPrimitiveType = true;
|
||||
parameter.vendorExtensions.put("x-csharp-value-type", true);
|
||||
parameter.vendorExtensions.put(X_CSHARP_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!parameter.isContainer && this.getNullableTypes().contains(parameter.dataType)) {
|
||||
parameter.vendorExtensions.put("x-csharp-value-type", true);
|
||||
parameter.vendorExtensions.put(X_CSHARP_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1377,12 +1381,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
parameter.isEnum = true;
|
||||
parameter.allowableValues = model.allowableValues;
|
||||
parameter.isPrimitiveType = true;
|
||||
parameter.vendorExtensions.put("x-is-value-type", true);
|
||||
parameter.vendorExtensions.put(X_IS_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!parameter.isContainer && this.getValueTypes().contains(parameter.dataType)) {
|
||||
parameter.vendorExtensions.put("x-is-value-type", true);
|
||||
parameter.vendorExtensions.put(X_IS_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1703,6 +1707,17 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
return toModelName(name) + "Tests";
|
||||
}
|
||||
|
||||
protected CodegenModel getCodegenModel(String codegenModelName, Schema schema){
|
||||
var key = new AbstractMap.SimpleEntry<>(codegenModelName, schema);
|
||||
if(codegenModelNameAndSchemaKeyToCodegenModelCache.containsKey(key)){
|
||||
return codegenModelNameAndSchemaKeyToCodegenModelCache.get(key);
|
||||
}
|
||||
|
||||
CodegenModel model = super.fromModel(codegenModelName, schema);
|
||||
codegenModelNameAndSchemaKeyToCodegenModelCache.put(key, model);
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setNullableReferenceTypes(final Boolean nullReferenceTypesFlag) {
|
||||
this.nullReferenceTypesFlag = nullReferenceTypesFlag;
|
||||
additionalProperties.put("nullableReferenceTypes", nullReferenceTypesFlag);
|
||||
@@ -2050,13 +2065,13 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
||||
} else if (c == 'l') {
|
||||
modifiers.remove("CultureInvariant");
|
||||
} else {
|
||||
vendorExtensions.put("x-modifier-" + c, c);
|
||||
vendorExtensions.put(X_MODIFIER_PREFIX + c, c);
|
||||
}
|
||||
}
|
||||
|
||||
String regex = pattern.substring(start, end).replace("\"", "\"\"");
|
||||
vendorExtensions.put("x-regex", regex);
|
||||
vendorExtensions.put("x-modifiers", modifiers);
|
||||
vendorExtensions.put(X_REGEX, regex);
|
||||
vendorExtensions.put(X_MODIFIERS, modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.CodegenConstants.X_ENUM_BYTE;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
@@ -433,7 +434,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
if (model.dataType.startsWith("byte")) {
|
||||
// F# Actually supports byte and short enums, swagger spec only supports byte.
|
||||
isByte = true;
|
||||
model.vendorExtensions.put("x-enum-byte", true);
|
||||
model.vendorExtensions.put(X_ENUM_BYTE, true);
|
||||
} else if (model.dataType.startsWith("int32")) {
|
||||
isInteger = true;
|
||||
model.vendorExtensions.put("x-enum-integer", true);
|
||||
@@ -487,7 +488,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
// Because C# uses nullable primitives for datatype, and datatype is used in DefaultCodegen for determining enum-ness, guard against weirdness here.
|
||||
if (var.isEnum) {
|
||||
if ("byte".equals(var.dataFormat)) {// C# Actually supports byte and short enums.
|
||||
var.vendorExtensions.put("x-enum-byte", true);
|
||||
var.vendorExtensions.put(X_ENUM_BYTE, true);
|
||||
var.isString = false;
|
||||
var.isLong = false;
|
||||
var.isInteger = false;
|
||||
|
||||
@@ -40,6 +40,8 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.CodegenConstants.X_MODIFIERS;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_REGEX;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
|
||||
@@ -1353,9 +1355,9 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
}
|
||||
|
||||
vendorExtensions.put("x-regex", regex.replace("\"", "\\\""));
|
||||
vendorExtensions.put(X_REGEX, regex.replace("\"", "\\\""));
|
||||
vendorExtensions.put("x-pattern", pattern.replace("\"", "\\\""));
|
||||
vendorExtensions.put("x-modifiers", modifiers);
|
||||
vendorExtensions.put(X_MODIFIERS, modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static org.openapitools.codegen.CodegenConstants.X_MODIFIERS;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_REGEX;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
public abstract class AbstractPythonConnexionServerCodegen extends AbstractPythonCodegen implements CodegenConfig {
|
||||
@@ -743,8 +745,8 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
}
|
||||
}
|
||||
|
||||
vendorExtensions.put("x-regex", regex);
|
||||
vendorExtensions.put("x-modifiers", modifiers);
|
||||
vendorExtensions.put(X_REGEX, regex);
|
||||
vendorExtensions.put(X_MODIFIERS, modifiers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.CodegenConstants.X_MODIFIERS;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_REGEX;
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
@@ -1915,9 +1917,9 @@ public abstract class AbstractPythonPydanticV1Codegen extends DefaultCodegen imp
|
||||
}
|
||||
}
|
||||
|
||||
vendorExtensions.put("x-regex", regex.replace("\"", "\\\""));
|
||||
vendorExtensions.put(X_REGEX, regex.replace("\"", "\\\""));
|
||||
vendorExtensions.put("x-pattern", pattern.replace("\"", "\\\""));
|
||||
vendorExtensions.put("x-modifiers", modifiers);
|
||||
vendorExtensions.put(X_MODIFIERS, modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.UUID.randomUUID;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_CSHARP_VALUE_TYPE;
|
||||
|
||||
public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
@@ -347,7 +348,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
protected void updateCodegenParameterEnum(CodegenParameter parameter, CodegenModel model) {
|
||||
super.updateCodegenParameterEnumLegacy(parameter, model);
|
||||
|
||||
if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional
|
||||
if (!parameter.required && parameter.vendorExtensions.get(X_CSHARP_VALUE_TYPE) != null) { //optional
|
||||
parameter.dataType = parameter.dataType + "?";
|
||||
}
|
||||
}
|
||||
@@ -627,7 +628,7 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen {
|
||||
super.patchProperty(enumRefs, model, property);
|
||||
|
||||
if (!property.isContainer && (this.getNullableTypes().contains(property.dataType) || property.isEnum)) {
|
||||
property.vendorExtensions.put("x-csharp-value-type", true);
|
||||
property.vendorExtensions.put(X_CSHARP_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_CSHARP_VALUE_TYPE;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
@@ -409,7 +410,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
super.updateCodegenParameterEnumLegacy(parameter, model);
|
||||
|
||||
if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional
|
||||
if (!parameter.required && parameter.vendorExtensions.get(X_CSHARP_VALUE_TYPE) != null) { //optional
|
||||
parameter.dataType = parameter.dataType + "?";
|
||||
}
|
||||
}
|
||||
@@ -436,7 +437,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null) {
|
||||
final Schema<?> parentModel = allDefinitions.get(toModelName(codegenModel.parent));
|
||||
if (parentModel != null) {
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||
final CodegenModel parentCodegenModel = getCodegenModel(codegenModel.parent, parentModel);
|
||||
if (codegenModel.hasEnums) {
|
||||
codegenModel = this.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||
}
|
||||
@@ -1626,7 +1627,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
if (!GENERICHOST.equals(getLibrary())) {
|
||||
if (!property.isContainer && (this.getNullableTypes().contains(property.dataType) || property.isEnum)) {
|
||||
property.vendorExtensions.put("x-csharp-value-type", true);
|
||||
property.vendorExtensions.put(X_CSHARP_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.UUID.randomUUID;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_CSHARP_VALUE_TYPE;
|
||||
|
||||
public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
|
||||
|
||||
@@ -287,7 +288,7 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
|
||||
super.patchProperty(enumRefs, model, property);
|
||||
|
||||
if (!property.isContainer && (this.getNullableTypes().contains(property.dataType) || property.isEnum)) {
|
||||
property.vendorExtensions.put("x-csharp-value-type", true);
|
||||
property.vendorExtensions.put(X_CSHARP_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +296,7 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen {
|
||||
protected void updateCodegenParameterEnum(CodegenParameter parameter, CodegenModel model) {
|
||||
super.updateCodegenParameterEnumLegacy(parameter, model);
|
||||
|
||||
if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional
|
||||
if (!parameter.required && parameter.vendorExtensions.get(X_CSHARP_VALUE_TYPE) != null) { //optional
|
||||
parameter.dataType = parameter.dataType + "?";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isEmpty;
|
||||
import static org.openapitools.codegen.CodegenConstants.X_CSHARP_VALUE_TYPE;
|
||||
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
@@ -350,7 +351,7 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
super.patchProperty(enumRefs, model, property);
|
||||
|
||||
if (!property.isContainer && (this.getNullableTypes().contains(property.dataType) || property.isEnum)) {
|
||||
property.vendorExtensions.put("x-csharp-value-type", true);
|
||||
property.vendorExtensions.put(X_CSHARP_VALUE_TYPE, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +359,7 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
protected void updateCodegenParameterEnum(CodegenParameter parameter, CodegenModel model) {
|
||||
super.updateCodegenParameterEnumLegacy(parameter, model);
|
||||
|
||||
if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional
|
||||
if (!parameter.required && parameter.vendorExtensions.get(X_CSHARP_VALUE_TYPE) != null) { //optional
|
||||
parameter.dataType = parameter.dataType + "?";
|
||||
}
|
||||
}
|
||||
@@ -380,7 +381,7 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen {
|
||||
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null) {
|
||||
final Schema parentModel = allDefinitions.get(toModelName(codegenModel.parent));
|
||||
if (parentModel != null) {
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||
final CodegenModel parentCodegenModel = getCodegenModel(codegenModel.parent, parentModel);
|
||||
if (codegenModel.hasEnums) {
|
||||
codegenModel = this.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||
}
|
||||
|
||||
@@ -226,6 +226,7 @@ public class ElixirClientCodegen extends DefaultCodegen {
|
||||
typeMapping.put("date", "Date.t");
|
||||
typeMapping.put("date-time", "DateTime.t");
|
||||
// other
|
||||
typeMapping.put("AnyType", "any()");
|
||||
typeMapping.put("ByteArray", "binary()");
|
||||
typeMapping.put("DateTime", "DateTime.t");
|
||||
typeMapping.put("UUID", "String.t");
|
||||
|
||||
@@ -58,6 +58,7 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
@Setter private boolean preferUnsignedInt = false;
|
||||
@Setter private boolean bestFitInt = false;
|
||||
@Setter private boolean avoidBoxedModels = false;
|
||||
private List<String> reqwestDefaultFeatures = Arrays.asList("native-tls");
|
||||
|
||||
public static final String PACKAGE_NAME = "packageName";
|
||||
public static final String EXTERN_CRATE_NAME = "externCrateName";
|
||||
@@ -77,6 +78,7 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
public static final String TOP_LEVEL_API_CLIENT = "topLevelApiClient";
|
||||
public static final String MOCKALL = "mockall";
|
||||
public static final String BON_BUILDER = "useBonBuilder";
|
||||
public static final String REQWEST_DEFAULT_FEATURES = "reqwestDefaultFeatures";
|
||||
|
||||
@Setter protected String packageName = "openapi";
|
||||
@Setter protected String packageVersion = "1.0.0";
|
||||
@@ -227,6 +229,8 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
.defaultValue(Boolean.FALSE.toString()));
|
||||
cliOptions.add(new CliOption(BON_BUILDER, "Use the bon crate for building parameter types. This option is for the 'reqwest-trait' library only", SchemaTypeUtil.BOOLEAN_TYPE)
|
||||
.defaultValue(Boolean.FALSE.toString()));
|
||||
cliOptions.add(new CliOption(REQWEST_DEFAULT_FEATURES, "Default features for the reqwest dependency (comma-separated). Use empty for no defaults. This option is for 'reqwest' and 'reqwest-trait' library only.")
|
||||
.defaultValue("native-tls"));
|
||||
|
||||
supportedLibraries.put(HYPER_LIBRARY, "HTTP client: Hyper (v1.x).");
|
||||
supportedLibraries.put(HYPER0X_LIBRARY, "HTTP client: Hyper (v0.x).");
|
||||
@@ -431,6 +435,21 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
}
|
||||
writePropertyBack(AVOID_BOXED_MODELS, getAvoidBoxedModels());
|
||||
|
||||
if (additionalProperties.containsKey(REQWEST_DEFAULT_FEATURES)) {
|
||||
Object value = additionalProperties.get(REQWEST_DEFAULT_FEATURES);
|
||||
if (value instanceof List) {
|
||||
reqwestDefaultFeatures = (List<String>) value;
|
||||
} else if (value instanceof String) {
|
||||
String str = (String) value;
|
||||
if (str.isEmpty()) {
|
||||
reqwestDefaultFeatures = new ArrayList<>();
|
||||
} else {
|
||||
reqwestDefaultFeatures = Arrays.asList(str.split(",\\s*"));
|
||||
}
|
||||
}
|
||||
}
|
||||
additionalProperties.put(REQWEST_DEFAULT_FEATURES, reqwestDefaultFeatures);
|
||||
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
|
||||
additionalProperties.put(EXTERN_CRATE_NAME, getExternCrateName());
|
||||
|
||||
@@ -100,6 +100,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
public static final String OPTIONAL_ACCEPT_NULLABLE = "optionalAcceptNullable";
|
||||
public static final String USE_SPRING_BUILT_IN_VALIDATION = "useSpringBuiltInValidation";
|
||||
public static final String USE_DEDUCTION_FOR_ONE_OF_INTERFACES = "useDeductionForOneOfInterfaces";
|
||||
public static final String SPRING_API_VERSION = "springApiVersion";
|
||||
|
||||
@Getter
|
||||
public enum RequestMappingMode {
|
||||
@@ -286,6 +287,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
optionalAcceptNullable));
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_DEDUCTION_FOR_ONE_OF_INTERFACES, "whether to use deduction for generated oneOf interfaces", useDeductionForOneOfInterfaces));
|
||||
cliOptions.add(CliOption.newString(SPRING_API_VERSION, "Value for 'version' attribute in @RequestMapping (for Spring 7 and above)."));
|
||||
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
|
||||
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
|
||||
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
|
||||
@@ -855,6 +857,8 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
}
|
||||
|
||||
private void prepareVersioningParameters(List<CodegenOperation> operations) {
|
||||
Object apiVersion = additionalProperties.get(SPRING_API_VERSION);
|
||||
boolean hasApiVersion = apiVersion != null;
|
||||
for (CodegenOperation operation : operations) {
|
||||
if (operation.getHasHeaderParams()) {
|
||||
List<CodegenParameter> versionParams = operation.headerParams.stream()
|
||||
@@ -877,6 +881,9 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
operation.hasVersionQueryParams = !versionParams.isEmpty();
|
||||
operation.vendorExtensions.put("versionQueryParamsList", versionParams);
|
||||
}
|
||||
if (hasApiVersion) {
|
||||
operation.vendorExtensions.putIfAbsent(VendorExtension.X_SPRING_API_VERSION.getName(), apiVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -981,6 +988,11 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
codegenModel.imports.remove("ApiModel");
|
||||
}
|
||||
|
||||
if (getAnnotationLibrary() != AnnotationLibrary.SWAGGER2) {
|
||||
// remove swagger imports
|
||||
codegenModel.imports.remove("Schema");
|
||||
}
|
||||
|
||||
return codegenModel;
|
||||
}
|
||||
|
||||
@@ -1205,6 +1217,7 @@ public class SpringCodegen extends AbstractJavaCodegen
|
||||
extensions.add(VendorExtension.X_SPRING_PAGINATED);
|
||||
extensions.add(VendorExtension.X_VERSION_PARAM);
|
||||
extensions.add(VendorExtension.X_PATTERN_MESSAGE);
|
||||
extensions.add(VendorExtension.X_SPRING_API_VERSION);
|
||||
return extensions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,8 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
private final DateTimeFormatter iso8601Date = DateTimeFormatter.ISO_DATE;
|
||||
private final DateTimeFormatter iso8601DateTime = DateTimeFormatter.ISO_DATE_TIME;
|
||||
|
||||
protected String apiDocPath = "docs/";
|
||||
|
||||
public TypeScriptClientCodegen() {
|
||||
super();
|
||||
|
||||
@@ -400,6 +402,11 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
private List<Map<String, String>> toTsImports(CodegenModel cm, Set<String> imports) {
|
||||
List<Map<String, String>> tsImports = new ArrayList<>();
|
||||
for (String im : imports) {
|
||||
@@ -432,6 +439,8 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp
|
||||
apiPackage = this.apiPackage + ".apis";
|
||||
testPackage = this.testPackage + ".tests";
|
||||
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
|
||||
additionalProperties.putIfAbsent(FRAMEWORK_SWITCH, FRAMEWORKS[0]);
|
||||
supportingFiles.add(new SupportingFile("index.mustache", "index.ts"));
|
||||
|
||||
|
||||
@@ -1499,11 +1499,16 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
public Set<String> oneOfArrays = new TreeSet<>();
|
||||
@Getter @Setter
|
||||
public Set<CodegenProperty> oneOfPrimitives = new HashSet<>();
|
||||
@Getter @Setter
|
||||
public CodegenDiscriminator.MappedModel selfReferencingDiscriminatorMapping;
|
||||
|
||||
public boolean isEntity; // Is a model containing an "id" property marked as isUniqueId
|
||||
public String returnPassthrough;
|
||||
public boolean hasReturnPassthroughVoid;
|
||||
|
||||
public boolean hasSelfReferencingDiscriminatorMapping(){
|
||||
return selfReferencingDiscriminatorMapping != null;
|
||||
}
|
||||
public boolean isDateType() {
|
||||
return isDate && "Date".equals(dataType);
|
||||
}
|
||||
@@ -1597,6 +1602,17 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege
|
||||
this.setAdditionalProperties(cm.getAdditionalProperties());
|
||||
this.setIsModel(cm.getIsModel());
|
||||
this.setComposedSchemas(cm.getComposedSchemas());
|
||||
if (this.discriminator != null) {
|
||||
Set<CodegenDiscriminator.MappedModel> mappedModels = this.discriminator.getMappedModels();
|
||||
for(CodegenDiscriminator.MappedModel mappedModel : mappedModels) {
|
||||
if(mappedModel.getModelName().equals(cm.classname)) {
|
||||
this.selfReferencingDiscriminatorMapping = mappedModel;
|
||||
}
|
||||
}
|
||||
if(this.selfReferencingDiscriminatorMapping != null) {
|
||||
this.discriminator.getMappedModels().remove(this.selfReferencingDiscriminatorMapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,6 +56,7 @@ import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.CodegenConstants.X_PARENT;
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
|
||||
public class ModelUtils {
|
||||
@@ -1716,7 +1717,7 @@ public class ModelUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object xParent = schema.getExtensions().get("x-parent");
|
||||
Object xParent = schema.getExtensions().get(X_PARENT);
|
||||
if (xParent == null) {
|
||||
return false;
|
||||
} else if (xParent instanceof Boolean) {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "{{classname}}.h"
|
||||
|
||||
#define MAX_NUMBER_LENGTH 16
|
||||
#define MAX_BUFFER_LENGTH 4096
|
||||
#define MAX_NUMBER_LENGTH_LONG 21
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
@@ -229,10 +231,16 @@ end:
|
||||
// query parameters
|
||||
{{^isArray}}
|
||||
char *keyQuery_{{{paramName}}} = NULL;
|
||||
{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}char *{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}char *{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}} *{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueQuery_{{{paramName}}} {{#isString}}{{^isEnum}}= NULL{{/isEnum}}{{/isString}}{{#isInteger}}= NULL{{/isInteger}}{{#isBoolean}}= NULL{{/isBoolean}};
|
||||
{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}char *{{/isLong}}{{#isInteger}}char *{{/isInteger}}{{#isDouble}}char *{{/isDouble}}{{#isFloat}}char *{{/isFloat}}{{#isBoolean}}char *{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}} *{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueQuery_{{{paramName}}} {{#isString}}{{^isEnum}}= NULL{{/isEnum}}{{/isString}}{{#isInteger}}= NULL{{/isInteger}}{{#isBoolean}}= NULL{{/isBoolean}}{{#isDouble}}= NULL{{/isDouble}}{{#isFloat}}= NULL{{/isFloat}};
|
||||
keyValuePair_t *keyPairQuery_{{paramName}} = 0;
|
||||
{{/isArray}}
|
||||
{{^isLong}}
|
||||
{{^isFloat}}
|
||||
{{^isDouble}}
|
||||
if ({{paramName}})
|
||||
{{/isDouble}}
|
||||
{{/isFloat}}
|
||||
{{/isLong}}
|
||||
{
|
||||
{{#isArray}}
|
||||
list_addElement(localVarQueryParameters,{{paramName}});
|
||||
@@ -243,17 +251,43 @@ end:
|
||||
valueQuery_{{{paramName}}} = calloc(1,MAX_NUMBER_LENGTH);
|
||||
snprintf(valueQuery_{{{paramName}}}, MAX_NUMBER_LENGTH, "%d", *{{{paramName}}});
|
||||
{{/isInteger}}
|
||||
{{#isFloat}}
|
||||
int s = snprintf(NULL, 0, "%.7e", {{{paramName}}});
|
||||
if (s >= 0)
|
||||
{
|
||||
valueQuery_{{{paramName}}} = calloc(1,s+1);
|
||||
snprintf(valueQuery_{{{paramName}}}, s+1, "%.7e", {{{paramName}}});
|
||||
}
|
||||
{{/isFloat}}
|
||||
{{#isDouble}}
|
||||
int s = snprintf(NULL, 0, "%.16e", {{{paramName}}});
|
||||
if (s >= 0)
|
||||
{
|
||||
valueQuery_{{{paramName}}} = calloc(1,s+1);
|
||||
snprintf(valueQuery_{{{paramName}}}, s+1, "%.16e", {{{paramName}}});
|
||||
}
|
||||
{{/isDouble}}
|
||||
{{#isLong}}
|
||||
valueQuery_{{{paramName}}} = calloc(1,MAX_NUMBER_LENGTH_LONG);
|
||||
snprintf(valueQuery_{{{paramName}}}, MAX_NUMBER_LENGTH_LONG, "%d", {{{paramName}}});
|
||||
{{/isLong}}
|
||||
{{#isBoolean}}
|
||||
valueQuery_{{{paramName}}} = calloc(1,MAX_NUMBER_LENGTH);
|
||||
snprintf(valueQuery_{{{paramName}}}, MAX_NUMBER_LENGTH, "%d", *{{{paramName}}});
|
||||
{{/isBoolean}}
|
||||
{{^isInteger}}
|
||||
{{^isBoolean}}
|
||||
{{^isFloat}}
|
||||
{{^isDouble}}
|
||||
{{^isLong}}
|
||||
valueQuery_{{{paramName}}} = {{#isString}}{{^isEnum}}strdup({{/isEnum}}{{/isString}}({{{paramName}}}){{#isString}}{{^isEnum}}){{/isEnum}}{{/isString}};
|
||||
{{/isLong}}
|
||||
{{/isDouble}}
|
||||
{{/isFloat}}
|
||||
{{/isBoolean}}
|
||||
{{/isInteger}}
|
||||
keyPairQuery_{{paramName}} = keyValuePair_create(keyQuery_{{{paramName}}}, {{#isEnum}}strdup({{{operationId}}}_{{enumName}}_ToString(
|
||||
{{/isEnum}}{{^isString}}{{^isInteger}}{{^isBoolean}}&{{/isBoolean}}{{/isInteger}}{{/isString}}valueQuery_{{{paramName}}}{{#isEnum}})){{/isEnum}});
|
||||
{{/isEnum}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}{{^isLong}}{{^isBoolean}}&{{/isBoolean}}{{/isLong}}{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}valueQuery_{{{paramName}}}{{#isEnum}})){{/isEnum}});
|
||||
list_addElement(localVarQueryParameters,keyPairQuery_{{paramName}});
|
||||
{{/isArray}}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{#pattern}} @Pattern(regexp="{{{.}}}"){{/pattern}}{{!
|
||||
{{^isUuid}}{{#pattern}} @Pattern(regexp="{{{.}}}"){{/pattern}}{{!
|
||||
minLength && maxLength set
|
||||
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
|
||||
minLength set, maxLength not
|
||||
@@ -17,4 +17,4 @@ isInteger set
|
||||
isLong set
|
||||
}}{{#isLong}}{{#minimum}} @Min({{.}}L){{/minimum}}{{#maximum}} @Max({{.}}L){{/maximum}}{{/isLong}}{{!
|
||||
Not Integer, not Long => we have a decimal value!
|
||||
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{.}}"){{/minimum}}{{#maximum}} @DecimalMax("{{.}}"){{/maximum}}{{/isLong}}{{/isInteger}}
|
||||
}}{{^isInteger}}{{^isLong}}{{#minimum}} @DecimalMin("{{.}}"){{/minimum}}{{#maximum}} @DecimalMax("{{.}}"){{/maximum}}{{/isLong}}{{/isInteger}}{{/isUuid}}
|
||||
@@ -357,10 +357,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
* @return ApiClient this client
|
||||
*/
|
||||
public ApiClient addDefaultHeader(String name, String value) {
|
||||
if (defaultHeaders.containsKey(name)) {
|
||||
defaultHeaders.remove(name);
|
||||
}
|
||||
defaultHeaders.add(name, value);
|
||||
defaultHeaders.set(name, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -737,7 +734,12 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
* @param requestBuilder The current request
|
||||
*/
|
||||
protected void addHeadersToRequest(HttpHeaders headers, WebClient.RequestBodySpec requestBuilder) {
|
||||
{{#useJakartaEe}}
|
||||
for (Entry<String, List<String>> entry : headers.headerSet()) {
|
||||
{{/useJakartaEe}}
|
||||
{{^useJakartaEe}}
|
||||
for (Entry<String, List<String>> entry : headers.entrySet()) {
|
||||
{{/useJakartaEe}}
|
||||
List<String> values = entry.getValue();
|
||||
for(String value : values) {
|
||||
if (value != null) {
|
||||
|
||||
@@ -131,7 +131,7 @@ ext {
|
||||
swagger_annotations_version = "2.2.9"
|
||||
{{/swagger2AnnotationLibrary}}
|
||||
{{#useJakartaEe}}
|
||||
spring_boot_version = "3.0.12"
|
||||
spring_boot_version = "3.2.12"
|
||||
jakarta_annotation_version = "2.1.1"
|
||||
beanvalidation_version = "3.0.2"
|
||||
reactor_version = "3.5.12"
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
<jackson-databind-nullable-version>0.2.7</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
{{#useJakartaEe}}
|
||||
<spring-boot-version>3.0.12</spring-boot-version>
|
||||
<spring-boot-version>3.2.12</spring-boot-version>
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
<reactor-version>3.5.12</reactor-version>
|
||||
<reactor-netty-version>1.2.8</reactor-netty-version>
|
||||
|
||||
@@ -27,7 +27,7 @@ import {{javaxPackage}}.validation.Valid;
|
||||
@Path("{{commonPath}}")
|
||||
@RequestScoped
|
||||
|
||||
@Api(description = "the {{{baseName}}} API")
|
||||
@Api
|
||||
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}
|
||||
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}
|
||||
{{>generatedAnnotation}}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
{{#withXml}}
|
||||
@XmlType(name="{{datatypeWithEnum}}")
|
||||
@XmlEnum({{dataType}}.class)
|
||||
{{/withXml}}
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}{{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
{{#enumVars}}{{#withXml}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}){{/withXml}}{{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
|
||||
|
||||
|
||||
@@ -7,13 +7,23 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
{{#withXml}}
|
||||
import {{javaxPackage}}.xml.bind.annotation.XmlElement;
|
||||
import {{javaxPackage}}.xml.bind.annotation.XmlRootElement;
|
||||
import {{javaxPackage}}.xml.bind.annotation.XmlAccessType;
|
||||
import {{javaxPackage}}.xml.bind.annotation.XmlAccessorType;
|
||||
import {{javaxPackage}}.xml.bind.annotation.XmlType;
|
||||
import {{javaxPackage}}.xml.bind.annotation.XmlEnum;
|
||||
import {{javaxPackage}}.xml.bind.annotation.XmlEnumValue;
|
||||
{{/withXml}}
|
||||
|
||||
{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{#description}}/**
|
||||
* {{.}}
|
||||
**/{{/description}}
|
||||
{{#useSwaggerAnnotations}}{{#description}}@ApiModel(description = "{{{.}}}"){{/description}}{{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}}
|
||||
@org.eclipse.microprofile.openapi.annotations.media.Schema({{#title}}title="{{{.}}}", {{/title}}{{#description}}description="{{{.}}}"{{/description}}{{^description}}description=""{{/description}}){{/useMicroProfileOpenAPIAnnotations}}
|
||||
@JsonTypeName("{{name}}")
|
||||
{{>generatedAnnotation}}{{>additionalModelTypeAnnotations}}
|
||||
{{>generatedAnnotation}}{{>additionalModelTypeAnnotations}}{{>xmlPojoAnnotation}}
|
||||
{{#vendorExtensions.x-class-extra-annotation}}
|
||||
{{{vendorExtensions.x-class-extra-annotation}}}
|
||||
{{/vendorExtensions.x-class-extra-annotation}}
|
||||
@@ -92,6 +102,9 @@ public class {{classname}} {{#parent}}extends {{{.}}}{{/parent}} {{#vendorExtens
|
||||
return this;
|
||||
}
|
||||
|
||||
{{#withXml}}
|
||||
@XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}})
|
||||
{{/withXml}}
|
||||
{{#vendorExtensions.x-extra-annotation}}{{{vendorExtensions.x-extra-annotation}}}{{/vendorExtensions.x-extra-annotation}}{{#useSwaggerAnnotations}}
|
||||
@ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}"){{/useSwaggerAnnotations}}{{#useMicroProfileOpenAPIAnnotations}}
|
||||
@org.eclipse.microprofile.openapi.annotations.media.Schema({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}description = "{{{description}}}"){{/useMicroProfileOpenAPIAnnotations}}
|
||||
|
||||
8
modules/openapi-generator/src/main/resources/JavaJaxRS/spec/xmlPojoAnnotation.mustache
vendored
Normal file
8
modules/openapi-generator/src/main/resources/JavaJaxRS/spec/xmlPojoAnnotation.mustache
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{{#withXml}}
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
{{#hasVars}} @XmlType(name = "{{classname}}", propOrder =
|
||||
{ {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}}
|
||||
}){{/hasVars}}
|
||||
{{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}}
|
||||
{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}}
|
||||
{{/withXml}}
|
||||
@@ -252,7 +252,8 @@ public interface {{classname}} {
|
||||
produces = { {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }{{/hasProduces}}{{#hasConsumes}},
|
||||
consumes = { {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }{{/hasConsumes}}{{/singleContentTypes}}{{#hasVersionHeaders}},
|
||||
headers = { {{#vendorExtensions.versionHeaderParamsList}}"{{baseName}}{{#defaultValue}}={{{.}}}{{/defaultValue}}"{{^-last}}, {{/-last}}{{/vendorExtensions.versionHeaderParamsList}} } {{/hasVersionHeaders}}{{#hasVersionQueryParams}},
|
||||
params = { {{#vendorExtensions.versionQueryParamsList}}"{{baseName}}{{#defaultValue}}={{{.}}}{{/defaultValue}}"{{^-last}}, {{/-last}}{{/vendorExtensions.versionQueryParamsList}} } {{/hasVersionQueryParams}}
|
||||
params = { {{#vendorExtensions.versionQueryParamsList}}"{{baseName}}{{#defaultValue}}={{{.}}}{{/defaultValue}}"{{^-last}}, {{/-last}}{{/vendorExtensions.versionQueryParamsList}} } {{/hasVersionQueryParams}}{{#vendorExtensions.x-spring-api-version}}{{^empty}},
|
||||
version = "{{{vendorExtensions.x-spring-api-version}}}"{{/empty}}{{/vendorExtensions.x-spring-api-version}}
|
||||
)
|
||||
{{^useResponseEntity}}
|
||||
@ResponseStatus({{#springHttpStatus}}{{#responses.0}}{{{code}}}{{/responses.0}}{{/springHttpStatus}})
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
{{#multiplatform}}
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.*
|
||||
import kotlinx.serialization.json.*
|
||||
|
||||
/**
|
||||
* {{{description}}}
|
||||
*
|
||||
*/
|
||||
{{#isDeprecated}}
|
||||
@Deprecated(message = "This schema is deprecated.")
|
||||
{{/isDeprecated}}
|
||||
@Serializable(with = {{classname}}.{{classname}}Serializer::class)
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}data class {{classname}}(var actualInstance: Any? = null) {
|
||||
|
||||
object {{classname}}Serializer : KSerializer<{{classname}}> {
|
||||
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("{{classname}}") {
|
||||
element("type", JsonPrimitive.serializer().descriptor)
|
||||
element("actualInstance", JsonElement.serializer().descriptor)
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: {{classname}}) {
|
||||
val jsonEncoder = encoder as? JsonEncoder ?: throw SerializationException("{{classname}} can only be serialized with Json")
|
||||
|
||||
when (val instance = value.actualInstance) {
|
||||
{{#composedSchemas}}
|
||||
{{#anyOf}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isString}}
|
||||
is kotlin.String -> jsonEncoder.encodeString(instance)
|
||||
{{/isString}}
|
||||
{{#isBoolean}}
|
||||
is kotlin.Boolean -> jsonEncoder.encodeBoolean(instance)
|
||||
{{/isBoolean}}
|
||||
{{#isInteger}}
|
||||
is kotlin.Int -> jsonEncoder.encodeInt(instance)
|
||||
{{/isInteger}}
|
||||
{{#isNumber}}
|
||||
{{#isDouble}}
|
||||
is kotlin.Double -> jsonEncoder.encodeDouble(instance)
|
||||
{{/isDouble}}
|
||||
{{#isFloat}}
|
||||
is kotlin.Float -> jsonEncoder.encodeFloat(instance)
|
||||
{{/isFloat}}
|
||||
{{/isNumber}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
is {{{dataType}}} -> jsonEncoder.encodeSerializableValue({{{dataType}}}.serializer(), instance)
|
||||
{{/isPrimitiveType}}
|
||||
{{/anyOf}}
|
||||
{{/composedSchemas}}
|
||||
null -> jsonEncoder.encodeJsonElement(JsonNull)
|
||||
else -> throw SerializationException("Unknown type in actualInstance: ${instance::class}")
|
||||
}
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder): {{classname}} {
|
||||
val jsonDecoder = decoder as? JsonDecoder ?: throw SerializationException("{{classname}} can only be deserialized with Json")
|
||||
val jsonElement = jsonDecoder.decodeJsonElement()
|
||||
|
||||
val errorMessages = mutableListOf<String>()
|
||||
|
||||
{{#composedSchemas}}
|
||||
{{#anyOf}}
|
||||
try {
|
||||
val instance = jsonDecoder.json.decodeFromJsonElement<{{{dataType}}}>(jsonElement)
|
||||
return {{classname}}(actualInstance = instance)
|
||||
} catch (e: Exception) {
|
||||
errorMessages.add("Failed to deserialize as {{{dataType}}}: ${e.message}")
|
||||
}
|
||||
{{/anyOf}}
|
||||
{{/composedSchemas}}
|
||||
|
||||
throw SerializationException("Cannot deserialize {{classname}}. Tried: ${errorMessages.joinToString(", ")}")
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/multiplatform}}
|
||||
@@ -0,0 +1,79 @@
|
||||
{{#multiplatform}}
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.*
|
||||
import kotlinx.serialization.json.*
|
||||
|
||||
/**
|
||||
* {{{description}}}
|
||||
*
|
||||
*/
|
||||
{{#isDeprecated}}
|
||||
@Deprecated(message = "This schema is deprecated.")
|
||||
{{/isDeprecated}}
|
||||
@Serializable(with = {{classname}}.{{classname}}Serializer::class)
|
||||
{{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}data class {{classname}}(var actualInstance: Any? = null) {
|
||||
|
||||
object {{classname}}Serializer : KSerializer<{{classname}}> {
|
||||
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("{{classname}}") {
|
||||
element("type", JsonPrimitive.serializer().descriptor)
|
||||
element("actualInstance", JsonElement.serializer().descriptor)
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: {{classname}}) {
|
||||
val jsonEncoder = encoder as? JsonEncoder ?: throw SerializationException("{{classname}} can only be serialized with Json")
|
||||
|
||||
when (val instance = value.actualInstance) {
|
||||
{{#composedSchemas}}
|
||||
{{#oneOf}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isString}}
|
||||
is kotlin.String -> jsonEncoder.encodeString(instance)
|
||||
{{/isString}}
|
||||
{{#isBoolean}}
|
||||
is kotlin.Boolean -> jsonEncoder.encodeBoolean(instance)
|
||||
{{/isBoolean}}
|
||||
{{#isInteger}}
|
||||
is kotlin.Int -> jsonEncoder.encodeInt(instance)
|
||||
{{/isInteger}}
|
||||
{{#isNumber}}
|
||||
{{#isDouble}}
|
||||
is kotlin.Double -> jsonEncoder.encodeDouble(instance)
|
||||
{{/isDouble}}
|
||||
{{#isFloat}}
|
||||
is kotlin.Float -> jsonEncoder.encodeFloat(instance)
|
||||
{{/isFloat}}
|
||||
{{/isNumber}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
is {{{dataType}}} -> jsonEncoder.encodeSerializableValue({{{dataType}}}.serializer(), instance)
|
||||
{{/isPrimitiveType}}
|
||||
{{/oneOf}}
|
||||
{{/composedSchemas}}
|
||||
null -> jsonEncoder.encodeJsonElement(JsonNull)
|
||||
else -> throw SerializationException("Unknown type in actualInstance: ${instance::class}")
|
||||
}
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder): {{classname}} {
|
||||
val jsonDecoder = decoder as? JsonDecoder ?: throw SerializationException("{{classname}} can only be deserialized with Json")
|
||||
val jsonElement = jsonDecoder.decodeJsonElement()
|
||||
|
||||
val errorMessages = mutableListOf<String>()
|
||||
|
||||
{{#composedSchemas}}
|
||||
{{#oneOf}}
|
||||
try {
|
||||
val instance = jsonDecoder.json.decodeFromJsonElement<{{{dataType}}}>(jsonElement)
|
||||
return {{classname}}(actualInstance = instance)
|
||||
} catch (e: Exception) {
|
||||
errorMessages.add("Failed to deserialize as {{{dataType}}}: ${e.message}")
|
||||
}
|
||||
{{/oneOf}}
|
||||
{{/composedSchemas}}
|
||||
|
||||
throw SerializationException("Cannot deserialize {{classname}}. Tried: ${errorMessages.joinToString(", ")}")
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/multiplatform}}
|
||||
@@ -579,6 +579,6 @@ class ObjectSerializer
|
||||
}
|
||||
}
|
||||
|
||||
return $qs ? (string) substr($qs, 0, -1) : '';
|
||||
return $qs ? substr($qs, 0, -1) : '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,6 +586,6 @@ class ObjectSerializer
|
||||
}
|
||||
}
|
||||
|
||||
return $qs ? (string) substr($qs, 0, -1) : '';
|
||||
return $qs ? substr($qs, 0, -1) : '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# {{invokerPackage}}\{{classname}}{{#description}}
|
||||
# {{invokerPackage}}\{{classname}}{{#operationTagDescription}}
|
||||
|
||||
{{.}}{{/description}}
|
||||
{{operationTagDescription}}{{/operationTagDescription}}
|
||||
|
||||
All URIs are relative to {{basePath}}, except if the operation defines another base path.
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ google-cloud-token = "^0.1"
|
||||
{{/supportAsync}}
|
||||
|
||||
[features]
|
||||
default = ["native-tls"]
|
||||
default = [{{#reqwestDefaultFeatures}}"{{.}}"{{^-last}}, {{/-last}}{{/reqwestDefaultFeatures}}]
|
||||
native-tls = ["reqwest/native-tls"]
|
||||
rustls-tls = ["reqwest/rustls-tls"]
|
||||
{{/reqwest}}
|
||||
@@ -109,7 +109,7 @@ mockall = { version = "^0.13", optional = true}
|
||||
bon = { version = "2.3", optional = true }
|
||||
{{/useBonBuilder}}
|
||||
[features]
|
||||
default = ["native-tls"]
|
||||
default = [{{#reqwestDefaultFeatures}}"{{.}}"{{^-last}}, {{/-last}}{{/reqwestDefaultFeatures}}]
|
||||
native-tls = ["reqwest/native-tls"]
|
||||
rustls-tls = ["reqwest/rustls-tls"]
|
||||
{{#mockall}}
|
||||
|
||||
@@ -302,7 +302,7 @@ export class {{classname}} extends BaseService {
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
{{#httpTransferCacheInOptions}}
|
||||
transferCache: localVarTransferCache,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
{{/httpTransferCacheInOptions}}
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
|
||||
@@ -65,5 +65,5 @@ import {operationId} from './symlinkDir';
|
||||
The CommonJS syntax is as follows:
|
||||
|
||||
```
|
||||
import localName = require('./symlinkDir')';
|
||||
import localName = require('./symlinkDir');
|
||||
```
|
||||
|
||||
@@ -47,6 +47,12 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
|
||||
return {{modelName}}FromJSONTyped(json, ignoreDiscriminator);
|
||||
}
|
||||
{{/discriminator.mappedModels}}
|
||||
{{#hasSelfReferencingDiscriminatorMapping}}
|
||||
if (json['{{discriminator.propertyBaseName}}'] === '{{selfReferencingDiscriminatorMapping.mappingName}}') {
|
||||
return {{selfReferencingDiscriminatorMapping.modelName}}FromJSONTyped(json, true);
|
||||
}
|
||||
{{/hasSelfReferencingDiscriminatorMapping}}
|
||||
|
||||
}
|
||||
{{/discriminator}}
|
||||
return {
|
||||
|
||||
@@ -21,6 +21,9 @@ export class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{
|
||||
{{#description}}
|
||||
/**
|
||||
* {{{.}}}
|
||||
{{#deprecated}}
|
||||
* @deprecated
|
||||
{{/deprecated}}
|
||||
*/
|
||||
{{/description}}
|
||||
'{{name}}'{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#isNullable}} | null{{/isNullable}};
|
||||
|
||||
@@ -30,30 +30,48 @@ import java.util.*;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
public class OpenAPINormalizerTest {
|
||||
|
||||
private static final String REF_AS_PARENT_IN_ALLOF = "REF_AS_PARENT_IN_ALLOF";
|
||||
private static final String X_PARENT = "x-parent";
|
||||
private static final String X_INTERNAL = "x-internal";
|
||||
|
||||
@Test
|
||||
public void testOpenAPINormalizerRefAsParentInAllOf() {
|
||||
// to test the rule REF_AS_PARENT_IN_ALLOF
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/allOf_extension_parent.yaml");
|
||||
|
||||
Schema schema = openAPI.getComponents().getSchemas().get("AnotherPerson");
|
||||
assertNull(schema.getExtensions());
|
||||
Schema<?> anotherPerson = openAPI.getComponents().getSchemas().get("AnotherPerson");
|
||||
assertNull(anotherPerson.getExtensions());
|
||||
|
||||
Schema schema2 = openAPI.getComponents().getSchemas().get("Person");
|
||||
assertEquals(schema2.getExtensions().get("x-parent"), "abstract");
|
||||
Schema<?>person = openAPI.getComponents().getSchemas().get("Person");
|
||||
assertEquals(person.getExtensions().get(X_PARENT), "abstract");
|
||||
|
||||
Schema<?> preNormPersonA = openAPI.getComponents().getSchemas().get("PersonA");
|
||||
assertNull(preNormPersonA.getExtensions());
|
||||
Schema<?> preNormPersonB = openAPI.getComponents().getSchemas().get("PersonB");
|
||||
assertNull(preNormPersonB.getExtensions());
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put("REF_AS_PARENT_IN_ALLOF", "true");
|
||||
options.put(REF_AS_PARENT_IN_ALLOF, "true");
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
Schema schema3 = openAPI.getComponents().getSchemas().get("AnotherPerson");
|
||||
assertEquals(schema3.getExtensions().get("x-parent"), true);
|
||||
Schema<?>schema3 = openAPI.getComponents().getSchemas().get("AnotherPerson");
|
||||
assertEquals(schema3.getExtensions().get(X_PARENT), true);
|
||||
|
||||
Schema schema4 = openAPI.getComponents().getSchemas().get("AnotherParent");
|
||||
assertEquals(schema4.getExtensions().get("x-parent"), true);
|
||||
Schema<?>schema4 = openAPI.getComponents().getSchemas().get("AnotherParent");
|
||||
assertEquals(schema4.getExtensions().get(X_PARENT), true);
|
||||
|
||||
Schema schema5 = openAPI.getComponents().getSchemas().get("Person");
|
||||
assertEquals(schema5.getExtensions().get("x-parent"), "abstract");
|
||||
Schema<?>schema5 = openAPI.getComponents().getSchemas().get("Person");
|
||||
assertEquals(schema5.getExtensions().get(X_PARENT), "abstract");
|
||||
|
||||
// Verify that all allOf refs gets marked as parents
|
||||
Schema<?>schemaWithTwoParents = openAPI.getComponents().getSchemas().get("SchemaWithTwoAllOfRefs");
|
||||
assertNull(schemaWithTwoParents.getExtensions());
|
||||
Schema<?>personA = openAPI.getComponents().getSchemas().get("PersonA");
|
||||
assertEquals(personA.getExtensions().get(X_PARENT), true);
|
||||
Schema<?>personB = openAPI.getComponents().getSchemas().get("PersonB");
|
||||
assertEquals(personB.getExtensions().get(X_PARENT), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -61,22 +79,22 @@ public class OpenAPINormalizerTest {
|
||||
// to test the both REF_AS_PARENT_IN_ALLOF and REFACTOR_ALLOF_WITH_PROPERTIES_ONLY
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/allOf_extension_parent.yaml");
|
||||
|
||||
Schema schema = openAPI.getComponents().getSchemas().get("Child");
|
||||
Schema<?> schema = openAPI.getComponents().getSchemas().get("Child");
|
||||
assertNull(schema.getExtensions());
|
||||
|
||||
Schema schema2 = openAPI.getComponents().getSchemas().get("Ancestor");
|
||||
Schema<?> schema2 = openAPI.getComponents().getSchemas().get("Ancestor");
|
||||
assertNull(schema2.getExtensions());
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put("REF_AS_PARENT_IN_ALLOF", "true");
|
||||
options.put(REF_AS_PARENT_IN_ALLOF, "true");
|
||||
options.put("REFACTOR_ALLOF_WITH_PROPERTIES_ONLY", "true");
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
Schema schema3 = openAPI.getComponents().getSchemas().get("Ancestor");
|
||||
assertEquals(schema3.getExtensions().get("x-parent"), true);
|
||||
Schema<?> schema3 = openAPI.getComponents().getSchemas().get("Ancestor");
|
||||
assertEquals(schema3.getExtensions().get(X_PARENT), true);
|
||||
|
||||
Schema schema4 = openAPI.getComponents().getSchemas().get("Child");
|
||||
Schema<?> schema4 = openAPI.getComponents().getSchemas().get("Child");
|
||||
assertNull(schema4.getExtensions());
|
||||
}
|
||||
|
||||
@@ -585,8 +603,8 @@ public class OpenAPINormalizerTest {
|
||||
Schema s = openAPI.getComponents().getSchemas().get("Dummy");
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions(), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(s.getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(s.getExtensions().get(X_INTERNAL), true);
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put("REMOVE_X_INTERNAL", "true");
|
||||
@@ -595,8 +613,8 @@ public class OpenAPINormalizerTest {
|
||||
|
||||
Schema s2 = openAPI.getComponents().getSchemas().get("Dummy");
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions(), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), null);
|
||||
assertEquals(s2.getExtensions().get("x-internal"), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), null);
|
||||
assertEquals(s2.getExtensions().get(X_INTERNAL), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -604,7 +622,7 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml");
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions(), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions(), null);
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@@ -612,9 +630,9 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get("x-internal"), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get(X_INTERNAL), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get(X_INTERNAL), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -622,7 +640,7 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml");
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions(), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions(), null);
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@@ -630,9 +648,9 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get("x-internal"), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get(X_INTERNAL), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get(X_INTERNAL), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -640,7 +658,7 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml");
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions(), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions(), null);
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@@ -648,16 +666,16 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get("x-internal"), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get(X_INTERNAL), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get(X_INTERNAL), true);
|
||||
}
|
||||
@Test
|
||||
public void testFilterWithMethodWithTrim() {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml");
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions(), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions(), null);
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@@ -665,9 +683,9 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get("x-internal"), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get(X_INTERNAL), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get(X_INTERNAL), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -675,7 +693,7 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml");
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions(), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions(), null);
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@@ -683,16 +701,16 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get("x-internal"), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get(X_INTERNAL), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get(X_INTERNAL), true);
|
||||
}
|
||||
@Test
|
||||
public void testFilterWithTagWithTrim() {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml");
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions(), null);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions(), null);
|
||||
|
||||
Map<String, String> options = new HashMap<>();
|
||||
@@ -700,9 +718,9 @@ public class OpenAPINormalizerTest {
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get("x-internal"), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get("x-internal"), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getExtensions().get(X_INTERNAL), false);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getExtensions().get(X_INTERNAL), true);
|
||||
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getPut().getExtensions().get(X_INTERNAL), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -953,6 +971,11 @@ public class OpenAPINormalizerTest {
|
||||
Schema schema21 = openAPI.getComponents().getSchemas().get("SingleAnyOfTest");
|
||||
assertEquals(schema21.getAnyOf().size(), 1);
|
||||
|
||||
Schema schema23 = openAPI.getComponents().getSchemas().get("PropertiesWithAnyOf");
|
||||
assertEquals(((Schema) schema23.getProperties().get("anyof_nullable_string")).getAnyOf().size(), 2);
|
||||
assertEquals(((Schema) schema23.getProperties().get("anyof_nullable_number")).getAnyOf().size(), 2);
|
||||
|
||||
// start the normalization
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put("SIMPLIFY_ONEOF_ANYOF", "true");
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
@@ -1007,6 +1030,14 @@ public class OpenAPINormalizerTest {
|
||||
assertEquals(schema22.getAnyOf(), null);
|
||||
assertEquals(schema22.getTypes(), Set.of("string"));
|
||||
assertEquals(schema22.getEnum().size(), 2);
|
||||
|
||||
Schema schema24 = openAPI.getComponents().getSchemas().get("PropertiesWithAnyOf");
|
||||
assertEquals(((Schema) schema24.getProperties().get("anyof_nullable_string")).getAnyOf(), null);
|
||||
assertEquals(((Schema) schema24.getProperties().get("anyof_nullable_string")).getNullable(), true);
|
||||
assertEquals(((Schema) schema24.getProperties().get("anyof_nullable_string")).getTypes().size(), 1);
|
||||
assertEquals(((Schema) schema24.getProperties().get("anyof_nullable_number")).getAnyOf(), null);
|
||||
assertEquals(((Schema) schema24.getProperties().get("anyof_nullable_number")).getNullable(), true);
|
||||
assertEquals(((Schema) schema24.getProperties().get("anyof_nullable_number")).getTypes().size(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1122,6 +1153,42 @@ public class OpenAPINormalizerTest {
|
||||
assertEquals(requiredProperties.getRequired(), null);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRemoveXInternalFromInlineProperties() {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/inline_x_internal_test.yaml");
|
||||
Schema parentSchema = openAPI.getComponents().getSchemas().get("ParentSchema");
|
||||
Schema inlineProperty = (Schema) parentSchema.getProperties().get("inlineXInternalProperty");
|
||||
|
||||
// Before normalization: x-internal should be present on inline property
|
||||
assertNotNull(inlineProperty.getExtensions());
|
||||
assertEquals(inlineProperty.getExtensions().get("x-internal"), true);
|
||||
|
||||
// Run normalizer with REMOVE_X_INTERNAL=true
|
||||
Map<String, String> options = new HashMap<>();
|
||||
options.put("REMOVE_X_INTERNAL", "true");
|
||||
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
|
||||
openAPINormalizer.normalize();
|
||||
|
||||
// After normalization: x-internal should be removed from inline property
|
||||
Schema parentSchemaAfter = openAPI.getComponents().getSchemas().get("ParentSchema");
|
||||
Schema inlinePropertyAfter = (Schema) parentSchemaAfter.getProperties().get("inlineXInternalProperty");
|
||||
|
||||
// x-internal extension should be removed (null or not present in map)
|
||||
if (inlinePropertyAfter.getExtensions() != null) {
|
||||
assertNull(inlinePropertyAfter.getExtensions().get("x-internal"));
|
||||
}
|
||||
|
||||
// The property itself should still exist (we're removing the flag, not the property)
|
||||
assertNotNull(inlinePropertyAfter);
|
||||
assertEquals(inlinePropertyAfter.getType(), "object");
|
||||
|
||||
// Nested properties should still exist
|
||||
assertNotNull(inlinePropertyAfter.getProperties());
|
||||
assertNotNull(inlinePropertyAfter.getProperties().get("nestedField"));
|
||||
assertNotNull(inlinePropertyAfter.getProperties().get("nestedNumber"));
|
||||
}
|
||||
|
||||
public static class RemoveRequiredNormalizer extends OpenAPINormalizer {
|
||||
|
||||
public RemoveRequiredNormalizer(OpenAPI openAPI, Map<String, String> inputRules) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.github.javaparser.ast.CompilationUnit;
|
||||
import com.github.javaparser.ast.body.FieldDeclaration;
|
||||
import com.github.javaparser.ast.expr.Expression;
|
||||
import com.github.javaparser.ast.expr.MethodCallExpr;
|
||||
import com.github.javaparser.ast.visitor.*;
|
||||
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.swagger.parser.OpenAPIParser;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
@@ -40,7 +40,6 @@ import org.openapitools.codegen.config.CodegenConfigurator;
|
||||
import org.openapitools.codegen.java.assertions.JavaFileAssert;
|
||||
import org.openapitools.codegen.languages.AbstractJavaCodegen;
|
||||
import org.openapitools.codegen.languages.JavaClientCodegen;
|
||||
import org.openapitools.codegen.languages.RubyClientCodegen;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.CXFServerFeatures;
|
||||
import org.openapitools.codegen.meta.features.SecurityFeature;
|
||||
@@ -49,7 +48,6 @@ import org.openapitools.codegen.model.OperationsMap;
|
||||
import org.openapitools.codegen.testutils.ConfigAssert;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -1791,11 +1789,71 @@ public class JavaClientCodegenTest {
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
|
||||
validateJavaSourceFiles(files);
|
||||
assertThat(files).hasSize(33);
|
||||
assertThat(files).hasSize(48);
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/Child.java"))
|
||||
.content().contains("public class Child extends Person {");
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/Adult.java"))
|
||||
.content().contains("public class Adult extends Person {");
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/SchemaWithTwoAllOfRefs.java"))
|
||||
.content().contains("public class SchemaWithTwoAllOfRefs {");
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/AnotherChild.java"))
|
||||
.content().contains("public class AnotherChild {");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allOfWithSeveralRefsAndRefAsParentInAllOfNormalizationIsTrue() {
|
||||
final Path output = newTempFolder();
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName(JAVA_GENERATOR)
|
||||
.addAdditionalProperty(CodegenConstants.API_PACKAGE, "xyz.abcdef.api")
|
||||
.addAdditionalProperty(CodegenConstants.MODEL_PACKAGE, "xyz.abcdef.model")
|
||||
.addAdditionalProperty(CodegenConstants.INVOKER_PACKAGE, "xyz.abcdef.invoker")
|
||||
.addOpenapiNormalizer("REF_AS_PARENT_IN_ALLOF", "true")
|
||||
.setInputSpec("src/test/resources/3_0/allOf_extension_parent.yaml")
|
||||
.setOutputDir(output.toString().replace("\\", "/"));
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
|
||||
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
|
||||
validateJavaSourceFiles(files);
|
||||
assertThat(files).hasSize(48);
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/Child.java"))
|
||||
.content().contains("public class Child extends Person {");
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/Adult.java"))
|
||||
.content().contains("public class Adult extends Person {");
|
||||
// The class does not extend a parent since the REF_AS_PARENT_IN_ALLOF normalizer will assign it two parents
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/SchemaWithTwoAllOfRefsOneIsMarkedAsParent.java"))
|
||||
.content().contains("public class SchemaWithTwoAllOfRefsOneIsMarkedAsParent {");
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/AnotherChild.java"))
|
||||
.content().contains("public class AnotherChild extends AnotherPerson {");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void allOfWithSeveralRefsButOnlyOneIsMarkedAsParent() {
|
||||
final Path output = newTempFolder();
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName(JAVA_GENERATOR)
|
||||
.addAdditionalProperty(CodegenConstants.API_PACKAGE, "xyz.abcdef.api")
|
||||
.addAdditionalProperty(CodegenConstants.MODEL_PACKAGE, "xyz.abcdef.model")
|
||||
.addAdditionalProperty(CodegenConstants.INVOKER_PACKAGE, "xyz.abcdef.invoker")
|
||||
.setInputSpec("src/test/resources/3_0/allOf_extension_parent.yaml")
|
||||
.setOutputDir(output.toString().replace("\\", "/"));
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");
|
||||
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
|
||||
validateJavaSourceFiles(files);
|
||||
assertThat(files).hasSize(48);
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/Child.java"))
|
||||
.content().contains("public class Child extends Person {");
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/Adult.java"))
|
||||
.content().contains("public class Adult extends Person {");
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/SchemaWithTwoAllOfRefsOneIsMarkedAsParent.java"))
|
||||
.content().contains("public class SchemaWithTwoAllOfRefsOneIsMarkedAsParent extends PersonAExplicitParent {");
|
||||
assertThat(output.resolve("src/main/java/xyz/abcdef/model/AnotherChild.java"))
|
||||
.content().contains("public class AnotherChild {");
|
||||
}
|
||||
@@ -3984,7 +4042,7 @@ public class JavaClientCodegenTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneOfClassWithAnnotation() throws IOException {
|
||||
public void testOneOfClassWithAnnotation() {
|
||||
final Map<String, File> files = generateFromContract("src/test/resources/3_0/java/oneOf-with-annotations.yaml", RESTCLIENT);
|
||||
JavaFileAssert.assertThat(files.get("Fruit.java"))
|
||||
.isNormalClass()
|
||||
@@ -3992,7 +4050,7 @@ public class JavaClientCodegenTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneOfInterfaceWithAnnotation() throws IOException {
|
||||
public void testOneOfInterfaceWithAnnotation() {
|
||||
final Map<String, File> files = generateFromContract("src/test/resources/3_0/java/oneOf-with-annotations.yaml", RESTCLIENT,
|
||||
Map.of(USE_ONE_OF_INTERFACES, "true"));
|
||||
JavaFileAssert.assertThat(files.get("Fruit.java"))
|
||||
|
||||
@@ -50,25 +50,42 @@ public abstract class AbstractAnnotationsAssert<ACTUAL extends AbstractAnnotatio
|
||||
return myself();
|
||||
}
|
||||
|
||||
private static boolean hasAttributes(final AnnotationExpr annotation, final Map<String, String> expectedAttributesToContains) {
|
||||
final Map<String, String> actualAttributes;
|
||||
if (annotation instanceof SingleMemberAnnotationExpr) {
|
||||
actualAttributes = ImmutableMap.of(
|
||||
"value", ((SingleMemberAnnotationExpr) annotation).getMemberValue().toString()
|
||||
);
|
||||
} else if (annotation instanceof NormalAnnotationExpr) {
|
||||
actualAttributes = ((NormalAnnotationExpr) annotation).getPairs().stream()
|
||||
.collect(Collectors.toMap(NodeWithSimpleName::getNameAsString, pair -> pair.getValue().toString()));
|
||||
} else if (annotation instanceof MarkerAnnotationExpr) {
|
||||
actualAttributes = new HashMap<>();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unexpected annotation expression type for: " + annotation);
|
||||
public ACTUAL containsWithNameAndDoesContainAttributes(final String name, final List<String> attributes) {
|
||||
super
|
||||
.withFailMessage("Should have annotation with name: " + name + " and no attributes: " + attributes + ", but was: " + actual)
|
||||
.anyMatch(annotation -> annotation.getNameAsString().equals(name) && hasNotAttributes(annotation, attributes));
|
||||
return myself();
|
||||
}
|
||||
|
||||
private static boolean hasNotAttributes(final AnnotationExpr annotation, final List<String> attributes) {
|
||||
final Map<String, String> actualAttributes = getAttributes(annotation);
|
||||
|
||||
return actualAttributes.keySet().stream()
|
||||
.noneMatch(attribute -> attributes.contains(attribute));
|
||||
}
|
||||
|
||||
private static boolean hasAttributes(final AnnotationExpr annotation, final Map<String, String> expectedAttributesToContains) {
|
||||
final Map<String, String> actualAttributes = getAttributes(annotation);
|
||||
|
||||
return expectedAttributesToContains.entrySet().stream()
|
||||
.allMatch(expected -> Objects.equals(actualAttributes.get(expected.getKey()), expected.getValue()));
|
||||
}
|
||||
|
||||
private static Map<String, String> getAttributes(final AnnotationExpr annotation) {
|
||||
if (annotation instanceof SingleMemberAnnotationExpr) {
|
||||
return ImmutableMap.of(
|
||||
"value", ((SingleMemberAnnotationExpr) annotation).getMemberValue().toString()
|
||||
);
|
||||
} else if (annotation instanceof NormalAnnotationExpr) {
|
||||
return ((NormalAnnotationExpr) annotation).getPairs().stream()
|
||||
.collect(Collectors.toMap(NodeWithSimpleName::getNameAsString, pair -> pair.getValue().toString()));
|
||||
} else if (annotation instanceof MarkerAnnotationExpr) {
|
||||
return new HashMap<>();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unexpected annotation expression type for: " + annotation);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private ACTUAL myself() {
|
||||
return (ACTUAL) this;
|
||||
|
||||
@@ -65,6 +65,7 @@ import static org.openapitools.codegen.languages.SpringCodegen.*;
|
||||
import static org.openapitools.codegen.languages.features.DocumentationProviderFeatures.ANNOTATION_LIBRARY;
|
||||
import static org.openapitools.codegen.languages.features.DocumentationProviderFeatures.DOCUMENTATION_PROVIDER;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
public class SpringCodegenTest {
|
||||
@@ -5738,4 +5739,93 @@ public class SpringCodegenTest {
|
||||
.isInterface()
|
||||
.assertTypeAnnotations().containsWithName("SuppressWarnings");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApiVersion() throws IOException {
|
||||
final Map<String, File> files = generateFromContract("src/test/resources/3_0/spring/apiVersion.yaml", SPRING_BOOT,
|
||||
Map.of(SpringCodegen.SPRING_API_VERSION, "v1",
|
||||
USE_TAGS, true));
|
||||
JavaFileAssert.assertThat(files.get("TestApi.java"))
|
||||
.assertMethod("getVersions")
|
||||
.assertMethodAnnotations()
|
||||
.containsWithNameAndAttributes("RequestMapping", Map.of("version", "\"v1\""))
|
||||
.toMethod().toFileAssert()
|
||||
|
||||
.assertMethod("getOverrides")
|
||||
.assertMethodAnnotations()
|
||||
.containsWithNameAndAttributes("RequestMapping", Map.of("version", "\"2+\""))
|
||||
.toMethod().toFileAssert()
|
||||
|
||||
.assertMethod("getNones")
|
||||
.assertMethodAnnotations()
|
||||
.containsWithNameAndDoesContainAttributes("RequestMapping", List.of("version"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void annotationLibraryDoesNotCauseImportConflictsInSpring() throws IOException {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("documentationProvider", "source");
|
||||
properties.put("annotationLibrary", "none");
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/java/native/issue21991.yaml");
|
||||
|
||||
SpringCodegen codegen = new SpringCodegen();
|
||||
codegen.setLibrary(SPRING_BOOT);
|
||||
codegen.setOpenAPI(openAPI);
|
||||
codegen.setOutputDir(output.getAbsolutePath());
|
||||
codegen.additionalProperties().putAll(properties);
|
||||
|
||||
ClientOptInput input = new ClientOptInput()
|
||||
.openAPI(openAPI)
|
||||
.config(codegen);
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
|
||||
Map<String, File> files = generator.opts(input).generate().stream()
|
||||
.collect(Collectors.toMap(File::getName, Function.identity()));
|
||||
|
||||
File apiFile = files.get("Schema.java");
|
||||
assertNotNull(apiFile);
|
||||
|
||||
JavaFileAssert.assertThat(apiFile).fileDoesNotContain(
|
||||
"import io.swagger.v3.oas.annotations.media.Schema;"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void annotationLibraryDoesNotCauseImportConflictsInSpringWithAnnotationLibrary() throws IOException {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("documentationProvider", "source");
|
||||
properties.put("annotationLibrary", "swagger2");
|
||||
|
||||
File output = Files.createTempDirectory("test").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/java/native/issue21991.yaml");
|
||||
|
||||
SpringCodegen codegen = new SpringCodegen();
|
||||
codegen.setOpenAPI(openAPI);
|
||||
codegen.setLibrary(SPRING_BOOT);
|
||||
codegen.setOutputDir(output.getAbsolutePath());
|
||||
codegen.additionalProperties().putAll(properties);
|
||||
|
||||
ClientOptInput input = new ClientOptInput()
|
||||
.openAPI(openAPI)
|
||||
.config(codegen);
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
|
||||
Map<String, File> files = generator.opts(input).generate().stream()
|
||||
.collect(Collectors.toMap(File::getName, Function.identity()));
|
||||
|
||||
File apiFile = files.get("Schema.java");
|
||||
assertNotNull(apiFile);
|
||||
|
||||
JavaFileAssert.assertThat(apiFile).fileContains(
|
||||
"import io.swagger.v3.oas.annotations.media.Schema;"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,6 +267,32 @@ public class TypeScriptClientCodegenTest {
|
||||
assertEquals(1, TestUtils.countOccurrences(content, "@deprecated"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeprecatedAttribute() throws Exception {
|
||||
final File output = Files.createTempDirectory("typescriptnodeclient_").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("typescript")
|
||||
.setInputSpec("src/test/resources/3_0/typescript/deprecated-attribute.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
final ClientOptInput clientOptInput = configurator.toClientOptInput();
|
||||
final DefaultGenerator generator = new DefaultGenerator();
|
||||
final List<File> files = generator.opts(clientOptInput).generate();
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
// verify operation is deprecated
|
||||
Path file = Paths.get(output + "/models/PetUpdateRequest.ts");
|
||||
TestUtils.assertFileContains(
|
||||
file,
|
||||
"* @deprecated"
|
||||
);
|
||||
|
||||
String content = Files.readString(file);
|
||||
assertEquals(1, TestUtils.countOccurrences(content, "@deprecated"));
|
||||
}
|
||||
|
||||
@Test(description = "Verify useErasableSyntax config parameter generates erasable code")
|
||||
public void testUseErasableSyntaxConfig() throws IOException {
|
||||
boolean[] options = {true, false};
|
||||
|
||||
@@ -623,6 +623,47 @@ public class ModelUtilsTest {
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isNullTypeSchemaTestWith31Spec() {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_1/null_schema_test.yaml");
|
||||
Map<String, String> options = new HashMap<>();
|
||||
Schema schema = openAPI.getComponents().getSchemas().get("AnyOfStringArrayOfString");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
|
||||
schema = openAPI.getComponents().getSchemas().get("IntegerRef");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
|
||||
schema = openAPI.getComponents().getSchemas().get("OneOfAnyType");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
|
||||
schema = openAPI.getComponents().getSchemas().get("AnyOfAnyType");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
|
||||
schema = openAPI.getComponents().getSchemas().get("Parent");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
// the dummy property is a ref to integer
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, (Schema) schema.getProperties().get("dummy")));
|
||||
|
||||
schema = openAPI.getComponents().getSchemas().get("AnyOfTest");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
// first element (getAnyOf().get(0)) is a string. no need to test
|
||||
assertTrue(ModelUtils.isNullTypeSchema(openAPI, (Schema) schema.getAnyOf().get(1)));
|
||||
assertTrue(ModelUtils.isNullTypeSchema(openAPI, (Schema) schema.getAnyOf().get(2)));
|
||||
assertTrue(ModelUtils.isNullTypeSchema(openAPI, (Schema) schema.getAnyOf().get(3)));
|
||||
|
||||
schema = openAPI.getComponents().getSchemas().get("OneOfRef");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, (Schema) schema.getOneOf().get(0)));
|
||||
|
||||
schema = openAPI.getComponents().getSchemas().get("OneOfMultiRef");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, (Schema) schema.getOneOf().get(0)));
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, (Schema) schema.getOneOf().get(1)));
|
||||
|
||||
schema = openAPI.getComponents().getSchemas().get("JustDescription");
|
||||
assertFalse(ModelUtils.isNullTypeSchema(openAPI, schema));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isUnsupportedSchemaTest() {
|
||||
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_1/unsupported_schema_test.yaml");
|
||||
|
||||
@@ -727,6 +727,40 @@ paths:
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
'/user/test_int32_int64_float_double':
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: test int32, int64 float and double query parameters in API
|
||||
description: This can test int32, int64 float and double query parameters in API.
|
||||
operationId: test_int32_int64_float_double
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: floatnum
|
||||
in: query
|
||||
description: A float number
|
||||
type: number
|
||||
format: float
|
||||
- name: doublenum
|
||||
in: query
|
||||
description: A double number
|
||||
type: number
|
||||
format: double
|
||||
- name: int32num
|
||||
in: query
|
||||
description: An int32 number
|
||||
type: integer
|
||||
format: int32
|
||||
- name: int64num
|
||||
in: query
|
||||
description: An int64 number
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
securityDefinitions:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
|
||||
@@ -37,6 +37,22 @@ components:
|
||||
type: string
|
||||
firstName:
|
||||
type: string
|
||||
PersonA:
|
||||
type: object
|
||||
properties:
|
||||
lastName:
|
||||
type: string
|
||||
PersonAExplicitParent:
|
||||
type: object
|
||||
x-parent: "abstract"
|
||||
properties:
|
||||
lastName:
|
||||
type: string
|
||||
PersonB:
|
||||
type: object
|
||||
properties:
|
||||
firstName:
|
||||
type: string
|
||||
Adult:
|
||||
description: A representation of an adult
|
||||
allOf:
|
||||
@@ -65,6 +81,26 @@ components:
|
||||
type: integer
|
||||
format: int32
|
||||
- $ref: '#/components/schemas/AnotherPerson'
|
||||
SchemaWithTwoAllOfRefs:
|
||||
description: A schema that has two allOfs with refs
|
||||
allOf:
|
||||
- type: object
|
||||
properties:
|
||||
age:
|
||||
type: integer
|
||||
format: int32
|
||||
- $ref: '#/components/schemas/PersonA'
|
||||
- $ref: '#/components/schemas/PersonB'
|
||||
SchemaWithTwoAllOfRefsOneIsMarkedAsParent:
|
||||
description: A schema that has two allOfs with refs, but one of the allOfs is explicitly marked with x-parent
|
||||
allOf:
|
||||
- type: object
|
||||
properties:
|
||||
age:
|
||||
type: integer
|
||||
format: int32
|
||||
- $ref: '#/components/schemas/PersonAExplicitParent'
|
||||
- $ref: '#/components/schemas/PersonB'
|
||||
AnotherPerson:
|
||||
description: person object without x-parent extension
|
||||
type: object
|
||||
|
||||
@@ -2134,6 +2134,7 @@ components:
|
||||
properties:
|
||||
"@type":
|
||||
type: string
|
||||
any_type_property: {}
|
||||
SingleRefType:
|
||||
type: string
|
||||
title: SingleRefType
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: Test inline x-internal
|
||||
components:
|
||||
schemas:
|
||||
ParentSchema:
|
||||
description: Schema with inline x-internal property
|
||||
type: object
|
||||
properties:
|
||||
normalProperty:
|
||||
type: string
|
||||
description: A normal property without x-internal
|
||||
inlineXInternalProperty:
|
||||
x-internal: true
|
||||
description: Inline object property marked as x-internal
|
||||
type: object
|
||||
properties:
|
||||
nestedField:
|
||||
type: string
|
||||
description: A field inside the inline x-internal object
|
||||
nestedNumber:
|
||||
type: integer
|
||||
description: Another field inside the inline object
|
||||
@@ -0,0 +1,23 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: x-spring-api-version test
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/versions:
|
||||
get:
|
||||
tags:
|
||||
- Test
|
||||
operationId: getVersions
|
||||
/overrides:
|
||||
get:
|
||||
tags:
|
||||
- Test
|
||||
operationId: getOverrides
|
||||
x-spring-api-version: '2+'
|
||||
/nones:
|
||||
get:
|
||||
tags:
|
||||
- Test
|
||||
operationId: getNones
|
||||
x-spring-api-version: ''
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
title: Minimal
|
||||
description: Api to reproduce bug
|
||||
version: 0.5.1-SNAPSHOT.0
|
||||
tags:
|
||||
- name: test
|
||||
servers:
|
||||
- url: http://localhost:8080
|
||||
paths:
|
||||
/api/v1/test:
|
||||
get:
|
||||
tags:
|
||||
- test
|
||||
operationId: test
|
||||
responses:
|
||||
"200":
|
||||
description: test operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/TestBaseDto"
|
||||
|
||||
components:
|
||||
schemas:
|
||||
TestObjectType:
|
||||
type: string
|
||||
enum:
|
||||
- TEST1
|
||||
- TEST2
|
||||
TestBaseDto:
|
||||
type: object
|
||||
properties:
|
||||
something:
|
||||
type: string
|
||||
testObjectType:
|
||||
$ref: "#/components/schemas/TestObjectType"
|
||||
discriminator:
|
||||
propertyName: testObjectType
|
||||
mapping:
|
||||
TEST2: '#/components/schemas/ExtendDto'
|
||||
TEST1: '#/components/schemas/TestBaseDto'
|
||||
ExtendDto:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/TestBaseDto'
|
||||
- type: object
|
||||
properties:
|
||||
someItems:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/TestBaseDto'
|
||||
@@ -0,0 +1,103 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
description: test order parameters
|
||||
version: 1.0.0
|
||||
title: Test order parameters
|
||||
license:
|
||||
name: Apache-2.0
|
||||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
|
||||
|
||||
paths:
|
||||
/pets:
|
||||
get:
|
||||
tags:
|
||||
- default
|
||||
summary: Finds Pets
|
||||
deprecated: true
|
||||
description: Find all pets
|
||||
operationId: findPets
|
||||
parameters:
|
||||
- name: type
|
||||
in: query
|
||||
description: type of pet
|
||||
style: form
|
||||
explode: false
|
||||
schema:
|
||||
type: string
|
||||
default: available
|
||||
- name: name
|
||||
in: query
|
||||
description: name of pet
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: age
|
||||
in: query
|
||||
description: age of pet
|
||||
schema:
|
||||
type: number
|
||||
format: int32
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
'400':
|
||||
description: Invalid status value
|
||||
|
||||
patch:
|
||||
tags:
|
||||
- default
|
||||
summary: Update a Pet
|
||||
description: Partially update an existing pet
|
||||
operationId: updatePet
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/PetUpdateRequest'
|
||||
responses:
|
||||
'200':
|
||||
description: Pet updated successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
'400':
|
||||
description: Invalid input
|
||||
'404':
|
||||
description: Pet not found
|
||||
|
||||
components:
|
||||
schemas:
|
||||
PetUpdateRequest:
|
||||
type: object
|
||||
description: Payload for updating a pet
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: New name for the pet
|
||||
age:
|
||||
type: integer
|
||||
format: int32
|
||||
description: Updated age
|
||||
deprecated: true
|
||||
type:
|
||||
type: string
|
||||
description: Type of pet
|
||||
required:
|
||||
- name
|
||||
|
||||
Pet:
|
||||
type: object
|
||||
description: Pet object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
age:
|
||||
type: integer
|
||||
format: int32
|
||||
type:
|
||||
type: string
|
||||
@@ -0,0 +1,107 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: Example
|
||||
license:
|
||||
name: MIT
|
||||
servers:
|
||||
- url: http://api.example.xyz/v1
|
||||
paths:
|
||||
/person/display/{personId}:
|
||||
get:
|
||||
parameters:
|
||||
- name: personId
|
||||
in: path
|
||||
required: true
|
||||
description: The id of the person to retrieve
|
||||
schema:
|
||||
type: string
|
||||
operationId: list
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/AnyOfTest"
|
||||
components:
|
||||
schemas:
|
||||
AnyOfTest:
|
||||
description: to test anyOf
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
- type: null
|
||||
- $ref: null
|
||||
OneOfTest:
|
||||
description: to test oneOf
|
||||
oneOf:
|
||||
- type: integer
|
||||
- type: 'null'
|
||||
- type: null
|
||||
- $ref: null
|
||||
OneOfTest2:
|
||||
description: to test oneOf
|
||||
oneOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
OneOfNullableTest:
|
||||
description: to test oneOf nullable
|
||||
oneOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
- $ref: null
|
||||
Parent:
|
||||
type: object
|
||||
properties:
|
||||
dummy:
|
||||
$ref: '#/components/schemas/IntegerRef'
|
||||
string_ref:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/StringRef'
|
||||
AnyOfStringArrayOfString:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: array
|
||||
items:
|
||||
type: string
|
||||
AnyOfAnyType:
|
||||
anyOf:
|
||||
- type: boolean
|
||||
- type: array
|
||||
items: {}
|
||||
- type: object
|
||||
- type: string
|
||||
- type: number
|
||||
- type: integer
|
||||
AnyOfAnyTypeWithRef:
|
||||
anyOf:
|
||||
- type: boolean
|
||||
- type: array
|
||||
items: { }
|
||||
- type: object
|
||||
- type: string
|
||||
- type: number
|
||||
- $ref: '#/components/schemas/IntegerRef'
|
||||
IntegerRef:
|
||||
type: integer
|
||||
StringRef:
|
||||
type: string
|
||||
OneOfAnyType:
|
||||
oneOf:
|
||||
- type: object
|
||||
- type: boolean
|
||||
- type: number
|
||||
- type: string
|
||||
- type: integer
|
||||
- type: array
|
||||
items: {}
|
||||
OneOfRef:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/IntegerRef'
|
||||
OneOfMultiRef:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/IntegerRef'
|
||||
- $ref: '#/components/schemas/StringRef'
|
||||
JustDescription:
|
||||
description: A schema with just description
|
||||
@@ -77,6 +77,18 @@ components:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/Number'
|
||||
- $ref: '#/components/schemas/Number2'
|
||||
PropertiesWithAnyOf:
|
||||
additionalProperties: false
|
||||
type: object
|
||||
properties:
|
||||
anyof_nullable_string:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: null
|
||||
anyof_nullable_number:
|
||||
anyOf:
|
||||
- type: number
|
||||
- type: null
|
||||
Number:
|
||||
enum:
|
||||
- one
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -15,7 +15,7 @@
|
||||
<packaging>pom</packaging>
|
||||
<name>openapi-generator-project</name>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>7.16.0</version>
|
||||
<version>7.17.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<url>https://github.com/openapitools/openapi-generator</url>
|
||||
<scm>
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.16.0-SNAPSHOT
|
||||
7.17.0-SNAPSHOT
|
||||
|
||||
@@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap
|
||||
|
||||
- API version: 0.1.0
|
||||
- SDK version: 1.0.0
|
||||
- Generator version: 7.16.0-SNAPSHOT
|
||||
- Generator version: 7.17.0-SNAPSHOT
|
||||
- Build package: org.openapitools.codegen.languages.CSharpClientCodegen
|
||||
|
||||
<a id="frameworks-supported"></a>
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.16.0-SNAPSHOT
|
||||
7.17.0-SNAPSHOT
|
||||
|
||||
@@ -7,7 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
|
||||
|
||||
- API version: 0.1.0
|
||||
- Package version: 1.0.0
|
||||
- Generator version: 7.16.0-SNAPSHOT
|
||||
- Generator version: 7.17.0-SNAPSHOT
|
||||
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.16.0-SNAPSHOT
|
||||
7.17.0-SNAPSHOT
|
||||
|
||||
@@ -7,7 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
|
||||
|
||||
- API version: 0.1.0
|
||||
- Package version: 1.0.0
|
||||
- Generator version: 7.16.0-SNAPSHOT
|
||||
- Generator version: 7.17.0-SNAPSHOT
|
||||
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.16.0-SNAPSHOT
|
||||
7.17.0-SNAPSHOT
|
||||
|
||||
@@ -4,7 +4,7 @@ Echo Server API
|
||||
|
||||
- API version: 0.1.0
|
||||
|
||||
- Generator version: 7.16.0-SNAPSHOT
|
||||
- Generator version: 7.17.0-SNAPSHOT
|
||||
|
||||
Echo Server API
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ import org.openapitools.client.auth.Authentication;
|
||||
import org.openapitools.client.auth.HttpBasicAuth;
|
||||
import org.openapitools.client.auth.HttpBearerAuth;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT")
|
||||
public class ApiClient extends JavaTimeFormatter {
|
||||
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||
|
||||
@@ -16,7 +16,7 @@ package org.openapitools.client;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.16.0-SNAPSHOT")
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT")
|
||||
public class ApiException extends Exception {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user