Skip to content

Commit

Permalink
fixes from spec pr 2959 (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta authored Oct 1, 2024
1 parent 949bdd3 commit 5d466ad
Show file tree
Hide file tree
Showing 11 changed files with 447 additions and 215 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import co.elastic.clients.json.JsonpUtils;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ApiTypeHelper;
import co.elastic.clients.util.ObjectBuilder;
import co.elastic.clients.util.WithJsonObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
Expand Down Expand Up @@ -59,19 +58,21 @@
*/

public abstract class ShardsOperationResponseBase implements JsonpSerializable {
@Nullable
private final ShardStatistics shards;

// ---------------------------------------------------------------------------------------------

protected ShardsOperationResponseBase(AbstractBuilder<?> builder) {

this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards");
this.shards = builder.shards;

}

/**
* Required - API name: {@code _shards}
* API name: {@code _shards}
*/
@Nullable
public final ShardStatistics shards() {
return this.shards;
}
Expand All @@ -87,8 +88,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("_shards");
this.shards.serialize(generator, mapper);
if (this.shards != null) {
generator.writeKey("_shards");
this.shards.serialize(generator, mapper);

}

}

Expand All @@ -100,18 +104,19 @@ public String toString() {
public abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>>
extends
WithJsonObjectBuilderBase<BuilderT> {
@Nullable
private ShardStatistics shards;

/**
* Required - API name: {@code _shards}
* API name: {@code _shards}
*/
public final BuilderT shards(ShardStatistics value) {
public final BuilderT shards(@Nullable ShardStatistics value) {
this.shards = value;
return self();
}

/**
* Required - API name: {@code _shards}
* API name: {@code _shards}
*/
public final BuilderT shards(Function<ShardStatistics.Builder, ObjectBuilder<ShardStatistics>> fn) {
return this.shards(fn.apply(new ShardStatistics.Builder()).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ public class EdgeNGramTokenizer extends TokenizerBase implements TokenizerDefini
@Nullable
private final String customTokenChars;

private final int maxGram;
@Nullable
private final Integer maxGram;

private final int minGram;
@Nullable
private final Integer minGram;

private final List<TokenChar> tokenChars;

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

this.customTokenChars = builder.customTokenChars;
this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram");
this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram");
this.maxGram = builder.maxGram;
this.minGram = builder.minGram;
this.tokenChars = ApiTypeHelper.unmodifiable(builder.tokenChars);

}
Expand All @@ -101,16 +103,18 @@ public final String customTokenChars() {
}

/**
* Required - API name: {@code max_gram}
* API name: {@code max_gram}
*/
public final int maxGram() {
@Nullable
public final Integer maxGram() {
return this.maxGram;
}

/**
* Required - API name: {@code min_gram}
* API name: {@code min_gram}
*/
public final int minGram() {
@Nullable
public final Integer minGram() {
return this.minGram;
}

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

}
generator.writeKey("max_gram");
generator.write(this.maxGram);
if (this.maxGram != null) {
generator.writeKey("max_gram");
generator.write(this.maxGram);

generator.writeKey("min_gram");
generator.write(this.minGram);
}
if (this.minGram != null) {
generator.writeKey("min_gram");
generator.write(this.minGram);

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

@Nullable
private Integer maxGram;

@Nullable
private Integer minGram;

@Nullable
Expand All @@ -176,17 +186,17 @@ public final Builder customTokenChars(@Nullable String value) {
}

/**
* Required - API name: {@code max_gram}
* API name: {@code max_gram}
*/
public final Builder maxGram(int value) {
public final Builder maxGram(@Nullable Integer value) {
this.maxGram = value;
return this;
}

/**
* Required - API name: {@code min_gram}
* API name: {@code min_gram}
*/
public final Builder minGram(int value) {
public final Builder minGram(@Nullable Integer value) {
this.minGram = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ public class NGramTokenizer extends TokenizerBase implements TokenizerDefinition
@Nullable
private final String customTokenChars;

private final int maxGram;
@Nullable
private final Integer maxGram;

private final int minGram;
@Nullable
private final Integer minGram;

private final List<TokenChar> tokenChars;

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

this.customTokenChars = builder.customTokenChars;
this.maxGram = ApiTypeHelper.requireNonNull(builder.maxGram, this, "maxGram");
this.minGram = ApiTypeHelper.requireNonNull(builder.minGram, this, "minGram");
this.maxGram = builder.maxGram;
this.minGram = builder.minGram;
this.tokenChars = ApiTypeHelper.unmodifiable(builder.tokenChars);

}
Expand All @@ -101,16 +103,18 @@ public final String customTokenChars() {
}

/**
* Required - API name: {@code max_gram}
* API name: {@code max_gram}
*/
public final int maxGram() {
@Nullable
public final Integer maxGram() {
return this.maxGram;
}

/**
* Required - API name: {@code min_gram}
* API name: {@code min_gram}
*/
public final int minGram() {
@Nullable
public final Integer minGram() {
return this.minGram;
}

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

}
generator.writeKey("max_gram");
generator.write(this.maxGram);
if (this.maxGram != null) {
generator.writeKey("max_gram");
generator.write(this.maxGram);

generator.writeKey("min_gram");
generator.write(this.minGram);
}
if (this.minGram != null) {
generator.writeKey("min_gram");
generator.write(this.minGram);

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

@Nullable
private Integer maxGram;

@Nullable
private Integer minGram;

@Nullable
Expand All @@ -176,17 +186,17 @@ public final Builder customTokenChars(@Nullable String value) {
}

/**
* Required - API name: {@code max_gram}
* API name: {@code max_gram}
*/
public final Builder maxGram(int value) {
public final Builder maxGram(@Nullable Integer value) {
this.maxGram = value;
return this;
}

/**
* Required - API name: {@code min_gram}
* API name: {@code min_gram}
*/
public final Builder minGram(int value) {
public final Builder minGram(@Nullable Integer value) {
this.minGram = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
'_types.SegmentsStats': '_types/Stats.ts#L273-L366',
'_types.ShardFailure': '_types/Errors.ts#L52-L58',
'_types.ShardStatistics': '_types/Stats.ts#L54-L66',
'_types.ShardsOperationResponseBase': '_types/Base.ts#L91-L93',
'_types.ShardsOperationResponseBase': '_types/Base.ts#L91-L94',
'_types.SlicedScroll': '_types/SlicedScroll.ts#L23-L27',
'_types.Slices': '_types/common.ts#L365-L370',
'_types.SlicesCalculation': '_types/common.ts#L372-L380',
Expand Down Expand Up @@ -1391,7 +1391,7 @@
'ilm.migrate_to_data_tiers.Response': 'ilm/migrate_to_data_tiers/Response.ts#L22-L32',
'ilm.move_to_step.Request': 'ilm/move_to_step/MoveToStepRequest.ts#L24-L36',
'ilm.move_to_step.Response': 'ilm/move_to_step/MoveToStepResponse.ts#L22-L24',
'ilm.move_to_step.StepKey': 'ilm/move_to_step/types.ts#L20-L24',
'ilm.move_to_step.StepKey': 'ilm/move_to_step/types.ts#L20-L25',
'ilm.put_lifecycle.Request': 'ilm/put_lifecycle/PutLifecycleRequest.ts#L25-L55',
'ilm.put_lifecycle.Response': 'ilm/put_lifecycle/PutLifecycleResponse.ts#L22-L24',
'ilm.remove_policy.Request': 'ilm/remove_policy/RemovePolicyRequest.ts#L23-L31',
Expand All @@ -1412,7 +1412,7 @@
'indices._types.DataStreamLifecycleRolloverConditions': 'indices/_types/DataStreamLifecycle.ts#L57-L69',
'indices._types.DataStreamLifecycleWithRollover': 'indices/_types/DataStreamLifecycle.ts#L33-L55',
'indices._types.DataStreamTimestampField': 'indices/_types/DataStream.ts#L129-L134',
'indices._types.DataStreamVisibility': 'indices/_types/DataStream.ts#L159-L161',
'indices._types.DataStreamVisibility': 'indices/_types/DataStream.ts#L159-L162',
'indices._types.DownsampleConfig': 'indices/_types/Downsample.ts#L22-L27',
'indices._types.DownsamplingRound': 'indices/_types/DownsamplingRound.ts#L23-L32',
'indices._types.FailureStore': 'indices/_types/DataStream.ts#L39-L43',
Expand Down Expand Up @@ -1730,20 +1730,20 @@
'ingest._types.PipelineProcessor': 'ingest/_types/Processors.ts#L1043-L1054',
'ingest._types.ProcessorBase': 'ingest/_types/Processors.ts#L266-L289',
'ingest._types.ProcessorContainer': 'ingest/_types/Processors.ts#L27-L264',
'ingest._types.RedactProcessor': 'ingest/_types/Processors.ts#L1056-L1090',
'ingest._types.RemoveProcessor': 'ingest/_types/Processors.ts#L1092-L1106',
'ingest._types.RenameProcessor': 'ingest/_types/Processors.ts#L1108-L1124',
'ingest._types.RerouteProcessor': 'ingest/_types/Processors.ts#L1126-L1154',
'ingest._types.ScriptProcessor': 'ingest/_types/Processors.ts#L1156-L1176',
'ingest._types.SetProcessor': 'ingest/_types/Processors.ts#L1178-L1212',
'ingest._types.SetSecurityUserProcessor': 'ingest/_types/Processors.ts#L1214-L1223',
'ingest._types.ShapeType': 'ingest/_types/Processors.ts#L1225-L1228',
'ingest._types.SortProcessor': 'ingest/_types/Processors.ts#L1230-L1246',
'ingest._types.SplitProcessor': 'ingest/_types/Processors.ts#L1248-L1273',
'ingest._types.TrimProcessor': 'ingest/_types/Processors.ts#L1275-L1291',
'ingest._types.UppercaseProcessor': 'ingest/_types/Processors.ts#L1293-L1309',
'ingest._types.UriPartsProcessor': 'ingest/_types/Processors.ts#L1329-L1355',
'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1311-L1327',
'ingest._types.RedactProcessor': 'ingest/_types/Processors.ts#L1056-L1097',
'ingest._types.RemoveProcessor': 'ingest/_types/Processors.ts#L1099-L1113',
'ingest._types.RenameProcessor': 'ingest/_types/Processors.ts#L1115-L1131',
'ingest._types.RerouteProcessor': 'ingest/_types/Processors.ts#L1133-L1161',
'ingest._types.ScriptProcessor': 'ingest/_types/Processors.ts#L1163-L1183',
'ingest._types.SetProcessor': 'ingest/_types/Processors.ts#L1185-L1219',
'ingest._types.SetSecurityUserProcessor': 'ingest/_types/Processors.ts#L1221-L1230',
'ingest._types.ShapeType': 'ingest/_types/Processors.ts#L1232-L1235',
'ingest._types.SortProcessor': 'ingest/_types/Processors.ts#L1237-L1253',
'ingest._types.SplitProcessor': 'ingest/_types/Processors.ts#L1255-L1280',
'ingest._types.TrimProcessor': 'ingest/_types/Processors.ts#L1282-L1298',
'ingest._types.UppercaseProcessor': 'ingest/_types/Processors.ts#L1300-L1316',
'ingest._types.UriPartsProcessor': 'ingest/_types/Processors.ts#L1336-L1362',
'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1318-L1334',
'ingest._types.UserAgentProcessor': 'ingest/_types/Processors.ts#L441-L472',
'ingest._types.UserAgentProperty': 'ingest/_types/Processors.ts#L474-L480',
'ingest.delete_geoip_database.Request': 'ingest/delete_geoip_database/DeleteGeoipDatabaseRequest.ts#L24-L48',
Expand All @@ -1766,13 +1766,14 @@
'ingest.put_geoip_database.Response': 'ingest/put_geoip_database/PutGeoipDatabaseResponse.ts#L22-L24',
'ingest.put_pipeline.Request': 'ingest/put_pipeline/PutPipelineRequest.ts#L25-L83',
'ingest.put_pipeline.Response': 'ingest/put_pipeline/PutPipelineResponse.ts#L22-L24',
'ingest.simulate.Document': 'ingest/simulate/types.ts#L50-L64',
'ingest.simulate.DocumentSimulation': 'ingest/simulate/types.ts#L66-L96',
'ingest.simulate.Ingest': 'ingest/simulate/types.ts#L29-L32',
'ingest.simulate.PipelineSimulation': 'ingest/simulate/types.ts#L40-L48',
'ingest.simulate.Document': 'ingest/simulate/types.ts#L62-L76',
'ingest.simulate.DocumentSimulation': 'ingest/simulate/types.ts#L78-L108',
'ingest.simulate.Ingest': 'ingest/simulate/types.ts#L29-L37',
'ingest.simulate.PipelineSimulation': 'ingest/simulate/types.ts#L52-L60',
'ingest.simulate.Redact': 'ingest/simulate/types.ts#L39-L44',
'ingest.simulate.Request': 'ingest/simulate/SimulatePipelineRequest.ts#L25-L57',
'ingest.simulate.Response': 'ingest/simulate/SimulatePipelineResponse.ts#L22-L24',
'ingest.simulate.SimulateDocumentResult': 'ingest/simulate/types.ts#L34-L38',
'ingest.simulate.SimulateDocumentResult': 'ingest/simulate/types.ts#L46-L50',
'license._types.License': 'license/_types/License.ts#L42-L53',
'license._types.LicenseStatus': 'license/_types/License.ts#L35-L40',
'license._types.LicenseType': 'license/_types/License.ts#L23-L33',
Expand Down Expand Up @@ -2851,8 +2852,8 @@
'watcher.stop.Request': 'watcher/stop/WatcherStopRequest.ts#L22-L26',
'watcher.stop.Response': 'watcher/stop/WatcherStopResponse.ts#L22-L24',
'xpack.info.BuildInformation': 'xpack/info/types.ts#L24-L27',
'xpack.info.Feature': 'xpack/info/types.ts#L77-L82',
'xpack.info.Features': 'xpack/info/types.ts#L42-L75',
'xpack.info.Feature': 'xpack/info/types.ts#L84-L89',
'xpack.info.Features': 'xpack/info/types.ts#L42-L82',
'xpack.info.MinimalLicenseInformation': 'xpack/info/types.ts#L34-L40',
'xpack.info.NativeCodeInformation': 'xpack/info/types.ts#L29-L32',
'xpack.info.Request': 'xpack/info/XPackInfoRequest.ts#L22-L42',
Expand Down Expand Up @@ -2929,10 +2930,10 @@
if (hash.length > 1) {
hash = hash.substring(1);
}
window.location = "https://github.com/elastic/elasticsearch-specification/tree/aefa7a7149bde6df74dca802340ea4b1fcc70dfb/specification/" + (paths[hash] || "");
window.location = "https://github.com/elastic/elasticsearch-specification/tree/3b1143a5a96fc7596af96485bccca492798d6f0e/specification/" + (paths[hash] || "");
</script>
</head>
<body>
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/aefa7a7149bde6df74dca802340ea4b1fcc70dfb/specification/">Elasticsearch API specification</a>.
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/3b1143a5a96fc7596af96485bccca492798d6f0e/specification/">Elasticsearch API specification</a>.
</body>
</html>
Loading

0 comments on commit 5d466ad

Please sign in to comment.