Skip to content

Commit 28422e6

Browse files
committed
Update samples and docs
1 parent ce481ac commit 28422e6

78 files changed

Lines changed: 802 additions & 799 deletions

File tree

Some content is hidden

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

docs/generators/java-microprofile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
9797
|useBeanValidation|Use BeanValidation API annotations| |false|
9898
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false|
9999
|useGzipFeature|Send gzip-encoded requests| |false|
100-
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
101100
|useJackson3|Use Jackson 3 instead of Jackson 2 for JSON processing. Only supported for 'native' and 'webclient' libraries.| |false|
101+
|useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false|
102102
|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped. Only jersey2, jersey3, native, okhttp-gson support this option.| |false|
103103
|useOneOfInterfaces|whether to use a java interface to describe a set of oneOf options, where each option is a class that implements the interface| |false|
104104
|usePlayWS|Use Play! Async HTTP client (Play WS API)| |false|

samples/client/others/java/webclient-sealedInterface/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ dependencies {
129129
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
130130
implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version"
131131
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
132-
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
133132
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
134133
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
135-
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
136134
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
135+
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
136+
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
137137
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
138138
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
139139
}

samples/client/others/java/webclient-sealedInterface_3_1/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ dependencies {
129129
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
130130
implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version"
131131
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
132-
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
133132
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
134133
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
135-
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
136134
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
135+
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
136+
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
137137
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
138138
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
139139
}

samples/client/others/java/webclient-useAbstractionForFiles/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ dependencies {
129129
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
130130
implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version"
131131
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
132-
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
133132
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
134133
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
135-
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
136134
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
135+
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
136+
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
137137
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
138138
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
139139
}

samples/client/petstore/java/webclient-jackson3/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# petstore-webclient
1+
# petstore-webclient-jackson3
22

33
OpenAPI Petstore
44

@@ -41,7 +41,7 @@ Add this dependency to your project's POM:
4141
```xml
4242
<dependency>
4343
<groupId>org.openapitools</groupId>
44-
<artifactId>petstore-webclient</artifactId>
44+
<artifactId>petstore-webclient-jackson3</artifactId>
4545
<version>1.0.0</version>
4646
<scope>compile</scope>
4747
</dependency>
@@ -53,12 +53,12 @@ Add this dependency to your project's build file:
5353

5454
```groovy
5555
repositories {
56-
mavenCentral() // Needed if the 'petstore-webclient' jar has been published to maven central.
57-
mavenLocal() // Needed if the 'petstore-webclient' jar has been published to the local maven repo.
56+
mavenCentral() // Needed if the 'petstore-webclient-jackson3' jar has been published to maven central.
57+
mavenLocal() // Needed if the 'petstore-webclient-jackson3' jar has been published to the local maven repo.
5858
}
5959
6060
dependencies {
61-
implementation "org.openapitools:petstore-webclient:1.0.0"
61+
implementation "org.openapitools:petstore-webclient-jackson3:1.0.0"
6262
}
6363
```
6464

@@ -72,7 +72,7 @@ mvn clean package
7272

7373
Then manually install the following JARs:
7474

75-
- `target/petstore-webclient-1.0.0.jar`
75+
- `target/petstore-webclient-jackson3-1.0.0.jar`
7676
- `target/lib/*.jar`
7777

7878
## Getting Started

samples/client/petstore/java/webclient-jackson3/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ if(hasProperty('target') && target == 'android') {
3232
}
3333

3434
compileOptions {
35-
sourceCompatibility JavaVersion.VERSION_1_8
36-
targetCompatibility JavaVersion.VERSION_1_8
35+
sourceCompatibility JavaVersion.VERSION_17
36+
targetCompatibility JavaVersion.VERSION_17
3737
}
3838

3939
// Rename the aar correctly
@@ -78,13 +78,13 @@ if(hasProperty('target') && target == 'android') {
7878
apply plugin: 'java'
7979
apply plugin: 'maven-publish'
8080

81-
sourceCompatibility = JavaVersion.VERSION_1_8
82-
targetCompatibility = JavaVersion.VERSION_1_8
81+
sourceCompatibility = JavaVersion.VERSION_17
82+
targetCompatibility = JavaVersion.VERSION_17
8383

8484
publishing {
8585
publications {
8686
maven(MavenPublication) {
87-
artifactId = 'petstore-webclient'
87+
artifactId = 'petstore-webclient-jackson3'
8888
from components.java
8989
}
9090
}
@@ -119,8 +119,9 @@ ext {
119119
reactor_netty_version = "1.2.8"
120120
jackson_version = "3.1.0"
121121
jackson_databind_version = "3.1.0"
122-
jackson_databind_nullable_version = "0.2.9" // TODO waiting for https://github.com/OpenAPITools/jackson-databind-nullable/pull/117
123-
jackson_annotations = "2.19.2"
122+
jackson_annotations_version = "2.19.2"
123+
jackson_databind_version = "2.19.2"
124+
jackson_databind_nullable_version = "0.2.9"
124125
junit_version = "5.10.2"
125126
}
126127

@@ -132,7 +133,7 @@ dependencies {
132133
implementation "tools.jackson.core:jackson-core:$jackson_version"
133134
implementation "tools.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
134135
implementation "tools.jackson.core:jackson-databind:$jackson_databind_version"
135-
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations"
136+
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
136137
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
137138
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
138139
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"

samples/client/petstore/java/webclient-jackson3/pom.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.openapitools</groupId>
5-
<artifactId>petstore-webclient</artifactId>
5+
<artifactId>petstore-webclient-jackson3</artifactId>
66
<packaging>jar</packaging>
7-
<name>petstore-webclient</name>
7+
<name>petstore-webclient-jackson3</name>
88
<version>1.0.0</version>
99
<url>https://github.com/openapitools/openapi-generator</url>
1010
<description>OpenAPI Java</description>
@@ -38,8 +38,8 @@
3838
<artifactId>maven-compiler-plugin</artifactId>
3939
<version>3.13.0</version>
4040
<configuration>
41-
<source>1.8</source>
42-
<target>1.8</target>
41+
<source>17</source>
42+
<target>17</target>
4343
</configuration>
4444
</plugin>
4545
<plugin>
@@ -117,10 +117,11 @@
117117
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
118118
<jackson-version>3.1.0</jackson-version>
119119
<jackson-databind-version>3.1.0</jackson-databind-version>
120-
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version> <!-- TODO waiting for https://github.com/OpenAPITools/jackson-databind-nullable/pull/117 -->
120+
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
121121
<spring-boot-version>4.0.3</spring-boot-version>
122-
<jakarta-annotation-version>3.0.0</jakarta-annotation-version>
123-
<reactor-version>3.4.34</reactor-version>
122+
<spring-boot-version>3.2.12</spring-boot-version>
123+
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
124+
<reactor-version>3.5.12</reactor-version>
124125
<reactor-netty-version>1.2.8</reactor-netty-version>
125126
<junit-version>5.10.2</junit-version>
126127
</properties>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = "petstore-webclient"
1+
rootProject.name = "petstore-webclient-jackson3"

samples/client/petstore/java/webclient-jackson3/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
import java.util.Map.Entry;
7171
import java.util.TimeZone;
7272

73-
import javax.annotation.Nullable;
73+
import jakarta.annotation.Nullable;
7474

7575
import java.time.OffsetDateTime;
7676

@@ -80,7 +80,7 @@
8080
import org.openapitools.client.auth.ApiKeyAuth;
8181
import org.openapitools.client.auth.OAuth;
8282

83-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
83+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
8484
public class ApiClient extends JavaTimeFormatter {
8585
public enum CollectionFormat {
8686
CSV(","), TSV("\t"), SSV(" "), PIPES("|"), MULTI(null);
@@ -149,7 +149,7 @@ public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFo
149149
.builder()
150150
.setDateFormat(dateFormat)
151151
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
152-
.addModule(new JsonNullableModule())
152+
.addModule(new JsonNullableJackson3Module())
153153
.build();
154154
}
155155

@@ -174,8 +174,8 @@ public static WebClient.Builder buildWebClientBuilder(ObjectMapper mapper) {
174174
ExchangeStrategies strategies = ExchangeStrategies
175175
.builder()
176176
.codecs(clientDefaultCodecsConfigurer -> {
177-
clientDefaultCodecsConfigurer.defaultCodecs().jacksonJsonEncoder(new JacksonJsonEncoder(mapper, MediaType.APPLICATION_JSON));
178-
clientDefaultCodecsConfigurer.defaultCodecs().jacksonJsonDecoder(new JacksonJsonDecoder(mapper, MediaType.APPLICATION_JSON));
177+
clientDefaultCodecsConfigurer.defaultCodecs().jacksonJsonEncoder(new JacksonJsonEncoder(mapper));
178+
clientDefaultCodecsConfigurer.defaultCodecs().jacksonJsonDecoder(new JacksonJsonDecoder(mapper));
179179
}).build();
180180
WebClient.Builder webClientBuilder = WebClient.builder().exchangeStrategies(strategies);
181181
return webClientBuilder;
@@ -713,7 +713,7 @@ protected WebClient.RequestBodySpec prepareRequest(String path, HttpMethod metho
713713
* @param requestBuilder The current request
714714
*/
715715
protected void addHeadersToRequest(HttpHeaders headers, WebClient.RequestBodySpec requestBuilder) {
716-
for (Entry<String, List<String>> entry : headers.entrySet()) {
716+
for (Entry<String, List<String>> entry : headers.headerSet()) {
717717
List<String> values = entry.getValue();
718718
for(String value : values) {
719719
if (value != null) {

samples/client/petstore/java/webclient-jackson3/src/main/java/org/openapitools/client/JavaTimeFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class.
2121
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
2222
*/
23-
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
23+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0-SNAPSHOT")
2424
public class JavaTimeFormatter {
2525
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
2626

0 commit comments

Comments
 (0)