Merge branch '3.3.x' into 4.0.x

This commit is contained in:
William Cheng
2018-08-16 01:01:34 +08:00
695 changed files with 32107 additions and 1097 deletions

View File

@@ -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` and `./bin/security/{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\`.
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.0.x`. Default: `master`.
- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `3.3.x`, `4.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

6
.gitignore vendored
View File

@@ -59,6 +59,12 @@ samples/client/petstore/qt5cpp/PetStore/PetStore
samples/client/petstore/qt5cpp/PetStore/Makefile
samples/client/petstore/qt5cpp/PetStore/PetStore.pro.user
# cpprestsdk
samples/client/petstore/cpp-restsdk/CMakeCache.txt
samples/client/petstore/cpp-restsdk/CMakeFiles/
samples/client/petstore/cpp-restsdk/Makefile
samples/client/petstore/cpp-restsdk/cmake_install.cmake
#Java/Android
**/.gradle
samples/client/petstore/java/hello.txt

View File

@@ -607,6 +607,55 @@
<module>samples/server/petstore/jaxrs/jersey1</module>
</modules>
</profile>
<profile>
<!-- openapi v3's one -->
<id>jaxrs-jersey</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-jersey</module>
</modules>
</profile>
<profile>
<id>jaxrs-spec</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-spec</module>
</modules>
</profile>
<profile>
<id>jaxrs-spec-interface</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-spec-interface</module>
</modules>
</profile>
<profile>
<id>jaxrs-spec-interface-response</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-spec-interface-response</module>
</modules>
</profile>
<profile>
<id>typescript-fetch-client-tests-default</id>
<activation>
@@ -862,6 +911,10 @@
<module>samples/client/petstore/kotlin-threetenbp/</module>
<module>samples/client/petstore/kotlin-string/</module>
<!-- servers -->
<module>samples/server/petstore/jaxrs-jersey</module>
<module>samples/server/petstore/jaxrs-spec</module>
<module>samples/server/petstore/jaxrs-spec-interface</module>
<module>samples/server/petstore/jaxrs-spec-interface-response</module>
<module>samples/server/petstore/java-vertx/rx</module>
<module>samples/server/petstore/java-vertx/async</module>
<module>samples/server/petstore/java-inflector</module>
@@ -901,7 +954,6 @@
<module>samples/server/petstore/jaxrs-cxf-cdi</module>
<module>samples/server/petstore/jaxrs-cxf-non-spring-app</module>
<module>samples/server/petstore/java-msf4j</module>
<module>samples/server/petstore/jaxrs-spec-interface</module>
<module>samples/server/petstore/scala-lagom-server</module>
<module>samples/server/petstore/scalatra</module>
<module>samples/server/petstore/finch</module>

View File

@@ -607,6 +607,55 @@
<module>samples/server/petstore/jaxrs/jersey1</module>
</modules>
</profile>
<profile>
<!-- openapi v3's one -->
<id>jaxrs-jersey</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-jersey</module>
</modules>
</profile>
<profile>
<id>jaxrs-spec</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-spec</module>
</modules>
</profile>
<profile>
<id>jaxrs-spec-interface</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-spec-interface</module>
</modules>
</profile>
<profile>
<id>jaxrs-spec-interface-response</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-spec-interface-response</module>
</modules>
</profile>
<profile>
<id>typescript-fetch-client-tests-default</id>
<activation>
@@ -852,6 +901,10 @@
<module>samples/client/petstore/java/google-api-client</module>
<module>samples/client/petstore/kotlin/</module>
<!-- servers -->
<module>samples/server/petstore/jaxrs-jersey</module>
<module>samples/server/petstore/jaxrs-spec</module>
<module>samples/server/petstore/jaxrs-spec-interface</module>
<module>samples/server/petstore/jaxrs-spec-interface-response</module>
<module>samples/server/petstore/java-vertx/rx</module>
<module>samples/server/petstore/java-vertx/async</module>
<module>samples/server/petstore/java-inflector</module>
@@ -875,7 +928,6 @@
<module>samples/server/petstore/jaxrs-cxf-cdi</module>
<module>samples/server/petstore/jaxrs-cxf-non-spring-app</module>
<module>samples/server/petstore/java-msf4j</module>
<module>samples/server/petstore/jaxrs-spec-interface</module>
</modules>
</profile>
</profiles>

View File

@@ -2,7 +2,7 @@
<div align="center">
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`3.2.1`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`3.2.2`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator)
[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator)
[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator)
[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
@@ -80,21 +80,18 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
The OpenAPI Specification has undergone 3 revisions since initial creation in 2010. The openapi-generator project has the following compatibilities with the OpenAPI Specification:
OpenAPI Generator Version | Release Date | OpenAPI Spec compatibility | Notes
---------------------------- | ------------ | -------------------------- | -----
4.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Major release with breaking changes (no fallback)
3.3.0 (upcoming minor release)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release (breaking changes with fallbacks)
3.2.1 (current master, upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.2.1-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.2.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.2.0) | 06.08.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.1.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.1.2) | 25.07.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.1.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.1.1) | 18.07.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.1.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.1.0) | 06.07.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release (breaking changes with fallbacks)
[3.0.3](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.0.3) | 27.06.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.0.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.0.2) | 18.06.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.0.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.0.1) | 11.06.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | Bugfix release
[3.0.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.0.0) | 01.06.2018 | 1.0, 1.1, 1.2, 2.0, 3.0 | First release with breaking changes
OpenAPI Generator Version | Release Date | Notes
---------------------------- | ------------ | -----
4.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/)| TBD | Major release with breaking changes (no fallback)
3.3.0 (upcoming minor release)| TBD | Minor release (breaking changes with fallbacks)
3.2.2 (current master, upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.2.2-SNAPSHOT/)| TBD | Bugfix release
[3.2.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.2.1) (latest stable release) | 14.08.2018 | Bugfix release
### [1.2 - Artifacts on Maven Central](#table-of-contents)
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
For old releases, please refer to the [**Release**](https://github.com/OpenAPITools/openapi-generator/releases) page.
## [1.2 - Artifacts on Maven Central](#table-of-contents)
You can find our released artefacts on maven central:
@@ -144,16 +141,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/3.2.0/openapi-generator-cli-3.2.0.jar`
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.1/openapi-generator-cli-3.2.1.jar`
For **Mac/Linux** users:
```sh
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.0/openapi-generator-cli-3.2.0.jar -O openapi-generator-cli.jar
wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.1/openapi-generator-cli-3.2.1.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/3.2.0/openapi-generator-cli-3.2.0.jar
Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.1/openapi-generator-cli-3.2.1.jar
```
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
@@ -174,7 +171,7 @@ An example of setting this up (NOTE: Always evaluate scripts curled from externa
```
mkdir -p ~/bin/openapitools
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator.cli.sh > ~/bin/openapitools/openapi-generator-cli
curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli
chmod u+x ~/bin/openapitools/openapi-generator-cli
export PATH=$PATH:~/bin/openapitools/
```

View File

@@ -35,6 +35,8 @@ build_script:
# install openapi-generator locally
- mvn clean install --quiet
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
# 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
# test c# API client (with PropertyChanged)
@@ -42,6 +44,10 @@ test_script:
# generate all petstore clients
- .\bin\windows\run-all-petstore.cmd
# generate all petstore clients (openapi3)
- .\bin\openapi3\windows\run-all-petstore.cmd
cache:
- C:\maven\
- C:\Users\appveyor\.m2

View File

@@ -29,8 +29,9 @@ fi
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
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
# restore csproj file
echo "restore csproject file: CI/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj"
cp ./CI/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj ./samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/
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/
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dynamic-html -o samples/dynamic-html $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dynamic-html -o samples/documentation/dynamic-html $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/markdown.yaml -g html -o samples/html.md $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/markdown.yaml -g html -o samples/documentation/html.md $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g html -o samples/html $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g html -o samples/documentation/html $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g html2 -o samples/html2 --additional-properties hideGenerationTimestamp=true $@"
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g html2 -o samples/documentation/html2 --additional-properties hideGenerationTimestamp=true $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -27,6 +27,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate $@ -i modules/openapi-generator/src/test/resources/3_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}"
ags="generate $@ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples/openapi3/client/petstore/csharp/OpenAPIClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -0,0 +1,32 @@
#!/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
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey $@"
java $JAVA_OPTS -jar $executable $ags

33
bin/openapi3/run-all-petstore Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
# this bash script will loop through all the .sh files under bin
# execute the script and check the result (exit code) to see if
# there's any error
echo "IMPORTANT: this script should be run by the CI (e.g. Shippable) only. There's no need to run this script to update Petstore samples for all generators."
echo "Please press CTRL+C to stop or the script will continue in 10 seconds."
sleep 10
successes=0
failures=0
for SCRIPT in $(ls -l ./bin/openapi3/*.sh | grep -v all)
do
if [ -f ${SCRIPT} -a -x ${SCRIPT} ]; then
echo "Running $SCRIPT (output to /dev/null)"
${SCRIPT} 2>&1 > /dev/null
rc=$?
if [[ ${rc} != 0 ]]; then
>&2 echo "ERROR!! FAILED TO RUN ${SCRIPT}"
((failures+=1))
else
((successes+=1))
fi
fi
done
if (( failures > 0 )); then
>&2 echo "[ERROR] ${failures} out of $((failures+successes)) scripts failed."
exit 1
else
echo "[SUCCESS] ${successes} generators finished."
fi

View File

@@ -0,0 +1,14 @@
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
If Not Exist %executable% (
mvn clean package
)
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\openapi3\client\petstore\csharp\SwaggerClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C}
java %JAVA_OPTS% -jar %executable% %ags%
REM restore csproj file
echo "restore csproject file: CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj"
copy /b/v/y CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj samples\openapi3\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\

View File

@@ -0,0 +1,15 @@
REM this batch file will loop through all the .bat files under bin\openapi3\windows\
REM execute the script and check the error level to see if there's any error
echo IMPORTANT: this script should be run by the CI (e.g. appveyor) only. There's no need to run this script to update Petstore samples for all generators.
echo Please press CTRL+C to stop or the script will continue in 10 seconds.
timeout 10
for /f "delims=" %%i in ('dir /b ".\bin\openapi3\windows\*.bat"') do (
CALL .\bin\openapi3\windows\%%i
IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 exit /b 1
)

View File

@@ -13,8 +13,8 @@ failures=0
for SCRIPT in $(ls -l ./bin/*.sh | grep -v all)
do
if [ -f ${SCRIPT} -a -x ${SCRIPT} ]; then
echo "Running $SCRIPT"
${SCRIPT}
echo "Running $SCRIPT (output to /dev/null)"
${SCRIPT} 2>&1 > /dev/null
rc=$?
if [[ ${rc} != 0 ]]; then
>&2 echo "ERROR!! FAILED TO RUN ${SCRIPT}"
@@ -30,4 +30,4 @@ if (( failures > 0 )); then
exit 1
else
echo "[SUCCESS] ${successes} generators finished."
fi
fi

View File

@@ -31,6 +31,7 @@ sleep 5
./bin/typescript-inversify-petstore.sh > /dev/null 2>&1
./bin/rust-server-petstore.sh > /dev/null 2>&1
./bin/openapi3/haskell-http-client-petstore.sh > /dev/null 2>&1
./bin/csharp-petstore.sh > /dev/null 2>&1
# Check:
if [ -n "$(git status --porcelain)" ]; then

View File

@@ -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 csharp -o samples/client/petstore/csharp/SwaggerClientNet40 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-40.json
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\SwaggerClientNet40 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c .\bin\csharp-petstore-net-40.json
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -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 csharp -o samples\client\petstore\csharp\SwaggerClientNetStandard --additional-properties targetFramework=v5.0,packageGuid={3AB1F259-1769-484B-9411-84505FCCBD55}
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\SwaggerClientNetStandard --additional-properties targetFramework=v5.0,packageGuid={3AB1F259-1769-484B-9411-84505FCCBD55}
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -9,7 +9,7 @@ set ags=generate -i modules\openapi-generator\src\test/resources\2_0\petstore-wi
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"
copy .\CI\samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj .\samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\
REM restore csproj file
echo "restore csproject file: CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj"
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\

View File

@@ -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 html -o samples\client\petstore\html
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g html -o samples\documentation\html
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -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 html2 -o samples\html2
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g html2 -o samples\documentation\html2
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -34,7 +34,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "org.openapitools:openapi-generator-gradle-plugin:3.1.2"
classpath "org.openapitools:openapi-generator-gradle-plugin:3.2.1"
}
}

View File

@@ -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=3.2.0 openApiValidate
gradle -PopenApiGeneratorVersion=3.2.1 openApiValidate
```

View File

@@ -41,6 +41,9 @@ openApiGenerate {
configOptions = [
dateLibrary: "java8"
]
systemProperties = [
modelDocs: "false"
]
}
task buildGoSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask){

View File

@@ -1 +1 @@
openApiGeneratorVersion=3.2.0
openApiGeneratorVersion=3.2.1

View File

@@ -323,7 +323,7 @@ open class GenerateTask : DefaultTask() {
@get:Internal
val configOptions = project.objects.property<Map<String, String>>()
private val originalEnvironmentVariables = mutableMapOf<String, String>()
private val originalEnvironmentVariables = mutableMapOf<String, String?>()
private fun <T : Any?> Property<T>.ifNotEmpty(block: Property<T>.(T) -> Unit) {
if (isPresent) {
@@ -352,8 +352,9 @@ open class GenerateTask : DefaultTask() {
try {
if (systemProperties.isPresent) {
systemProperties.get().forEach { (key, value) ->
originalEnvironmentVariables[key] = System.getProperty(key)
System.setProperty(key, value)
// System.setProperty returns the original value for a key, or null.
// Cache the original value or null…we will late put the properties back in their original state.
originalEnvironmentVariables[key] = System.setProperty(key, value)
configurator.addSystemProperty(key, value)
}
}
@@ -540,8 +541,12 @@ open class GenerateTask : DefaultTask() {
throw GradleException("Code generation failed.", e)
}
} finally {
originalEnvironmentVariables.forEach { entry ->
System.setProperty(entry.key, entry.value)
// Reset all modified system properties back to their original state
originalEnvironmentVariables.forEach {
when {
it.value == null -> System.clearProperty(it.key)
else -> System.setProperty(it.key, it.value)
}
}
originalEnvironmentVariables.clear()
}

View File

@@ -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>3.2.0</version>
<version>3.2.1</version>
<executions>
<execution>
<goals>
@@ -37,6 +37,8 @@ mvn clean compile
### General Configuration parameters
:bulb: These **general** configurations should be in the same level
- `inputSpec` - OpenAPI Spec file path
- `validateSpec` - Whether or not to validate the input spec prior to generation. Invalid specifications will result in an error.
- `language` - target generation language (deprecated, replaced by `generatorName` as values here don't represent only 'language' any longer)
@@ -49,7 +51,7 @@ mvn clean compile
- `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 (see below)
- `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
- `generateApis` - generate the apis (`true` by default)

View File

@@ -12,7 +12,7 @@
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.1</version>
<executions>
<execution>
<goals>

View File

@@ -12,7 +12,7 @@
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.1</version>
<executions>
<execution>
<goals>

View File

@@ -12,7 +12,7 @@
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.1</version>
<executions>
<execution>
<goals>

View File

@@ -4577,6 +4577,14 @@ public class DefaultCodegen implements CodegenConfig {
}
}
/**
* checks if the data should be classified as "string" in enum
* e.g. double in C# needs to be double-quoted (e.g. "2.8") by treating it as a string
* In the future, we may rename this function to "isEnumString"
*
* @param dataType data type
* @return true if it's a enum string
*/
public boolean isDataTypeString(String dataType) {
return "String".equals(dataType);
}

View File

@@ -169,14 +169,15 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
if (!generateApiTests && !generateModelTests) {
config.additionalProperties().put(CodegenConstants.EXCLUDE_TESTS, true);
}
// for backward compatibility
if (System.getProperty("debugSwagger") != null) {
LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'.");
Json.prettyPrint(openAPI);
}
if (System.getProperty("debugOpenAPI") != null) {
Json.prettyPrint(openAPI);
} else if (System.getProperty("debugSwagger") != null) {
// This exists for backward compatibility
// We fall to this block only if debugOpenAPI is null. No need to dump this twice.
LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'.");
Json.prettyPrint(openAPI);
}
config.processOpts();
@@ -787,8 +788,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
configureOpenAPIInfo();
// resolve inline models
//InlineModelResolver inlineModelResolver = new InlineModelResolver();
//inlineModelResolver.flatten(openAPI);
InlineModelResolver inlineModelResolver = new InlineModelResolver();
inlineModelResolver.flatten(openAPI);
List<File> files = new ArrayList<File>();
// models

View File

@@ -0,0 +1,560 @@
/*
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
* Copyright 2018 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.ObjectSchema;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.Paths;
import io.swagger.v3.core.util.Json;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.swagger.v3.oas.models.media.Content;
import io.swagger.v3.oas.models.media.MediaType;
import java.util.*;
import io.swagger.v3.oas.models.media.XML;
public class InlineModelResolver {
private OpenAPI openapi;
private boolean skipMatches;
static Logger LOGGER = LoggerFactory.getLogger(InlineModelResolver.class);
Map<String, Schema> addedModels = new HashMap<String, Schema>();
Map<String, String> generatedSignature = new HashMap<String, String>();
public void flatten(OpenAPI openapi) {
this.openapi = openapi;
if (openapi.getComponents() == null) {
return; // There's nothing here
}
if (openapi.getComponents().getSchemas() == null) {
openapi.getComponents().setSchemas(new HashMap<String, Schema>());
}
// operations
Map<String, PathItem> paths = openapi.getPaths();
Map<String, Schema> models = openapi.getComponents().getSchemas();
if (paths != null) {
for (String pathname : paths.keySet()) {
PathItem path = paths.get(pathname);
for (Operation operation : path.readOperations()) {
RequestBody requestBody = operation.getRequestBody();
if (requestBody != null) {
Schema model = ModelUtils.getSchemaFromRequestBody(requestBody);
if (model instanceof ObjectSchema) {
Schema obj = (Schema) model;
if (obj.getType() == null || "object".equals(obj.getType())) {
if (obj.getProperties() != null && obj.getProperties().size() > 0) {
flattenProperties(obj.getProperties(), pathname);
// for model name, use "title" if defined, otherwise default to 'inline_object'
String modelName = resolveModelName(obj.getTitle(), "inline_object");
addGenerated(modelName, model);
openapi.getComponents().addSchemas(modelName, model);
// create request body
RequestBody rb = new RequestBody();
Content content = new Content();
MediaType mt = new MediaType();
Schema schema = new Schema();
schema.set$ref(modelName);
mt.setSchema(schema);
// get "consumes", e.g. application/xml, application/json
Set<String> consumes;
if (requestBody == null || requestBody.getContent() == null || requestBody.getContent().isEmpty()) {
consumes = new HashSet<>();
consumes.add("application/json"); // default to application/json
LOGGER.info("Default to application/json for inline body schema");
} else {
consumes = requestBody.getContent().keySet();
}
for (String consume : consumes) {
content.addMediaType(consume, mt);
}
rb.setContent(content);
// add to openapi "components"
if (openapi.getComponents().getRequestBodies() == null) {
Map<String, RequestBody> requestBodies = new HashMap<String, RequestBody>();
requestBodies.put(modelName, rb);
openapi.getComponents().setRequestBodies(requestBodies);
} else {
openapi.getComponents().getRequestBodies().put(modelName, rb);
}
// update requestBody to use $ref instead of inline def
requestBody.set$ref(modelName);
}
}
} else if (model instanceof ArraySchema) {
ArraySchema am = (ArraySchema) model;
Schema inner = am.getItems();
if (inner instanceof ObjectSchema) {
ObjectSchema op = (ObjectSchema) inner;
if (op.getProperties() != null && op.getProperties().size() > 0) {
flattenProperties(op.getProperties(), pathname);
String modelName = resolveModelName(op.getTitle(), null);
Schema innerModel = modelFromProperty(op, modelName);
String existing = matchGenerated(innerModel);
if (existing != null) {
Schema schema = new Schema().$ref(existing);
schema.setRequired(op.getRequired());
am.setItems(schema);
} else {
Schema schema = new Schema().$ref(modelName);
schema.setRequired(op.getRequired());
am.setItems(schema);
addGenerated(modelName, innerModel);
openapi.getComponents().addSchemas(modelName, innerModel);
}
}
}
}
}
List<Parameter> parameters = operation.getParameters();
if (parameters != null) {
for (Parameter parameter : parameters) {
if (parameter.getSchema() != null) {
Schema model = parameter.getSchema();
if (model instanceof ObjectSchema) {
Schema obj = (Schema) model;
if (obj.getType() == null || "object".equals(obj.getType())) {
if (obj.getProperties() != null && obj.getProperties().size() > 0) {
flattenProperties(obj.getProperties(), pathname);
String modelName = resolveModelName(obj.getTitle(), parameter.getName());
parameter.$ref(modelName);
addGenerated(modelName, model);
openapi.getComponents().addSchemas(modelName, model);
}
}
} else if (model instanceof ArraySchema) {
ArraySchema am = (ArraySchema) model;
Schema inner = am.getItems();
if (inner instanceof ObjectSchema) {
ObjectSchema op = (ObjectSchema) inner;
if (op.getProperties() != null && op.getProperties().size() > 0) {
flattenProperties(op.getProperties(), pathname);
String modelName = resolveModelName(op.getTitle(), parameter.getName());
Schema innerModel = modelFromProperty(op, modelName);
String existing = matchGenerated(innerModel);
if (existing != null) {
Schema schema = new Schema().$ref(existing);
schema.setRequired(op.getRequired());
am.setItems(schema);
} else {
Schema schema = new Schema().$ref(modelName);
schema.setRequired(op.getRequired());
am.setItems(schema);
addGenerated(modelName, innerModel);
openapi.getComponents().addSchemas(modelName, innerModel);
}
}
}
}
}
}
}
Map<String, ApiResponse> responses = operation.getResponses();
if (responses != null) {
for (String key : responses.keySet()) {
ApiResponse response = responses.get(key);
if (ModelUtils.getSchemaFromResponse(response) != null) {
Schema property = ModelUtils.getSchemaFromResponse(response);
if (property instanceof ObjectSchema) {
ObjectSchema op = (ObjectSchema) property;
if (op.getProperties() != null && op.getProperties().size() > 0) {
String modelName = resolveModelName(op.getTitle(), "inline_response_" + key);
Schema model = modelFromProperty(op, modelName);
String existing = matchGenerated(model);
Content content = response.getContent();
for (MediaType mediaType : content.values()) {
if (existing != null) {
Schema schema = this.makeSchema(existing, property);
schema.setRequired(op.getRequired());
mediaType.setSchema(schema);
} else {
Schema schema = this.makeSchema(modelName, property);
schema.setRequired(op.getRequired());
mediaType.setSchema(schema);
addGenerated(modelName, model);
openapi.getComponents().addSchemas(modelName, model);
}
}
}
} else if (property instanceof ArraySchema) {
ArraySchema ap = (ArraySchema) property;
Schema inner = ap.getItems();
if (inner instanceof ObjectSchema) {
ObjectSchema op = (ObjectSchema) inner;
if (op.getProperties() != null && op.getProperties().size() > 0) {
flattenProperties(op.getProperties(), pathname);
String modelName = resolveModelName(op.getTitle(),
"inline_response_" + key);
Schema innerModel = modelFromProperty(op, modelName);
String existing = matchGenerated(innerModel);
if (existing != null) {
Schema schema = this.makeSchema(existing, op);
schema.setRequired(op.getRequired());
ap.setItems(schema);
} else {
Schema schema = this.makeSchema(modelName, op);
schema.setRequired(op.getRequired());
ap.setItems(schema);
addGenerated(modelName, innerModel);
openapi.getComponents().addSchemas(modelName, innerModel);
}
}
}
} else if (property instanceof MapSchema) {
MapSchema mp = (MapSchema) property;
Schema innerProperty = (Schema) mp.getAdditionalProperties();
if (innerProperty instanceof ObjectSchema) {
ObjectSchema op = (ObjectSchema) innerProperty;
if (op.getProperties() != null && op.getProperties().size() > 0) {
flattenProperties(op.getProperties(), pathname);
String modelName = resolveModelName(op.getTitle(),
"inline_response_" + key);
Schema innerModel = modelFromProperty(op, modelName);
String existing = matchGenerated(innerModel);
if (existing != null) {
Schema schema = new Schema().$ref(existing);
schema.setRequired(op.getRequired());
mp.setAdditionalProperties(schema);
} else {
Schema schema = new Schema().$ref(modelName);
schema.setRequired(op.getRequired());
mp.setAdditionalProperties(schema);
addGenerated(modelName, innerModel);
openapi.getComponents().addSchemas(modelName, innerModel);
}
}
}
}
}
}
}
}
}
}
// definitions
if (models != null) {
List<String> modelNames = new ArrayList<String>(models.keySet());
for (String modelName : modelNames) {
Schema model = models.get(modelName);
if (model instanceof Schema) {
Schema m = (Schema) model;
Map<String, Schema> properties = m.getProperties();
flattenProperties(properties, modelName);
fixStringModel(m);
} else if (ModelUtils.isArraySchema(model)) {
ArraySchema m = (ArraySchema) model;
Schema inner = m.getItems();
if (inner instanceof ObjectSchema) {
ObjectSchema op = (ObjectSchema) inner;
if (op.getProperties() != null && op.getProperties().size() > 0) {
String innerModelName = resolveModelName(op.getTitle(), modelName + "_inner");
Schema innerModel = modelFromProperty(op, innerModelName);
String existing = matchGenerated(innerModel);
if (existing == null) {
openapi.getComponents().addSchemas(innerModelName, innerModel);
addGenerated(innerModelName, innerModel);
Schema schema = new Schema().$ref(innerModelName);
schema.setRequired(op.getRequired());
m.setItems(schema);
} else {
Schema schema = new Schema().$ref(existing);
schema.setRequired(op.getRequired());
m.setItems(schema);
}
}
}
} else if (ModelUtils.isComposedSchema(model)) {
ComposedSchema m = (ComposedSchema) model;
if (m.getAllOf() != null && !m.getAllOf().isEmpty()) {
Schema child = null;
for (Schema component : m.getAllOf()) {
if (component.get$ref() == null) {
child = component;
}
}
if (child != null) {
Map<String, Schema> properties = child.getProperties();
flattenProperties(properties, modelName);
}
}
}
}
}
}
/**
* This function fix models that are string (mostly enum). Before this fix, the
* example would look something like that in the doc: "\"example from def\""
*
* @param m Schema implementation
*/
private void fixStringModel(Schema m) {
if (m.getType() != null && m.getType().equals("string") && m.getExample() != null) {
String example = m.getExample().toString();
if (example.substring(0, 1).equals("\"") && example.substring(example.length() - 1).equals("\"")) {
m.setExample(example.substring(1, example.length() - 1));
}
}
}
private String resolveModelName(String title, String key) {
if (title == null) {
return uniqueName(key);
} else {
return uniqueName(title);
}
}
public String matchGenerated(Schema model) {
if (this.skipMatches) {
return null;
}
String json = Json.pretty(model);
if (generatedSignature.containsKey(json)) {
return generatedSignature.get(json);
}
return null;
}
public void addGenerated(String name, Schema model) {
generatedSignature.put(Json.pretty(model), name);
}
public String uniqueName(String key) {
if (key == null) {
key = "NULL_UNIQUE_NAME";
LOGGER.warn("null key found. Default to NULL_UNIQUE_NAME");
}
int count = 0;
boolean done = false;
key = key.replaceAll("[^a-z_\\.A-Z0-9 ]", ""); // FIXME: a parameter
// should not be assigned. Also declare the methods parameters as 'final'.
while (!done) {
String name = key;
if (count > 0) {
name = key + "_" + count;
}
if (openapi.getComponents().getSchemas() == null) {
return name;
} else if (!openapi.getComponents().getSchemas().containsKey(name)) {
return name;
}
count += 1;
}
return key;
}
public void flattenProperties(Map<String, Schema> properties, String path) {
if (properties == null) {
return;
}
Map<String, Schema> propsToUpdate = new HashMap<String, Schema>();
Map<String, Schema> modelsToAdd = new HashMap<String, Schema>();
for (String key : properties.keySet()) {
Schema property = properties.get(key);
if (property instanceof ObjectSchema && ((ObjectSchema) property).getProperties() != null
&& ((ObjectSchema) property).getProperties().size() > 0) {
ObjectSchema op = (ObjectSchema) property;
String modelName = resolveModelName(op.getTitle(), path + "_" + key);
Schema model = modelFromProperty(op, modelName);
String existing = matchGenerated(model);
if (existing != null) {
Schema schema = new Schema().$ref(existing);
schema.setRequired(op.getRequired());
propsToUpdate.put(key, schema);
} else {
Schema schema = new Schema().$ref(modelName);
schema.setRequired(op.getRequired());
propsToUpdate.put(key, schema);
modelsToAdd.put(modelName, model);
addGenerated(modelName, model);
openapi.getComponents().addSchemas(modelName, model);
}
} else if (property instanceof ArraySchema) {
ArraySchema ap = (ArraySchema) property;
Schema inner = ap.getItems();
if (inner instanceof ObjectSchema) {
ObjectSchema op = (ObjectSchema) inner;
if (op.getProperties() != null && op.getProperties().size() > 0) {
flattenProperties(op.getProperties(), path);
String modelName = resolveModelName(op.getTitle(), path + "_" + key);
Schema innerModel = modelFromProperty(op, modelName);
String existing = matchGenerated(innerModel);
if (existing != null) {
Schema schema = new Schema().$ref(existing);
schema.setRequired(op.getRequired());
ap.setItems(schema);
} else {
Schema schema = new Schema().$ref(modelName);
schema.setRequired(op.getRequired());
ap.setItems(schema);
addGenerated(modelName, innerModel);
openapi.getComponents().addSchemas(modelName, innerModel);
}
}
}
}
if (ModelUtils.isMapSchema(property)) {
Schema inner = (Schema) property.getAdditionalProperties();
if (inner instanceof ObjectSchema) {
ObjectSchema op = (ObjectSchema) inner;
if (op.getProperties() != null && op.getProperties().size() > 0) {
flattenProperties(op.getProperties(), path);
String modelName = resolveModelName(op.getTitle(), path + "_" + key);
Schema innerModel = modelFromProperty(op, modelName);
String existing = matchGenerated(innerModel);
if (existing != null) {
Schema schema = new Schema().$ref(existing);
schema.setRequired(op.getRequired());
property.setAdditionalProperties(schema);
} else {
Schema schema = new Schema().$ref(modelName);
schema.setRequired(op.getRequired());
property.setAdditionalProperties(schema);
addGenerated(modelName, innerModel);
openapi.getComponents().addSchemas(modelName, innerModel);
}
}
}
}
}
if (propsToUpdate.size() > 0) {
for (String key : propsToUpdate.keySet()) {
properties.put(key, propsToUpdate.get(key));
}
}
for (String key : modelsToAdd.keySet()) {
openapi.getComponents().addSchemas(key, modelsToAdd.get(key));
this.addedModels.put(key, modelsToAdd.get(key));
}
}
@SuppressWarnings("static-method")
public Schema modelFromProperty(ArraySchema object, @SuppressWarnings("unused") String path) {
String description = object.getDescription();
String example = null;
Object obj = object.getExample();
if (obj != null) {
example = obj.toString();
}
Schema inner = object.getItems();
if (inner instanceof ObjectSchema) {
ArraySchema model = new ArraySchema();
model.setDescription(description);
model.setExample(example);
model.setItems(object.getItems());
model.setName(object.getName());
return model;
}
return null;
}
public Schema modelFromProperty(ObjectSchema object, String path) {
String description = object.getDescription();
String example = null;
Object obj = object.getExample();
if (obj != null) {
example = obj.toString();
}
XML xml = object.getXml();
Map<String, Schema> properties = object.getProperties();
Schema model = new Schema();
model.setDescription(description);
model.setExample(example);
model.setName(object.getName());
model.setXml(xml);
if (properties != null) {
flattenProperties(properties, path);
model.setProperties(properties);
}
return model;
}
@SuppressWarnings("static-method")
public Schema modelFromProperty(MapSchema object, @SuppressWarnings("unused") String path) {
String description = object.getDescription();
String example = null;
Object obj = object.getExample();
if (obj != null) {
example = obj.toString();
}
ArraySchema model = new ArraySchema();
model.setDescription(description);
model.setName(object.getName());
model.setExample(example);
model.setItems((Schema) object.getAdditionalProperties());
return model;
}
/**
* Make a Schema
*
* @param ref new property name
* @param property Schema
* @return {@link Schema} A constructed OpenAPI property
*/
public Schema makeSchema(String ref, Schema property) {
Schema newProperty = new Schema().$ref(ref);
this.copyVendorExtensions(property, newProperty);
return newProperty;
}
/**
* Copy vendor extensions from Model to another Model
*
* @param source source property
* @param target target property
*/
public void copyVendorExtensions(Schema source, Schema target) {
Map<String, Object> vendorExtensions = source.getExtensions();
for (String extName : vendorExtensions.keySet()) {
target.addExtension(extName, vendorExtensions.get(extName));
}
}
public boolean isSkipMatches() {
return skipMatches;
}
public void setSkipMatches(boolean skipMatches) {
this.skipMatches = skipMatches;
}
}

View File

@@ -596,12 +596,12 @@ public class CodegenConfigurator implements Serializable {
return;
}
LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" +
"\n - [debugSwagger] prints the openapi specification as interpreted by the codegen" +
"\n - [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen" +
"\n - [debugModels] prints models passed to the template engine" +
"\n - [debugOperations] prints operations passed to the template engine" +
"\n - [debugSupportingFiles] prints additional data passed to the template engine");
System.setProperty("debugSwagger", "");
System.setProperty("debugOpenAPI", "");
System.setProperty("debugModels", "");
System.setProperty("debugOperations", "");
System.setProperty("debugSupportingFiles", "");

View File

@@ -19,6 +19,7 @@ package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache;
import io.swagger.v3.core.util.Json;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.*;
@@ -713,12 +714,22 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
return p.getDefault().toString();
}
} else if (ModelUtils.isDateSchema(p)) {
// TODO
if (p.getDefault() != null) {
return "\"" + p.getDefault().toString() + "\"";
}
} else if (ModelUtils.isDateTimeSchema(p)) {
// TODO
if (p.getDefault() != null) {
return "\"" + p.getDefault().toString() + "\"";
}
} else if (ModelUtils.isNumberSchema(p)) {
if (p.getDefault() != null) {
return p.getDefault().toString();
if (ModelUtils.isFloatSchema(p)) { // float
return p.getDefault().toString() + "F";
} else if (ModelUtils.isDoubleSchema(p)) { // double
return p.getDefault().toString() + "D";
} else {
return p.getDefault().toString();
}
}
} else if (ModelUtils.isIntegerSchema(p)) {
if (p.getDefault() != null) {
@@ -961,4 +972,48 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
public String escapeUnsafeCharacters(String input) {
return input.replace("*/", "*_/").replace("/*", "/_*").replace("--", "- -");
}
@Override
public boolean isDataTypeString(String dataType) {
// also treat double/decimal/float as "string" in enum so that the values (e.g. 2.8) get double-quoted
return "String".equalsIgnoreCase(dataType) || "double?".equals(dataType) || "decimal?".equals(dataType) || "float?".equals(dataType);
}
@Override
public void setParameterExampleValue(CodegenParameter codegenParameter) {
// set the example value
// if not specified in x-example, generate a default value
// TODO need to revise how to obtain the example value
if (codegenParameter.vendorExtensions != null && codegenParameter.vendorExtensions.containsKey("x-example")) {
codegenParameter.example = Json.pretty(codegenParameter.vendorExtensions.get("x-example"));
} else if (Boolean.TRUE.equals(codegenParameter.isBoolean)) {
codegenParameter.example = "true";
} else if (Boolean.TRUE.equals(codegenParameter.isLong)) {
codegenParameter.example = "789";
} else if (Boolean.TRUE.equals(codegenParameter.isInteger)) {
codegenParameter.example = "56";
} else if (Boolean.TRUE.equals(codegenParameter.isFloat)) {
codegenParameter.example = "3.4F";
} else if (Boolean.TRUE.equals(codegenParameter.isDouble)) {
codegenParameter.example = "1.2D";
} else if (Boolean.TRUE.equals(codegenParameter.isNumber)) {
codegenParameter.example = "8.14";
} else if (Boolean.TRUE.equals(codegenParameter.isBinary)) {
codegenParameter.example = "BINARY_DATA_HERE";
} else if (Boolean.TRUE.equals(codegenParameter.isByteArray)) {
codegenParameter.example = "BYTE_ARRAY_DATA_HERE";
} else if (Boolean.TRUE.equals(codegenParameter.isFile)) {
codegenParameter.example = "/path/to/file.txt";
} else if (Boolean.TRUE.equals(codegenParameter.isDate)) {
codegenParameter.example = "2013-10-20";
} else if (Boolean.TRUE.equals(codegenParameter.isDateTime)) {
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.isString)) {
codegenParameter.example = codegenParameter.paramName + "_example";
}
}
}

View File

@@ -19,13 +19,17 @@ package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.media.Schema;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache;
import org.openapitools.codegen.CodegenConfig;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.DefaultCodegen;
import org.openapitools.codegen.mustache.IndentedLambda;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.Map;
abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractCppCodegen.class);
@@ -242,4 +246,23 @@ abstract public class AbstractCppCodegen extends DefaultCodegen implements Codeg
public String getTypeDeclaration(String str) {
return "std::shared_ptr<" + toModelName(str) + ">";
}
public void processOpts() {
super.processOpts();
addMustacheLambdas(additionalProperties);
}
private void addMustacheLambdas(Map<String, Object> objs) {
Map<String, Mustache.Lambda> lambdas = new ImmutableMap.Builder<String, Mustache.Lambda>()
.put("multiline_comment_4", new IndentedLambda(4, " ", "///"))
.build();
if (objs.containsKey("lambda")) {
LOGGER.warn("A property named 'lambda' already exists. Mustache lambdas renamed from 'lambda' to '_lambda'.");
objs.put("_lambda", lambdas);
} else {
objs.put("lambda", lambdas);
}
}
}

View File

@@ -603,11 +603,11 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
}
/*
* The pattern spec follows the Perl convention and style of modifiers. .NET
* does not support this syntax directly so we need to convert the pattern to a .NET compatible
* format and apply modifiers in a compatible way.
* See https://msdn.microsoft.com/en-us/library/yd1hzczs(v=vs.110).aspx for .NET options.
*/
* The pattern spec follows the Perl convention and style of modifiers. .NET
* does not support this syntax directly so we need to convert the pattern to a .NET compatible
* format and apply modifiers in a compatible way.
* See https://msdn.microsoft.com/en-us/library/yd1hzczs(v=vs.110).aspx for .NET options.
*/
public void postProcessPattern(String pattern, Map<String, Object> vendorExtensions) {
if (pattern != null) {
int i = pattern.lastIndexOf('/');
@@ -707,7 +707,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
}
// number
if(datatype.startsWith("int") || datatype.startsWith("long") ||
if (datatype.startsWith("int") || datatype.startsWith("long") ||
datatype.startsWith("double") || datatype.startsWith("float")) {
String varName = "NUMBER_" + value;
varName = varName.replaceAll("-", "MINUS_");
@@ -751,13 +751,18 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
public String getNameUsingModelPropertyNaming(String name) {
switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) {
case original: return name;
case camelCase: return camelize(name, true);
case PascalCase: return camelize(name);
case snake_case: return underscore(name);
default: throw new IllegalArgumentException("Invalid model property naming '" +
name + "'. Must be 'original', 'camelCase', " +
"'PascalCase' or 'snake_case'");
case original:
return name;
case camelCase:
return camelize(name, true);
case PascalCase:
return camelize(name);
case snake_case:
return underscore(name);
default:
throw new IllegalArgumentException("Invalid model property naming '" +
name + "'. Must be 'original', 'camelCase', " +
"'PascalCase' or 'snake_case'");
}
}

View File

@@ -60,9 +60,9 @@ public class ConfluenceWikiCodegen extends DefaultCodegen implements CodegenConf
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
additionalProperties.put("appName", "OpenAPI Sample");
additionalProperties.put("appDescription", "A sample openapi server");
additionalProperties.put("infoUrl", "https://helloreverb.com");
additionalProperties.put("infoEmail", "hello@helloreverb.com");
additionalProperties.put("appDescription", "A sample OpenAPI server");
additionalProperties.put("infoUrl", "https://openapi-generator.tech");
additionalProperties.put("infoEmail", "team@openapitools.org");
additionalProperties.put("licenseInfo", "All rights reserved");
additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html");
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);

View File

@@ -139,6 +139,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen {
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("cmake-lists.mustache", "", "CMakeLists.txt"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList("int", "char", "bool", "long", "float", "double", "int32_t", "int64_t"));

View File

@@ -18,13 +18,12 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.SupportingFile;
import java.io.File;
@@ -38,10 +37,16 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
public static final String INTERFACE_ONLY = "interfaceOnly";
public static final String RETURN_RESPONSE = "returnResponse";
public static final String GENERATE_POM = "generatePom";
public static final String USE_SWAGGER_ANNOTATIONS = "useSwaggerAnnotations";
public static final String JACKSON = "jackson";
private boolean interfaceOnly = false;
private boolean returnResponse = false;
private boolean generatePom = true;
private boolean useSwaggerAnnotations = true;
private boolean useJackson = false;
private String primaryResourceName;
public JavaJAXRSSpecServerCodegen() {
super();
@@ -90,6 +95,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
cliOptions.add(CliOption.newBoolean(GENERATE_POM, "Whether to generate pom.xml if the file does not already exist.").defaultValue(String.valueOf(generatePom)));
cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.").defaultValue(String.valueOf(interfaceOnly)));
cliOptions.add(CliOption.newBoolean(RETURN_RESPONSE, "Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true.").defaultValue(String.valueOf(returnResponse)));
cliOptions.add(CliOption.newBoolean(USE_SWAGGER_ANNOTATIONS, "Whether to generate Swagger annotations.", useSwaggerAnnotations));
}
@Override
@@ -109,6 +115,13 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
additionalProperties.remove(RETURN_RESPONSE);
}
}
if (additionalProperties.containsKey(USE_SWAGGER_ANNOTATIONS)) {
useSwaggerAnnotations = Boolean.valueOf(additionalProperties.get(USE_SWAGGER_ANNOTATIONS).toString());
}
writePropertyBack(USE_SWAGGER_ANNOTATIONS, useSwaggerAnnotations);
useJackson = convertPropertyToBoolean(JACKSON);
if (interfaceOnly) {
// Change default artifactId if genereating interfaces only, before command line options are applied in base class.
artifactId = "openapi-jaxrs-client";
@@ -148,32 +161,44 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
basePath = basePath.substring(0, pos);
}
String operationKey = basePath;
if (StringUtils.isEmpty(basePath)) {
basePath = "default";
basePath = tag;
operationKey = "";
primaryResourceName = tag;
} else if (basePath.matches("\\{.*\\}")) {
basePath = tag;
operationKey = "";
co.subresourceOperation = true;
} else {
if (co.path.startsWith("/" + basePath)) {
co.path = co.path.substring(("/" + basePath).length());
}
co.subresourceOperation = !co.path.isEmpty();
}
List<CodegenOperation> opList = operations.get(basePath);
List<CodegenOperation> opList = operations.get(operationKey);
if (opList == null || opList.isEmpty()) {
opList = new ArrayList<CodegenOperation>();
operations.put(basePath, opList);
operations.put(operationKey, opList);
}
opList.add(co);
co.baseName = basePath;
}
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);
model.imports.remove("ApiModelProperty");
model.imports.remove("ApiModel");
model.imports.remove("JsonSerialize");
model.imports.remove("ToStringSerializer");
model.imports.remove("JsonValue");
model.imports.remove("JsonProperty");
public CodegenModel fromModel(String name, Schema model, Map<String, Schema> allDefinitions) {
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
if (!useSwaggerAnnotations) {
codegenModel.imports.remove("ApiModelProperty");
codegenModel.imports.remove("ApiModel");
}
if (!useJackson) {
codegenModel.imports.remove("JsonSerialize");
codegenModel.imports.remove("ToStringSerializer");
codegenModel.imports.remove("JsonValue");
codegenModel.imports.remove("JsonProperty");
}
return codegenModel;
}
@Override
@@ -186,4 +211,14 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
public String getHelp() {
return "Generates a Java JAXRS Server according to JAXRS 2.0 specification.";
}
@Override
public String toApiName(final String name) {
String computed = name;
if (computed.length() == 0) {
return primaryResourceName + "Api";
}
computed = sanitizeName(computed);
return camelize(computed) + "Api";
}
}

View File

@@ -837,6 +837,13 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
return newOperationId;
}
// operationId starts with a number
if (operationId.matches("^\\d.*")) {
String newOperationId = camelize("call_" + operationId, true);
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + newOperationId);
return newOperationId;
}
return operationId;
}

View File

@@ -17,31 +17,13 @@
package org.openapitools.codegen.languages;
import io.swagger.models.properties.*;
import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.parameters.*;
import org.openapitools.codegen.*;
import java.io.File;
import java.util.*;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.PathItem.HttpMethod;
import io.swagger.v3.oas.models.*;
import io.swagger.v3.oas.models.parameters.*;
import io.swagger.v3.core.util.Yaml;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PhpLaravelServerCodegen extends AbstractPhpCodegen {
@SuppressWarnings("hiding")
protected String apiVersion = "1.0.0";
protected String variableNamingConvention = "camelCase";
/**
* Configures the type of generator.
@@ -80,6 +62,7 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen {
super();
embeddedTemplateDir = templateDir = "php-laravel";
variableNamingConvention = "camelCase";
/*
* packPath

View File

@@ -165,7 +165,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
supportedLibraries.put("urllib3", "urllib3-based client");
supportedLibraries.put("asyncio", "Asyncio-based client (python 3.5+)");
supportedLibraries.put("tornado", "tornado-based client");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use: asyncio, tornado, urllib3");
libraryOption.setDefault(DEFAULT_LIBRARY);
cliOptions.add(libraryOption);
setLibrary(DEFAULT_LIBRARY);

View File

@@ -43,7 +43,7 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
outputFolder = "docs";
modelTemplateFiles.put("model.mustache", ".html");
apiTemplateFiles.put("operation.mustache", ".html");
embeddedTemplateDir = templateDir = "swagger-static";
embeddedTemplateDir = templateDir = "openapi-static";
cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC));
cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC));
@@ -94,8 +94,8 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
}
@Override
public String escapeReservedWord(String name) {
if(this.reservedWordsMappings().containsKey(name)) {
public String escapeReservedWord(String name) {
if (this.reservedWordsMappings().containsKey(name)) {
return this.reservedWordsMappings().get(name);
}
return "_" + name;
@@ -121,5 +121,5 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
public String escapeUnsafeCharacters(String input) {
// just return the original string
return input;
}
}
}

View File

@@ -82,9 +82,9 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
additionalProperties.put("appName", "OpenAPI Sample");
additionalProperties.put("appDescription", "A sample openapi server");
additionalProperties.put("appDescription", "A sample OpenAPI server");
additionalProperties.put("infoUrl", "https://openapi-generator.tech");
additionalProperties.put("infoEmail", "contributors@openapitools.org");
additionalProperties.put("infoEmail", "team@openapitools.org");
additionalProperties.put("licenseInfo", "All rights reserved");
additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html");
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);
@@ -180,7 +180,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
Map<String, Object> vendorExtensions = openAPI.getExtensions();
if (vendorExtensions != null) {
for(Map.Entry<String, Object> vendorExtension: vendorExtensions.entrySet()) {
for (Map.Entry<String, Object> vendorExtension : vendorExtensions.entrySet()) {
// Vendor extensions could be Maps (objects). If we wanted to iterate through them in our template files
// without knowing the keys beforehand, the default `toString` method renders them unusable. Instead, we
// convert them to JSON strings now, which means we can easily use them later.

View File

@@ -69,9 +69,9 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
additionalProperties.put("appName", "OpenAPI Sample");
additionalProperties.put("appDescription", "A sample openapi server");
additionalProperties.put("infoUrl", "https://helloreverb.com");
additionalProperties.put("infoEmail", "hello@helloreverb.com");
additionalProperties.put("appDescription", "A sample OpenAPI server");
additionalProperties.put("infoUrl", "https//openapi-generator.tech");
additionalProperties.put("infoEmail", "team@openapitools.org");
additionalProperties.put("licenseInfo", "All rights reserved");
additionalProperties.put("licenseUrl", "http://apache.org/licenses/LICENSE-2.0.html");
additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage);

View File

@@ -43,13 +43,14 @@ import java.io.Writer;
*/
public class IndentedLambda implements Mustache.Lambda {
private final int prefixSpaceCount;
private final String prefix;
private int spaceCode;
/**
* Constructs a new instance of {@link IndentedLambda}, with an indent count of 4 spaces
*/
public IndentedLambda() {
this(4, " ");
this(4, " ", null);
}
/**
@@ -59,15 +60,38 @@ public class IndentedLambda implements Mustache.Lambda {
* @param indentionCharacter String representation of the character used in the indent (e.g. " ", "\t", ".").
*/
public IndentedLambda(int prefixSpaceCount, String indentionCharacter) {
this(prefixSpaceCount, Character.codePointAt(indentionCharacter, 0));
this(prefixSpaceCount, Character.codePointAt(indentionCharacter, 0), null);
}
/**
* Constructs a new instance of {@link IndentedLambda}, with customized indent count and intention character
*
* @param prefixSpaceCount The number of indented characters to apply as a prefix to a fragment.
* @param indentionCharacter String representation of the character used in the indent (e.g. " ", "\t", ".").
* @param prefix An optional prefix to prepend before the line (useful for multi-line comments).
*/
public IndentedLambda(int prefixSpaceCount, String indentionCharacter, String prefix) {
this(prefixSpaceCount, Character.codePointAt(indentionCharacter, 0), prefix);
}
/**
* Constructs a new instance of {@link IndentedLambda}
*
* @param prefixSpaceCount The number of indented characters to apply as a prefix to a fragment.
* @param indentionCodePoint Code point of the single character used for indentation.
*/
private IndentedLambda(int prefixSpaceCount, int indentionCodePoint) {
this(prefixSpaceCount, indentionCodePoint, null);
}
/**
* Constructs a new instance of {@link IndentedLambda}
*
* @param prefixSpaceCount The number of indented characters to apply as a prefix to a fragment.
* @param indentionCodePoint Code point of the single character used for indentation.
* @param prefix An optional prefix to prepend before the line (useful for multi-line comments).
*/
private IndentedLambda(int prefixSpaceCount, int indentionCodePoint, String prefix) {
if (prefixSpaceCount <= 0) {
throw new IllegalArgumentException("prefixSpaceCount must be greater than 0");
}
@@ -78,6 +102,7 @@ public class IndentedLambda implements Mustache.Lambda {
this.prefixSpaceCount = prefixSpaceCount;
this.spaceCode = indentionCodePoint;
this.prefix = prefix;
}
@Override
@@ -96,6 +121,7 @@ public class IndentedLambda implements Mustache.Lambda {
// So, we want to skip the first line.
if (i > 0) {
sb.append(prefixedIndention);
if (prefix != null) sb.append(prefix);
}
sb.append(line);

View File

@@ -648,7 +648,7 @@ public class ModelUtils {
} else if (isStringSchema(ref) && (ref.getEnum() != null && !ref.getEnum().isEmpty())) {
// top-level enum class
return schema;
} else if (isMapSchema(ref) || isArraySchema(ref)) { // map/array def should be created as models
} else if (isMapSchema(ref) || isArraySchema(ref) || isComposedSchema(ref)) { // map/array def should be created as models
return schema;
} else {
return unaliasSchema(allSchemas, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref())));

View File

@@ -6,22 +6,20 @@ import {{apiPackage}}.*;
{{#imports}}import {{import}};
{{/imports}}
{{^fullJavaUtil}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.restassured.RestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.response.Response;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import static io.restassured.config.ObjectMapperConfig.objectMapperConfig;
import static io.restassured.config.RestAssuredConfig.config;
import static org.openapitools.client.GsonObjectMapper.gson;
{{/fullJavaUtil}}
public class ApiClient {
{{#basePath}}
public static final String BASE_URI = "{{basePath}}";
{{/basePath}}
private final Config config;
@@ -42,7 +40,9 @@ public class ApiClient {
{{/apiInfo}}
public static class Config {
private Supplier<RequestSpecBuilder> baseReqSpec;
private Supplier<RequestSpecBuilder> baseReqSpec = () -> new RequestSpecBuilder()
{{#basePath}}.setBaseUri(BASE_URI){{/basePath}}
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper(gson())));
/**
* Use common specification for all operations

View File

@@ -15,7 +15,9 @@ import java.util.Map;
import io.restassured.RestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.Method;
import io.restassured.response.Response;
import io.swagger.annotations.*;
import java.lang.reflect.Type;
import java.util.function.Consumer;
@@ -41,6 +43,15 @@ public class {{classname}} {
{{#operations}}
{{#operation}}
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#hasAuthMethods}}, authorizations = {
{{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
{{/hasMore}}{{/scopes}}
}{{/isOAuth}}){{#hasMore}},
{{/hasMore}}{{/authMethods}}
}{{/hasAuthMethods}}, tags={ {{#tags}}{{#name}}"{{{name}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} })
@ApiResponses(value = { {{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}") {{#hasMore}},{{/hasMore}}{{/responses}} })
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
@@ -83,29 +94,14 @@ public class {{classname}} {
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
public class {{operationIdCamelCase}}Oper {
public static class {{operationIdCamelCase}}Oper {
public static final String REQ_METHOD = "{{httpMethod}}";
public static final Method REQ_METHOD = {{httpMethod}};
public static final String REQ_URI = "{{path}}";
public static final String SUMMARY = "{{{summary}}}";
private RequestSpecBuilder reqSpec;
private ResponseSpecBuilder respSpec;
public {{operationIdCamelCase}}Oper() {
this.reqSpec = new RequestSpecBuilder();
{{#vendorExtensions}}
{{#x-contentType}}
reqSpec.setContentType("{{x-contentType}}");
{{/x-contentType}}
{{#x-accepts}}
reqSpec.setAccept("{{x-accepts}}");
{{/x-accepts}}
{{/vendorExtensions}}
this.respSpec = new ResponseSpecBuilder();
}
public {{operationIdCamelCase}}Oper(RequestSpecBuilder reqSpec) {
this.reqSpec = reqSpec;
{{#vendorExtensions}}
@@ -126,7 +122,7 @@ public class {{classname}} {
* @return type
*/
public <T> T execute(Function<Response, T> handler) {
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request({{httpMethod}}, REQ_URI));
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
}
{{#returnType}}

View File

@@ -6,7 +6,9 @@ package {{package}};
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
{{#useSwaggerAnnotations}}
import io.swagger.annotations.*;
{{/useSwaggerAnnotations}}
import java.io.InputStream;
import java.util.Map;
@@ -14,8 +16,8 @@ import java.util.List;
{{#useBeanValidation}}import javax.validation.constraints.*;
import javax.validation.Valid;{{/useBeanValidation}}
@Path("/{{{baseName}}}")
@Api(description = "the {{{baseName}}} API"){{#hasConsumes}}
@Path("/{{{baseName}}}"){{#useSwaggerAnnotations}}
@Api(description = "the {{{baseName}}} API"){{/useSwaggerAnnotations}}{{#hasConsumes}}
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
{{>generatedAnnotation}}public {{#interfaceOnly}}interface{{/interfaceOnly}}{{^interfaceOnly}}class{{/interfaceOnly}} {{classname}} {

View File

@@ -1,7 +1,7 @@
@{{httpMethod}}{{#subresourceOperation}}
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}{{#useSwaggerAnnotations}}
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#hasAuthMethods}}, authorizations = {
{{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
@@ -10,5 +10,5 @@
{{/hasMore}}{{/authMethods}}
}{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
@ApiResponses(value = { {{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},{{/hasMore}}{{/responses}} })
@ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}},{{/hasMore}}{{/responses}} }){{/useSwaggerAnnotations}}
{{#returnResponse}}Response{{/returnResponse}}{{^returnResponse}}{{>returnTypeInterface}}{{/returnResponse}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}});

View File

@@ -1,7 +1,7 @@
@{{httpMethod}}{{#subresourceOperation}}
@Path("{{{path}}}"){{/subresourceOperation}}{{#hasConsumes}}
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}{{#useSwaggerAnnotations}}
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnBaseType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
{{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
@@ -11,7 +11,7 @@
}{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
@ApiResponses(value = { {{#responses}}
@ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#hasMore}},{{/hasMore}}{{/responses}}
})
}){{/useSwaggerAnnotations}}
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) {
return Response.ok().entity("magic!").build();
}

View File

@@ -1 +1 @@
{{#isHeaderParam}}@HeaderParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} {{#description}} @ApiParam("{{description}}"){{/description}} {{{dataType}}} {{paramName}}{{/isHeaderParam}}
{{#isHeaderParam}}@HeaderParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isHeaderParam}}

View File

@@ -1 +1 @@
{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{#description}} @ApiParam("{{description}}"){{/description}} {{{dataType}}} {{paramName}}{{/isPathParam}}
{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isPathParam}}

View File

@@ -1,4 +1,6 @@
{{#useSwaggerAnnotations}}
import io.swagger.annotations.*;
{{/useSwaggerAnnotations}}
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
@@ -7,8 +9,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
{{#description}}
/**
* {{description}}
**/{{/description}}
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}
**/{{/description}}{{#useSwaggerAnnotations}}
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}{{/useSwaggerAnnotations}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
{{#vars}}{{#isEnum}}{{^isContainer}}
@@ -34,8 +36,8 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
return this;
}
{{#vendorExtensions.extraAnnotation}}{{{vendorExtensions.extraAnnotation}}}{{/vendorExtensions.extraAnnotation}}
@ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
{{#vendorExtensions.extraAnnotation}}{{{vendorExtensions.extraAnnotation}}}{{/vendorExtensions.extraAnnotation}}{{#useSwaggerAnnotations}}
@ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}"){{/useSwaggerAnnotations}}
@JsonProperty("{{baseName}}")
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}};

View File

@@ -42,12 +42,14 @@
<version>2.0</version>
<scope>provided</scope>
</dependency>
{{#useSwaggerAnnotations}}
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
<version>1.5.3</version>
</dependency>
{{/useSwaggerAnnotations}}
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@@ -1 +1 @@
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} {{#description}} @ApiParam("{{description}}"){{/description}} {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@@ -13,7 +13,7 @@
"dependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.26.0",
"superagent": "3.5.2"
"superagent": "3.7.0"
},
"devDependencies": {
"babel-core": "6.26.0",

View File

@@ -11,7 +11,7 @@
"fs": false
},
"dependencies": {
"superagent": "3.5.2"
"superagent": "3.7.0"
},
"devDependencies": {
"mocha": "~2.3.4",

View File

@@ -62,7 +62,7 @@ the object you have available during client generation:
```
# The following additional debug options are available for all codegen targets:
# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen
# -DdebugOpenAPI prints the OpenAPI Specification as interpreted by the codegen
# -DdebugModels prints models passed to the template engine
# -DdebugOperations prints operations passed to the template engine
# -DdebugSupportingFiles prints additional data passed to the template engine

View File

@@ -0,0 +1,43 @@
# C++ API client
{{#appDescription}}
{{{appDescription}}}
{{/appDescription}}
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI spec](https://openapis.org) from a remote server, you can easily generate an API client.
- API version: {{appVersion}}
- Package version: {{packageVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
- API namespace: {{{apiPackage}}}
- Model namespace: {{{modelPackage}}}
## Installation
### Prerequisites
Install [cpprestsdk](https://github.com/Microsoft/cpprestsdk).
- Windows: `vcpkg install cpprestsdk cpprestsdk:x64-windows`
- Mac: `brew install cpprestsdk`
- Linux: `sudo apt-get install libcpprest-dev`
### Build
```sh
cmake -DCPPREST_ROOT=/usr -DCMAKE_CXX_FLAGS="-I/usr/local/opt/openssl/include" -DCMAKE_MODULE_LINKER_FLAGS="-L/usr/local/opt/openssl/lib"
make
```
## Author
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
{{/hasMore}}{{/apis}}{{/apiInfo}}

View File

@@ -51,7 +51,7 @@ public:
~{{classname}}() override;
{{/gmockApis}}
{{^gmockApis}}
virtual ~{{classname}}() = default;
virtual ~{{classname}}();
{{/gmockApis}}
{{#operation}}
@@ -62,7 +62,7 @@ public:
/// {{notes}}
/// </remarks>
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
/// <param name="{{paramName}}">{{#lambda.multiline_comment_4}}{{description}}{{/lambda.multiline_comment_4}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}</param>
{{/allParams}}
pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{operationId}}(
{{#allParams}}

View File

@@ -31,14 +31,10 @@ message("A ${CMAKE_BUILD_TYPE} build configuration is detected")
#find_package(Boost 1.45.0 REQUIRED COMPONENTS ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
# build and set path to cpp rest sdk
#set(CPPREST_ROOT ${PROJECT_SOURCE_DIR}/../../../developmentTools/3rdParty/cpprest)
set(CPPREST_ROOT ${PROJECT_SOURCE_DIR}/3rdParty/cpprest)
set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include)
set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib)
if( NOT DEFINED CPPREST_ROOT )
message( FATAL_ERROR "Failed to find cpprest SDK (or missing components). Double check that \"CPPREST_ROOT\" is properly set")
endif( NOT DEFINED CPPREST_ROOT )
include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR})
#SUPPORTING FILES

View File

@@ -7,11 +7,14 @@
[JsonConverter(typeof(StringEnumConverter))]
{{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
{
{{#allowableValues}}{{#enumVars}}
{{#allowableValues}}
{{#enumVars}}
/// <summary>
/// Enum {{name}} for {{{value}}}
/// </summary>
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}}
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}

View File

@@ -9,11 +9,16 @@
{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}}
{{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}}
{
{{#allowableValues}}{{#enumVars}}
{{#allowableValues}}
{{#enumVars}}
/// <summary>
/// Enum {{name}} for value: {{{value}}}
/// </summary>
{{#isString}}[EnumMember(Value = "{{{value}}}")]{{/isString}}
{{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}}
{{#isString}}
[EnumMember(Value = "{{{value}}}")]
{{/isString}}
{{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}{{! NOTE: This model's enumVars is modified to look like CodegenProperty}}

View File

@@ -133,7 +133,7 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public {{#parent}}{{^isArrayModel}}override {{/isArrayModel}}{{/parent}}{{^parent}}virtual {{/parent}}string ToJson()
public {{#parent}}{{^isArrayModel}}{{^isMapModel}}override {{/isMapModel}}{{/isArrayModel}}{{/parent}}{{^parent}}virtual {{/parent}}string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
@@ -247,7 +247,9 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
{{/discriminator}}
{{#parent}}
{{^isArrayModel}}
{{^isMapModel}}
foreach(var x in BaseValidate(validationContext)) yield return x;
{{/isMapModel}}
{{/isArrayModel}}
{{/parent}}
{{#vars}}

View File

@@ -10,12 +10,17 @@
{{/isString}}
{{>visibility}} enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#vendorExtensions.x-enum-byte}}: byte{{/vendorExtensions.x-enum-byte}}
{
{{#allowableValues}}{{#enumVars}}
{{#allowableValues}}
{{#enumVars}}
/// <summary>
/// Enum {{name}} for value: {{{value}}}
/// </summary>
{{#isString}}[EnumMember(Value = "{{{value}}}")]{{/isString}}
{{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}}
{{#isString}}
[EnumMember(Value = "{{{value}}}")]
{{/isString}}
{{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}},{{/-last}}
{{/enumVars}}
{{/allowableValues}}
}
{{/isContainer}}

View File

@@ -186,6 +186,7 @@ module {{moduleName}}
end
return data, status_code, headers
end
{{/operation}}
end
{{/operations}}

View File

@@ -97,7 +97,7 @@ export class ObjectSerializer {
}
return transformedData;
} else if (type === "Date") {
return data.toString();
return data.toISOString();
} else {
if (enumsMap[type]) {
return data;

View File

@@ -0,0 +1,108 @@
package org.openapitools.codegen.java.jaxrs;
import io.swagger.v3.oas.models.Operation;
import org.junit.Before;
import org.junit.Test;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* Unit-Test for {@link org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen}.
*
* @author attrobit
*/
public class JavaJAXRSSpecServerCodegenTest {
private JavaJAXRSSpecServerCodegen instance;
@Before
public void before() {
instance = new JavaJAXRSSpecServerCodegen();
}
/**
* Test
* {@link JavaJAXRSSpecServerCodegen#addOperationToGroup(String, String, Operation, CodegenOperation, Map)} for Resource with path "/" and set tag.
*/
@Test
public void testAddOperationToGroupForRootResource() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.operationId = "findPrimaryresource";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
instance.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
assertThat(operationList.size(), is(1));
assertThat(operationList.containsKey(""), is(true));
assertThat(codegenOperation.baseName, is("Primaryresource"));
}
/**
* Test
* {@link JavaJAXRSSpecServerCodegen#addOperationToGroup(String, String, Operation, CodegenOperation, Map)} for Resource with path param.
*/
@Test
public void testAddOperationToGroupForRootResourcePathParam() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.operationId = "getPrimaryresource";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
instance.addOperationToGroup("Primaryresource", "/{uuid}", operation, codegenOperation, operationList);
assertThat(operationList.size(), is(1));
assertThat(operationList.containsKey(""), is(true));
assertThat(codegenOperation.baseName, is("Primaryresource"));
}
/**
* Test
* {@link JavaJAXRSSpecServerCodegen#addOperationToGroup(String, String,
* Operation, CodegenOperation, Map)} for Resource with path "/subresource".
*/
@Test
public void testAddOperationToGroupForSubresource() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.path = "/subresource";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
instance.addOperationToGroup("Default", "/subresource", operation, codegenOperation, operationList);
assertThat(codegenOperation.baseName, is("subresource"));
assertThat(operationList.size(), is(1));
assertThat(operationList.containsKey("subresource"), is(true));
}
/**
* Test {@link JavaJAXRSSpecServerCodegen#toApiName(String)} with subresource.
*/
@Test
public void testToApiNameForSubresource() {
final String subresource = instance.toApiName("subresource");
assertThat(subresource, is("SubresourceApi"));
}
/**
* Test {@link JavaJAXRSSpecServerCodegen#toApiName(String)} with primary resource.
*/
@Test
public void testToApiNameForPrimaryResource() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.operationId = "findPrimaryresource";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
instance.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
final String subresource = instance.toApiName("");
assertThat(subresource, is("PrimaryresourceApi"));
}
}

View File

@@ -19,10 +19,7 @@ package org.openapitools.codegen.utils;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.IntegerSchema;
import io.swagger.v3.oas.models.media.ObjectSchema;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.oas.models.responses.ApiResponse;
@@ -32,7 +29,10 @@ import org.openapitools.codegen.TestUtils;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ModelUtilsTest {
@@ -173,4 +173,24 @@ public class ModelUtilsTest {
Parameter result2 = ModelUtils.getReferencedParameter(openAPI, new Parameter().$ref("#/components/parameters/OtherParameter"));
Assert.assertEquals(result2, otherParameter);
}
/**
* Issue https://github.com/OpenAPITools/openapi-generator/issues/582.
* Composed schemas should not get unaliased when generating model properties, in order to properly
* generate the property data type name.
*/
@Test
public void testComposedSchemasAreNotUnaliased() {
ComposedSchema composedSchema = new ComposedSchema().allOf(Arrays.asList(
new Schema<>().$ref("#/components/schemas/SomeSchema"),
new ObjectSchema()
));
Schema refToComposedSchema = new Schema().$ref("#/components/schemas/SomeComposedSchema");
Map<String, Schema> allSchemas = new HashMap<>();
allSchemas.put("SomeComposedSchema", composedSchema);
Assert.assertEquals(refToComposedSchema, ModelUtils.unaliasSchema(allSchemas, refToComposedSchema));
}
}

13
pom.xml
View File

@@ -715,6 +715,19 @@
<module>samples/server/petstore/jaxrs/jersey1</module>
</modules>
</profile>
<profile>
<!-- openapi v3's one -->
<id>jaxrs-jersey</id>
<activation>
<property>
<name>env</name>
<value>java</value>
</property>
</activation>
<modules>
<module>samples/server/petstore/jaxrs-jersey</module>
</modules>
</profile>
<profile>
<id>jaxrs-spec</id>
<activation>

View File

@@ -1 +1 @@
2.3.0-SNAPSHOT
3.2.0-SNAPSHOT

View File

@@ -1,12 +1,12 @@
# swagger_petstore____end____rn_n_r
# open_api_petstore____end____rn_n_r
SwaggerPetstoreEndRnNR - JavaScript client for swagger_petstore____end____rn_n_r
OpenApiPetstoreEndRnNR - JavaScript client for open_api_petstore____end____rn_n_r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
- Package version: 1.0.0 *_/ &#x3D;end -- \r\n \n \r
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
## Installation
@@ -20,7 +20,7 @@ please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.co
Then install it via:
```shell
npm install swagger_petstore____end____rn_n_r --save
npm install open_api_petstore____end____rn_n_r --save
```
##### Local development
@@ -38,13 +38,13 @@ Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the follow
npm link
```
Finally, switch to the directory you want to use your swagger_petstore____end____rn_n_r from, and run:
Finally, switch to the directory you want to use your open_api_petstore____end____rn_n_r from, and run:
```shell
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
```
You should now be able to `require('swagger_petstore____end____rn_n_r')` in javascript files from the directory you ran the last
You should now be able to `require('open_api_petstore____end____rn_n_r')` in javascript files from the directory you ran the last
command above from.
#### git
@@ -93,12 +93,11 @@ module: {
Please follow the [installation](#installation) instruction and execute the following JS code:
```javascript
var SwaggerPetstoreEndRnNR = require('swagger_petstore____end____rn_n_r');
var OpenApiPetstoreEndRnNR = require('open_api_petstore____end____rn_n_r');
var api = new SwaggerPetstoreEndRnNR.FakeApi()
var opts = {
'testCodeInjectEndRnNR': "testCodeInjectEndRnNR_example" // {String} To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
var api = new OpenApiPetstoreEndRnNR.FakeApi()
var opts = {
'UNKNOWN_BASE_TYPE': new OpenApiPetstoreEndRnNR.UNKNOWN_BASE_TYPE() // {UNKNOWN_BASE_TYPE}
};
var callback = function(error, data, response) {
@@ -114,16 +113,16 @@ api.testCodeInjectEndRnNR(opts, callback);
## Documentation for API Endpoints
All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
All URIs are relative to *http://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*SwaggerPetstoreEndRnNR.FakeApi* | [**testCodeInjectEndRnNR**](docs/FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
*OpenApiPetstoreEndRnNR.FakeApi* | [**testCodeInjectEndRnNR**](docs/FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
## Documentation for Models
- [SwaggerPetstoreEndRnNR.ModelReturn](docs/ModelReturn.md)
- [OpenApiPetstoreEndRnNR.ModelReturn](docs/ModelReturn.md)
## Documentation for Authorization

View File

@@ -1,6 +1,6 @@
# SwaggerPetstoreEndRnNR.FakeApi
# OpenApiPetstoreEndRnNR.FakeApi
All URIs are relative to *https://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
All URIs are relative to *http://petstore.swagger.io *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r/v2 *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r*
Method | HTTP request | Description
------------- | ------------- | -------------
@@ -13,16 +13,16 @@ Method | HTTP request | Description
To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
### Example
```javascript
var SwaggerPetstoreEndRnNR = require('swagger_petstore____end____rn_n_r');
var OpenApiPetstoreEndRnNR = require('open_api_petstore____end____rn_n_r');
var apiInstance = new SwaggerPetstoreEndRnNR.FakeApi();
var opts = {
'testCodeInjectEndRnNR': "testCodeInjectEndRnNR_example" // String | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
var apiInstance = new OpenApiPetstoreEndRnNR.FakeApi();
var opts = {
'UNKNOWN_BASE_TYPE': new OpenApiPetstoreEndRnNR.UNKNOWN_BASE_TYPE() // UNKNOWN_BASE_TYPE |
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
@@ -37,7 +37,7 @@ apiInstance.testCodeInjectEndRnNR(opts, callback);
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**testCodeInjectEndRnNR** | **String**| To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r | [optional]
**UNKNOWN_BASE_TYPE** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | [optional]
### Return type
@@ -50,5 +50,5 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json, *_/ =end --
- **Accept**: application/json, *_/ =end --
- **Accept**: Not defined

View File

@@ -1,4 +1,4 @@
# SwaggerPetstoreEndRnNR.ModelReturn
# OpenApiPetstoreEndRnNR.ModelReturn
## Properties
Name | Type | Description | Notes

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2

View File

@@ -1,5 +1,5 @@
{
"name": "swagger_petstore____end____rn_n_r",
"name": "open_api_petstore____end____rn_n_r",
"version": "1.0.0 *_/ =end -- \r\n \n \r",
"description": "This_spec_is_mainly_for_testing_Petstore_server_and_contains_fake_endpoints_models__Please_do_not_use_this_for_any_other_purpose__Special_characters_______end______",
"license": "Apache-2.0 */ &#39; &quot; &#x3D;end -- \r\n \n \r",
@@ -11,7 +11,7 @@
"fs": false
},
"dependencies": {
"superagent": "3.5.2"
"superagent": "3.7.0"
},
"devDependencies": {
"mocha": "~2.3.4",

View File

@@ -1,14 +1,14 @@
/**
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* Swagger Codegen version: 2.3.0-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*
* Do not edit the class manually.
*
@@ -23,10 +23,10 @@
module.exports = factory(require('superagent'), require('querystring'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstoreEndRnNR) {
root.SwaggerPetstoreEndRnNR = {};
if (!root.OpenApiPetstoreEndRnNR) {
root.OpenApiPetstoreEndRnNR = {};
}
root.SwaggerPetstoreEndRnNR.ApiClient = factory(root.superagent, root.querystring);
root.OpenApiPetstoreEndRnNR.ApiClient = factory(root.superagent, root.querystring);
}
}(this, function(superagent, querystring) {
'use strict';
@@ -47,9 +47,9 @@
/**
* The base URL against which to resolve every API call's (relative) path.
* @type {String}
* @default https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r
* @default http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r
*/
this.basePath = 'https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'.replace(/\/+$/, '');
this.basePath = 'http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r'.replace(/\/+$/, '');
/**
* The authentication methods to be included for all API calls.
@@ -96,6 +96,10 @@
this.agent = new superagent.agent();
}
/*
* Allow user to override superagent agent
*/
this.requestAgent = null;
};
/**
@@ -413,6 +417,12 @@
// set header parameters
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
// set requestAgent if it is set by user
if (this.requestAgent) {
request.agent(this.requestAgent);
}
// set request timeout
request.timeout(this.timeout);

View File

@@ -1,14 +1,14 @@
/**
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* Swagger Codegen version: 2.3.0-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*
* Do not edit the class manually.
*
@@ -17,18 +17,18 @@
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient'], factory);
define(['ApiClient', 'model/UNKNOWN_BASE_TYPE'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'));
module.exports = factory(require('../ApiClient'), require('../model/UNKNOWN_BASE_TYPE'));
} else {
// Browser globals (root is window)
if (!root.SwaggerPetstoreEndRnNR) {
root.SwaggerPetstoreEndRnNR = {};
if (!root.OpenApiPetstoreEndRnNR) {
root.OpenApiPetstoreEndRnNR = {};
}
root.SwaggerPetstoreEndRnNR.FakeApi = factory(root.SwaggerPetstoreEndRnNR.ApiClient);
root.OpenApiPetstoreEndRnNR.FakeApi = factory(root.OpenApiPetstoreEndRnNR.ApiClient, root.OpenApiPetstoreEndRnNR.UNKNOWN_BASE_TYPE);
}
}(this, function(ApiClient) {
}(this, function(ApiClient, UNKNOWN_BASE_TYPE) {
'use strict';
/**
@@ -57,14 +57,15 @@
*/
/**
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param {Object} opts Optional parameters
* @param {String} opts.testCodeInjectEndRnNR To test code injection *_/ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r
* @param {module:model/UNKNOWN_BASE_TYPE} opts.UNKNOWN_BASE_TYPE
* @param {module:api/FakeApi~testCodeInjectEndRnNRCallback} callback The callback function, accepting three arguments: error, data, response
*/
this.testCodeInjectEndRnNR = function(opts, callback) {
opts = opts || {};
var postBody = null;
var postBody = opts['UNKNOWN_BASE_TYPE'];
var pathParams = {
@@ -76,12 +77,11 @@
var headerParams = {
};
var formParams = {
'test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r': opts['testCodeInjectEndRnNR']
};
var authNames = [];
var contentTypes = ['application/json', '*_/ =end -- '];
var accepts = ['application/json', '*_/ =end -- '];
var accepts = [];
var returnType = null;
return this.apiClient.callApi(

View File

@@ -1,14 +1,14 @@
/**
* Swagger Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end --
*
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
*
* Swagger Codegen version: 2.3.0-SNAPSHOT
* OpenAPI Generator version: 3.2.0-SNAPSHOT
*
* Do not edit the class manually.
*
@@ -31,9 +31,9 @@
* <p>
* An AMD (recommended!) or CommonJS application will generally do something equivalent to the following:
* <pre>
* var SwaggerPetstoreEndRnNR = require('index'); // See note below*.
* var xxxSvc = new SwaggerPetstoreEndRnNR.XxxApi(); // Allocate the API class we're going to use.
* var yyyModel = new SwaggerPetstoreEndRnNR.Yyy(); // Construct a model instance.
* var OpenApiPetstoreEndRnNR = require('index'); // See note below*.
* var xxxSvc = new OpenApiPetstoreEndRnNR.XxxApi(); // Allocate the API class we're going to use.
* var yyyModel = new OpenApiPetstoreEndRnNR.Yyy(); // Construct a model instance.
* yyyModel.someProperty = 'someValue';
* ...
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.
@@ -45,8 +45,8 @@
* <p>
* A non-AMD browser application (discouraged) might do something like this:
* <pre>
* var xxxSvc = new SwaggerPetstoreEndRnNR.XxxApi(); // Allocate the API class we're going to use.
* var yyy = new SwaggerPetstoreEndRnNR.Yyy(); // Construct a model instance.
* var xxxSvc = new OpenApiPetstoreEndRnNR.XxxApi(); // Allocate the API class we're going to use.
* var yyy = new OpenApiPetstoreEndRnNR.Yyy(); // Construct a model instance.
* yyyModel.someProperty = 'someValue';
* ...
* var zzz = xxxSvc.doSomething(yyyModel); // Invoke the service.

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