-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java][Client] Fix Gradle and SBT builds for REST Assured generator (#…
…5990) * Fix Gradle and SBT builds for Java REST Assured generator * Add missing jackson-databind-nullable dependency to SBT build * Update rest-assured sample * Add sample for Java client with REST Assured and Jackson * Add new REST Assured sample as Maven sub-module
- Loading branch information
Showing
240 changed files
with
23,146 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"!include": "bin/java-petstore-rest-assured-jackson.json", | ||
"generatorName": "java", | ||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml", | ||
"outputDir": "samples/client/petstore/java/rest-assured-jackson", | ||
"templateDir": "modules/openapi-generator/src/main/resources/Java/libraries/rest-assured", | ||
"additionalProperties": { | ||
"hideGenerationTimestamp": true, | ||
"booleanGetterPrefix": "is", | ||
"java8": "true", | ||
"dateLibrary": "java8", | ||
"serializationLibrary": "jackson", | ||
"useBeanValidation": "true", | ||
"performBeanValidation": "true" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"library": "rest-assured", | ||
"artifactId": "petstore-rest-assured-jackson" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/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" | ||
target_dir="./samples/client/petstore/java/rest-assured-jackson/" | ||
|
||
if [ ! -f "$executable" ] | ||
then | ||
mvn -B clean package | ||
fi | ||
|
||
# if you've executed sbt assembly previously it will use that instead. | ||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" | ||
args="generate -t modules/openapi-generator/src/main/resources/Java/libraries/rest-assured -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-rest-assured-jackson.json -o ${target_dir} --additional-properties hideGenerationTimestamp=true --additional-properties useBeanValidation=true --additional-properties performBeanValidation=true --additional-properties booleanGetterPrefix=is --additional-properties java8=true --additional-properties dateLibrary=java8 --additional-properties serializationLibrary=jackson $@" | ||
|
||
echo "Removing ${target_dir}" | ||
rm -rf "${target_dir}" | ||
|
||
java $JAVA_OPTS -jar $executable $args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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 -t modules\openapi-generator\src\main\resources\Java\libraries\rest-assured -i modules\openapi-generator\src\test\resources\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin\java-petstore-rest-assured-jackson.json -o samples\client\petstore\java\rest-assured-jackson --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=is,java8=true,dateLibrary=java8,serializationLibrary=jackson,useBeanValidation=true,performBeanValidation=true, | ||
|
||
java %JAVA_OPTS% -jar %executable% %ags% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
samples/client/petstore/java/rest-assured-jackson/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
*.class | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# exclude jar for gradle wrapper | ||
!gradle/wrapper/*.jar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
# build files | ||
**/target | ||
target | ||
.gradle | ||
build |
23 changes: 23 additions & 0 deletions
23
samples/client/petstore/java/rest-assured-jackson/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
1 change: 1 addition & 0 deletions
1
samples/client/petstore/java/rest-assured-jackson/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4.3.1-SNAPSHOT |
22 changes: 22 additions & 0 deletions
22
samples/client/petstore/java/rest-assured-jackson/.travis.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Generated by OpenAPI Generator: https://openapi-generator.tech | ||
# | ||
# Ref: https://docs.travis-ci.com/user/languages/java/ | ||
# | ||
language: java | ||
jdk: | ||
- openjdk12 | ||
- openjdk11 | ||
- openjdk10 | ||
- openjdk9 | ||
- openjdk8 | ||
before_install: | ||
# ensure gradlew has proper permission | ||
- chmod a+x ./gradlew | ||
script: | ||
# test using maven | ||
#- mvn test | ||
# test using gradle | ||
- gradle test | ||
# test using sbt | ||
# - sbt test |
43 changes: 43 additions & 0 deletions
43
samples/client/petstore/java/rest-assured-jackson/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# petstore-rest-assured-jackson | ||
|
||
## Requirements | ||
|
||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed. | ||
|
||
## Installation & Usage | ||
|
||
To install the API client library to your local Maven repository, simply execute: | ||
|
||
```shell | ||
mvn install | ||
``` | ||
|
||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: | ||
|
||
```shell | ||
mvn deploy | ||
``` | ||
|
||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. | ||
|
||
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: | ||
|
||
```xml | ||
<dependency> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>petstore-rest-assured-jackson</artifactId> | ||
<version>1.0.0</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
|
||
``` | ||
|
||
## Recommendation | ||
|
||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. | ||
|
||
## Author | ||
|
||
|
||
|
||
|
Oops, something went wrong.