Skip to content

Commit 61f6aa5

Browse files
[8.19] Regenerate client (#1266)
* [codegen] update to latest spec * old switch statement * update rest client version --------- Co-authored-by: Laura Trotta <laura.trotta@elastic.co>
1 parent 1159daf commit 61f6aa5

4 files changed

Lines changed: 50 additions & 36 deletions

File tree

java-client/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ signing {
177177
dependencies {
178178
// Compile and test with the last 7.x version to make sure transition scenarios where
179179
// the Java API client coexists with a 7.x HLRC work fine
180-
val elasticsearchVersion = "8.19.0"
180+
val elasticsearchVersion = "8.19.18"
181181
val jacksonVersion = "2.17.0"
182182
val openTelemetryVersion = "1.29.0"
183183
val jackson3Version = "3.0.0"

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

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
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;
3332
import java.lang.Integer;
3433
import java.util.Objects;
3534
import java.util.function.Function;
35+
import javax.annotation.Nullable;
3636

3737
//----------------------------------------------------------------
3838
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
@@ -59,16 +59,18 @@
5959
*/
6060
@JsonpDeserializable
6161
public class TextIndexPrefixes implements JsonpSerializable {
62-
private final int maxChars;
62+
@Nullable
63+
private final Integer maxChars;
6364

64-
private final int minChars;
65+
@Nullable
66+
private final Integer minChars;
6567

6668
// ---------------------------------------------------------------------------------------------
6769

6870
private TextIndexPrefixes(Builder builder) {
6971

70-
this.maxChars = ApiTypeHelper.requireNonNull(builder.maxChars, this, "maxChars", 0);
71-
this.minChars = ApiTypeHelper.requireNonNull(builder.minChars, this, "minChars", 0);
72+
this.maxChars = builder.maxChars;
73+
this.minChars = builder.minChars;
7274

7375
}
7476

@@ -77,16 +79,18 @@ public static TextIndexPrefixes of(Function<Builder, ObjectBuilder<TextIndexPref
7779
}
7880

7981
/**
80-
* Required - API name: {@code max_chars}
82+
* API name: {@code max_chars}
8183
*/
82-
public final int maxChars() {
84+
@Nullable
85+
public final Integer maxChars() {
8386
return this.maxChars;
8487
}
8588

8689
/**
87-
* Required - API name: {@code min_chars}
90+
* API name: {@code min_chars}
8891
*/
89-
public final int minChars() {
92+
@Nullable
93+
public final Integer minChars() {
9094
return this.minChars;
9195
}
9296

@@ -101,11 +105,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
101105

102106
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
103107

104-
generator.writeKey("max_chars");
105-
generator.write(this.maxChars);
108+
if (this.maxChars != null) {
109+
generator.writeKey("max_chars");
110+
generator.write(this.maxChars);
106111

107-
generator.writeKey("min_chars");
108-
generator.write(this.minChars);
112+
}
113+
if (this.minChars != null) {
114+
generator.writeKey("min_chars");
115+
generator.write(this.minChars);
116+
117+
}
109118

110119
}
111120

@@ -121,8 +130,10 @@ public String toString() {
121130
*/
122131

123132
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<TextIndexPrefixes> {
133+
@Nullable
124134
private Integer maxChars;
125135

136+
@Nullable
126137
private Integer minChars;
127138

128139
public Builder() {
@@ -133,17 +144,17 @@ private Builder(TextIndexPrefixes instance) {
133144

134145
}
135146
/**
136-
* Required - API name: {@code max_chars}
147+
* API name: {@code max_chars}
137148
*/
138-
public final Builder maxChars(int value) {
149+
public final Builder maxChars(@Nullable Integer value) {
139150
this.maxChars = value;
140151
return this;
141152
}
142153

143154
/**
144-
* Required - API name: {@code min_chars}
155+
* API name: {@code min_chars}
145156
*/
146-
public final Builder minChars(int value) {
157+
public final Builder minChars(@Nullable Integer value) {
147158
this.minChars = value;
148159
return this;
149160
}

java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/SourceConfig.java

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,23 @@ public SourceConfig build() {
186186
public static final JsonpDeserializer<SourceConfig> _DESERIALIZER = JsonpDeserializer
187187
.lazy(() -> JsonpDeserializer.of(EnumSet.of(JsonParser.Event.START_OBJECT, JsonParser.Event.START_ARRAY,
188188
JsonParser.Event.VALUE_TRUE, JsonParser.Event.VALUE_FALSE), (parser, mapper, event) -> {
189-
return switch (event) {
190-
case VALUE_TRUE -> SourceConfig.of(b -> b.fetch(true));
191-
case VALUE_FALSE -> SourceConfig.of(b -> b.fetch(false));
192-
case START_ARRAY -> {
193-
List<String> includes = JsonpDeserializer
194-
.arrayDeserializer(JsonpDeserializer.stringDeserializer())
195-
.deserialize(parser, mapper, event);
196-
yield SourceConfig.of(b -> b.filter(f -> f.includes(includes)));
197-
}
198-
case START_OBJECT -> {
199-
SourceFilter filter = SourceFilter._DESERIALIZER.deserialize(parser, mapper, event);
200-
yield SourceConfig.of(b -> b.filter(filter));
201-
}
202-
default -> null;
203-
};
204-
}));
189+
switch (event) {
190+
case VALUE_TRUE :
191+
return SourceConfig.of(b -> b.fetch(true));
192+
case VALUE_FALSE :
193+
return SourceConfig.of(b -> b.fetch(false));
194+
case START_ARRAY : {
195+
List<String> includes = JsonpDeserializer
196+
.arrayDeserializer(JsonpDeserializer.stringDeserializer())
197+
.deserialize(parser, mapper, event);
198+
return SourceConfig.of(b -> b.filter(f -> f.includes(includes)));
199+
}
200+
case START_OBJECT : {
201+
SourceFilter filter = SourceFilter._DESERIALIZER.deserialize(parser, mapper, event);
202+
return SourceConfig.of(b -> b.filter(filter));
203+
}
204+
default :
205+
return null;
206+
}
207+
}));
205208
}

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
@@ -3381,10 +3381,10 @@
33813381
if (hash.length > 1) {
33823382
hash = hash.substring(1);
33833383
}
3384-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/7519af4b0af73ca3853a06b148d0951e21e0ca37/specification/" + (paths[hash] || "");
3384+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/2c64e145d46f8357f9333ce632b7d7a894e05865/specification/" + (paths[hash] || "");
33853385
</script>
33863386
</head>
33873387
<body>
3388-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/7519af4b0af73ca3853a06b148d0951e21e0ca37/specification/">Elasticsearch API specification</a>.
3388+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/2c64e145d46f8357f9333ce632b7d7a894e05865/specification/">Elasticsearch API specification</a>.
33893389
</body>
33903390
</html>

0 commit comments

Comments
 (0)