Skip to content

Commit 122e121

Browse files
authored
partial fixes from api-spec pr 2485 (#777)
1 parent 5d3be4c commit 122e121

11 files changed

+227
-99
lines changed

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

+23-13
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import co.elastic.clients.json.NamedDeserializer;
2929
import co.elastic.clients.json.ObjectBuilderDeserializer;
3030
import co.elastic.clients.json.ObjectDeserializer;
31-
import co.elastic.clients.util.ApiTypeHelper;
3231
import co.elastic.clients.util.ObjectBuilder;
3332
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3433
import jakarta.json.stream.JsonGenerator;
@@ -62,8 +61,10 @@
6261
*/
6362
@JsonpDeserializable
6463
public class ExtendedBounds<T> implements JsonpSerializable {
64+
@Nullable
6565
private final T max;
6666

67+
@Nullable
6768
private final T min;
6869

6970
@Nullable
@@ -73,8 +74,8 @@ public class ExtendedBounds<T> implements JsonpSerializable {
7374

7475
private ExtendedBounds(Builder<T> builder) {
7576

76-
this.max = ApiTypeHelper.requireNonNull(builder.max, this, "max");
77-
this.min = ApiTypeHelper.requireNonNull(builder.min, this, "min");
77+
this.max = builder.max;
78+
this.min = builder.min;
7879
this.tSerializer = builder.tSerializer;
7980

8081
}
@@ -84,19 +85,21 @@ public static <T> ExtendedBounds<T> of(Function<Builder<T>, ObjectBuilder<Extend
8485
}
8586

8687
/**
87-
* Required - Maximum value for the bound.
88+
* Maximum value for the bound.
8889
* <p>
8990
* API name: {@code max}
9091
*/
92+
@Nullable
9193
public final T max() {
9294
return this.max;
9395
}
9496

9597
/**
96-
* Required - Minimum value for the bound.
98+
* Minimum value for the bound.
9799
* <p>
98100
* API name: {@code min}
99101
*/
102+
@Nullable
100103
public final T min() {
101104
return this.min;
102105
}
@@ -112,11 +115,16 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
112115

113116
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
114117

115-
generator.writeKey("max");
116-
JsonpUtils.serialize(this.max, generator, tSerializer, mapper);
118+
if (this.max != null) {
119+
generator.writeKey("max");
120+
JsonpUtils.serialize(this.max, generator, tSerializer, mapper);
117121

118-
generator.writeKey("min");
119-
JsonpUtils.serialize(this.min, generator, tSerializer, mapper);
122+
}
123+
if (this.min != null) {
124+
generator.writeKey("min");
125+
JsonpUtils.serialize(this.min, generator, tSerializer, mapper);
126+
127+
}
120128

121129
}
122130

@@ -134,29 +142,31 @@ public String toString() {
134142
public static class Builder<T> extends WithJsonObjectBuilderBase<Builder<T>>
135143
implements
136144
ObjectBuilder<ExtendedBounds<T>> {
145+
@Nullable
137146
private T max;
138147

148+
@Nullable
139149
private T min;
140150

141151
@Nullable
142152
private JsonpSerializer<T> tSerializer;
143153

144154
/**
145-
* Required - Maximum value for the bound.
155+
* Maximum value for the bound.
146156
* <p>
147157
* API name: {@code max}
148158
*/
149-
public final Builder<T> max(T value) {
159+
public final Builder<T> max(@Nullable T value) {
150160
this.max = value;
151161
return this;
152162
}
153163

154164
/**
155-
* Required - Minimum value for the bound.
165+
* Minimum value for the bound.
156166
* <p>
157167
* API name: {@code min}
158168
*/
159-
public final Builder<T> min(T value) {
169+
public final Builder<T> min(@Nullable T value) {
160170
this.min = value;
161171
return this;
162172
}

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

+37
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package co.elastic.clients.elasticsearch._types.aggregations;
2121

22+
import co.elastic.clients.elasticsearch._types.Script;
2223
import co.elastic.clients.json.JsonpDeserializable;
2324
import co.elastic.clients.json.JsonpDeserializer;
2425
import co.elastic.clients.json.JsonpMapper;
@@ -72,6 +73,9 @@ public class VariableWidthHistogramAggregation implements AggregationVariant, Js
7273
@Nullable
7374
private final Integer initialBuffer;
7475

76+
@Nullable
77+
private final Script script;
78+
7579
// ---------------------------------------------------------------------------------------------
7680

7781
private VariableWidthHistogramAggregation(Builder builder) {
@@ -80,6 +84,7 @@ private VariableWidthHistogramAggregation(Builder builder) {
8084
this.buckets = builder.buckets;
8185
this.shardSize = builder.shardSize;
8286
this.initialBuffer = builder.initialBuffer;
87+
this.script = builder.script;
8388

8489
}
8590

@@ -139,6 +144,14 @@ public final Integer initialBuffer() {
139144
return this.initialBuffer;
140145
}
141146

147+
/**
148+
* API name: {@code script}
149+
*/
150+
@Nullable
151+
public final Script script() {
152+
return this.script;
153+
}
154+
142155
/**
143156
* Serialize this object to JSON.
144157
*/
@@ -170,6 +183,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
170183
generator.write(this.initialBuffer);
171184

172185
}
186+
if (this.script != null) {
187+
generator.writeKey("script");
188+
this.script.serialize(generator, mapper);
189+
190+
}
173191

174192
}
175193

@@ -199,6 +217,9 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
199217
@Nullable
200218
private Integer initialBuffer;
201219

220+
@Nullable
221+
private Script script;
222+
202223
/**
203224
* The name of the field.
204225
* <p>
@@ -242,6 +263,21 @@ public final Builder initialBuffer(@Nullable Integer value) {
242263
return this;
243264
}
244265

266+
/**
267+
* API name: {@code script}
268+
*/
269+
public final Builder script(@Nullable Script value) {
270+
this.script = value;
271+
return this;
272+
}
273+
274+
/**
275+
* API name: {@code script}
276+
*/
277+
public final Builder script(Function<Script.Builder, ObjectBuilder<Script>> fn) {
278+
return this.script(fn.apply(new Script.Builder()).build());
279+
}
280+
245281
@Override
246282
protected Builder self() {
247283
return this;
@@ -275,6 +311,7 @@ protected static void setupVariableWidthHistogramAggregationDeserializer(
275311
op.add(Builder::buckets, JsonpDeserializer.integerDeserializer(), "buckets");
276312
op.add(Builder::shardSize, JsonpDeserializer.integerDeserializer(), "shard_size");
277313
op.add(Builder::initialBuffer, JsonpDeserializer.integerDeserializer(), "initial_buffer");
314+
op.add(Builder::script, Script._DESERIALIZER, "script");
278315

279316
}
280317

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

+50
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@
2424
import co.elastic.clients.json.JsonpMapper;
2525
import co.elastic.clients.json.ObjectBuilderDeserializer;
2626
import co.elastic.clients.json.ObjectDeserializer;
27+
import co.elastic.clients.util.ApiTypeHelper;
2728
import co.elastic.clients.util.ObjectBuilder;
2829
import jakarta.json.stream.JsonGenerator;
30+
import java.lang.String;
31+
import java.util.List;
2932
import java.util.Objects;
3033
import java.util.function.Function;
34+
import javax.annotation.Nullable;
3135

3236
//----------------------------------------------------------------
3337
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
@@ -54,11 +58,15 @@
5458
*/
5559
@JsonpDeserializable
5660
public class HtmlStripCharFilter extends CharFilterBase implements CharFilterDefinitionVariant {
61+
private final List<String> escapedTags;
62+
5763
// ---------------------------------------------------------------------------------------------
5864

5965
private HtmlStripCharFilter(Builder builder) {
6066
super(builder);
6167

68+
this.escapedTags = ApiTypeHelper.unmodifiable(builder.escapedTags);
69+
6270
}
6371

6472
public static HtmlStripCharFilter of(Function<Builder, ObjectBuilder<HtmlStripCharFilter>> fn) {
@@ -73,10 +81,27 @@ public CharFilterDefinition.Kind _charFilterDefinitionKind() {
7381
return CharFilterDefinition.Kind.HtmlStrip;
7482
}
7583

84+
/**
85+
* API name: {@code escaped_tags}
86+
*/
87+
public final List<String> escapedTags() {
88+
return this.escapedTags;
89+
}
90+
7691
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
7792

7893
generator.write("type", "html_strip");
7994
super.serializeInternal(generator, mapper);
95+
if (ApiTypeHelper.isDefined(this.escapedTags)) {
96+
generator.writeKey("escaped_tags");
97+
generator.writeStartArray();
98+
for (String item0 : this.escapedTags) {
99+
generator.write(item0);
100+
101+
}
102+
generator.writeEnd();
103+
104+
}
80105

81106
}
82107

@@ -89,6 +114,29 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
89114
public static class Builder extends CharFilterBase.AbstractBuilder<Builder>
90115
implements
91116
ObjectBuilder<HtmlStripCharFilter> {
117+
@Nullable
118+
private List<String> escapedTags;
119+
120+
/**
121+
* API name: {@code escaped_tags}
122+
* <p>
123+
* Adds all elements of <code>list</code> to <code>escapedTags</code>.
124+
*/
125+
public final Builder escapedTags(List<String> list) {
126+
this.escapedTags = _listAddAll(this.escapedTags, list);
127+
return this;
128+
}
129+
130+
/**
131+
* API name: {@code escaped_tags}
132+
* <p>
133+
* Adds one or more values to <code>escapedTags</code>.
134+
*/
135+
public final Builder escapedTags(String value, String... values) {
136+
this.escapedTags = _listAdd(this.escapedTags, value, values);
137+
return this;
138+
}
139+
92140
@Override
93141
protected Builder self() {
94142
return this;
@@ -117,6 +165,8 @@ public HtmlStripCharFilter build() {
117165

118166
protected static void setupHtmlStripCharFilterDeserializer(ObjectDeserializer<HtmlStripCharFilter.Builder> op) {
119167
CharFilterBase.setupCharFilterBaseDeserializer(op);
168+
op.add(Builder::escapedTags, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()),
169+
"escaped_tags");
120170

121171
op.ignore("type");
122172
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public final String locale() {
347347

348348
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
349349

350-
generator.write("type", "{dynamic_property}");
350+
generator.write("type", "{dynamic_type}");
351351
super.serializeInternal(generator, mapper);
352352
if (this.enabled != null) {
353353
generator.writeKey("enabled");

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

+5-6
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public enum Kind implements JsonEnum {
9696

9797
DoubleRange("double_range"),
9898

99-
DynamicType("{dynamic_property}"),
99+
DynamicType("{dynamic_type}"),
100100

101101
Alias("alias"),
102102

@@ -433,18 +433,17 @@ public DoubleRangeProperty doubleRange() {
433433
}
434434

435435
/**
436-
* Is this variant instance of kind {@code {dynamic_property}}?
436+
* Is this variant instance of kind {@code {dynamic_type}}?
437437
*/
438438
public boolean isDynamicType() {
439439
return _kind == Kind.DynamicType;
440440
}
441441

442442
/**
443-
* Get the {@code {dynamic_property}} variant value.
443+
* Get the {@code {dynamic_type}} variant value.
444444
*
445445
* @throws IllegalStateException
446-
* if the current variant is not of the {@code {dynamic_property}}
447-
* kind.
446+
* if the current variant is not of the {@code {dynamic_type}} kind.
448447
*/
449448
public DynamicProperty dynamicType() {
450449
return TaggedUnionUtils.get(this, Kind.DynamicType);
@@ -1621,7 +1620,7 @@ protected static void setupPropertyDeserializer(ObjectDeserializer<Builder> op)
16211620
op.add(Builder::denseVector, DenseVectorProperty._DESERIALIZER, "dense_vector");
16221621
op.add(Builder::double_, DoubleNumberProperty._DESERIALIZER, "double");
16231622
op.add(Builder::doubleRange, DoubleRangeProperty._DESERIALIZER, "double_range");
1624-
op.add(Builder::dynamicType, DynamicProperty._DESERIALIZER, "{dynamic_property}");
1623+
op.add(Builder::dynamicType, DynamicProperty._DESERIALIZER, "{dynamic_type}");
16251624
op.add(Builder::alias, FieldAliasProperty._DESERIALIZER, "alias");
16261625
op.add(Builder::flattened, FlattenedProperty._DESERIALIZER, "flattened");
16271626
op.add(Builder::float_, FloatNumberProperty._DESERIALIZER, "float");

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,15 @@ public static Property doubleRange(Function<DoubleRangeProperty.Builder, ObjectB
261261
}
262262

263263
/**
264-
* Creates a builder for the {@link DynamicProperty {dynamic_property}}
264+
* Creates a builder for the {@link DynamicProperty {dynamic_type}}
265265
* {@code Property} variant.
266266
*/
267267
public static DynamicProperty.Builder dynamicType() {
268268
return new DynamicProperty.Builder();
269269
}
270270

271271
/**
272-
* Creates a Property of the {@link DynamicProperty {dynamic_property}}
272+
* Creates a Property of the {@link DynamicProperty {dynamic_type}}
273273
* {@code Property} variant.
274274
*/
275275
public static Property dynamicType(Function<DynamicProperty.Builder, ObjectBuilder<DynamicProperty>> fn) {

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

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
public enum RuntimeFieldType implements JsonEnum {
4949
Boolean("boolean"),
5050

51+
Composite("composite"),
52+
5153
Date("date"),
5254

5355
Double("double"),

0 commit comments

Comments
 (0)