Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 9e824ae

Browse files
authored
Adds gradle build tool support for java generator (#430)
* Adds buildTool cli option for java * Updates buildTool info * Adds gradle files in petsote sample * Adds gitignore * Moves common files to same place in java * Fixes gradle checker framework settings * Excludes gradle wrapper * Fixes buuild and settings filenames for gradle buildTool * Fixes gitignoring of gradle wrapper files * Updates java version constraint in gradle settings file, petstore uses gradle in ci * Reverts root gitignore * Fixes java generator tests * Fixes AuthorTemplateTest * Fixes all getGnerator invocations * Docs regen * Updates buildTool ordering for docs * Samples regen
1 parent 8771aee commit 9e824ae

File tree

41 files changed

+377
-375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+377
-375
lines changed

.circleci/parallel.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ elif [ "$JOB_ID" = "testJava17ClientSamples" ]; then
2929
echo "Running job $JOB_ID ..."
3030
java -version
3131
mvn -version
32+
gradle --version
33+
3234
cat ./.circleci/testJava17ClientSamples.sh | parallel
3335

3436
else

.circleci/testJava17ClientSamples.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
(cd samples/client/petstore/java && mvn test)
1+
(cd samples/client/petstore/java && gradle wrapper && gradle test)
22
(cd samples/client/3_0_3_unit_test/java && mvn test)
33
(cd samples/client/3_1_0_unit_test/java && mvn test)

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ test-output/
4949
#Java/Android
5050
**/.gradle
5151

52-
5352
# Python
5453
*.pyc
5554
__pycache__

bin/generate_samples_configs/java.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ outputDir: samples/client/petstore/java
33
inputSpec: src/test/resources/3_0/python/petstore_customized.yaml
44
additionalProperties:
55
artifactId: petstore
6-
hideGenerationTimestamp: "true"
6+
hideGenerationTimestamp: "true"
7+
buildTool: gradle

docs/generators/java.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2323
|artifactDescription|artifact description in generated pom.xml| |OpenAPI Java|
2424
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapi-json-schema-tools/openapi-json-schema-generator|
2525
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
26+
|buildTool|the build automation tool used in generated code|<dl><dt>**maven**</dt><dd>Use maven</dd><dt>**gradle**</dt><dd>Use gradle</dd></dl>|maven|
2627
|developerEmail|developer email in generated pom.xml| |[email protected]|
2728
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
2829
|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org|
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
build/
2+
.gradle/
3+
.idea/
4+
target/
5+
6+
# gradle wrapper
7+
gradlew
8+
gradlew.bat
9+
gradle/

samples/client/3_0_3_unit_test/java/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.gitignore
12
README.md
23
docs/RootServerInfo.md
34
docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md

samples/client/3_0_3_unit_test/java/README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,6 @@ Add this dependency to your project's POM:
4141
</dependency>
4242
```
4343

44-
### Others
45-
46-
At first generate the JAR by executing:
47-
48-
```shell
49-
mvn clean package
50-
```
51-
52-
Then manually install the following JARs:
53-
54-
- `target/unit-test-api-0.0.1.jar`
55-
- `target/lib/*.jar`
56-
5744

5845
## Usage Notes
5946
### Validation, Immutability, and Data Type

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/header/Rfc6570Serializer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ private static String percentEncode(String s) throws NotImplementedException {
2727
.replace("%7E", "~");
2828
// This could be done faster with more hand-crafted code.
2929
} catch (UnsupportedEncodingException wow) {
30-
throw new NotImplementedException(wow.getMessage());
30+
@Nullable String msg = wow.getMessage();
31+
if (msg == null) {
32+
throw new NotImplementedException("UnsupportedEncodingException thrown");
33+
}
34+
throw new NotImplementedException(msg);
3135
}
3236
}
3337

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/parameter/CookieSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected CookieSerializer(Map<String, Parameter> parameters) {
1616

1717
public String serialize(Map<String, ?> inData) throws NotImplementedException {
1818
String result = "";
19-
Map<String, ?> sortedData = new TreeMap<>(inData);
19+
Map<String, @Nullable Object> sortedData = new TreeMap<>(inData);
2020
for (Map.Entry<String, ?> entry: sortedData.entrySet()) {
2121
String mapKey = entry.getKey();
2222
@Nullable Parameter parameter = parameters.get(mapKey);

0 commit comments

Comments
 (0)