Skip to content

Commit b761671

Browse files
committed
Partial fixes from spec 2597
1 parent 44a3ecb commit b761671

File tree

5 files changed

+49
-29
lines changed

5 files changed

+49
-29
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/core/mtermvectors/MultiTermVectorsOperation.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
*/
6767
@JsonpDeserializable
6868
public class MultiTermVectorsOperation implements JsonpSerializable {
69+
@Nullable
6970
private final String id;
7071

7172
@Nullable
@@ -107,7 +108,7 @@ public class MultiTermVectorsOperation implements JsonpSerializable {
107108

108109
private MultiTermVectorsOperation(Builder builder) {
109110

110-
this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id");
111+
this.id = builder.id;
111112
this.index = builder.index;
112113
this.doc = builder.doc;
113114
this.fields = ApiTypeHelper.unmodifiable(builder.fields);
@@ -128,10 +129,11 @@ public static MultiTermVectorsOperation of(Function<Builder, ObjectBuilder<Multi
128129
}
129130

130131
/**
131-
* Required - The ID of the document.
132+
* The ID of the document.
132133
* <p>
133134
* API name: {@code _id}
134135
*/
136+
@Nullable
135137
public final String id() {
136138
return this.id;
137139
}
@@ -271,9 +273,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
271273

272274
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
273275

274-
generator.writeKey("_id");
275-
generator.write(this.id);
276+
if (this.id != null) {
277+
generator.writeKey("_id");
278+
generator.write(this.id);
276279

280+
}
277281
if (this.index != null) {
278282
generator.writeKey("_index");
279283
generator.write(this.index);
@@ -355,6 +359,7 @@ public String toString() {
355359
public static class Builder extends WithJsonObjectBuilderBase<Builder>
356360
implements
357361
ObjectBuilder<MultiTermVectorsOperation> {
362+
@Nullable
358363
private String id;
359364

360365
@Nullable
@@ -394,11 +399,11 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
394399
private VersionType versionType;
395400

396401
/**
397-
* Required - The ID of the document.
402+
* The ID of the document.
398403
* <p>
399404
* API name: {@code _id}
400405
*/
401-
public final Builder id(String value) {
406+
public final Builder id(@Nullable String value) {
402407
this.id = value;
403408
return this;
404409
}

java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2712,10 +2712,10 @@
27122712
if (hash.length > 1) {
27132713
hash = hash.substring(1);
27142714
}
2715-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/9d726e6ef275db3645a638fe318c3ab2a569e2fe/specification/" + (paths[hash] || "");
2715+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/a9d5ab8fe29deeedf3c8b7b95c90ebac95249bd9/specification/" + (paths[hash] || "");
27162716
</script>
27172717
</head>
27182718
<body>
2719-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/9d726e6ef275db3645a638fe318c3ab2a569e2fe/specification/">Elasticsearch API specification</a>.
2719+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/a9d5ab8fe29deeedf3c8b7b95c90ebac95249bd9/specification/">Elasticsearch API specification</a>.
27202720
</body>
27212721
</html>

java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoScript.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@
6161
public class NodeInfoScript implements JsonpSerializable {
6262
private final String allowedTypes;
6363

64+
@Nullable
6465
private final String disableMaxCompilationsRate;
6566

6667
// ---------------------------------------------------------------------------------------------
6768

6869
private NodeInfoScript(Builder builder) {
6970

7071
this.allowedTypes = ApiTypeHelper.requireNonNull(builder.allowedTypes, this, "allowedTypes");
71-
this.disableMaxCompilationsRate = ApiTypeHelper.requireNonNull(builder.disableMaxCompilationsRate, this,
72-
"disableMaxCompilationsRate");
72+
this.disableMaxCompilationsRate = builder.disableMaxCompilationsRate;
7373

7474
}
7575

@@ -85,8 +85,9 @@ public final String allowedTypes() {
8585
}
8686

8787
/**
88-
* Required - API name: {@code disable_max_compilations_rate}
88+
* API name: {@code disable_max_compilations_rate}
8989
*/
90+
@Nullable
9091
public final String disableMaxCompilationsRate() {
9192
return this.disableMaxCompilationsRate;
9293
}
@@ -105,8 +106,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
105106
generator.writeKey("allowed_types");
106107
generator.write(this.allowedTypes);
107108

108-
generator.writeKey("disable_max_compilations_rate");
109-
generator.write(this.disableMaxCompilationsRate);
109+
if (this.disableMaxCompilationsRate != null) {
110+
generator.writeKey("disable_max_compilations_rate");
111+
generator.write(this.disableMaxCompilationsRate);
112+
113+
}
110114

111115
}
112116

@@ -124,6 +128,7 @@ public String toString() {
124128
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<NodeInfoScript> {
125129
private String allowedTypes;
126130

131+
@Nullable
127132
private String disableMaxCompilationsRate;
128133

129134
/**
@@ -135,9 +140,9 @@ public final Builder allowedTypes(String value) {
135140
}
136141

137142
/**
138-
* Required - API name: {@code disable_max_compilations_rate}
143+
* API name: {@code disable_max_compilations_rate}
139144
*/
140-
public final Builder disableMaxCompilationsRate(String value) {
145+
public final Builder disableMaxCompilationsRate(@Nullable String value) {
141146
this.disableMaxCompilationsRate = value;
142147
return this;
143148
}

java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettings.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public class NodeInfoSettings implements JsonpSerializable {
7474
@Nullable
7575
private final NodeInfoAction action;
7676

77+
@Nullable
7778
private final NodeInfoClient client;
7879

7980
private final NodeInfoSettingsHttp http;
@@ -108,7 +109,7 @@ private NodeInfoSettings(Builder builder) {
108109
this.repositories = builder.repositories;
109110
this.discovery = builder.discovery;
110111
this.action = builder.action;
111-
this.client = ApiTypeHelper.requireNonNull(builder.client, this, "client");
112+
this.client = builder.client;
112113
this.http = ApiTypeHelper.requireNonNull(builder.http, this, "http");
113114
this.bootstrap = builder.bootstrap;
114115
this.transport = ApiTypeHelper.requireNonNull(builder.transport, this, "transport");
@@ -171,8 +172,9 @@ public final NodeInfoAction action() {
171172
}
172173

173174
/**
174-
* Required - API name: {@code client}
175+
* API name: {@code client}
175176
*/
177+
@Nullable
176178
public final NodeInfoClient client() {
177179
return this.client;
178180
}
@@ -276,9 +278,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
276278
this.action.serialize(generator, mapper);
277279

278280
}
279-
generator.writeKey("client");
280-
this.client.serialize(generator, mapper);
281+
if (this.client != null) {
282+
generator.writeKey("client");
283+
this.client.serialize(generator, mapper);
281284

285+
}
282286
generator.writeKey("http");
283287
this.http.serialize(generator, mapper);
284288

@@ -346,6 +350,7 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
346350
@Nullable
347351
private NodeInfoAction action;
348352

353+
@Nullable
349354
private NodeInfoClient client;
350355

351356
private NodeInfoSettingsHttp http;
@@ -463,15 +468,15 @@ public final Builder action(Function<NodeInfoAction.Builder, ObjectBuilder<NodeI
463468
}
464469

465470
/**
466-
* Required - API name: {@code client}
471+
* API name: {@code client}
467472
*/
468-
public final Builder client(NodeInfoClient value) {
473+
public final Builder client(@Nullable NodeInfoClient value) {
469474
this.client = value;
470475
return this;
471476
}
472477

473478
/**
474-
* Required - API name: {@code client}
479+
* API name: {@code client}
475480
*/
476481
public final Builder client(Function<NodeInfoClient.Builder, ObjectBuilder<NodeInfoClient>> fn) {
477482
return this.client(fn.apply(new NodeInfoClient.Builder()).build());

java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/info/NodeInfoSettingsNetwork.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import co.elastic.clients.json.JsonpUtils;
2727
import co.elastic.clients.json.ObjectBuilderDeserializer;
2828
import co.elastic.clients.json.ObjectDeserializer;
29-
import co.elastic.clients.util.ApiTypeHelper;
3029
import co.elastic.clients.util.ObjectBuilder;
3130
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3231
import jakarta.json.stream.JsonGenerator;
@@ -60,13 +59,14 @@
6059
*/
6160
@JsonpDeserializable
6261
public class NodeInfoSettingsNetwork implements JsonpSerializable {
62+
@Nullable
6363
private final String host;
6464

6565
// ---------------------------------------------------------------------------------------------
6666

6767
private NodeInfoSettingsNetwork(Builder builder) {
6868

69-
this.host = ApiTypeHelper.requireNonNull(builder.host, this, "host");
69+
this.host = builder.host;
7070

7171
}
7272

@@ -75,8 +75,9 @@ public static NodeInfoSettingsNetwork of(Function<Builder, ObjectBuilder<NodeInf
7575
}
7676

7777
/**
78-
* Required - API name: {@code host}
78+
* API name: {@code host}
7979
*/
80+
@Nullable
8081
public final String host() {
8182
return this.host;
8283
}
@@ -92,8 +93,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
9293

9394
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
9495

95-
generator.writeKey("host");
96-
generator.write(this.host);
96+
if (this.host != null) {
97+
generator.writeKey("host");
98+
generator.write(this.host);
99+
100+
}
97101

98102
}
99103

@@ -111,12 +115,13 @@ public String toString() {
111115
public static class Builder extends WithJsonObjectBuilderBase<Builder>
112116
implements
113117
ObjectBuilder<NodeInfoSettingsNetwork> {
118+
@Nullable
114119
private String host;
115120

116121
/**
117-
* Required - API name: {@code host}
122+
* API name: {@code host}
118123
*/
119-
public final Builder host(String value) {
124+
public final Builder host(@Nullable String value) {
120125
this.host = value;
121126
return this;
122127
}

0 commit comments

Comments
 (0)