Skip to content

Commit f745cce

Browse files
[codegen] update to latest spec (#1264)
Co-authored-by: Laura Trotta <laura.trotta@elastic.co>
1 parent e0e3da3 commit f745cce

2 files changed

Lines changed: 30 additions & 19 deletions

File tree

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/doc-files/api-spec.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3509,10 +3509,10 @@
35093509
if (hash.length > 1) {
35103510
hash = hash.substring(1);
35113511
}
3512-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/31789f4216047ef7ba7969e31610fa2bbfe696b1/specification/" + (paths[hash] || "");
3512+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/b5550652a718400bf19023a2a2a3166fec5c1802/specification/" + (paths[hash] || "");
35133513
</script>
35143514
</head>
35153515
<body>
3516-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/31789f4216047ef7ba7969e31610fa2bbfe696b1/specification/">Elasticsearch API specification</a>.
3516+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/b5550652a718400bf19023a2a2a3166fec5c1802/specification/">Elasticsearch API specification</a>.
35173517
</body>
35183518
</html>

0 commit comments

Comments
 (0)