Skip to content

Commit 79b9fe8

Browse files
committed
Update to latest API spec, update ES test server to use SSL (#384)
1 parent a675781 commit 79b9fe8

28 files changed

+950
-472
lines changed

java-client/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ dependencies {
225225

226226
// MIT
227227
// https://www.testcontainers.org/
228-
testImplementation("org.testcontainers", "testcontainers", "1.17.2")
229-
testImplementation("org.testcontainers", "elasticsearch", "1.17.2")
228+
testImplementation("org.testcontainers", "testcontainers", "1.17.3")
229+
testImplementation("org.testcontainers", "elasticsearch", "1.17.3")
230230
}
231231

232232

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ErrorCause.java

+11-6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class ErrorCause implements JsonpSerializable {
6060
@Nullable
6161
private final String type;
6262

63+
@Nullable
6364
private final String reason;
6465

6566
@Nullable
@@ -79,7 +80,7 @@ private ErrorCause(Builder builder) {
7980
this.metadata = ApiTypeHelper.unmodifiable(builder.metadata);
8081

8182
this.type = builder.type;
82-
this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason");
83+
this.reason = builder.reason;
8384
this.stackTrace = builder.stackTrace;
8485
this.causedBy = builder.causedBy;
8586
this.rootCause = ApiTypeHelper.unmodifiable(builder.rootCause);
@@ -109,10 +110,11 @@ public final String type() {
109110
}
110111

111112
/**
112-
* Required - A human-readable explanation of the error, in english
113+
* A human-readable explanation of the error, in english
113114
* <p>
114115
* API name: {@code reason}
115116
*/
117+
@Nullable
116118
public final String reason() {
117119
return this.reason;
118120
}
@@ -172,9 +174,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
172174
generator.write(this.type);
173175

174176
}
175-
generator.writeKey("reason");
176-
generator.write(this.reason);
177+
if (this.reason != null) {
178+
generator.writeKey("reason");
179+
generator.write(this.reason);
177180

181+
}
178182
if (this.stackTrace != null) {
179183
generator.writeKey("stack_trace");
180184
generator.write(this.stackTrace);
@@ -246,6 +250,7 @@ public final Builder metadata(String key, JsonData value) {
246250
@Nullable
247251
private String type;
248252

253+
@Nullable
249254
private String reason;
250255

251256
@Nullable
@@ -271,11 +276,11 @@ public final Builder type(@Nullable String value) {
271276
}
272277

273278
/**
274-
* Required - A human-readable explanation of the error, in english
279+
* A human-readable explanation of the error, in english
275280
* <p>
276281
* API name: {@code reason}
277282
*/
278-
public final Builder reason(String value) {
283+
public final Builder reason(@Nullable String value) {
279284
this.reason = value;
280285
return this;
281286
}

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/GeoBoundsAggregate.java

+13-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import co.elastic.clients.json.JsonpMapper;
3030
import co.elastic.clients.json.ObjectBuilderDeserializer;
3131
import co.elastic.clients.json.ObjectDeserializer;
32-
import co.elastic.clients.util.ApiTypeHelper;
3332
import co.elastic.clients.util.ObjectBuilder;
3433
import jakarta.json.stream.JsonGenerator;
3534
import java.util.Objects;
@@ -46,14 +45,15 @@
4645
*/
4746
@JsonpDeserializable
4847
public class GeoBoundsAggregate extends AggregateBase implements AggregateVariant {
48+
@Nullable
4949
private final GeoBounds bounds;
5050

5151
// ---------------------------------------------------------------------------------------------
5252

5353
private GeoBoundsAggregate(Builder builder) {
5454
super(builder);
5555

56-
this.bounds = ApiTypeHelper.requireNonNull(builder.bounds, this, "bounds");
56+
this.bounds = builder.bounds;
5757

5858
}
5959

@@ -70,17 +70,21 @@ public Aggregate.Kind _aggregateKind() {
7070
}
7171

7272
/**
73-
* Required - API name: {@code bounds}
73+
* API name: {@code bounds}
7474
*/
75+
@Nullable
7576
public final GeoBounds bounds() {
7677
return this.bounds;
7778
}
7879

7980
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
8081

8182
super.serializeInternal(generator, mapper);
82-
generator.writeKey("bounds");
83-
this.bounds.serialize(generator, mapper);
83+
if (this.bounds != null) {
84+
generator.writeKey("bounds");
85+
this.bounds.serialize(generator, mapper);
86+
87+
}
8488

8589
}
8690

@@ -93,18 +97,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
9397
public static class Builder extends AggregateBase.AbstractBuilder<Builder>
9498
implements
9599
ObjectBuilder<GeoBoundsAggregate> {
100+
@Nullable
96101
private GeoBounds bounds;
97102

98103
/**
99-
* Required - API name: {@code bounds}
104+
* API name: {@code bounds}
100105
*/
101-
public final Builder bounds(GeoBounds value) {
106+
public final Builder bounds(@Nullable GeoBounds value) {
102107
this.bounds = value;
103108
return this;
104109
}
105110

106111
/**
107-
* Required - API name: {@code bounds}
112+
* API name: {@code bounds}
108113
*/
109114
public final Builder bounds(Function<GeoBounds.Builder, ObjectBuilder<GeoBounds>> fn) {
110115
return this.bounds(fn.apply(new GeoBounds.Builder()).build());

0 commit comments

Comments
 (0)