Skip to content

Commit 5d466ad

Browse files
authored
fixes from spec pr 2959 (#887)
1 parent 949bdd3 commit 5d466ad

File tree

11 files changed

+447
-215
lines changed

11 files changed

+447
-215
lines changed

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

Lines changed: 13 additions & 8 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;
@@ -59,19 +58,21 @@
5958
*/
6059

6160
public abstract class ShardsOperationResponseBase implements JsonpSerializable {
61+
@Nullable
6262
private final ShardStatistics shards;
6363

6464
// ---------------------------------------------------------------------------------------------
6565

6666
protected ShardsOperationResponseBase(AbstractBuilder<?> builder) {
6767

68-
this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards");
68+
this.shards = builder.shards;
6969

7070
}
7171

7272
/**
73-
* Required - API name: {@code _shards}
73+
* API name: {@code _shards}
7474
*/
75+
@Nullable
7576
public final ShardStatistics shards() {
7677
return this.shards;
7778
}
@@ -87,8 +88,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
8788

8889
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
8990

90-
generator.writeKey("_shards");
91-
this.shards.serialize(generator, mapper);
91+
if (this.shards != null) {
92+
generator.writeKey("_shards");
93+
this.shards.serialize(generator, mapper);
94+
95+
}
9296

9397
}
9498

@@ -100,18 +104,19 @@ public String toString() {
100104
public abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>>
101105
extends
102106
WithJsonObjectBuilderBase<BuilderT> {
107+
@Nullable
103108
private ShardStatistics shards;
104109

105110
/**
106-
* Required - API name: {@code _shards}
111+
* API name: {@code _shards}
107112
*/
108-
public final BuilderT shards(ShardStatistics value) {
113+
public final BuilderT shards(@Nullable ShardStatistics value) {
109114
this.shards = value;
110115
return self();
111116
}
112117

113118
/**
114-
* Required - API name: {@code _shards}
119+
* API name: {@code _shards}
115120
*/
116121
public final BuilderT shards(Function<ShardStatistics.Builder, ObjectBuilder<ShardStatistics>> fn) {
117122
return this.shards(fn.apply(new ShardStatistics.Builder()).build());

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

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ public class EdgeNGramTokenizer extends TokenizerBase implements TokenizerDefini
6262
@Nullable
6363
private final String customTokenChars;
6464

65-
private final int maxGram;
65+
@Nullable
66+
private final Integer maxGram;
6667

67-
private final int minGram;
68+
@Nullable
69+
private final Integer minGram;
6870

6971
private final List<TokenChar> tokenChars;
7072

@@ -74,8 +76,8 @@ private EdgeNGramTokenizer(Builder builder) {
7476
super(builder);
7577

7678
this.customTokenChars = builder.customTokenChars;
77-
this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram");
78-
this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram");
79+
this.maxGram = builder.maxGram;
80+
this.minGram = builder.minGram;
7981
this.tokenChars = ApiTypeHelper.unmodifiable(builder.tokenChars);
8082

8183
}
@@ -101,16 +103,18 @@ public final String customTokenChars() {
101103
}
102104

103105
/**
104-
* Required - API name: {@code max_gram}
106+
* API name: {@code max_gram}
105107
*/
106-
public final int maxGram() {
108+
@Nullable
109+
public final Integer maxGram() {
107110
return this.maxGram;
108111
}
109112

110113
/**
111-
* Required - API name: {@code min_gram}
114+
* API name: {@code min_gram}
112115
*/
113-
public final int minGram() {
116+
@Nullable
117+
public final Integer minGram() {
114118
return this.minGram;
115119
}
116120

@@ -130,12 +134,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
130134
generator.write(this.customTokenChars);
131135

132136
}
133-
generator.writeKey("max_gram");
134-
generator.write(this.maxGram);
137+
if (this.maxGram != null) {
138+
generator.writeKey("max_gram");
139+
generator.write(this.maxGram);
135140

136-
generator.writeKey("min_gram");
137-
generator.write(this.minGram);
141+
}
142+
if (this.minGram != null) {
143+
generator.writeKey("min_gram");
144+
generator.write(this.minGram);
138145

146+
}
139147
if (ApiTypeHelper.isDefined(this.tokenChars)) {
140148
generator.writeKey("token_chars");
141149
generator.writeStartArray();
@@ -160,8 +168,10 @@ public static class Builder extends TokenizerBase.AbstractBuilder<Builder>
160168
@Nullable
161169
private String customTokenChars;
162170

171+
@Nullable
163172
private Integer maxGram;
164173

174+
@Nullable
165175
private Integer minGram;
166176

167177
@Nullable
@@ -176,17 +186,17 @@ public final Builder customTokenChars(@Nullable String value) {
176186
}
177187

178188
/**
179-
* Required - API name: {@code max_gram}
189+
* API name: {@code max_gram}
180190
*/
181-
public final Builder maxGram(int value) {
191+
public final Builder maxGram(@Nullable Integer value) {
182192
this.maxGram = value;
183193
return this;
184194
}
185195

186196
/**
187-
* Required - API name: {@code min_gram}
197+
* API name: {@code min_gram}
188198
*/
189-
public final Builder minGram(int value) {
199+
public final Builder minGram(@Nullable Integer value) {
190200
this.minGram = value;
191201
return this;
192202
}

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

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ public class NGramTokenizer extends TokenizerBase implements TokenizerDefinition
6262
@Nullable
6363
private final String customTokenChars;
6464

65-
private final int maxGram;
65+
@Nullable
66+
private final Integer maxGram;
6667

67-
private final int minGram;
68+
@Nullable
69+
private final Integer minGram;
6870

6971
private final List<TokenChar> tokenChars;
7072

@@ -74,8 +76,8 @@ private NGramTokenizer(Builder builder) {
7476
super(builder);
7577

7678
this.customTokenChars = builder.customTokenChars;
77-
this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram");
78-
this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram");
79+
this.maxGram = builder.maxGram;
80+
this.minGram = builder.minGram;
7981
this.tokenChars = ApiTypeHelper.unmodifiable(builder.tokenChars);
8082

8183
}
@@ -101,16 +103,18 @@ public final String customTokenChars() {
101103
}
102104

103105
/**
104-
* Required - API name: {@code max_gram}
106+
* API name: {@code max_gram}
105107
*/
106-
public final int maxGram() {
108+
@Nullable
109+
public final Integer maxGram() {
107110
return this.maxGram;
108111
}
109112

110113
/**
111-
* Required - API name: {@code min_gram}
114+
* API name: {@code min_gram}
112115
*/
113-
public final int minGram() {
116+
@Nullable
117+
public final Integer minGram() {
114118
return this.minGram;
115119
}
116120

@@ -130,12 +134,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
130134
generator.write(this.customTokenChars);
131135

132136
}
133-
generator.writeKey("max_gram");
134-
generator.write(this.maxGram);
137+
if (this.maxGram != null) {
138+
generator.writeKey("max_gram");
139+
generator.write(this.maxGram);
135140

136-
generator.writeKey("min_gram");
137-
generator.write(this.minGram);
141+
}
142+
if (this.minGram != null) {
143+
generator.writeKey("min_gram");
144+
generator.write(this.minGram);
138145

146+
}
139147
if (ApiTypeHelper.isDefined(this.tokenChars)) {
140148
generator.writeKey("token_chars");
141149
generator.writeStartArray();
@@ -160,8 +168,10 @@ public static class Builder extends TokenizerBase.AbstractBuilder<Builder>
160168
@Nullable
161169
private String customTokenChars;
162170

171+
@Nullable
163172
private Integer maxGram;
164173

174+
@Nullable
165175
private Integer minGram;
166176

167177
@Nullable
@@ -176,17 +186,17 @@ public final Builder customTokenChars(@Nullable String value) {
176186
}
177187

178188
/**
179-
* Required - API name: {@code max_gram}
189+
* API name: {@code max_gram}
180190
*/
181-
public final Builder maxGram(int value) {
191+
public final Builder maxGram(@Nullable Integer value) {
182192
this.maxGram = value;
183193
return this;
184194
}
185195

186196
/**
187-
* Required - API name: {@code min_gram}
197+
* API name: {@code min_gram}
188198
*/
189-
public final Builder minGram(int value) {
199+
public final Builder minGram(@Nullable Integer value) {
190200
this.minGram = value;
191201
return this;
192202
}

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

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@
345345
'_types.SegmentsStats': '_types/Stats.ts#L273-L366',
346346
'_types.ShardFailure': '_types/Errors.ts#L52-L58',
347347
'_types.ShardStatistics': '_types/Stats.ts#L54-L66',
348-
'_types.ShardsOperationResponseBase': '_types/Base.ts#L91-L93',
348+
'_types.ShardsOperationResponseBase': '_types/Base.ts#L91-L94',
349349
'_types.SlicedScroll': '_types/SlicedScroll.ts#L23-L27',
350350
'_types.Slices': '_types/common.ts#L365-L370',
351351
'_types.SlicesCalculation': '_types/common.ts#L372-L380',
@@ -1391,7 +1391,7 @@
13911391
'ilm.migrate_to_data_tiers.Response': 'ilm/migrate_to_data_tiers/Response.ts#L22-L32',
13921392
'ilm.move_to_step.Request': 'ilm/move_to_step/MoveToStepRequest.ts#L24-L36',
13931393
'ilm.move_to_step.Response': 'ilm/move_to_step/MoveToStepResponse.ts#L22-L24',
1394-
'ilm.move_to_step.StepKey': 'ilm/move_to_step/types.ts#L20-L24',
1394+
'ilm.move_to_step.StepKey': 'ilm/move_to_step/types.ts#L20-L25',
13951395
'ilm.put_lifecycle.Request': 'ilm/put_lifecycle/PutLifecycleRequest.ts#L25-L55',
13961396
'ilm.put_lifecycle.Response': 'ilm/put_lifecycle/PutLifecycleResponse.ts#L22-L24',
13971397
'ilm.remove_policy.Request': 'ilm/remove_policy/RemovePolicyRequest.ts#L23-L31',
@@ -1412,7 +1412,7 @@
14121412
'indices._types.DataStreamLifecycleRolloverConditions': 'indices/_types/DataStreamLifecycle.ts#L57-L69',
14131413
'indices._types.DataStreamLifecycleWithRollover': 'indices/_types/DataStreamLifecycle.ts#L33-L55',
14141414
'indices._types.DataStreamTimestampField': 'indices/_types/DataStream.ts#L129-L134',
1415-
'indices._types.DataStreamVisibility': 'indices/_types/DataStream.ts#L159-L161',
1415+
'indices._types.DataStreamVisibility': 'indices/_types/DataStream.ts#L159-L162',
14161416
'indices._types.DownsampleConfig': 'indices/_types/Downsample.ts#L22-L27',
14171417
'indices._types.DownsamplingRound': 'indices/_types/DownsamplingRound.ts#L23-L32',
14181418
'indices._types.FailureStore': 'indices/_types/DataStream.ts#L39-L43',
@@ -1730,20 +1730,20 @@
17301730
'ingest._types.PipelineProcessor': 'ingest/_types/Processors.ts#L1043-L1054',
17311731
'ingest._types.ProcessorBase': 'ingest/_types/Processors.ts#L266-L289',
17321732
'ingest._types.ProcessorContainer': 'ingest/_types/Processors.ts#L27-L264',
1733-
'ingest._types.RedactProcessor': 'ingest/_types/Processors.ts#L1056-L1090',
1734-
'ingest._types.RemoveProcessor': 'ingest/_types/Processors.ts#L1092-L1106',
1735-
'ingest._types.RenameProcessor': 'ingest/_types/Processors.ts#L1108-L1124',
1736-
'ingest._types.RerouteProcessor': 'ingest/_types/Processors.ts#L1126-L1154',
1737-
'ingest._types.ScriptProcessor': 'ingest/_types/Processors.ts#L1156-L1176',
1738-
'ingest._types.SetProcessor': 'ingest/_types/Processors.ts#L1178-L1212',
1739-
'ingest._types.SetSecurityUserProcessor': 'ingest/_types/Processors.ts#L1214-L1223',
1740-
'ingest._types.ShapeType': 'ingest/_types/Processors.ts#L1225-L1228',
1741-
'ingest._types.SortProcessor': 'ingest/_types/Processors.ts#L1230-L1246',
1742-
'ingest._types.SplitProcessor': 'ingest/_types/Processors.ts#L1248-L1273',
1743-
'ingest._types.TrimProcessor': 'ingest/_types/Processors.ts#L1275-L1291',
1744-
'ingest._types.UppercaseProcessor': 'ingest/_types/Processors.ts#L1293-L1309',
1745-
'ingest._types.UriPartsProcessor': 'ingest/_types/Processors.ts#L1329-L1355',
1746-
'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1311-L1327',
1733+
'ingest._types.RedactProcessor': 'ingest/_types/Processors.ts#L1056-L1097',
1734+
'ingest._types.RemoveProcessor': 'ingest/_types/Processors.ts#L1099-L1113',
1735+
'ingest._types.RenameProcessor': 'ingest/_types/Processors.ts#L1115-L1131',
1736+
'ingest._types.RerouteProcessor': 'ingest/_types/Processors.ts#L1133-L1161',
1737+
'ingest._types.ScriptProcessor': 'ingest/_types/Processors.ts#L1163-L1183',
1738+
'ingest._types.SetProcessor': 'ingest/_types/Processors.ts#L1185-L1219',
1739+
'ingest._types.SetSecurityUserProcessor': 'ingest/_types/Processors.ts#L1221-L1230',
1740+
'ingest._types.ShapeType': 'ingest/_types/Processors.ts#L1232-L1235',
1741+
'ingest._types.SortProcessor': 'ingest/_types/Processors.ts#L1237-L1253',
1742+
'ingest._types.SplitProcessor': 'ingest/_types/Processors.ts#L1255-L1280',
1743+
'ingest._types.TrimProcessor': 'ingest/_types/Processors.ts#L1282-L1298',
1744+
'ingest._types.UppercaseProcessor': 'ingest/_types/Processors.ts#L1300-L1316',
1745+
'ingest._types.UriPartsProcessor': 'ingest/_types/Processors.ts#L1336-L1362',
1746+
'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1318-L1334',
17471747
'ingest._types.UserAgentProcessor': 'ingest/_types/Processors.ts#L441-L472',
17481748
'ingest._types.UserAgentProperty': 'ingest/_types/Processors.ts#L474-L480',
17491749
'ingest.delete_geoip_database.Request': 'ingest/delete_geoip_database/DeleteGeoipDatabaseRequest.ts#L24-L48',
@@ -1766,13 +1766,14 @@
17661766
'ingest.put_geoip_database.Response': 'ingest/put_geoip_database/PutGeoipDatabaseResponse.ts#L22-L24',
17671767
'ingest.put_pipeline.Request': 'ingest/put_pipeline/PutPipelineRequest.ts#L25-L83',
17681768
'ingest.put_pipeline.Response': 'ingest/put_pipeline/PutPipelineResponse.ts#L22-L24',
1769-
'ingest.simulate.Document': 'ingest/simulate/types.ts#L50-L64',
1770-
'ingest.simulate.DocumentSimulation': 'ingest/simulate/types.ts#L66-L96',
1771-
'ingest.simulate.Ingest': 'ingest/simulate/types.ts#L29-L32',
1772-
'ingest.simulate.PipelineSimulation': 'ingest/simulate/types.ts#L40-L48',
1769+
'ingest.simulate.Document': 'ingest/simulate/types.ts#L62-L76',
1770+
'ingest.simulate.DocumentSimulation': 'ingest/simulate/types.ts#L78-L108',
1771+
'ingest.simulate.Ingest': 'ingest/simulate/types.ts#L29-L37',
1772+
'ingest.simulate.PipelineSimulation': 'ingest/simulate/types.ts#L52-L60',
1773+
'ingest.simulate.Redact': 'ingest/simulate/types.ts#L39-L44',
17731774
'ingest.simulate.Request': 'ingest/simulate/SimulatePipelineRequest.ts#L25-L57',
17741775
'ingest.simulate.Response': 'ingest/simulate/SimulatePipelineResponse.ts#L22-L24',
1775-
'ingest.simulate.SimulateDocumentResult': 'ingest/simulate/types.ts#L34-L38',
1776+
'ingest.simulate.SimulateDocumentResult': 'ingest/simulate/types.ts#L46-L50',
17761777
'license._types.License': 'license/_types/License.ts#L42-L53',
17771778
'license._types.LicenseStatus': 'license/_types/License.ts#L35-L40',
17781779
'license._types.LicenseType': 'license/_types/License.ts#L23-L33',
@@ -2851,8 +2852,8 @@
28512852
'watcher.stop.Request': 'watcher/stop/WatcherStopRequest.ts#L22-L26',
28522853
'watcher.stop.Response': 'watcher/stop/WatcherStopResponse.ts#L22-L24',
28532854
'xpack.info.BuildInformation': 'xpack/info/types.ts#L24-L27',
2854-
'xpack.info.Feature': 'xpack/info/types.ts#L77-L82',
2855-
'xpack.info.Features': 'xpack/info/types.ts#L42-L75',
2855+
'xpack.info.Feature': 'xpack/info/types.ts#L84-L89',
2856+
'xpack.info.Features': 'xpack/info/types.ts#L42-L82',
28562857
'xpack.info.MinimalLicenseInformation': 'xpack/info/types.ts#L34-L40',
28572858
'xpack.info.NativeCodeInformation': 'xpack/info/types.ts#L29-L32',
28582859
'xpack.info.Request': 'xpack/info/XPackInfoRequest.ts#L22-L42',
@@ -2929,10 +2930,10 @@
29292930
if (hash.length > 1) {
29302931
hash = hash.substring(1);
29312932
}
2932-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/aefa7a7149bde6df74dca802340ea4b1fcc70dfb/specification/" + (paths[hash] || "");
2933+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/3b1143a5a96fc7596af96485bccca492798d6f0e/specification/" + (paths[hash] || "");
29332934
</script>
29342935
</head>
29352936
<body>
2936-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/aefa7a7149bde6df74dca802340ea4b1fcc70dfb/specification/">Elasticsearch API specification</a>.
2937+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/3b1143a5a96fc7596af96485bccca492798d6f0e/specification/">Elasticsearch API specification</a>.
29372938
</body>
29382939
</html>

0 commit comments

Comments
 (0)