-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[Java][Client] Fix Gradle and SBT builds for REST Assured generator #5990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2d658e0
Fix Gradle and SBT builds for Java REST Assured generator
joschi d8ea411
Add missing jackson-databind-nullable dependency to SBT build
joschi ebdc1e8
Update rest-assured sample
joschi e7a2946
Add sample for Java client with REST Assured and Jackson
joschi a6f0fd7
Add new REST Assured sample as Maven sub-module
joschi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add sample for Java client with REST Assured and Jackson
- Loading branch information
commit e7a2946126114a9c2e4626f6f970ff417d604f66
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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% |
21 changes: 21 additions & 0 deletions
21
samples/client/petstore/java/rest-assured-jackson/.gitignore
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.