Skip to content

Commit 22e948f

Browse files
committed
chore: generate bin/generate-samples.sh bin/configs/java-*
1 parent 7248b49 commit 22e948f

24 files changed

Lines changed: 301 additions & 221 deletions

File tree

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,19 @@ ext {
117117
beanvalidation_version = "2.0.2"
118118
reactor_version = "3.4.34"
119119
reactor_netty_version = "1.2.8"
120-
jackson_version = "2.19.2"
121-
jackson_databind_version = "2.19.2"
120+
jackson_version = "2.21.1"
121+
jackson_annotations_version = "2.21"
122122
jackson_databind_nullable_version = "0.2.9"
123123
junit_version = "5.10.2"
124124
}
125125

126126
dependencies {
127-
implementation "com.google.code.findbugs:jsr305:3.0.2"
128127
implementation "io.projectreactor:reactor-core:$reactor_version"
129128
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
130129
implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version"
131130
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
132-
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
133-
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
134-
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
131+
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
132+
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
135133
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
136134
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
137135
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"

samples/client/others/java/webclient-sealedInterface/pom.xml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,20 @@
8787
</dependency>
8888

8989
<!-- JSON processing: jackson -->
90+
<dependency>
91+
<groupId>com.fasterxml.jackson.core</groupId>
92+
<artifactId>jackson-core</artifactId>
93+
<version>${jackson-version}</version>
94+
</dependency>
95+
<dependency>
96+
<groupId>com.fasterxml.jackson.core</groupId>
97+
<artifactId>jackson-annotations</artifactId>
98+
<version>${jackson-annotations-version}</version>
99+
</dependency>
90100
<dependency>
91101
<groupId>com.fasterxml.jackson.core</groupId>
92102
<artifactId>jackson-databind</artifactId>
93-
<version>${jackson-databind-version}</version>
103+
<version>${jackson-version}</version>
94104
</dependency>
95105
<dependency>
96106
<groupId>org.openapitools</groupId>
@@ -120,13 +130,13 @@
120130
</dependencies>
121131
<properties>
122132
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
123-
<jackson-version>2.19.2</jackson-version>
124-
<jackson-databind-version>2.19.2</jackson-databind-version>
133+
<jackson-version>2.21.1</jackson-version>
125134
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
126135
<spring-boot-version>2.7.17</spring-boot-version>
127136
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
128137
<reactor-version>3.4.34</reactor-version>
129138
<reactor-netty-version>1.2.8</reactor-netty-version>
130-
<junit-version>5.10.2</junit-version>
139+
<jackson-annotations-version>2.21</jackson-annotations-version>
140+
<junit-version>5.14.3</junit-version>
131141
</properties>
132142
</project>

samples/client/others/java/webclient-sealedInterface/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313

1414
package org.openapitools.client;
1515

16-
import com.fasterxml.jackson.core.JsonProcessingException;
1716
import com.fasterxml.jackson.databind.DeserializationFeature;
17+
18+
import com.fasterxml.jackson.core.JsonProcessingException;
1819
import com.fasterxml.jackson.databind.ObjectMapper;
1920
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
21+
import org.springframework.http.codec.json.Jackson2JsonDecoder;
22+
import org.springframework.http.codec.json.Jackson2JsonEncoder;
2023
import org.openapitools.jackson.nullable.JsonNullableModule;
2124
import org.springframework.core.ParameterizedTypeReference;
2225
import org.springframework.http.HttpHeaders;
@@ -33,8 +36,6 @@
3336
import org.springframework.http.client.ClientHttpRequestInterceptor;
3437
import org.springframework.http.client.ClientHttpResponse;
3538
import org.springframework.http.client.reactive.ClientHttpRequest;
36-
import org.springframework.http.codec.json.Jackson2JsonDecoder;
37-
import org.springframework.http.codec.json.Jackson2JsonEncoder;
3839
import org.springframework.util.CollectionUtils;
3940
import org.springframework.util.LinkedMultiValueMap;
4041
import org.springframework.util.MultiValueMap;
@@ -104,15 +105,15 @@ protected String collectionToString(Collection<?> collection) {
104105

105106
protected final WebClient webClient;
106107
protected final DateFormat dateFormat;
107-
protected final ObjectMapper objectMapper;
108+
protected final ObjectMapper mapper;
108109

109110
protected Map<String, Authentication> authentications;
110111

111112

112113
public ApiClient() {
113114
this.dateFormat = createDefaultDateFormat();
114-
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
115-
this.webClient = buildWebClient(this.objectMapper);
115+
this.mapper = createDefaultMapper(this.dateFormat);
116+
this.webClient = buildWebClient(this.mapper);
116117
this.init();
117118
}
118119

@@ -121,17 +122,17 @@ public ApiClient(WebClient webClient) {
121122
}
122123

123124
public ApiClient(ObjectMapper mapper, DateFormat format) {
124-
this(buildWebClient(mapper.copy()), format);
125+
this(buildWebClient(mapper), format);
125126
}
126127

127128
public ApiClient(WebClient webClient, ObjectMapper mapper, DateFormat format) {
128-
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
129+
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper)), format);
129130
}
130131

131132
protected ApiClient(WebClient webClient, DateFormat format) {
132133
this.webClient = webClient;
133134
this.dateFormat = format;
134-
this.objectMapper = createDefaultObjectMapper(format);
135+
this.mapper = createDefaultMapper(format);
135136
this.init();
136137
}
137138

@@ -141,7 +142,7 @@ public static DateFormat createDefaultDateFormat() {
141142
return dateFormat;
142143
}
143144

144-
public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFormat) {
145+
public static ObjectMapper createDefaultMapper(@Nullable DateFormat dateFormat) {
145146
if (null == dateFormat) {
146147
dateFormat = createDefaultDateFormat();
147148
}
@@ -154,6 +155,7 @@ public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFo
154155
return mapper;
155156
}
156157

158+
157159
protected void init() {
158160
// Setup authentications (key: authentication name, value: authentication).
159161
authentications = new HashMap<String, Authentication>();
@@ -182,7 +184,7 @@ public static WebClient.Builder buildWebClientBuilder(ObjectMapper mapper) {
182184
* @return WebClient
183185
*/
184186
public static WebClient.Builder buildWebClientBuilder() {
185-
return buildWebClientBuilder(createDefaultObjectMapper(null));
187+
return buildWebClientBuilder(createDefaultMapper(null));
186188
}
187189

188190
/**
@@ -199,7 +201,7 @@ public static WebClient buildWebClient(ObjectMapper mapper) {
199201
* @return WebClient
200202
*/
201203
public static WebClient buildWebClient() {
202-
return buildWebClientBuilder(createDefaultObjectMapper(null)).build();
204+
return buildWebClientBuilder(createDefaultMapper(null)).build();
203205
}
204206

205207
/**
@@ -373,10 +375,10 @@ public String formatDate(Date date) {
373375

374376
/**
375377
* Get the ObjectMapper used to make HTTP requests.
376-
* @return ObjectMapper objectMapper
378+
* @return ObjectMapper mapper
377379
*/
378380
public ObjectMapper getObjectMapper() {
379-
return objectMapper;
381+
return mapper;
380382
}
381383

382384
/**
@@ -426,16 +428,16 @@ public MultiValueMap<String, String> parameterToMultiValueMapJson(CollectionForm
426428
valueCollection = (Collection<?>) value;
427429
} else {
428430
try {
429-
return parameterToMultiValueMap(collectionFormat, name, objectMapper.writeValueAsString(value));
430-
} catch (JsonProcessingException e) {
431+
return parameterToMultiValueMap(collectionFormat, name, mapper.writeValueAsString(value));
432+
} catch (JsonProcessingException e) {
431433
throw new RuntimeException(e);
432434
}
433435
}
434436

435437
List<String> values = new ArrayList<>();
436438
for(Object o : valueCollection) {
437439
try {
438-
values.add(objectMapper.writeValueAsString(o));
440+
values.add(mapper.writeValueAsString(o));
439441
} catch (JsonProcessingException e) {
440442
throw new RuntimeException(e);
441443
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,19 @@ ext {
117117
beanvalidation_version = "2.0.2"
118118
reactor_version = "3.4.34"
119119
reactor_netty_version = "1.2.8"
120-
jackson_version = "2.19.2"
121-
jackson_databind_version = "2.19.2"
120+
jackson_version = "2.21.1"
121+
jackson_annotations_version = "2.21"
122122
jackson_databind_nullable_version = "0.2.9"
123123
junit_version = "5.10.2"
124124
}
125125

126126
dependencies {
127-
implementation "com.google.code.findbugs:jsr305:3.0.2"
128127
implementation "io.projectreactor:reactor-core:$reactor_version"
129128
implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version"
130129
implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version"
131130
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
132-
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
133-
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
134-
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
131+
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_annotations_version"
132+
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
135133
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
136134
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
137135
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"

samples/client/others/java/webclient-sealedInterface_3_1/pom.xml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,20 @@
8787
</dependency>
8888

8989
<!-- JSON processing: jackson -->
90+
<dependency>
91+
<groupId>com.fasterxml.jackson.core</groupId>
92+
<artifactId>jackson-core</artifactId>
93+
<version>${jackson-version}</version>
94+
</dependency>
95+
<dependency>
96+
<groupId>com.fasterxml.jackson.core</groupId>
97+
<artifactId>jackson-annotations</artifactId>
98+
<version>${jackson-annotations-version}</version>
99+
</dependency>
90100
<dependency>
91101
<groupId>com.fasterxml.jackson.core</groupId>
92102
<artifactId>jackson-databind</artifactId>
93-
<version>${jackson-databind-version}</version>
103+
<version>${jackson-version}</version>
94104
</dependency>
95105
<dependency>
96106
<groupId>org.openapitools</groupId>
@@ -120,13 +130,13 @@
120130
</dependencies>
121131
<properties>
122132
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
123-
<jackson-version>2.19.2</jackson-version>
124-
<jackson-databind-version>2.19.2</jackson-databind-version>
133+
<jackson-version>2.21.1</jackson-version>
125134
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>
126135
<spring-boot-version>2.7.17</spring-boot-version>
127136
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
128137
<reactor-version>3.4.34</reactor-version>
129138
<reactor-netty-version>1.2.8</reactor-netty-version>
130-
<junit-version>5.10.2</junit-version>
139+
<jackson-annotations-version>2.21</jackson-annotations-version>
140+
<junit-version>5.14.3</junit-version>
131141
</properties>
132142
</project>

samples/client/others/java/webclient-sealedInterface_3_1/src/main/java/org/openapitools/client/ApiClient.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@
1313

1414
package org.openapitools.client;
1515

16-
import com.fasterxml.jackson.core.JsonProcessingException;
1716
import com.fasterxml.jackson.databind.DeserializationFeature;
17+
18+
import com.fasterxml.jackson.core.JsonProcessingException;
1819
import com.fasterxml.jackson.databind.ObjectMapper;
1920
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
21+
import org.springframework.http.codec.json.Jackson2JsonDecoder;
22+
import org.springframework.http.codec.json.Jackson2JsonEncoder;
2023
import org.openapitools.jackson.nullable.JsonNullableModule;
2124
import org.springframework.core.ParameterizedTypeReference;
2225
import org.springframework.http.HttpHeaders;
@@ -33,8 +36,6 @@
3336
import org.springframework.http.client.ClientHttpRequestInterceptor;
3437
import org.springframework.http.client.ClientHttpResponse;
3538
import org.springframework.http.client.reactive.ClientHttpRequest;
36-
import org.springframework.http.codec.json.Jackson2JsonDecoder;
37-
import org.springframework.http.codec.json.Jackson2JsonEncoder;
3839
import org.springframework.util.CollectionUtils;
3940
import org.springframework.util.LinkedMultiValueMap;
4041
import org.springframework.util.MultiValueMap;
@@ -104,15 +105,15 @@ protected String collectionToString(Collection<?> collection) {
104105

105106
protected final WebClient webClient;
106107
protected final DateFormat dateFormat;
107-
protected final ObjectMapper objectMapper;
108+
protected final ObjectMapper mapper;
108109

109110
protected Map<String, Authentication> authentications;
110111

111112

112113
public ApiClient() {
113114
this.dateFormat = createDefaultDateFormat();
114-
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
115-
this.webClient = buildWebClient(this.objectMapper);
115+
this.mapper = createDefaultMapper(this.dateFormat);
116+
this.webClient = buildWebClient(this.mapper);
116117
this.init();
117118
}
118119

@@ -121,17 +122,17 @@ public ApiClient(WebClient webClient) {
121122
}
122123

123124
public ApiClient(ObjectMapper mapper, DateFormat format) {
124-
this(buildWebClient(mapper.copy()), format);
125+
this(buildWebClient(mapper), format);
125126
}
126127

127128
public ApiClient(WebClient webClient, ObjectMapper mapper, DateFormat format) {
128-
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper.copy())), format);
129+
this(Optional.ofNullable(webClient).orElseGet(() -> buildWebClient(mapper)), format);
129130
}
130131

131132
protected ApiClient(WebClient webClient, DateFormat format) {
132133
this.webClient = webClient;
133134
this.dateFormat = format;
134-
this.objectMapper = createDefaultObjectMapper(format);
135+
this.mapper = createDefaultMapper(format);
135136
this.init();
136137
}
137138

@@ -141,7 +142,7 @@ public static DateFormat createDefaultDateFormat() {
141142
return dateFormat;
142143
}
143144

144-
public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFormat) {
145+
public static ObjectMapper createDefaultMapper(@Nullable DateFormat dateFormat) {
145146
if (null == dateFormat) {
146147
dateFormat = createDefaultDateFormat();
147148
}
@@ -154,6 +155,7 @@ public static ObjectMapper createDefaultObjectMapper(@Nullable DateFormat dateFo
154155
return mapper;
155156
}
156157

158+
157159
protected void init() {
158160
// Setup authentications (key: authentication name, value: authentication).
159161
authentications = new HashMap<String, Authentication>();
@@ -182,7 +184,7 @@ public static WebClient.Builder buildWebClientBuilder(ObjectMapper mapper) {
182184
* @return WebClient
183185
*/
184186
public static WebClient.Builder buildWebClientBuilder() {
185-
return buildWebClientBuilder(createDefaultObjectMapper(null));
187+
return buildWebClientBuilder(createDefaultMapper(null));
186188
}
187189

188190
/**
@@ -199,7 +201,7 @@ public static WebClient buildWebClient(ObjectMapper mapper) {
199201
* @return WebClient
200202
*/
201203
public static WebClient buildWebClient() {
202-
return buildWebClientBuilder(createDefaultObjectMapper(null)).build();
204+
return buildWebClientBuilder(createDefaultMapper(null)).build();
203205
}
204206

205207
/**
@@ -373,10 +375,10 @@ public String formatDate(Date date) {
373375

374376
/**
375377
* Get the ObjectMapper used to make HTTP requests.
376-
* @return ObjectMapper objectMapper
378+
* @return ObjectMapper mapper
377379
*/
378380
public ObjectMapper getObjectMapper() {
379-
return objectMapper;
381+
return mapper;
380382
}
381383

382384
/**
@@ -426,16 +428,16 @@ public MultiValueMap<String, String> parameterToMultiValueMapJson(CollectionForm
426428
valueCollection = (Collection<?>) value;
427429
} else {
428430
try {
429-
return parameterToMultiValueMap(collectionFormat, name, objectMapper.writeValueAsString(value));
430-
} catch (JsonProcessingException e) {
431+
return parameterToMultiValueMap(collectionFormat, name, mapper.writeValueAsString(value));
432+
} catch (JsonProcessingException e) {
431433
throw new RuntimeException(e);
432434
}
433435
}
434436

435437
List<String> values = new ArrayList<>();
436438
for(Object o : valueCollection) {
437439
try {
438-
values.add(objectMapper.writeValueAsString(o));
440+
values.add(mapper.writeValueAsString(o));
439441
} catch (JsonProcessingException e) {
440442
throw new RuntimeException(e);
441443
}

0 commit comments

Comments
 (0)