forked from loafle/openapi-generator-original
Compare commits
118 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fae9d4a37b | ||
|
|
93edd7650b | ||
|
|
4ead766b9e | ||
|
|
242d296082 | ||
|
|
a864ae90de | ||
|
|
314f18a2c1 | ||
|
|
d86f3edc73 | ||
|
|
ab9facd905 | ||
|
|
2a5a272300 | ||
|
|
6c98046ee6 | ||
|
|
3df525ee33 | ||
|
|
c2f5038d75 | ||
|
|
5de7f09ae9 | ||
|
|
cd85210835 | ||
|
|
6660b74247 | ||
|
|
19f47d0caa | ||
|
|
146c1fb255 | ||
|
|
0d701b7ce9 | ||
|
|
e68426fda9 | ||
|
|
86e53d6f0b | ||
|
|
6379022c42 | ||
|
|
ad06496887 | ||
|
|
4e9d226443 | ||
|
|
66bf0dce9e | ||
|
|
9f1b9386f1 | ||
|
|
dcf3f420f9 | ||
|
|
dc3543981e | ||
|
|
57560d365f | ||
|
|
c6207c0a49 | ||
|
|
89d0c01764 | ||
|
|
8c9a1512ae | ||
|
|
e06a408141 | ||
|
|
caac76c265 | ||
|
|
6ff0512b31 | ||
|
|
1eca97f738 | ||
|
|
8d9eb5ba54 | ||
|
|
6b7c5edbce | ||
|
|
b5121745a8 | ||
|
|
25dce23d81 | ||
|
|
ded0bd6801 | ||
|
|
740325f885 | ||
|
|
7916f2f880 | ||
|
|
b74fa4458d | ||
|
|
522a1a2372 | ||
|
|
f667effa76 | ||
|
|
dc81574f2b | ||
|
|
7ecc99192d | ||
|
|
39648ee3a7 | ||
|
|
6a1fc51069 | ||
|
|
c509d9897a | ||
|
|
ddf21f0ca5 | ||
|
|
a2e84c348c | ||
|
|
87adba9c4b | ||
|
|
aae97638a9 | ||
|
|
20b8eff6e3 | ||
|
|
14118807ba | ||
|
|
e3bc228dd5 | ||
|
|
6742302922 | ||
|
|
91af76700e | ||
|
|
8a6d996c4f | ||
|
|
40ec016c87 | ||
|
|
7756296c25 | ||
|
|
44e4dc3ff4 | ||
|
|
f93e75b078 | ||
|
|
0a037ae111 | ||
|
|
499c8ac5c1 | ||
|
|
38b1fe2d36 | ||
|
|
d748312818 | ||
|
|
d1043c910c | ||
|
|
60e6371fc5 | ||
|
|
50878fbc2e | ||
|
|
5167955ee0 | ||
|
|
b88b1d656a | ||
|
|
5c6824f569 | ||
|
|
e4f56d5906 | ||
|
|
d0a8d68512 | ||
|
|
ff1c7c87ef | ||
|
|
7109f5fb3b | ||
|
|
2e6b911022 | ||
|
|
2bc9592bd5 | ||
|
|
dfda6655ec | ||
|
|
d243a6b96d | ||
|
|
c4bf6588aa | ||
|
|
213c015c95 | ||
|
|
268196e7f6 | ||
|
|
e284d2e466 | ||
|
|
63e1e0451c | ||
|
|
1e06d7fe88 | ||
|
|
6a1f33d2f8 | ||
|
|
689534cfd7 | ||
|
|
d139219bba | ||
|
|
be8c5faa50 | ||
|
|
972fe8fa40 | ||
|
|
3526fe403f | ||
|
|
f8562d292b | ||
|
|
2de5528cc2 | ||
|
|
658970da29 | ||
|
|
5ad318bfae | ||
|
|
e30f0c9879 | ||
|
|
18b66ed28c | ||
|
|
8b34bc1f97 | ||
|
|
3014ece6d8 | ||
|
|
87c9de210f | ||
|
|
d5e24f0111 | ||
|
|
1ad6701f02 | ||
|
|
10ac54f1b3 | ||
|
|
81d53e2982 | ||
|
|
6bffe4dbc7 | ||
|
|
fdd08dc1f1 | ||
|
|
4e579ff75b | ||
|
|
e85e1f112a | ||
|
|
f550553e3f | ||
|
|
049d24ee4f | ||
|
|
42f47b7b0a | ||
|
|
87414352a5 | ||
|
|
c353f79342 | ||
|
|
c3efb91e31 | ||
|
|
cbe39ba881 |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
open_collective: openapi_generator
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
|
||||
- [ ] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh`, `./bin/openapi3/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\bin\windows\`. If contributing template-only or documentation-only changes which will change sample output, be sure to [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) first.
|
||||
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`~~, `3.4.x`, `4.0.x`~~. Default: `master`.
|
||||
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.1.x`, `5.0.x`. Default: `master`.
|
||||
- [ ] Copied the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
|
||||
|
||||
### Description of the PR
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -88,6 +88,9 @@ samples/client/petstore/java/jersey2/build/
|
||||
samples/client/petstore/java/okhttp-gson/.gradle/
|
||||
samples/client/petstore/java/okhttp-gson/build/
|
||||
samples/client/petstore/java/feign/build/
|
||||
samples/client/petstore/java/feign10x/build/
|
||||
samples/client/petstore/java/feign/project/
|
||||
samples/client/petstore/java/feign10x/project/
|
||||
samples/client/petstore/java/retrofit/build/
|
||||
samples/client/petstore/java/retrofit2/build/
|
||||
samples/client/petstore/java/retrofit2/hello.txt
|
||||
@@ -218,6 +221,7 @@ samples/server/petstore/erlang-server/rebar.lock
|
||||
samples/client/petstore/dart/petstore/packages
|
||||
samples/client/petstore/dart/flutter_petstore/test/packages
|
||||
samples/client/petstore/dart/petstore/test/packages
|
||||
**/.dart_tool
|
||||
|
||||
# JS
|
||||
samples/client/petstore/javascript/package-lock.json
|
||||
|
||||
@@ -1 +1 @@
|
||||
oracle64-1.8.0.152
|
||||
1.8
|
||||
|
||||
31
.travis.yml
31
.travis.yml
@@ -7,6 +7,9 @@ jdk:
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
# Avoid caching our built dependencies between runs.
|
||||
- rm -fr $HOME/.m2/repository/org/openapitools/
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
@@ -128,26 +131,40 @@ script:
|
||||
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
|
||||
- mvn --quiet --batch-mode --show-version clean install
|
||||
- mvn --quiet --batch-mode --show-version verify -Psamples
|
||||
# test maven plugin
|
||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml
|
||||
- mvn clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml
|
||||
# test gradle plugin
|
||||
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
|
||||
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
|
||||
after_success:
|
||||
# push to maven repo
|
||||
- if [ $SONATYPE_USERNAME ] && [ -z $TRAVIS_TAG ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
if [ "$TRAVIS_BRANCH" = "master" ]; then
|
||||
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ]; then
|
||||
echo "Publishing from branch $TRAVIS_BRANCH";
|
||||
mvn clean deploy -DskipTests=true -B -U -P release --settings CI/settings.xml;
|
||||
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
||||
pushd .;
|
||||
cd modules/openapi-generator-gradle-plugin;
|
||||
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" uploadArchives --no-daemon;
|
||||
echo "Finished ./gradlew uploadArchives";
|
||||
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishMavenJavaPublicationToNexusRepository closeAndReleaseRepository --no-daemon;
|
||||
echo "Finished ./gradlew publishPluginMavenPublicationToNexusRepository closeAndReleaseRepository";
|
||||
popd;
|
||||
elif ([[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]) ; then
|
||||
elif [ -z $TRAVIS_TAG ] && [[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]; then
|
||||
echo "Publishing from branch $TRAVIS_BRANCH";
|
||||
mvn clean deploy --settings CI/settings.xml;
|
||||
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
||||
pushd .;
|
||||
cd modules/openapi-generator-gradle-plugin;
|
||||
./gradlew -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishPluginMavenPublicationToNexusRepository closeAndReleaseRepository --no-daemon;
|
||||
echo "Finished ./gradlew publishPluginMavenPublicationToNexusRepository closeAndReleaseRepository";
|
||||
popd;
|
||||
fi;
|
||||
if [ -n $TRAVIS_TAG ] && [[ "$TRAVIS_TAG" =~ ^[v][0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Publishing the gradle plugin to Gradle Portal on tag $TRAVIS_TAG (only)";
|
||||
pushd .;
|
||||
cd modules/openapi-generator-gradle-plugin;
|
||||
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" publishPlugins -Dgradle.publish.key=$GRADLE_PUBLISH_KEY -Dgradle.publish.secret=$GRADLE_PUBLISH_SECRET --no-daemon;
|
||||
echo "Finished ./gradlew publishPlugins (plugin portal)";
|
||||
./gradlew -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" uploadArchives --no-daemon;
|
||||
echo "Finished ./gradlew uploadArchives";
|
||||
popd;
|
||||
fi;
|
||||
fi;
|
||||
|
||||
@@ -12,6 +12,15 @@ if [ "$NODE_INDEX" = "1" ]; then
|
||||
#cp CI/pom.xml.circleci pom.xml
|
||||
java -version
|
||||
mvn --quiet verify -Psamples.circleci
|
||||
|
||||
# generate all petstore samples (client, servers, doc)
|
||||
./bin/run-all-petstore
|
||||
# generate all petstore samples (openapi3)
|
||||
./bin/openapi3/run-all-petstore
|
||||
# generate test scripts
|
||||
./bin/tests/run-all-test
|
||||
# test all generators with fake petstore spec (2.0, 3.0)
|
||||
./bin/utils/test-fake-petstore-for-all.sh
|
||||
elif [ "$NODE_INDEX" = "2" ]; then
|
||||
# run ensure-up-to-date sample script on SNAPSHOT version only
|
||||
project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout`
|
||||
|
||||
@@ -47,16 +47,16 @@ OpenAPI spec version: 1.0.0
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="JsonSubTypes">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
||||
@@ -65,10 +65,10 @@ OpenAPI spec version: 1.0.0
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
42
README.md
42
README.md
@@ -2,11 +2,20 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.0.0`): [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.0.2`): [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
|
||||
[`4.1.x`](https://github.com/OpenAPITools/openapi-generator/tree/4.1.x) branch: [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
|
||||
[`5.0.x`](https://github.com/OpenAPITools/openapi-generator/tree/5.0.x) branch: [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
@@ -88,7 +97,10 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
|
||||
OpenAPI Generator Version | Release Date | Notes
|
||||
---------------------------- | ------------ | -----
|
||||
[4.0.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.0.0) (latest stable release) | 13.05.2019 | Major release with breaking changes (with or without fallback)
|
||||
5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/)| 13.05.2020 | Major release with breaking changes (no fallback)
|
||||
4.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.0-SNAPSHOT/)| 15.07.2019 | Minor release (breaking changes with fallbacks)
|
||||
4.0.2 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.2-SNAPSHOT/)| 15.06.2019 | Patch release (minor bug fixes, etc)
|
||||
[4.0.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.0.2) (latest stable release) | 31.05.2019 | Patch release (bug fixes, minor enhancements, etc)
|
||||
|
||||
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||
|
||||
@@ -144,16 +156,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository.
|
||||
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
|
||||
|
||||
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.0/openapi-generator-cli-4.0.0.jar`
|
||||
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.0/openapi-generator-cli-4.0.0.jar -O openapi-generator-cli.jar
|
||||
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
```
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.0/openapi-generator-cli-4.0.0.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -356,10 +368,10 @@ npm install @openapitools/openapi-generator-cli -g
|
||||
openapi-generator version
|
||||
```
|
||||
|
||||
Or install a particualar OpenAPI Generator version (e.g. v4.0.0):
|
||||
Or install a particualar OpenAPI Generator version (e.g. v4.0.2):
|
||||
|
||||
```sh
|
||||
npm install @openapitools/openapi-generator-cli@cli-4.0.0 -g
|
||||
npm install @openapitools/openapi-generator-cli@cli-4.0.2 -g
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@@ -382,7 +394,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
```
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.0/openapi-generator-cli-4.0.0.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar)
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
|
||||
@@ -524,6 +536,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [codecentric AG](https://www.codecentric.de/)
|
||||
- [Cupix](https://www.cupix.com/)
|
||||
- [FormAPI](https://formapi.io/)
|
||||
- [Fuse](https://www.fuse.no/)
|
||||
- [GenFlow](https://github.com/RepreZen/GenFlow)
|
||||
- [GMO Pepabo](https://pepabo.com/en/)
|
||||
- [GoDaddy](https://godaddy.com)
|
||||
@@ -542,6 +555,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [unblu inc.](https://www.unblu.com/)
|
||||
- [Veamly](https://www.veamly.com/)
|
||||
- [Xero](https://www.xero.com/)
|
||||
- [Yelp](https://www.yelp.com/)
|
||||
- [Zalando](https://www.zalando.com)
|
||||
|
||||
## [5 - Presentations/Videos/Tutorials/Books](#table-of-contents)
|
||||
@@ -571,9 +585,13 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2019-03-25 - [Access any REST service with the SAP S/4HANA Cloud SDK](https://blogs.sap.com/2019/03/25/integrate-sap-s4hana-cloud-sdk-with-open-api/) by [Alexander Duemont](https://people.sap.com/alexander.duemont)
|
||||
- 2019-03-25 - [OpenAPI generatorを試してみる](https://qiita.com/amuyikam/items/e8a45daae59c68be0fc8) by [@amuyikam](https://twitter.com/amuyikam)
|
||||
- 2019-03-27 - [OpenAPI3を使ってみよう!Go言語でクライアントとスタブの自動生成まで!](https://techblog.zozo.com/entry/openapi3/go) by [@gold_kou](https://twitter.com/gold_kou)
|
||||
- 2019-04-17 - [OpenAPIによるスキーマファースト開発の実施サンプルとCloud Runについて](https://tech-blog.optim.co.jp/entry/2019/04/17/174000) by [@yukey1031](https://twitter.com/yukey1031)
|
||||
- 2019-04-18 - [How to use OpenAPI3 for API developer (RubyKaigi 2019)](https://speakerdeck.com/ota42y/how-to-use-openapi3-for-api-developer) by [@ota42y](https://twitter.com/ota42y) at [RubyKaigi 2019](https://rubykaigi.org/2019)
|
||||
- 2019-04-29 - [A Beginner's Guide to Code Generation for REST APIs (OpenAPI Generator)](https://gum.co/openapi_generator_ebook) by [William Cheng](https://twitter.com/wing328)
|
||||
- 2019-05-01 - [Design and generate a REST API from Swagger / OpenAPI in Java, Python, C# and more](https://simply-how.com/design-and-generate-api-code-from-openapi) by [Simply How](https://simply-how.com/)
|
||||
- 2019-05-17 - [Generate Spring Boot REST API using Swagger/OpenAPI](https://www.47northlabs.com/knowledge-base/generate-spring-boot-rest-api-using-swagger-openapi/) by [Antonie Zafirov](https://www.47northlabs.com/author/antonie-zafirov/)
|
||||
- 2019-05-22 - [REST APIs代码生成指南(OpenAPI Generator)](https://gum.co/openapi_generator_ebook_gb) by [William Cheng](https://twitter.com/wing328), [Xin Meng](https://github.com/xmeng1)
|
||||
- 2019-05/24 - [REST API 代碼生成指南 (OpenAPI Generator)](https://gum.co/openapi_generator_ebook_big5) by [William Cheng](https://twitter.com/wing328)
|
||||
|
||||
## [6 - About Us](#table-of-contents)
|
||||
|
||||
@@ -586,7 +604,8 @@ OpenAPI Generator core team members are contributors who have been making signif
|
||||
* [@jimschubert](https://github.com/jimschubert) (2016/05) [:heart:](https://www.patreon.com/jimschubert)
|
||||
* [@cbornet](https://github.com/cbornet) (2016/05)
|
||||
* [@ackintosh](https://github.com/ackintosh) (2018/02) [:heart:](https://www.patreon.com/ackintosh/overview)
|
||||
* [@jmini](https://github.com/jmini) (2018/04)
|
||||
* [@jmini](https://github.com/jmini) (2018/04) [:heart:](https://www.patreon.com/jmini)
|
||||
* [@etherealjoy](https://github.com/etherealjoy) (2019/06)
|
||||
|
||||
:heart: = Link to support the contributor directly
|
||||
|
||||
@@ -655,6 +674,7 @@ Here is a list of template creators:
|
||||
* TypeScript (jQuery): @bherila
|
||||
* TypeScript (Node): @mhardorf
|
||||
* TypeScript (Rxjs): @denyo
|
||||
* TypeScript (Inversify): @gualtierim
|
||||
* Server Stubs
|
||||
* Ada: @stcarrez
|
||||
* C# ASP.NET5: @jimschubert [:heart:](https://www.patreon.com/jimschubert)
|
||||
@@ -738,7 +758,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Apex | |
|
||||
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
|
||||
| C | @zhemant (2018/11) |
|
||||
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @fvarose (2017/11) @etherealjoy (2018/02) @martindelille (2018/03) |
|
||||
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) |
|
||||
| C# | @mandrean (2017/08), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert) |
|
||||
| Clojure | |
|
||||
| Dart | @ircecho (2017/07) @swipesight (2018/09) @jaumard (2018/09) |
|
||||
@@ -793,7 +813,7 @@ OpenAPI Generator is a fork of [Swagger Codegen](https://github.com/swagger-api/
|
||||
- [Jean-François Côté](https://github.com/JFCote)
|
||||
- [Jim Schubert](https://github.com/jimschubert)
|
||||
- [Jon Schoning](https://github.com/jonschoning)
|
||||
- [Jérémie Bresson](https://github.com/jmini)
|
||||
- [Jérémie Bresson](https://github.com/jmini) [:heart:](https://www.patreon.com/jmini)
|
||||
- [Jörn Ahrens](https://github.com/jayearn)
|
||||
- [Keni Steward](https://github.com/kenisteward)
|
||||
- [Marcin Stefaniuk](https://github.com/mstefaniuk)
|
||||
|
||||
@@ -30,7 +30,6 @@ install:
|
||||
- cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5
|
||||
- cmd: java -version
|
||||
- cmd: gradle -v
|
||||
- cmd: gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --info
|
||||
- cmd: dir/w
|
||||
- git clone https://github.com/wing328/swagger-samples
|
||||
- ps: Start-Process -FilePath 'C:\maven\apache-maven-3.2.5\bin\mvn' -ArgumentList 'jetty:run' -WorkingDirectory "$env:appveyor_build_folder\swagger-samples\java\java-jersey-jaxrs-ci"
|
||||
@@ -50,6 +49,8 @@ build_script:
|
||||
- msbuild samples\client\petstore\csharp\OpenAPIClientNetStandard\Org.OpenAPITools.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||
# install openapi-generator locally
|
||||
- mvn clean install --quiet
|
||||
# run the locally installed openapi-generator-gradle-plugin
|
||||
- gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --info
|
||||
test_script:
|
||||
# restore test-related files
|
||||
- copy /b/v/y CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
@@ -57,9 +58,9 @@ test_script:
|
||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test c# API client
|
||||
- nunit-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
|
||||
- nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
|
||||
# test c# API client (with PropertyChanged)
|
||||
- nunit-console samples\client\petstore\csharp\OpenAPIClientWithPropertyChanged\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
|
||||
- nunit3-console samples\client\petstore\csharp\OpenAPIClientWithPropertyChanged\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
|
||||
|
||||
# generate all petstore clients
|
||||
- .\bin\windows\run-all-petstore.cmd
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/cpp-rest-sdk-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/cpp-rest-sdk-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk/client $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -32,6 +32,6 @@ ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
# restore csproj file
|
||||
echo "restore csproject file: CI/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj"
|
||||
echo "restore csproject file: CI/samples.ci/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj"
|
||||
cp ./CI/samples.ci/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj ./samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/MSF4J -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-msf4j -o samples/server/petstore/java-msf4j/ -DhideGenerationTimestamp=true --additional-properties artifactId=java-msf4j-server $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/java-msf4j-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-msf4j -o samples/server/petstore/java-msf4j/ -DhideGenerationTimestamp=true --additional-properties artifactId=java-msf4j-server $@"
|
||||
|
||||
echo "Removing files and folders under samples/server/petstore/java-msf4j/src/main"
|
||||
rm -rf samples/server/petstore/java-msf4j/src/main
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/undertow -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-undertow-server -o samples/server/petstore/undertow --additional-properties hideGenerationTimestamp=true $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/java-undertow-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-undertow-server -o samples/server/petstore/java-undertow --additional-properties hideGenerationTimestamp=true $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
4
bin/kotlin-springboot-petstore-all.sh
Executable file
4
bin/kotlin-springboot-petstore-all.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/kotlin-springboot-petstore-server.sh
|
||||
./bin/kotlin-springboot-petstore-server-reactive.sh
|
||||
35
bin/kotlin-springboot-petstore-server-reactive.sh
Executable file
35
bin/kotlin-springboot-petstore-server-reactive.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=$(ls -ld "$SCRIPT")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=$(dirname "$SCRIPT")/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=$(dirname "$SCRIPT")/..
|
||||
APP_DIR=$(cd "${APP_DIR}"; pwd)
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/petstore/kotlin-springboot-reactive --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,reactive=true"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot-reactive"
|
||||
rm -rf samples/server/petstore/kotlin-springboot-reactive
|
||||
|
||||
echo "Generating Kotling Spring Boot reactive server..."
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server-deprecated --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server -o samples/server/petstore/nodejs -Dservice $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server-deprecated -o samples/server/petstore/nodejs -Dservice $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate $@ -t modules/openapi-generator/src/main/resources/finch -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-finch -o samples/server/petstore/finch"
|
||||
ags="generate $@ -t modules/openapi-generator/src/main/resources/scala-finch -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-finch -o samples/server/petstore/scala-finch"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
4
bin/openapi3/kotlin-springboot-petstore-all.sh
Executable file
4
bin/openapi3/kotlin-springboot-petstore-all.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/openapi3/kotlin-springboot-petstore-server.sh
|
||||
./bin/openapi3/kotlin-springboot-petstore-server-reactive.sh
|
||||
35
bin/openapi3/kotlin-springboot-petstore-server-reactive.sh
Executable file
35
bin/openapi3/kotlin-springboot-petstore-server-reactive.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=$(ls -ld "$SCRIPT")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=$(dirname "$SCRIPT")/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=$(dirname "$SCRIPT")/..
|
||||
APP_DIR=$(cd "${APP_DIR}"; pwd)
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/openapi3/petstore/kotlin-springboot-reactive --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,reactive=true"
|
||||
|
||||
echo "Cleaning previously generated files if any from samples/server/openapi3/petstore/kotlin-springboot-reactive"
|
||||
rm -rf samples/server/openapi3/petstore/kotlin-springboot-reactive
|
||||
|
||||
echo "Generating Kotling Spring Boot server..."
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server-deprecated --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server -o samples/server/petstore/nodejs -Dservice $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server-deprecated -o samples/server/petstore/nodejs -Dservice $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
input=modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
out_folder=samples/server/openapi3/petstore/php-ze-ph
|
||||
resources=modules/openapi-generator/src/main/resources/ze-ph
|
||||
resources=modules/openapi-generator/src/main/resources/php-ze-ph
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
input=modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
out_folder=samples/server/petstore/php-ze-ph
|
||||
resources=modules/openapi-generator/src/main/resources/ze-ph
|
||||
resources=modules/openapi-generator/src/main/resources/php-ze-ph
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
|
||||
@@ -27,6 +27,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/finch -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g scala-finch -o samples/server/petstore/finch $@"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/scala-finch -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g scala-finch -o samples/server/petstore/scala-finch $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -48,11 +48,13 @@ declare -a scripts=(
|
||||
"./bin/r-petstore.sh"
|
||||
"./bin/haskell-http-client-petstore.sh"
|
||||
"./bin/csharp-petstore.sh"
|
||||
"./bin/csharp-netcore-petstore.sh"
|
||||
"./bin/csharp-netcore-petstore-all.sh"
|
||||
"./bin/elixir-petstore.sh"
|
||||
"./bin/go-petstore.sh"
|
||||
"./bin/go-petstore-withxml.sh"
|
||||
"./bin/go-gin-petstore-server.sh"
|
||||
"./bin/groovy-petstore.sh"
|
||||
"./bin/apex-petstore.sh"
|
||||
#"./bin/elm-petstore-all.sh"
|
||||
"./bin/meta-codegen.sh"
|
||||
# OTHERS
|
||||
|
||||
@@ -33,8 +33,10 @@ fi
|
||||
|
||||
echo "Release preparation: replacing $FROM with $TO in different files"
|
||||
|
||||
# This script assumes the files defined here have a version surrounded by angle brackets within an xml node.
|
||||
# For example, >4.0.0< becomes >4.0.1-SNAPSHOT<.
|
||||
# Verify the sed command below against a file before adding here.
|
||||
declare -a files=("modules/openapi-generator-cli/pom.xml"
|
||||
"modules/openapi-generator-gradle-plugin/gradle.properties"
|
||||
"modules/openapi-generator-gradle-plugin/pom.xml"
|
||||
"modules/openapi-generator-core/pom.xml"
|
||||
"modules/openapi-generator-maven-plugin/pom.xml"
|
||||
@@ -51,7 +53,7 @@ sedi () {
|
||||
for filename in "${files[@]}"; do
|
||||
# e.g. sed -i '' "s/3.0.1-SNAPSHOT/3.0.1/g" CI/pom.xml.bash
|
||||
#echo "Running command: sed -i '' "s/$FROM/$TO/g" $filename"
|
||||
if sedi "s/$FROM/$TO/g" $filename; then
|
||||
if sedi "s/>$FROM</>$TO</g" $filename; then
|
||||
echo "Updated $filename successfully!"
|
||||
else
|
||||
echo "ERROR: Failed to update $filename with the following command"
|
||||
|
||||
@@ -34,12 +34,13 @@ fi
|
||||
echo "Release preparation: replacing $FROM with $TO in different files"
|
||||
|
||||
declare -a files=("modules/openapi-generator-maven-plugin/README.md"
|
||||
"modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml"
|
||||
"modules/openapi-generator-maven-plugin/examples/java-client.xml"
|
||||
"modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml"
|
||||
"modules/openapi-generator-maven-plugin/examples/non-java.xml"
|
||||
"modules/openapi-generator-gradle-plugin/README.adoc"
|
||||
"modules/openapi-generator-gradle-plugin/gradle.properties"
|
||||
"modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties"
|
||||
"modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle"
|
||||
"modules/openapi-generator-gradle-plugin/samples/local-spec/README.md"
|
||||
"README.md")
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-restsdk -o samples\client\petstore\cpp-restsdk
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g cpp-restsdk -o samples\client\petstore\cpp-restsdk\client
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
||||
@@ -5,7 +5,7 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\openapi-generator\src\test/resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples\client\petstore\csharp\SwaggerClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C}
|
||||
set ags=generate -i modules\openapi-generator\src\test/resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples\client\petstore\csharp\OpenAPIClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C}
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@ If Not Exist %executable% (
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g php-ze-ph -o samples\server\petstore\ze-ph
|
||||
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g php-ze-ph -o samples\server\petstore\php-ze-ph
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
||||
|
||||
@@ -91,7 +91,7 @@ The following generators are available:
|
||||
- [jaxrs-spec](generators/jaxrs-spec.md)
|
||||
- [kotlin-server](generators/kotlin-server.md)
|
||||
- [kotlin-spring](generators/kotlin-spring.md)
|
||||
- [nodejs-server](generators/nodejs-server.md)
|
||||
- [nodejs-server-deprecated](generators/nodejs-server-deprecated.md) (deprecated)
|
||||
- [php-laravel](generators/php-laravel.md)
|
||||
- [php-lumen](generators/php-lumen.md)
|
||||
- [php-silex](generators/php-silex.md)
|
||||
|
||||
@@ -28,3 +28,4 @@ sidebar_label: csharp
|
||||
|netCoreProjectFile|Use the new format (.NET Core) for .NET project files (.csproj).| |false|
|
||||
|validatable|Generates self-validatable models.| |true|
|
||||
|useCompareNetObjects|Use KellermanSoftware.CompareNetObjects for deep recursive object comparison. WARNING: this option incurs potential performance impact.| |false|
|
||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive| |false|
|
||||
|
||||
@@ -10,6 +10,7 @@ sidebar_label: go
|
||||
|packageName|Go package name (convention: lowercase).| |openapi|
|
||||
|packageVersion|Go package version.| |1.0.0|
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|isGoSubmodule|whether the generated Go module is a submodule| |false|
|
||||
|withGoCodegenComment|whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs| |false|
|
||||
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|
||||
@@ -17,8 +17,6 @@ sidebar_label: groovy
|
||||
|groupId|groupId in generated pom.xml| |org.openapitools|
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-groovy|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
|
||||
|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|
||||
|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapitools/openapi-generator.git|
|
||||
|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|
||||
@@ -54,4 +54,5 @@ sidebar_label: java
|
||||
|useRuntimeException|Use RuntimeException instead of Exception| |false|
|
||||
|feignVersion|Version of OpenFeign: '10.x', '9.x' (default)| |false|
|
||||
|useReflectionEqualsHashCode|Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.| |false|
|
||||
|caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false|
|
||||
|library|library template (sub-template) to use|<dl><dt>**jersey1**</dt><dd>HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.8.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.</dd><dt>**jersey2**</dt><dd>HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.x</dd><dt>**feign**</dt><dd>HTTP client: OpenFeign 9.x or 10.x. JSON processing: Jackson 2.8.x. To enable OpenFeign 10.x, set the 'feignVersion' option to '10.x'</dd><dt>**okhttp-gson**</dt><dd>[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.</dd><dt>**retrofit**</dt><dd>HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.</dd><dt>**retrofit2**</dt><dd>HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)</dd><dt>**resttemplate**</dt><dd>HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.8.x</dd><dt>**webclient**</dt><dd>HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x</dd><dt>**resteasy**</dt><dd>HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.8.x</dd><dt>**vertx**</dt><dd>HTTP client: VertX client 3.x. JSON processing: Jackson 2.8.x</dd><dt>**google-api-client**</dt><dd>HTTP client: Google API client 1.x. JSON processing: Jackson 2.8.x</dd><dt>**rest-assured**</dt><dd>HTTP client: rest-assured : 3.x. JSON processing: Gson 2.x. Only for Java8</dd><dl>|okhttp-gson|
|
||||
|
||||
@@ -13,7 +13,7 @@ sidebar_label: javascript-flowtyped
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package| |null|
|
||||
|npmVersion|The version of your npm package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|
||||
@@ -20,10 +20,11 @@ sidebar_label: kotlin-spring
|
||||
|serverPort|configuration the port in which the sever is to run on| |8080|
|
||||
|modelPackage|model package for generated code| |org.openapitools.model|
|
||||
|apiPackage|api package for generated code| |org.openapitools.api|
|
||||
|exceptionHandler|generate default global exception handlers| |true|
|
||||
|exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true|
|
||||
|gradleBuildFile|generate a gradle build file using the Kotlin DSL| |true|
|
||||
|swaggerAnnotations|generate swagger annotations to go alongside controllers and models| |false|
|
||||
|serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false|
|
||||
|serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false|
|
||||
|useBeanValidation|Use BeanValidation API annotations to validate data types| |true|
|
||||
|reactive|use coroutines for reactive behavior| |false|
|
||||
|library|library template (sub-template)|<dl><dt>**spring-boot**</dt><dd>Spring-boot Server application.</dd><dl>|spring-boot|
|
||||
|
||||
16
docs/generators/nodejs-server-deprecated.md
Normal file
16
docs/generators/nodejs-server-deprecated.md
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
---
|
||||
id: generator-opts-server-nodejs-server-deprecated
|
||||
title: Config Options for nodejs-server-deprecated
|
||||
sidebar_label: nodejs-server-deprecated
|
||||
---
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|
||||
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|googleCloudFunctions|When specified, it will generate the code which runs within Google Cloud Functions instead of standalone Node.JS server. See https://cloud.google.com/functions/docs/quickstart for the details of how to deploy the generated code.| |false|
|
||||
|exportedName|When the generated code will be deployed to Google Cloud Functions, this option can be used to update the name of the exported function. By default, it refers to the basePath. This does not affect normal standalone nodejs server code.| |null|
|
||||
|serverPort|TCP port to listen on.| |null|
|
||||
@@ -13,10 +13,10 @@ sidebar_label: typescript-angular
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full angular package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false|
|
||||
|providedInRoot|Use this property to provide Injectables in root (it is only valid in angular version greater or equal to 6.0.0).| |false|
|
||||
|
||||
@@ -13,5 +13,6 @@ sidebar_label: typescript-aurelia
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package| |null|
|
||||
|npmVersion|The version of your npm package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|
||||
@@ -13,10 +13,10 @@ sidebar_label: typescript-axios
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package| |null|
|
||||
|npmVersion|The version of your npm package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url of your private npmRepo in the package.json| |null|
|
||||
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|withSeparateModelsAndApi|Put the model and api in separate folders and in separate classes| |false|
|
||||
|withoutPrefixEnums|Don't prefix enum names with class names| |false|
|
||||
|
||||
@@ -13,8 +13,8 @@ sidebar_label: typescript-fetch
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package| |null|
|
||||
|npmVersion|The version of your npm package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|
||||
@@ -13,10 +13,11 @@ sidebar_label: typescript-inversify
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package| |null|
|
||||
|npmVersion|The version of your npm package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|usePromise|Setting this property to use promise instead of observable inside every service.| |false|
|
||||
|useRxJS6|Setting this property to use rxjs 6 instead of rxjs 5.| |false|
|
||||
|taggedUnions|Use discriminators to create tagged unions instead of extending interfaces.| |false|
|
||||
|
||||
@@ -13,8 +13,8 @@ sidebar_label: typescript-jquery
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package| |null|
|
||||
|npmVersion|The version of your npm package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|jqueryAlreadyImported|When using this in legacy app using mix of typescript and javascript, this will only declare jquery and not import it| |false|
|
||||
|
||||
@@ -13,7 +13,7 @@ sidebar_label: typescript-node
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package| |null|
|
||||
|npmVersion|The version of your npm package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|
||||
@@ -13,8 +13,8 @@ sidebar_label: typescript-rxjs
|
||||
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|
||||
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name| |camelCase|
|
||||
|supportsES6|Generate code that conforms to ES6.| |false|
|
||||
|npmName|The name under which you want to publish generated npm package| |null|
|
||||
|npmVersion|The version of your npm package| |null|
|
||||
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|
||||
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
|
||||
|snapshot|When setting this property to true, the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|
||||
|snapshot|When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm| |false|
|
||||
|withInterfaces|Setting this property to true will generate interfaces next to the default class implementations.| |false|
|
||||
|
||||
@@ -7,7 +7,7 @@ It's easy to work with templates for codegen!
|
||||
|
||||
The generator workflow has [transforming logic](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages) as well as templates for each generation of code.
|
||||
|
||||
Each generator will create a data structure from the OpenAPI document; OpenAPI 2.0 and OpenAPI 3.x documents are normalized into the same API model within the generator. This model is then applied to the templates. While generators do not need to perform transformations, it's often necessary in order to add more advanced support for your language or framework. You may need to refer to the generator implementation to understand some of the logic while creating or customizing templates (see [FinchServerCodegen.java](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/FinchServerCodegen.java) for an advanced example).
|
||||
Each generator will create a data structure from the OpenAPI document; OpenAPI 2.0 and OpenAPI 3.x documents are normalized into the same API model within the generator. This model is then applied to the templates. While generators do not need to perform transformations, it's often necessary in order to add more advanced support for your language or framework. You may need to refer to the generator implementation to understand some of the logic while creating or customizing templates (see [ScalaFinchServerCodegen.java](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java) for an advanced example).
|
||||
|
||||
The transform logic needs to implement [CodegenConfig.java](https://github.com/openapitools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java) and is most easily done by extending [DefaultCodegen.java](https://github.com/openapitools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java). Take a look at the various implementations as a guideline while the instructions get more complete.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -83,7 +83,7 @@ public class Meta implements Runnable {
|
||||
ImmutableList.of(
|
||||
new SupportingFile("pom.mustache", "", "pom.xml"),
|
||||
new SupportingFile("generatorClass.mustache", on(File.separator).join("src/main/java", asPath(targetPackage)), mainClass.concat(".java")),
|
||||
new SupportingFile("debugGeneratorTest.mustache", on(File.separator).join("src/test/java", asPath("org.openapitools.codegen.debug")), "DebugCodegenLauncher.java"),
|
||||
new SupportingFile("generatorClassTest.mustache", on(File.separator).join("src/test/java", asPath(targetPackage)), mainClass.concat("Test.java")),
|
||||
new SupportingFile("README.mustache", "", "README.md"),
|
||||
new SupportingFile("api.template", "src/main/resources" + File.separator + name,"api.mustache"),
|
||||
new SupportingFile("model.template", "src/main/resources" + File.separator + name,"model.mustache"),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -40,26 +40,32 @@ compileJava.dependsOn tasks.openApiGenerate
|
||||
|
||||
== Plugin Setup
|
||||
|
||||
[source,group]
|
||||
----
|
||||
plugins {
|
||||
id "org.openapi.generator" version "4.0.2"
|
||||
}
|
||||
----
|
||||
|
||||
Using https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application[legacy plugin application]:
|
||||
|
||||
[source,groovy]
|
||||
----
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
// or, via Gradle Plugin Portal:
|
||||
// url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:4.0.0"
|
||||
classpath "org.openapitools:openapi-generator-gradle-plugin:4.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'org.openapi.generator'
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
The gradle plugin is not currently published to https://plugins.gradle.org/m2/.
|
||||
====
|
||||
|
||||
== Configuration
|
||||
|
||||
=== openApiGenerate
|
||||
@@ -599,7 +605,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:4.0.0') {
|
||||
classpath('org.openapitools:openapi-generator-gradle-plugin:4.0.2') {
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.2.60'
|
||||
ext.kotlin_version = '1.2.61'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
@@ -11,14 +11,13 @@ buildscript {
|
||||
maven {
|
||||
url "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
maven {
|
||||
url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "gradle.plugin.org.gradle.kotlin:gradle-kotlin-dsl-plugins:1.0-rc-3"
|
||||
classpath "com.gradle.publish:plugin-publish-plugin:0.10.1"
|
||||
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.20.0"
|
||||
classpath "de.marcphilipp.gradle:nexus-publish-plugin:0.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +34,11 @@ ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
||||
|
||||
apply plugin: 'com.gradle.plugin-publish'
|
||||
apply plugin: 'java-gradle-plugin'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'signing'
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: "org.gradle.kotlin.kotlin-dsl"
|
||||
apply plugin: 'io.codearte.nexus-staging'
|
||||
apply plugin: "de.marcphilipp.nexus-publish"
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
@@ -87,6 +87,72 @@ test {
|
||||
}
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
from javadoc
|
||||
classifier = 'javadoc'
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from sourceSets.main.allSource
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives javadocJar, sourcesJar
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
pom {
|
||||
name = 'OpenAPI-Generator Contributors'
|
||||
description = project.description
|
||||
url = 'https://openapi-generator.tech'
|
||||
organization {
|
||||
name = 'org.openapitools'
|
||||
url = 'https://github.com/OpenAPITools'
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name = "The Apache Software License, Version 2.0"
|
||||
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
distribution = "repo"
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "openapitools"
|
||||
name = "OpenAPI-Generator Contributors"
|
||||
email = "team@openapitools.org"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = 'https://github.com/OpenAPITools/openapi-generator'
|
||||
connection = 'scm:git:git://github.com/OpenAPITools/openapi-generator.git'
|
||||
developerConnection = 'scm:git:ssh://git@github.com:OpenAPITools/openapi-generator.git'
|
||||
}
|
||||
issueManagement {
|
||||
system = 'GitHub'
|
||||
url = 'https://github.com/OpenAPITools/openapi-generator/issues'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nexusStaging {
|
||||
username = project.properties["ossrhUsername"]
|
||||
password = project.properties["ossrhPassword"]
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
// To retrieve: ./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="$SIGNING_SECRET" getStagingProfile --no-daemon
|
||||
stagingProfileId = "456297f829bbbe"
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
openApiGenerator {
|
||||
@@ -109,6 +175,7 @@ pluginBundle {
|
||||
displayName = 'OpenAPI Generator Gradle Plugin'
|
||||
tags = ['openapi-3.0', 'openapi-2.0', 'openapi', 'swagger', 'codegen', 'sdk']
|
||||
version = "$openApiGeneratorVersion"
|
||||
group = "org.openapitools"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,79 +186,8 @@ pluginBundle {
|
||||
// or stored as key=value pairs in ~/.gradle/gradle.properties
|
||||
// You can also apply them in CI via environment variables. See Gradle's docs for details.
|
||||
signing {
|
||||
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
|
||||
sign configurations.archives
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from sourceSets.main.allSource
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives javadocJar, sourcesJar
|
||||
}
|
||||
|
||||
def pomConfig = {
|
||||
description project.description
|
||||
name 'OpenAPI-Generator Contributors'
|
||||
url 'https://openapi-generator.tech'
|
||||
organization {
|
||||
name 'org.openapitools'
|
||||
url 'https://github.com/OpenAPITools'
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name "The Apache Software License, Version 2.0"
|
||||
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
|
||||
distribution "repo"
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id "openapitools"
|
||||
name "OpenAPI-Generator Contributors"
|
||||
email "team@openapitools.org"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url 'https://github.com/OpenAPITools/openapi-generator'
|
||||
connection 'scm:git:git://github.com/OpenAPITools/openapi-generator.git'
|
||||
developerConnection 'scm:git:ssh://git@github.com:OpenAPITools/openapi-generator.git'
|
||||
}
|
||||
issueManagement {
|
||||
system 'GitHub'
|
||||
url 'https://github.com/OpenAPITools/openapi-generator/issues'
|
||||
}
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
|
||||
// credentials here would need to be passed along with the gradle command:
|
||||
// ./gradlew -P ossrhUsername=yourUser
|
||||
// or stored in ~/.gradle/gradle.properties as key=value pairs
|
||||
mavenDeployer {
|
||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
|
||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
|
||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
||||
}
|
||||
|
||||
pom.withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('description', project.description)
|
||||
root.children().last() + pomConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
required { isReleaseVersion && (gradle.taskGraph.hasTask("publishPluginMavenPublicationToNexusRepository") ) }
|
||||
sign publishing.publications.mavenJava
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
@@ -205,4 +201,19 @@ compileTestKotlin {
|
||||
}
|
||||
}
|
||||
|
||||
uploadArchives.dependsOn 'check'
|
||||
javadoc {
|
||||
if(JavaVersion.current().isJava9Compatible()) {
|
||||
options.addBooleanOption('html5', true)
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
closeRepository {
|
||||
onlyIf { nexusPublishing.useStaging.get() }
|
||||
}
|
||||
releaseRepository{
|
||||
onlyIf { nexusPublishing.useStaging.get() }
|
||||
}
|
||||
}
|
||||
|
||||
publishToNexus.dependsOn 'check'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
openApiGeneratorVersion=4.0.0
|
||||
openApiGeneratorVersion=4.0.2
|
||||
|
||||
# BEGIN placeholders
|
||||
# these are just placeholders to allow contributors to build directly
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -72,7 +72,7 @@
|
||||
<!-- calls "clean assemble install" -->
|
||||
<task>clean</task>
|
||||
<task>assemble</task>
|
||||
<task>install</task>
|
||||
<task>publishToMavenLocal</task>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
1
modules/openapi-generator-gradle-plugin/samples/.gitignore
vendored
Normal file
1
modules/openapi-generator-gradle-plugin/samples/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.bak/
|
||||
@@ -17,5 +17,5 @@ gradle generateGoWithInvalidSpec
|
||||
The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example:
|
||||
|
||||
```bash
|
||||
gradle -PopenApiGeneratorVersion=4.0.0 openApiValidate
|
||||
gradle -PopenApiGeneratorVersion=4.0.2 openApiValidate
|
||||
```
|
||||
|
||||
@@ -1 +1 @@
|
||||
openApiGeneratorVersion=4.0.0
|
||||
openApiGeneratorVersion=4.0.2
|
||||
|
||||
BIN
modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
172
modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew
vendored
Executable file
172
modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew
vendored
Executable file
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
84
modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat
vendored
Normal file
84
modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,2 +1,3 @@
|
||||
rootProject.name = 'openapi-generator-gradle-plugin'
|
||||
enableFeaturePreview('STABLE_PUBLISHING')
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -39,50 +39,56 @@ mvn clean compile
|
||||
|
||||
:bulb: These **general** configurations should be in the same level
|
||||
|
||||
- `inputSpec` - OpenAPI Spec file path
|
||||
- `language` - target generation language (deprecated, replaced by `generatorName` as values here don't represent only 'language' any longer)
|
||||
- `generatorName` - target generator name
|
||||
- `output` - target output path (default is `${project.build.directory}/generated-sources/openapi`. Can also be set globally through the `openapi.generator.maven.plugin.output` property)
|
||||
- `templateDirectory` - directory with mustache templates
|
||||
- `addCompileSourceRoot` - add the output directory to the project as a source root (`true` by default)
|
||||
- `modelPackage` - the package to use for generated model objects/classes
|
||||
- `apiPackage` - the package to use for generated api objects/classes
|
||||
- `invokerPackage` - the package to use for the generated invoker objects
|
||||
- `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums
|
||||
- `withXml` - enable XML annotations inside the generated models and API (only works with Java `language` and libraries that provide support for JSON and XML)
|
||||
- `configOptions` - a map of language-specific parameters. To show a full list of generator-specified parameters (options), please use `configHelp` (explained below)
|
||||
- `configHelp` - dumps the configuration help for the specified library (generates no sources)
|
||||
- `ignoreFileOverride` - specifies the full path to a `.openapi-generator-ignore` used for pattern based overrides of generated outputs
|
||||
- `removeOperationIdPrefix` - remove operationId prefix (e.g. user_getName => getName)
|
||||
- `logToStderr` - write all log messages (not just errors) to STDOUT
|
||||
- `enablePostProcessFile` - enable file post-processing hook
|
||||
- `skipValidateSpec` - Whether or not to skip validating the input spec prior to generation. By default, invalid specifications will result in an error.
|
||||
- `strictSpec` - Whether or not to treat an input document strictly against the spec. 'MUST' and 'SHALL' wording in OpenAPI spec is strictly adhered to. e.g. when false, no fixes will be applied to documents which pass validation but don't follow the spec.
|
||||
- `generateAliasAsModel` - generate alias (array, map) as model
|
||||
- `generateApis` - generate the apis (`true` by default)
|
||||
- `generateApiTests` - generate the api tests (`true` by default. Only available if `generateApis` is `true`)
|
||||
- `generateApiDocumentation` - generate the api documentation (`true` by default. Only available if `generateApis` is `true`)
|
||||
- `generateModels` - generate the models (`true` by default)
|
||||
- `modelsToGenerate` - A comma separated list of models to generate. All models is the default.
|
||||
- `generateModelTests` - generate the model tests (`true` by default. Only available if `generateModels` is `true`)
|
||||
- `generateModelDocumentation` - generate the model documentation (`true` by default. Only available if `generateModels` is `true`)
|
||||
- `generateSupportingFiles` - generate the supporting files (`true` by default)
|
||||
- `supportingFilesToGenerate` - A comma separated list of supporting files to generate. All files is the default.
|
||||
- `skip` - skip code generation (`false` by default. Can also be set globally through the `codegen.skip` property)
|
||||
- `verbose` - verbose mode (`false` by default)
|
||||
- `groupId`, `artifactId` and `artifactVersion` - sets project information in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators
|
||||
- `gitUserId` and `gitRepoId` - sets git information of the project
|
||||
- `auth` - adds authorization headers when fetching the OpenAPI definitions remotely. Pass in a URL-encoded string of `name:header` with a comma separating multiple values
|
||||
- `configurationFile` - Path to separate json configuration file. File content should be in a json format {"optionKey":"optionValue", "optionKey1":"optionValue1"...} Supported options can be different for each language. Run `config-help -g {generator name}` command for language specific config options
|
||||
- `skipOverwrite` - Specifies if the existing files should be overwritten during the generation. (`false` by default)
|
||||
- `library` - library template (sub-template)
|
||||
- `instantiationTypes` - sets instantiation type mappings in the format of type=instantiatedType,type=instantiatedType. For example (in Java): `array=ArrayList,map=HashMap`. In other words array types will get instantiated as ArrayList in generated code. You can also have multiple occurrences of this option
|
||||
- `importMappings` - specifies mappings between a given class and the import that should be used for that class in the format of type=import,type=import. You can also have multiple occurrences of this option
|
||||
- `typeMappings` - sets mappings between OpenAPI spec types and generated code types in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: `array=List,map=Map,string=String`. You can also have multiple occurrences of this option
|
||||
- `languageSpecificPrimitives` - specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: `String,boolean,Boolean,Double`. You can also have multiple occurrences of this option
|
||||
- `additionalProperties` - sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. You can also have multiple occurrences of this option
|
||||
- `reservedWordsMappings` - specifies how a reserved name should be escaped to. Otherwise, the default `_<name>` is used. For example `id=identifier`. You can also have multiple occurrences of this option
|
||||
- `skipIfSpecIsUnchanged` - Skip the execution if the source file is older than the output folder (`false` by default. Can also be set globally through the `codegen.skipIfSpecIsUnchanged` property)
|
||||
| Option | Property | Description |
|
||||
|--------|----------|-------------|
|
||||
| `inputSpec` | `openapi.generator.maven.plugin.inputSpec` | OpenAPI Spec file path
|
||||
| `language` | `openapi.generator.maven.plugin.language` | target generation language (deprecated, replaced by `generatorName` as values here don't represent only 'language' any longer)
|
||||
| `generatorName` | `openapi.generator.maven.plugin.generatorName` | target generator name
|
||||
| `output` | `openapi.generator.maven.plugin.output` | target output path (default is `${project.build.directory}/generated-sources/openapi`. Can also be set globally through the `openapi.generator.maven.plugin.output` property)
|
||||
| `templateDirectory` | `openapi.generator.maven.plugin.templateDirectory` | directory with mustache templates
|
||||
| `addCompileSourceRoot` | `openapi.generator.maven.plugin.addCompileSourceRoot` | add the output directory to the project as a source root (`true` by default)
|
||||
| `modelPackage` | `openapi.generator.maven.plugin.modelPackage` | the package to use for generated model objects/classes
|
||||
| `apiPackage` | `openapi.generator.maven.plugin.apiPackage` | the package to use for generated api objects/classes
|
||||
| `invokerPackage` | `openapi.generator.maven.plugin.invokerPackage` | the package to use for the generated invoker objects
|
||||
| `modelNamePrefix` | `openapi.generator.maven.plugin.modelNamePrefix` | Sets the prefix for model classes and enums
|
||||
| `modelNameSuffix` | `openapi.generator.maven.plugin.modelNameSuffix` | Sets the suffix for model classes and enums
|
||||
| `withXml` | `openapi.generator.maven.plugin.withXml` | enable XML annotations inside the generated models and API (only works with Java `language` and libraries that provide support for JSON and XML)
|
||||
| `configOptions` | N/A | a map of language-specific parameters. To show a full list of generator-specified parameters (options), please use `configHelp` (explained below)
|
||||
| `configHelp` | `codegen.configHelp` | dumps the configuration help for the specified library (generates no sources)
|
||||
| `ignoreFileOverride` | `openapi.generator.maven.plugin.ignoreFileOverride` | specifies the full path to a `.openapi-generator-ignore` used for pattern based overrides of generated outputs
|
||||
| `removeOperationIdPrefix` | `openapi.generator.maven.plugin.removeOperationIdPrefix` | remove operationId prefix (e.g. user_getName => getName)
|
||||
| `logToStderr` | `openapi.generator.maven.plugin.logToStderr` | write all log messages (not just errors) to STDOUT
|
||||
| `enablePostProcessFile` | `openapi.generator.maven.plugin.` | enable file post-processing hook
|
||||
| `skipValidateSpec` | `openapi.generator.maven.plugin.skipValidateSpec` | Whether or not to skip validating the input spec prior to generation. By default, invalid specifications will result in an error.
|
||||
| `strictSpec` | `openapi.generator.maven.plugin.strictSpec` | Whether or not to treat an input document strictly against the spec. 'MUST' and 'SHALL' wording in OpenAPI spec is strictly adhered to. e.g. when false, no fixes will be applied to documents which pass validation but don't follow the spec.
|
||||
| `generateAliasAsModel` | `openapi.generator.maven.plugin.generateAliasAsModel` | generate alias (array, map) as model
|
||||
| `generateApis` | `openapi.generator.maven.plugin.generateApis` | generate the apis (`true` by default)
|
||||
| `generateApiTests` | `openapi.generator.maven.plugin.generateApiTests` | generate the api tests (`true` by default. Only available if `generateApis` is `true`)
|
||||
| `generateApiDocumentation` | `openapi.generator.maven.plugin.generateApiDocumentation` | generate the api documentation (`true` by default. Only available if `generateApis` is `true`)
|
||||
| `generateModels` | `openapi.generator.maven.plugin.generateModels` | generate the models (`true` by default)
|
||||
| `modelsToGenerate` | `openapi.generator.maven.plugin.modelsToGenerate` | A comma separated list of models to generate. All models is the default.
|
||||
| `generateModelTests` | `openapi.generator.maven.plugin.generateModelTests` | generate the model tests (`true` by default. Only available if `generateModels` is `true`)
|
||||
| `generateModelDocumentation` | `openapi.generator.maven.plugin.generateModelDocumentation` | generate the model documentation (`true` by default. Only available if `generateModels` is `true`)
|
||||
| `generateSupportingFiles` | `openapi.generator.maven.plugin.generateSupportingFiles` | generate the supporting files (`true` by default)
|
||||
| `supportingFilesToGenerate` | `openapi.generator.maven.plugin.supportingFilesToGenerate` | A comma separated list of supporting files to generate. All files is the default.
|
||||
| `skip` | `codegen.skip` | skip code generation (`false` by default. Can also be set globally through the `codegen.skip` property)
|
||||
| `verbose` | `openapi.generator.maven.plugin.verbose` | verbose mode (`false` by default)
|
||||
| `groupId` | `openapi.generator.maven.plugin.groupId` | sets project information in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators
|
||||
| `artifactId` | `openapi.generator.maven.plugin.artifactId` | sets project information in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators
|
||||
| `artifactVersion` | `openapi.generator.maven.plugin.artifactVersion` | sets project information in generated pom.xml/build.gradle or other build script. Language-specific conversions occur in non-jvm generators
|
||||
| `gitUserId` and `gitRepoId` | `openapi.generator.maven.plugin.gitUserId` | sets git information of the project
|
||||
| `auth` | `openapi.generator.maven.plugin.auth` | adds authorization headers when fetching the OpenAPI definitions remotely. Pass in a URL-encoded string of `name:header` with a comma separating multiple values
|
||||
| `configurationFile` | `openapi.generator.maven.plugin.configurationFile` | Path to separate json configuration file. File content should be in a json format {"optionKey":"optionValue", "optionKey1":"optionValue1"...} Supported options can be different for each language. Run `config-help -g {generator name}` command for language specific config options
|
||||
| `skipOverwrite` | `openapi.generator.maven.plugin.skipOverwrite` | Specifies if the existing files should be overwritten during the generation. (`false` by default)
|
||||
| `library` | `openapi.generator.maven.plugin.library` | library template (sub-template)
|
||||
| `instantiationTypes` | `openapi.generator.maven.plugin.instantiationTypes` | sets instantiation type mappings in the format of type=instantiatedType,type=instantiatedType. For example (in Java): `array=ArrayList,map=HashMap`. In other words array types will get instantiated as ArrayList in generated code. You can also have multiple occurrences of this option
|
||||
| `importMappings` | `openapi.generator.maven.plugin.importMappings` | specifies mappings between a given class and the import that should be used for that class in the format of type=import,type=import. You can also have multiple occurrences of this option
|
||||
| `typeMappings` | `openapi.generator.maven.plugin.typeMappings` | sets mappings between OpenAPI spec types and generated code types in the format of OpenAPIType=generatedType,OpenAPIType=generatedType. For example: `array=List,map=Map,string=String`. You can also have multiple occurrences of this option
|
||||
| `languageSpecificPrimitives` | `openapi.generator.maven.plugin.languageSpecificPrimitives` | specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: `String,boolean,Boolean,Double`. You can also have multiple occurrences of this option
|
||||
| `additionalProperties` | `openapi.generator.maven.plugin.additionalProperties` | sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. You can also have multiple occurrences of this option
|
||||
| `reservedWordsMappings` | `openapi.generator.maven.plugin.reservedWordsMappings` | specifies how a reserved name should be escaped to. Otherwise, the default `_<name>` is used. For example `id=identifier`. You can also have multiple occurrences of this option
|
||||
| `skipIfSpecIsUnchanged` | `codegen.skipIfSpecIsUnchanged` | Skip the execution if the source file is older than the output folder (`false` by default. Can also be set globally through the `codegen.skipIfSpecIsUnchanged` property)
|
||||
| `engine` | `openapi.generator.maven.plugin.engine` | The name of templating engine to use, "mustache" (default) or "handlebars" (beta)
|
||||
|
||||
|
||||
### Custom Generator
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -50,6 +50,12 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<dependencies>
|
||||
<!-- dependencies are needed for the client being generated -->
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<version>4.0.2</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
@@ -63,6 +63,12 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<dependencies>
|
||||
<!-- dependencies are needed for the client being generated -->
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -31,4 +31,10 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -30,4 +30,10 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
|
||||
@@ -105,146 +105,152 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
/**
|
||||
* Location of the OpenAPI spec, as URL or file.
|
||||
*/
|
||||
@Parameter(name = "inputSpec", required = true)
|
||||
@Parameter(name = "inputSpec", property = "openapi.generator.maven.plugin.inputSpec", required = true)
|
||||
private String inputSpec;
|
||||
|
||||
/**
|
||||
* Git user ID, e.g. swagger-api.
|
||||
*/
|
||||
@Parameter(name = "gitUserId", required = false)
|
||||
@Parameter(name = "gitUserId", property = "openapi.generator.maven.plugin.gitUserId", required = false)
|
||||
private String gitUserId;
|
||||
|
||||
/**
|
||||
* Git repo ID, e.g. openapi-generator.
|
||||
*/
|
||||
@Parameter(name = "gitRepoId", required = false)
|
||||
@Parameter(name = "gitRepoId", property = "openapi.generator.maven.plugin.gitRepoId", required = false)
|
||||
private String gitRepoId;
|
||||
|
||||
/**
|
||||
* Folder containing the template files.
|
||||
*/
|
||||
@Parameter(name = "templateDirectory")
|
||||
@Parameter(name = "templateDirectory", property = "openapi.generator.maven.plugin.templateDirectory")
|
||||
private File templateDirectory;
|
||||
|
||||
/**
|
||||
* The name of templating engine to use, "mustache" (default) or "handlebars" (beta)
|
||||
*/
|
||||
@Parameter(name = "engine", defaultValue = "mustache", property="openapi.generator.maven.plugin.engine")
|
||||
private String engine;
|
||||
|
||||
/**
|
||||
* Adds authorization headers when fetching the swagger definitions remotely. " Pass in a
|
||||
* URL-encoded string of name:header with a comma separating multiple values
|
||||
*/
|
||||
@Parameter(name = "auth")
|
||||
@Parameter(name = "auth", property = "openapi.generator.maven.plugin.auth")
|
||||
private String auth;
|
||||
|
||||
/**
|
||||
* Path to separate json configuration file.
|
||||
*/
|
||||
@Parameter(name = "configurationFile", required = false)
|
||||
@Parameter(name = "configurationFile", property = "openapi.generator.maven.plugin.configurationFile", required = false)
|
||||
private String configurationFile;
|
||||
|
||||
/**
|
||||
* Specifies if the existing files should be overwritten during the generation.
|
||||
*/
|
||||
@Parameter(name = "skipOverwrite", required = false)
|
||||
@Parameter(name = "skipOverwrite", property = "openapi.generator.maven.plugin.skipOverwrite", required = false)
|
||||
private Boolean skipOverwrite;
|
||||
|
||||
/**
|
||||
* The package to use for generated api objects/classes
|
||||
*/
|
||||
@Parameter(name = "apiPackage")
|
||||
@Parameter(name = "apiPackage", property = "openapi.generator.maven.plugin.apiPackage")
|
||||
private String apiPackage;
|
||||
|
||||
/**
|
||||
* The package to use for generated model objects/classes
|
||||
*/
|
||||
@Parameter(name = "modelPackage")
|
||||
@Parameter(name = "modelPackage", property = "openapi.generator.maven.plugin.modelPackage")
|
||||
private String modelPackage;
|
||||
|
||||
/**
|
||||
* The package to use for the generated invoker objects
|
||||
*/
|
||||
@Parameter(name = "invokerPackage")
|
||||
@Parameter(name = "invokerPackage", property = "openapi.generator.maven.plugin.invokerPackage")
|
||||
private String invokerPackage;
|
||||
|
||||
/**
|
||||
* The default package to use for the generated objects
|
||||
*/
|
||||
@Parameter(name = "packageName")
|
||||
@Parameter(name = "packageName", property = "openapi.generator.maven.plugin.packageName")
|
||||
private String packageName;
|
||||
|
||||
/**
|
||||
* groupId in generated pom.xml
|
||||
*/
|
||||
@Parameter(name = "groupId")
|
||||
@Parameter(name = "groupId", property = "openapi.generator.maven.plugin.groupId")
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* artifactId in generated pom.xml
|
||||
*/
|
||||
@Parameter(name = "artifactId")
|
||||
@Parameter(name = "artifactId", property = "openapi.generator.maven.plugin.artifactId")
|
||||
private String artifactId;
|
||||
|
||||
/**
|
||||
* artifact version in generated pom.xml
|
||||
*/
|
||||
@Parameter(name = "artifactVersion")
|
||||
@Parameter(name = "artifactVersion", property = "openapi.generator.maven.plugin.artifactVersion")
|
||||
private String artifactVersion;
|
||||
|
||||
/**
|
||||
* Sets the library
|
||||
*/
|
||||
@Parameter(name = "library", required = false)
|
||||
@Parameter(name = "library", property = "openapi.generator.maven.plugin.library", required = false)
|
||||
private String library;
|
||||
|
||||
/**
|
||||
* Sets the prefix for model enums and classes
|
||||
*/
|
||||
@Parameter(name = "modelNamePrefix", required = false)
|
||||
@Parameter(name = "modelNamePrefix", property = "openapi.generator.maven.plugin.modelNamePrefix", required = false)
|
||||
private String modelNamePrefix;
|
||||
|
||||
/**
|
||||
* Sets the suffix for model enums and classes
|
||||
*/
|
||||
@Parameter(name = "modelNameSuffix", required = false)
|
||||
@Parameter(name = "modelNameSuffix", property = "openapi.generator.maven.plugin.modelNameSuffix", required = false)
|
||||
private String modelNameSuffix;
|
||||
|
||||
/**
|
||||
* Sets an optional ignoreFileOverride path
|
||||
*/
|
||||
@Parameter(name = "ignoreFileOverride", required = false)
|
||||
@Parameter(name = "ignoreFileOverride", property = "openapi.generator.maven.plugin.ignoreFileOverride", required = false)
|
||||
private String ignoreFileOverride;
|
||||
|
||||
/**
|
||||
* To remove operationId prefix (e.g. user_getName => getName)
|
||||
*/
|
||||
@Parameter(name = "removeOperationIdPrefix", required = false)
|
||||
@Parameter(name = "removeOperationIdPrefix", property = "openapi.generator.maven.plugin.removeOperationIdPrefix", required = false)
|
||||
private Boolean removeOperationIdPrefix;
|
||||
|
||||
/**
|
||||
* To write all log messages (not just errors) to STDOUT
|
||||
*/
|
||||
@Parameter(name = "logToStderr", required = false)
|
||||
@Parameter(name = "logToStderr", property = "openapi.generator.maven.plugin.logToStderr", required = false)
|
||||
private Boolean logToStderr;
|
||||
|
||||
/**
|
||||
* To file post-processing hook
|
||||
*/
|
||||
@Parameter(name = "enablePostProcessFile", required = false)
|
||||
@Parameter(name = "enablePostProcessFile", property = "openapi.generator.maven.plugin.enablePostProcessFile", required = false)
|
||||
private Boolean enablePostProcessFile;
|
||||
|
||||
/**
|
||||
* To skip spec validation
|
||||
*/
|
||||
@Parameter(name = "skipValidateSpec", required = false)
|
||||
@Parameter(name = "skipValidateSpec", property = "openapi.generator.maven.plugin.skipValidateSpec", required = false)
|
||||
private Boolean skipValidateSpec;
|
||||
|
||||
/**
|
||||
* To treat a document strictly against the spec.
|
||||
*/
|
||||
@Parameter(name = "strictSpec", required = false)
|
||||
private Boolean strictSpecBehavior;
|
||||
@Parameter(name = "strictSpec", property = "openapi.generator.maven.plugin.strictSpec", required = false)
|
||||
private Boolean strictSpec;
|
||||
|
||||
/**
|
||||
* To generate alias (array, map) as model
|
||||
*/
|
||||
@Parameter(name = "generateAliasAsModel", required = false)
|
||||
@Parameter(name = "generateAliasAsModel", property = "openapi.generator.maven.plugin.generateAliasAsModel", required = false)
|
||||
private Boolean generateAliasAsModel;
|
||||
|
||||
/**
|
||||
@@ -256,97 +262,97 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
/**
|
||||
* A map of types and the types they should be instantiated as
|
||||
*/
|
||||
@Parameter(name = "instantiationTypes")
|
||||
@Parameter(name = "instantiationTypes", property = "openapi.generator.maven.plugin.instantiationTypes")
|
||||
private List<String> instantiationTypes;
|
||||
|
||||
/**
|
||||
* A map of classes and the import that should be used for that class
|
||||
*/
|
||||
@Parameter(name = "importMappings")
|
||||
@Parameter(name = "importMappings", property = "openapi.generator.maven.plugin.importMappings")
|
||||
private List<String> importMappings;
|
||||
|
||||
/**
|
||||
* A map of swagger spec types and the generated code types to use for them
|
||||
*/
|
||||
@Parameter(name = "typeMappings")
|
||||
@Parameter(name = "typeMappings", property = "openapi.generator.maven.plugin.typeMappings")
|
||||
private List<String> typeMappings;
|
||||
|
||||
/**
|
||||
* A map of additional language specific primitive types
|
||||
*/
|
||||
@Parameter(name = "languageSpecificPrimitives")
|
||||
@Parameter(name = "languageSpecificPrimitives", property = "openapi.generator.maven.plugin.languageSpecificPrimitives")
|
||||
private List<String> languageSpecificPrimitives;
|
||||
|
||||
/**
|
||||
* A map of additional properties that can be referenced by the mustache templates
|
||||
*/
|
||||
@Parameter(name = "additionalProperties")
|
||||
@Parameter(name = "additionalProperties", property = "openapi.generator.maven.plugin.additionalProperties")
|
||||
private List<String> additionalProperties;
|
||||
|
||||
/**
|
||||
* A map of reserved names and how they should be escaped
|
||||
*/
|
||||
@Parameter(name = "reservedWordsMappings")
|
||||
@Parameter(name = "reservedWordsMappings", property = "openapi.generator.maven.plugin.reservedWordMappings")
|
||||
private List<String> reservedWordsMappings;
|
||||
|
||||
/**
|
||||
* Generate the apis
|
||||
*/
|
||||
@Parameter(name = "generateApis", required = false)
|
||||
@Parameter(name = "generateApis", property = "openapi.generator.maven.plugin.generateApis", required = false)
|
||||
private Boolean generateApis = true;
|
||||
|
||||
/**
|
||||
* Generate the models
|
||||
*/
|
||||
@Parameter(name = "generateModels", required = false)
|
||||
@Parameter(name = "generateModels", property = "openapi.generator.maven.plugin.generateModels", required = false)
|
||||
private Boolean generateModels = true;
|
||||
|
||||
/**
|
||||
* A comma separated list of models to generate. All models is the default.
|
||||
*/
|
||||
@Parameter(name = "modelsToGenerate", required = false)
|
||||
@Parameter(name = "modelsToGenerate", property = "openapi.generator.maven.plugin.modelsToGenerate", required = false)
|
||||
private String modelsToGenerate = "";
|
||||
|
||||
/**
|
||||
* Generate the supporting files
|
||||
*/
|
||||
@Parameter(name = "generateSupportingFiles", required = false)
|
||||
@Parameter(name = "generateSupportingFiles", property = "openapi.generator.maven.plugin.generateSupportingFiles", required = false)
|
||||
private Boolean generateSupportingFiles = true;
|
||||
|
||||
/**
|
||||
* A comma separated list of models to generate. All models is the default.
|
||||
*/
|
||||
@Parameter(name = "supportingFilesToGenerate", required = false)
|
||||
@Parameter(name = "supportingFilesToGenerate", property = "openapi.generator.maven.plugin.supportingFilesToGenerate", required = false)
|
||||
private String supportingFilesToGenerate = "";
|
||||
|
||||
/**
|
||||
* Generate the model tests
|
||||
*/
|
||||
@Parameter(name = "generateModelTests", required = false)
|
||||
@Parameter(name = "generateModelTests", property = "openapi.generator.maven.plugin.generateModelTests", required = false)
|
||||
private Boolean generateModelTests = true;
|
||||
|
||||
/**
|
||||
* Generate the model documentation
|
||||
*/
|
||||
@Parameter(name = "generateModelDocumentation", required = false)
|
||||
@Parameter(name = "generateModelDocumentation", property = "openapi.generator.maven.plugin.generateModelDocumentation", required = false)
|
||||
private Boolean generateModelDocumentation = true;
|
||||
|
||||
/**
|
||||
* Generate the api tests
|
||||
*/
|
||||
@Parameter(name = "generateApiTests", required = false)
|
||||
@Parameter(name = "generateApiTests", property = "openapi.generator.maven.plugin.generateApiTests", required = false)
|
||||
private Boolean generateApiTests = true;
|
||||
|
||||
/**
|
||||
* Generate the api documentation
|
||||
*/
|
||||
@Parameter(name = "generateApiDocumentation", required = false)
|
||||
@Parameter(name = "generateApiDocumentation", property = "openapi.generator.maven.plugin.generateApiDocumentation", required = false)
|
||||
private Boolean generateApiDocumentation = true;
|
||||
|
||||
/**
|
||||
* Generate the api documentation
|
||||
*/
|
||||
@Parameter(name = "withXml", required = false)
|
||||
@Parameter(name = "withXml", property = "openapi.generator.maven.plugin.withXml", required = false)
|
||||
private Boolean withXml = false;
|
||||
|
||||
/**
|
||||
@@ -374,7 +380,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter
|
||||
protected Map<String, String> originalEnvironmentVariables = new HashMap<String, String>();
|
||||
|
||||
@Parameter
|
||||
@Parameter(property = "codegen.configHelp")
|
||||
private boolean configHelp = false;
|
||||
|
||||
/**
|
||||
@@ -465,8 +471,8 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator.setValidateSpec(!skipValidateSpec);
|
||||
}
|
||||
|
||||
if (strictSpecBehavior != null) {
|
||||
configurator.setStrictSpecBehavior(strictSpecBehavior);
|
||||
if (strictSpec != null) {
|
||||
configurator.setStrictSpecBehavior(strictSpec);
|
||||
}
|
||||
|
||||
if (logToStderr != null) {
|
||||
@@ -550,6 +556,10 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
configurator.setTemplateDir(templateDirectory.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (null != engine) {
|
||||
configurator.setTemplatingEngineName(engine);
|
||||
}
|
||||
|
||||
// Set generation options
|
||||
if (null != generateApis && generateApis) {
|
||||
GeneratorProperties.setProperty(CodegenConstants.APIS, "");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>openapi-generator-online</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -313,7 +313,7 @@
|
||||
<dependency>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-core</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.0.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
|
||||
@@ -69,6 +69,9 @@ public class CodegenConstants {
|
||||
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
|
||||
public static final String WITH_GO_CODEGEN_COMMENT_DESC = "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs";
|
||||
|
||||
public static final String IS_GO_SUBMODULE = "isGoSubmodule";
|
||||
public static final String IS_GO_SUBMODULE_DESC = "whether the generated Go module is a submodule";
|
||||
|
||||
public static final String GROUP_ID = "groupId";
|
||||
public static final String GROUP_ID_DESC = "groupId in generated pom.xml";
|
||||
|
||||
@@ -232,6 +235,8 @@ public class CodegenConstants {
|
||||
public static final String PARCELIZE_MODELS = "parcelizeModels";
|
||||
public static final String PARCELIZE_MODELS_DESC = "toggle \"@Parcelize\" for generated models";
|
||||
|
||||
public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders";
|
||||
public static final String CASE_INSENSITIVE_RESPONSE_HEADERS_DESC = "Make API response's headers case-insensitive";
|
||||
|
||||
// Not user-configurable. System provided for use in templates.
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class CodegenParameter {
|
||||
public String example; // example value (x-example)
|
||||
public String jsonSchema;
|
||||
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary,
|
||||
isBoolean, isDate, isDateTime, isUuid, isEmail, isFreeFormObject;
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject;
|
||||
public boolean isListContainer, isMapContainer;
|
||||
public boolean isFile;
|
||||
public boolean isEnum;
|
||||
@@ -168,6 +168,7 @@ public class CodegenParameter {
|
||||
output.isDate = this.isDate;
|
||||
output.isDateTime = this.isDateTime;
|
||||
output.isUuid = this.isUuid;
|
||||
output.isUri = this.isUri;
|
||||
output.isEmail = this.isEmail;
|
||||
output.isFreeFormObject = this.isFreeFormObject;
|
||||
output.isListContainer = this.isListContainer;
|
||||
@@ -222,6 +223,7 @@ public class CodegenParameter {
|
||||
Objects.equals(isDate, that.isDate) &&
|
||||
Objects.equals(isDateTime, that.isDateTime) &&
|
||||
Objects.equals(isUuid, that.isUuid) &&
|
||||
Objects.equals(isUri, that.isUri) &&
|
||||
Objects.equals(isEmail, that.isEmail) &&
|
||||
Objects.equals(isFreeFormObject, that.isFreeFormObject) &&
|
||||
Objects.equals(isListContainer, that.isListContainer) &&
|
||||
@@ -289,6 +291,7 @@ public class CodegenParameter {
|
||||
isDate,
|
||||
isDateTime,
|
||||
isUuid,
|
||||
isUri,
|
||||
isEmail,
|
||||
isFreeFormObject,
|
||||
isListContainer,
|
||||
@@ -357,6 +360,7 @@ public class CodegenParameter {
|
||||
", isDate=" + isDate +
|
||||
", isDateTime=" + isDateTime +
|
||||
", isUuid=" + isUuid +
|
||||
", isUri=" + isUri +
|
||||
", isEmail=" + isEmail +
|
||||
", isFreeFormObject=" + isFreeFormObject +
|
||||
", isListContainer=" + isListContainer +
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CodegenProperty implements Cloneable {
|
||||
public boolean hasMoreNonReadOnly; // for model constructor, true if next property is not readonly
|
||||
public boolean isPrimitiveType, isModel, isContainer;
|
||||
public boolean isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isByteArray, isBinary, isFile,
|
||||
isBoolean, isDate, isDateTime, isUuid, isEmail, isFreeFormObject;
|
||||
isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject;
|
||||
public boolean isListContainer, isMapContainer;
|
||||
public boolean isEnum;
|
||||
public boolean isReadOnly;
|
||||
@@ -472,6 +472,7 @@ public class CodegenProperty implements Cloneable {
|
||||
isDate,
|
||||
isDateTime,
|
||||
isUuid,
|
||||
isUri,
|
||||
isEmail,
|
||||
isFreeFormObject,
|
||||
isMapContainer,
|
||||
@@ -552,6 +553,7 @@ public class CodegenProperty implements Cloneable {
|
||||
Objects.equals(isDate, other.isDate) &&
|
||||
Objects.equals(isDateTime, other.isDateTime) &&
|
||||
Objects.equals(isUuid, other.isUuid) &&
|
||||
Objects.equals(isUri, other.isUri) &&
|
||||
Objects.equals(isEmail, other.isEmail) &&
|
||||
Objects.equals(isFreeFormObject, other.isFreeFormObject) &&
|
||||
Objects.equals(isBinary, other.isBinary) &&
|
||||
@@ -649,6 +651,7 @@ public class CodegenProperty implements Cloneable {
|
||||
", isDate=" + isDate +
|
||||
", isDateTime=" + isDateTime +
|
||||
", isUuid=" + isUuid +
|
||||
", isUri=" + isUri +
|
||||
", isEmail=" + isEmail +
|
||||
", isFreeFormObject=" + isFreeFormObject +
|
||||
", isListContainer=" + isListContainer +
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CodegenSecurity {
|
||||
// Oauth specific
|
||||
public String flow, authorizationUrl, tokenUrl;
|
||||
public List<Map<String, Object>> scopes;
|
||||
public Boolean isCode, isPassword, isApplication, isImplicit;
|
||||
public Boolean isCode, isPassword, isApplication, isImplicit, hasScopes;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -1015,6 +1015,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("binary", "File");
|
||||
typeMapping.put("file", "File");
|
||||
typeMapping.put("UUID", "UUID");
|
||||
typeMapping.put("URI", "URI");
|
||||
//typeMapping.put("BigDecimal", "BigDecimal"); //TODO need the mapping?
|
||||
|
||||
|
||||
@@ -1025,6 +1026,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping.put("BigDecimal", "java.math.BigDecimal");
|
||||
importMapping.put("UUID", "java.util.UUID");
|
||||
importMapping.put("URI", "java.net.URI");
|
||||
importMapping.put("File", "java.io.File");
|
||||
importMapping.put("Date", "java.util.Date");
|
||||
importMapping.put("Timestamp", "java.sql.Timestamp");
|
||||
@@ -1233,6 +1235,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.example = "2013-10-20T19:20:30+01:00";
|
||||
} else if (Boolean.TRUE.equals(codegenParameter.isUuid)) {
|
||||
codegenParameter.example = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
|
||||
} else if (Boolean.TRUE.equals(codegenParameter.isUri)) {
|
||||
codegenParameter.example = "https://openapi-generator.tech";
|
||||
} else if (Boolean.TRUE.equals(codegenParameter.isString)) {
|
||||
codegenParameter.example = codegenParameter.paramName + "_example";
|
||||
} else if (Boolean.TRUE.equals(codegenParameter.isFreeFormObject)) {
|
||||
@@ -1512,6 +1516,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
return "array";
|
||||
} else if (ModelUtils.isUUIDSchema(schema)) {
|
||||
return "UUID";
|
||||
} else if (ModelUtils.isURISchema(schema)) {
|
||||
return "URI";
|
||||
} else if (ModelUtils.isStringSchema(schema)) {
|
||||
return "string";
|
||||
} else if (ModelUtils.isFreeFormObject(schema)) {
|
||||
@@ -2038,6 +2044,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// keep isString to true to make it backward compatible
|
||||
property.isString = true;
|
||||
property.isUuid = true;
|
||||
} else if (ModelUtils.isURISchema(p)) {
|
||||
property.isString = true; // for backward compatibility
|
||||
property.isUri = true;
|
||||
} else if (ModelUtils.isEmailSchema(p)) {
|
||||
property.isString = true;
|
||||
property.isEmail = true;
|
||||
@@ -2201,6 +2210,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// property.baseType = getSimpleRef(p.get$ref());
|
||||
//}
|
||||
// --END of revision
|
||||
property.isModel = ModelUtils.isModel(p);
|
||||
setNonArrayMapProperty(property, type);
|
||||
}
|
||||
|
||||
@@ -3026,6 +3036,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else {
|
||||
codegenParameter.dataType = codegenProperty.dataType;
|
||||
}
|
||||
if (ModelUtils.isObjectSchema(parameterSchema)) {
|
||||
codegenProperty.complexType = codegenParameter.dataType;
|
||||
}
|
||||
codegenParameter.dataFormat = codegenProperty.dataFormat;
|
||||
codegenParameter.required = codegenProperty.required;
|
||||
|
||||
@@ -3212,6 +3225,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
* @return data type
|
||||
*/
|
||||
protected String getParameterDataType(Parameter parameter, Schema schema) {
|
||||
if (parameter.get$ref() != null) {
|
||||
String refName = ModelUtils.getSimpleRef(parameter.get$ref());
|
||||
return toModelName(refName);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -4643,9 +4660,17 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
schema.setAdditionalProperties(inner);
|
||||
}
|
||||
CodegenProperty codegenProperty = fromProperty("property", schema);
|
||||
// only support 1-dimension map only
|
||||
|
||||
imports.add(codegenProperty.baseType);
|
||||
|
||||
CodegenProperty innerCp = codegenProperty;
|
||||
while (innerCp != null) {
|
||||
if (innerCp.complexType != null) {
|
||||
imports.add(innerCp.complexType);
|
||||
}
|
||||
innerCp = innerCp.items;
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(bodyParameterName)) {
|
||||
codegenParameter.baseName = "request_body";
|
||||
} else {
|
||||
@@ -4698,7 +4723,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.items = codegenProperty.items;
|
||||
codegenParameter.mostInnerItems = codegenProperty.mostInnerItems;
|
||||
codegenParameter.dataType = getTypeDeclaration(arraySchema);
|
||||
codegenParameter.baseType = getSchemaType(arraySchema);
|
||||
codegenParameter.baseType = getSchemaType(inner);
|
||||
codegenParameter.isContainer = Boolean.TRUE;
|
||||
codegenParameter.isListContainer = Boolean.TRUE;
|
||||
|
||||
@@ -4833,10 +4858,19 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
protected void updateOption(String key, String defaultValue) {
|
||||
for (CliOption cliOption : cliOptions) {
|
||||
if (cliOption.getOpt().equals(key)) {
|
||||
cliOption.setDefault(defaultValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void removeOption(String key) {
|
||||
for(int i = 0; i < cliOptions.size(); i++) {
|
||||
if(cliOptions.get(i).getOpt().equals(key)) {
|
||||
cliOptions.get(i).setDefault(defaultValue);
|
||||
return;
|
||||
if (key.equals(cliOptions.get(i).getOpt())) {
|
||||
cliOptions.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4853,7 +4887,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
*
|
||||
* @param objs map of object
|
||||
*/
|
||||
public void generateJSONSpecFile(Map<String, Object> objs) {
|
||||
protected void generateJSONSpecFile(Map<String, Object> objs) {
|
||||
OpenAPI openAPI = (OpenAPI) objs.get("openAPI");
|
||||
if (openAPI != null) {
|
||||
try {
|
||||
|
||||
@@ -1051,6 +1051,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
if (securities != null && securities.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Map<String, SecurityScheme> authMethods = getAuthMethods(securities, securitySchemes);
|
||||
if (authMethods == null || authMethods.isEmpty()) {
|
||||
authMethods = getAuthMethods(globalSecurities, securitySchemes);
|
||||
@@ -1058,6 +1059,39 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
|
||||
if (authMethods != null && !authMethods.isEmpty()) {
|
||||
codegenOperation.authMethods = config.fromSecurity(authMethods);
|
||||
List<Map<String, Object>> scopes = new ArrayList<Map<String, Object>>();
|
||||
if (codegenOperation.authMethods != null){
|
||||
for (CodegenSecurity security : codegenOperation.authMethods){
|
||||
if (security != null && security.isBasicBearer != null && security.isBasicBearer &&
|
||||
securities != null){
|
||||
for (SecurityRequirement req : securities){
|
||||
if (req == null) continue;
|
||||
for (String key : req.keySet()){
|
||||
if (security.name != null && key.equals(security.name)){
|
||||
int count = 0;
|
||||
for (String sc : req.get(key)){
|
||||
Map<String, Object> scope = new HashMap<String, Object>();
|
||||
scope.put("scope", sc);
|
||||
scope.put("description", "");
|
||||
count++;
|
||||
if (req.get(key) != null && count < req.get(key).size()){
|
||||
scope.put("hasMore", "true");
|
||||
} else {
|
||||
scope.put("hasMore", null);
|
||||
}
|
||||
scopes.add(scope);
|
||||
}
|
||||
//end this inner for
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
security.hasScopes = scopes.size() > 0;
|
||||
security.scopes = scopes;
|
||||
}
|
||||
}
|
||||
}
|
||||
codegenOperation.hasAuthMethods = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -277,6 +277,8 @@ public class ExampleGenerator {
|
||||
return mp;
|
||||
} else if (ModelUtils.isUUIDSchema(property)) {
|
||||
return "046b6c7f-0b8a-43b9-b35d-6489e6daee91";
|
||||
} else if (ModelUtils.isURISchema(property)) {
|
||||
return "https://openapi-generator.tech";
|
||||
} else if (ModelUtils.isStringSchema(property)) {
|
||||
LOGGER.debug("String property");
|
||||
String defaultValue = (String) property.getDefault();
|
||||
|
||||
@@ -193,6 +193,8 @@ public class XmlExampleGenerator {
|
||||
return "********";
|
||||
} else if (ModelUtils.isUUIDSchema(schema)) {
|
||||
return "046b6c7f-0b8a-43b9-b35d-6489e6daee91";
|
||||
} else if (ModelUtils.isURISchema(schema)) {
|
||||
return "https://openapi-generator.tech";
|
||||
// do these last in case the specific types above are derived from these classes
|
||||
} else if (ModelUtils.isStringSchema(schema)) {
|
||||
return "aeiou";
|
||||
|
||||
@@ -140,6 +140,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
|
||||
typeMapping.put("object", "Swagger.Object");
|
||||
typeMapping.put("number", "Swagger.Number");
|
||||
typeMapping.put("UUID", "Swagger.UString");
|
||||
typeMapping.put("URI", "Swagger.UString");
|
||||
typeMapping.put("file", "Swagger.Http_Content_Type");
|
||||
typeMapping.put("binary", "Swagger.Binary");
|
||||
|
||||
|
||||
@@ -652,19 +652,6 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
return escapeText(pattern);
|
||||
}
|
||||
|
||||
public boolean convertPropertyToBoolean(String propertyKey) {
|
||||
boolean booleanValue = false;
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
booleanValue = Boolean.valueOf(additionalProperties.get(propertyKey).toString());
|
||||
}
|
||||
|
||||
return booleanValue;
|
||||
}
|
||||
|
||||
public void writePropertyBack(String propertyKey, boolean value) {
|
||||
additionalProperties.put(propertyKey, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sanitizeTag(String tag) {
|
||||
return camelize(sanitizeName(tag));
|
||||
|
||||
@@ -76,6 +76,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
// nullable type
|
||||
protected Set<String> nullableType = new HashSet<String>();
|
||||
|
||||
protected Set<String> valueTypes = new HashSet<String>();
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractCSharpCodegen.class);
|
||||
|
||||
public AbstractCSharpCodegen() {
|
||||
@@ -185,11 +187,16 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("map", "Dictionary");
|
||||
typeMapping.put("object", "Object");
|
||||
typeMapping.put("UUID", "Guid?");
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
// nullable type
|
||||
nullableType = new HashSet<String>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double", "DateTime", "Guid")
|
||||
);
|
||||
// value Types
|
||||
valueTypes = new HashSet<String>(
|
||||
Arrays.asList("decimal", "bool", "int", "float", "long", "double")
|
||||
);
|
||||
}
|
||||
|
||||
public void setReturnICollection(boolean returnICollection) {
|
||||
@@ -414,6 +421,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
|
||||
final Map<String, Object> processed = super.postProcessAllModels(objs);
|
||||
postProcessEnumRefs(processed);
|
||||
updateValueTypeProperty(processed);
|
||||
return processed;
|
||||
}
|
||||
|
||||
@@ -454,6 +462,19 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
var.isPrimitiveType = true;
|
||||
}
|
||||
}
|
||||
for (CodegenProperty var : model.vars) {
|
||||
if (enumRefs.containsKey(var.dataType)) {
|
||||
// Handle any enum properties referred to by $ref.
|
||||
// This is different in C# than most other generators, because enums in C# are compiled to integral types,
|
||||
// while enums in many other languages are true objects.
|
||||
CodegenModel refModel = enumRefs.get(var.dataType);
|
||||
var.allowableValues = refModel.allowableValues;
|
||||
var.isEnum = true;
|
||||
|
||||
// We do these after updateCodegenPropertyEnum to avoid generalities that don't mesh with C#.
|
||||
var.isPrimitiveType = true;
|
||||
}
|
||||
}
|
||||
|
||||
// We're looping all models here.
|
||||
if (model.isEnum) {
|
||||
@@ -541,6 +562,23 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update property if it is a C# value type
|
||||
*
|
||||
* @param models list of all models
|
||||
*/
|
||||
protected void updateValueTypeProperty(Map<String, Object> models) {
|
||||
for (Map.Entry<String, Object> entry : models.entrySet()) {
|
||||
String openAPIName = entry.getKey();
|
||||
CodegenModel model = ModelUtils.getModelByName(openAPIName, models);
|
||||
if (model != null) {
|
||||
for (CodegenProperty var : model.vars) {
|
||||
var.vendorExtensions.put("isValueType", isValueType(var));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
|
||||
super.postProcessOperationsWithModels(objs, allModels);
|
||||
@@ -1055,6 +1093,17 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
"double".equals(dataType) || "decimal".equals(dataType) || "float".equals(dataType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the property being passed is a C# value type
|
||||
*
|
||||
* @param var property
|
||||
* @return true if property is a value type
|
||||
*/
|
||||
|
||||
protected boolean isValueType(CodegenProperty var) {
|
||||
return (valueTypes.contains(var.dataType) || var.isEnum ) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter codegenParameter) {
|
||||
|
||||
@@ -1087,6 +1136,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
codegenParameter.example = "2013-10-20T19:20:30+01:00";
|
||||
} else if (Boolean.TRUE.equals(codegenParameter.isUuid)) {
|
||||
codegenParameter.example = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
|
||||
} else if (Boolean.TRUE.equals(codegenParameter.isUri)) {
|
||||
codegenParameter.example = "https://openapi-generator.tech";
|
||||
} else if (Boolean.TRUE.equals(codegenParameter.isString)) {
|
||||
codegenParameter.example = codegenParameter.paramName + "_example";
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -26,10 +28,12 @@ import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.DefaultCodegen;
|
||||
import org.openapitools.codegen.templating.mustache.IndentedLambda;
|
||||
import org.openapitools.codegen.utils.URLPathUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -300,4 +304,17 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preprocessOpenAPI(OpenAPI openAPI) {
|
||||
URL url = URLPathUtils.getServerURL(openAPI);
|
||||
String port = URLPathUtils.getPort(url, "");
|
||||
String host = url.getHost();
|
||||
if(!port.isEmpty()) {
|
||||
this.additionalProperties.put("serverPort", port);
|
||||
}
|
||||
if(!host.isEmpty()) {
|
||||
this.additionalProperties.put("serverHost", host);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("boolean", "BOOLEAN");
|
||||
typeMapping.put("string", "STRING_32");
|
||||
typeMapping.put("UUID", "UUID"); //
|
||||
typeMapping.put("URI", "STRING"); //
|
||||
typeMapping.put("date", "DATE");
|
||||
typeMapping.put("DateTime", "DATE_TIME");
|
||||
typeMapping.put("date-time", "DATE_TIME");
|
||||
|
||||
@@ -171,6 +171,7 @@ public abstract class AbstractFSharpCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("map", "IDictionary");
|
||||
typeMapping.put("object", "obj");
|
||||
typeMapping.put("UUID", "Guid");
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
// nullable type
|
||||
nullableType = new HashSet<String>(
|
||||
|
||||
@@ -98,6 +98,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
typeMapping.put("boolean", "bool");
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("UUID", "string");
|
||||
typeMapping.put("URI", "string");
|
||||
typeMapping.put("date", "string");
|
||||
typeMapping.put("DateTime", "time.Time");
|
||||
typeMapping.put("password", "string");
|
||||
@@ -360,10 +361,11 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
// this will only import "fmt" if there are items in pathParams
|
||||
// this will only import "fmt" and "strings" if there are items in pathParams
|
||||
for (CodegenOperation operation : operations) {
|
||||
if (operation.pathParams != null && operation.pathParams.size() > 0) {
|
||||
imports.add(createMapping("import", "fmt"));
|
||||
imports.add(createMapping("import", "strings"));
|
||||
break; //just need to import once
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
typeMapping.put("boolean", "Boolean");
|
||||
typeMapping.put("string", "String");
|
||||
typeMapping.put("UUID", "ID");
|
||||
typeMapping.put("URI", "String");
|
||||
typeMapping.put("date", "String");
|
||||
typeMapping.put("DateTime", "String");
|
||||
typeMapping.put("password", "String");
|
||||
@@ -463,4 +464,4 @@ public abstract class AbstractGraphQLCodegen extends DefaultCodegen implements C
|
||||
|
||||
return camelize(name) + "Input";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,14 +266,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_ID, artifactId);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SNAPSHOT_VERSION)) {
|
||||
Boolean useSnapshotVersion = Boolean.valueOf((String) additionalProperties.get(CodegenConstants.SNAPSHOT_VERSION));
|
||||
|
||||
if (useSnapshotVersion) {
|
||||
this.setArtifactVersion(this.buildSnapshotVersion(this.artifactVersion));
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_URL)) {
|
||||
this.setArtifactUrl((String) additionalProperties.get(CodegenConstants.ARTIFACT_URL));
|
||||
} else {
|
||||
@@ -1047,12 +1039,16 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION));
|
||||
} else if (openAPI.getInfo() != null && openAPI.getInfo().getVersion() != null) {
|
||||
this.setArtifactVersion(openAPI.getInfo().getVersion());
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
} else {
|
||||
//not set, use to be passed to template
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.SNAPSHOT_VERSION)) {
|
||||
Boolean useSnapshotVersion = Boolean.valueOf((String) additionalProperties.get(CodegenConstants.SNAPSHOT_VERSION));
|
||||
if (useSnapshotVersion) {
|
||||
this.setArtifactVersion(this.buildSnapshotVersion(this.getArtifactVersion()));
|
||||
}
|
||||
}
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
|
||||
}
|
||||
|
||||
private static String getAccept(OpenAPI openAPI, Operation operation) {
|
||||
@@ -1060,7 +1056,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
String defaultContentType = "application/json";
|
||||
Set<String> producesInfo = getProducesInfo(openAPI, operation);
|
||||
if (producesInfo != null && !producesInfo.isEmpty()) {
|
||||
ArrayList<String> produces = new ArrayList<String>(producesInfo);
|
||||
ArrayList<String> produces = new ArrayList<>(producesInfo);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String produce : produces) {
|
||||
if (defaultContentType.equalsIgnoreCase(produce)) {
|
||||
@@ -1085,7 +1081,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
@Override
|
||||
protected boolean needToImport(String type) {
|
||||
return super.needToImport(type) && type.indexOf(".") < 0;
|
||||
return super.needToImport(type) && !type.contains(".");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1183,10 +1179,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
|
||||
if (removedChildEnum) {
|
||||
// If we removed an entry from this model's vars, we need to ensure hasMore is updated
|
||||
int count = 0, numVars = codegenProperties.size();
|
||||
int count = 0;
|
||||
int numVars = codegenProperties.size();
|
||||
for (CodegenProperty codegenProperty : codegenProperties) {
|
||||
count += 1;
|
||||
codegenProperty.hasMore = (count < numVars) ? true : false;
|
||||
codegenProperty.hasMore = count < numVars;
|
||||
}
|
||||
codegenModel.vars = codegenProperties;
|
||||
}
|
||||
@@ -1444,27 +1441,13 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return escapeText(pattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convertPropertyToBoolean(String propertyKey) {
|
||||
boolean booleanValue = false;
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
booleanValue = Boolean.valueOf(additionalProperties.get(propertyKey).toString());
|
||||
}
|
||||
|
||||
return booleanValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writePropertyBack(String propertyKey, boolean value) {
|
||||
additionalProperties.put(propertyKey, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the Getter name for boolean property, e.g. isActive
|
||||
*
|
||||
* @param name the name of the property
|
||||
* @return getter name based on naming convention
|
||||
*/
|
||||
@Override
|
||||
public String toBooleanGetter(String name) {
|
||||
return booleanGetterPrefix + getterAndSetterCapitalize(name);
|
||||
}
|
||||
@@ -1505,7 +1488,6 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return camelize(name, lowercaseFirstLetter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postProcessFile(File file, String fileType) {
|
||||
if (file == null) {
|
||||
|
||||
@@ -44,6 +44,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
protected String apiSuffix = "Api";
|
||||
|
||||
protected String sourceFolder = "src/main/kotlin";
|
||||
protected String testFolder = "src/test/kotlin";
|
||||
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
@@ -166,14 +167,14 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
typeMapping.put("ByteArray", "kotlin.ByteArray");
|
||||
typeMapping.put("number", "java.math.BigDecimal");
|
||||
typeMapping.put("date-time", "java.time.LocalDateTime");
|
||||
typeMapping.put("date", "java.time.LocalDateTime");
|
||||
typeMapping.put("date", "java.time.LocalDate");
|
||||
typeMapping.put("file", "java.io.File");
|
||||
typeMapping.put("array", "kotlin.Array");
|
||||
typeMapping.put("list", "kotlin.collections.List");
|
||||
typeMapping.put("map", "kotlin.collections.Map");
|
||||
typeMapping.put("object", "kotlin.Any");
|
||||
typeMapping.put("binary", "kotlin.Array<kotlin.Byte>");
|
||||
typeMapping.put("Date", "java.time.LocalDateTime");
|
||||
typeMapping.put("Date", "java.time.LocalDate");
|
||||
typeMapping.put("DateTime", "java.time.LocalDateTime");
|
||||
|
||||
instantiationTypes.put("array", "kotlin.arrayOf");
|
||||
@@ -183,6 +184,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
importMapping = new HashMap<String, String>();
|
||||
importMapping.put("BigDecimal", "java.math.BigDecimal");
|
||||
importMapping.put("UUID", "java.util.UUID");
|
||||
importMapping.put("URI", "java.net.URI");
|
||||
importMapping.put("File", "java.io.File");
|
||||
importMapping.put("Date", "java.util.Date");
|
||||
importMapping.put("Timestamp", "java.sql.Timestamp");
|
||||
@@ -208,12 +210,17 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||
return (outputFolder + File.separator + apiDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar);
|
||||
return (outputFolder + File.separator + sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiTestFileFolder() {
|
||||
return (outputFolder + File.separator + testFolder + File.separator + apiPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -410,6 +417,10 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
|
||||
this.sourceFolder = sourceFolder;
|
||||
}
|
||||
|
||||
public void setTestFolder(String testFolder) {
|
||||
this.testFolder = testFolder;
|
||||
}
|
||||
|
||||
public Boolean getParcelizeModels() {
|
||||
return parcelizeModels;
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
typeMapping.put("binary", "string");
|
||||
typeMapping.put("ByteArray", "string");
|
||||
typeMapping.put("UUID", "string");
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||
|
||||
@@ -81,6 +81,7 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
||||
typeMapping.put("binary", "String");
|
||||
typeMapping.put("ByteArray", "String");
|
||||
typeMapping.put("UUID", "String");
|
||||
typeMapping.put("URI", "String");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
@@ -39,14 +40,19 @@ import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractTypeScriptClientCodegen.class);
|
||||
|
||||
protected static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm", Locale.ROOT);
|
||||
|
||||
private static final String X_DISCRIMINATOR_TYPE = "x-discriminator-value";
|
||||
private static final String UNDEFINED_VALUE = "undefined";
|
||||
public static final String NPM_NAME = "npmName";
|
||||
public static final String NPM_VERSION = "npmVersion";
|
||||
public static final String SNAPSHOT = "snapshot";
|
||||
|
||||
protected static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm", Locale.ROOT);
|
||||
|
||||
protected String modelPropertyNaming = "camelCase";
|
||||
protected Boolean supportsES6 = false;
|
||||
protected HashSet<String> languageGenericTypes;
|
||||
protected String npmName = null;
|
||||
protected String npmVersion = "1.0.0";
|
||||
|
||||
public AbstractTypeScriptClientCodegen() {
|
||||
super();
|
||||
@@ -117,10 +123,17 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
typeMapping.put("File", "any");
|
||||
typeMapping.put("ByteArray", "string");
|
||||
typeMapping.put("UUID", "string");
|
||||
typeMapping.put("URI", "string");
|
||||
typeMapping.put("Error", "Error");
|
||||
|
||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue(this.modelPropertyNaming));
|
||||
cliOptions.add(new CliOption(CodegenConstants.SUPPORTS_ES6, CodegenConstants.SUPPORTS_ES6_DESC).defaultValue(String.valueOf(this.getSupportsES6())));
|
||||
this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package." +
|
||||
" Required to generate a full package"));
|
||||
this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package. If not provided, using the version from the OpenAPI specification file.").defaultValue(this.getNpmVersion()));
|
||||
this.cliOptions.add(CliOption.newBoolean(SNAPSHOT,
|
||||
"When setting this property to true, the version will be suffixed with -SNAPSHOT." + this.SNAPSHOT_SUFFIX_FORMAT.toPattern(),
|
||||
false));
|
||||
|
||||
}
|
||||
|
||||
@@ -144,6 +157,37 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
setSupportsES6(Boolean.valueOf(additionalProperties.get(CodegenConstants.SUPPORTS_ES6).toString()));
|
||||
additionalProperties.put("supportsES6", getSupportsES6());
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(NPM_NAME)) {
|
||||
this.setNpmName(additionalProperties.get(NPM_NAME).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preprocessOpenAPI(OpenAPI openAPI) {
|
||||
|
||||
if (additionalProperties.containsKey(NPM_NAME)) {
|
||||
|
||||
// If no npmVersion is provided in additional properties, version from API specification is used.
|
||||
// If none of them is provided then fallbacks to default version
|
||||
if (additionalProperties.containsKey(NPM_VERSION)) {
|
||||
this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString());
|
||||
} else if (openAPI.getInfo() != null && openAPI.getInfo().getVersion() != null) {
|
||||
this.setNpmVersion(openAPI.getInfo().getVersion());
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) {
|
||||
if (npmVersion.toUpperCase(Locale.ROOT).matches("^.*-SNAPSHOT$")) {
|
||||
this.setNpmVersion(npmVersion + "." + SNAPSHOT_SUFFIX_FORMAT.format(new Date()));
|
||||
} else {
|
||||
this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date()));
|
||||
}
|
||||
}
|
||||
additionalProperties.put(NPM_VERSION, npmVersion);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,7 +241,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
public String toVarName(String name) {
|
||||
name = this.toParamName(name);
|
||||
|
||||
// if the proprty name has any breaking characters such as :, ;, . etc.
|
||||
// if the property name has any breaking characters such as :, ;, . etc.
|
||||
// then wrap the name within single quotes.
|
||||
// my:interface:property: string; => 'my:interface:property': string;
|
||||
if (propertyHasBreakingCharacters(name)) {
|
||||
@@ -568,6 +612,22 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
||||
return supportsES6;
|
||||
}
|
||||
|
||||
public String getNpmName() {
|
||||
return npmName;
|
||||
}
|
||||
|
||||
public void setNpmName(String npmName) {
|
||||
this.npmName = npmName;
|
||||
}
|
||||
|
||||
public String getNpmVersion() {
|
||||
return npmVersion;
|
||||
}
|
||||
|
||||
public void setNpmVersion(String npmVersion) {
|
||||
this.npmVersion = npmVersion;
|
||||
}
|
||||
|
||||
private void setDiscriminatorValue(CodegenModel model, String baseName, String value) {
|
||||
for (CodegenProperty prop : model.allVars) {
|
||||
if (prop.baseName.equals(baseName)) {
|
||||
|
||||
@@ -21,6 +21,7 @@ import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
@@ -46,7 +47,7 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
private String classPrefix = "OAS";
|
||||
private String apiVersion = "42.0";
|
||||
private String buildMethod = "sfdx";
|
||||
private String namedCredential = classPrefix;
|
||||
private String namedCredential;
|
||||
private String srcPath = "force-app/main/default/";
|
||||
private String sfdxConfigPath = "config/";
|
||||
private HashMap<String, Object> primitiveDefaults = new HashMap<String, Object>();
|
||||
@@ -93,6 +94,7 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
typeMapping.put("number", "Double");
|
||||
typeMapping.put("short", "Integer");
|
||||
typeMapping.put("UUID", "String");
|
||||
typeMapping.put("URI", "String");
|
||||
|
||||
// https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_reserved_words.htm
|
||||
setReservedWordsLowerCase(
|
||||
@@ -161,8 +163,10 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
|
||||
@Override
|
||||
public void preprocessOpenAPI(OpenAPI openAPI) {
|
||||
Info info = openAPI.getInfo();
|
||||
String calloutLabel = info.getTitle();
|
||||
String calloutLabel = openAPI.getInfo().getTitle();
|
||||
if (StringUtils.isNotBlank(namedCredential)) {
|
||||
calloutLabel = namedCredential;
|
||||
}
|
||||
additionalProperties.put("calloutLabel", calloutLabel);
|
||||
String sanitized = sanitizeName(calloutLabel);
|
||||
additionalProperties.put("calloutName", sanitized);
|
||||
|
||||
@@ -100,6 +100,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen {
|
||||
typeMapping.put("DateTime", "DateTime");
|
||||
typeMapping.put("date", "DateTime");
|
||||
typeMapping.put("UUID", "Guid");
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
setSupportNullable(Boolean.TRUE);
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("file", "binary");
|
||||
typeMapping.put("binary", "binary");
|
||||
typeMapping.put("UUID", "string");
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
/**
|
||||
* Additional Properties. These values can be passed to the templates and
|
||||
|
||||
@@ -152,6 +152,7 @@ public class CLibcurlClientCodegen extends DefaultCodegen implements CodegenConf
|
||||
typeMapping.put("binary", "binary_t*");
|
||||
typeMapping.put("ByteArray", "char");
|
||||
typeMapping.put("UUID", "char");
|
||||
typeMapping.put("URI", "char");
|
||||
typeMapping.put("array", "list");
|
||||
typeMapping.put("map", "list_t*");
|
||||
typeMapping.put("date-time", "char");
|
||||
|
||||
@@ -73,6 +73,9 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
// use KellermanSoftware.CompareNetObjects for deep recursive object comparision
|
||||
protected boolean useCompareNetObjects = Boolean.FALSE;
|
||||
|
||||
// To make API response's headers dictionary case insensitive
|
||||
protected boolean caseInsensitiveResponseHeaders = Boolean.FALSE;
|
||||
|
||||
public CSharpClientCodegen() {
|
||||
super();
|
||||
supportsInheritance = true;
|
||||
@@ -95,6 +98,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
typeMapping.put("DateTime", "DateTime");
|
||||
typeMapping.put("date", "DateTime");
|
||||
typeMapping.put("UUID", "Guid");
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
setSupportNullable(Boolean.TRUE);
|
||||
|
||||
@@ -198,6 +202,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
CodegenConstants.USE_COMPARE_NET_OBJECTS_DESC,
|
||||
this.useCompareNetObjects);
|
||||
|
||||
addSwitch(CodegenConstants.CASE_INSENSITIVE_RESPONSE_HEADERS,
|
||||
CodegenConstants.CASE_INSENSITIVE_RESPONSE_HEADERS_DESC,
|
||||
this.caseInsensitiveResponseHeaders);
|
||||
|
||||
regexModifiers = new HashMap<Character, String>();
|
||||
regexModifiers.put('i', "IgnoreCase");
|
||||
regexModifiers.put('m', "Multiline");
|
||||
@@ -801,6 +809,10 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
||||
this.useCompareNetObjects = useCompareNetObjects;
|
||||
}
|
||||
|
||||
public void setCaseInsensitiveResponseHeaders(final Boolean caseInsensitiveResponseHeaders) {
|
||||
this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders;
|
||||
}
|
||||
|
||||
public boolean isNonPublicApi() {
|
||||
return nonPublicApi;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
|
||||
typeMapping.put("map", "Dictionary");
|
||||
typeMapping.put("object", "Object");
|
||||
typeMapping.put("UUID", "Guid");
|
||||
typeMapping.put("URI", "string");
|
||||
|
||||
setSupportNullable(Boolean.TRUE);
|
||||
hideGenerationTimestamp = Boolean.TRUE;
|
||||
|
||||
@@ -93,6 +93,7 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
typeMapping.put("date", "inst?");
|
||||
typeMapping.put("DateTime", "inst?");
|
||||
typeMapping.put("UUID", "uuid?");
|
||||
typeMapping.put("URI", "string?");
|
||||
|
||||
// But some type mappings are not really worth/meaningful to check for:
|
||||
typeMapping.put("object", "any?"); // Like, everything is an object.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user