Skip to content

Commit

Permalink
FIxes from spec 2597 (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta authored May 31, 2024
1 parent 5452149 commit 131c604
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public enum Kind implements JsonEnum {

Avg("avg"),

BoxPlot("box_plot"),
Boxplot("boxplot"),

BucketMetricValue("bucket_metric_value"),

Expand Down Expand Up @@ -328,20 +328,20 @@ public AvgAggregate avg() {
}

/**
* Is this variant instance of kind {@code box_plot}?
* Is this variant instance of kind {@code boxplot}?
*/
public boolean isBoxPlot() {
return _kind == Kind.BoxPlot;
public boolean isBoxplot() {
return _kind == Kind.Boxplot;
}

/**
* Get the {@code box_plot} variant value.
* Get the {@code boxplot} variant value.
*
* @throws IllegalStateException
* if the current variant is not of the {@code box_plot} kind.
* if the current variant is not of the {@code boxplot} kind.
*/
public BoxPlotAggregate boxPlot() {
return TaggedUnionUtils.get(this, Kind.BoxPlot);
public BoxPlotAggregate boxplot() {
return TaggedUnionUtils.get(this, Kind.Boxplot);
}

/**
Expand Down Expand Up @@ -1540,15 +1540,15 @@ public ObjectBuilder<Aggregate> avg(Function<AvgAggregate.Builder, ObjectBuilder
return this.avg(fn.apply(new AvgAggregate.Builder()).build());
}

public ObjectBuilder<Aggregate> boxPlot(BoxPlotAggregate v) {
this._kind = Kind.BoxPlot;
public ObjectBuilder<Aggregate> boxplot(BoxPlotAggregate v) {
this._kind = Kind.Boxplot;
this._value = v;
return this;
}

public ObjectBuilder<Aggregate> boxPlot(
public ObjectBuilder<Aggregate> boxplot(
Function<BoxPlotAggregate.Builder, ObjectBuilder<BoxPlotAggregate>> fn) {
return this.boxPlot(fn.apply(new BoxPlotAggregate.Builder()).build());
return this.boxplot(fn.apply(new BoxPlotAggregate.Builder()).build());
}

public ObjectBuilder<Aggregate> bucketMetricValue(BucketMetricValueAggregate v) {
Expand Down Expand Up @@ -2285,7 +2285,7 @@ public Aggregate build() {
deserializers.put("adjacency_matrix", AdjacencyMatrixAggregate._DESERIALIZER);
deserializers.put("auto_date_histogram", AutoDateHistogramAggregate._DESERIALIZER);
deserializers.put("avg", AvgAggregate._DESERIALIZER);
deserializers.put("box_plot", BoxPlotAggregate._DESERIALIZER);
deserializers.put("boxplot", BoxPlotAggregate._DESERIALIZER);
deserializers.put("bucket_metric_value", BucketMetricValueAggregate._DESERIALIZER);
deserializers.put("cardinality", CardinalityAggregate._DESERIALIZER);
deserializers.put("children", ChildrenAggregate._DESERIALIZER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,20 @@ public static Aggregate avg(Function<AvgAggregate.Builder, ObjectBuilder<AvgAggr
}

/**
* Creates a builder for the {@link BoxPlotAggregate box_plot} {@code Aggregate}
* Creates a builder for the {@link BoxPlotAggregate boxplot} {@code Aggregate}
* variant.
*/
public static BoxPlotAggregate.Builder boxPlot() {
public static BoxPlotAggregate.Builder boxplot() {
return new BoxPlotAggregate.Builder();
}

/**
* Creates a Aggregate of the {@link BoxPlotAggregate box_plot}
* {@code Aggregate} variant.
* Creates a Aggregate of the {@link BoxPlotAggregate boxplot} {@code Aggregate}
* variant.
*/
public static Aggregate boxPlot(Function<BoxPlotAggregate.Builder, ObjectBuilder<BoxPlotAggregate>> fn) {
public static Aggregate boxplot(Function<BoxPlotAggregate.Builder, ObjectBuilder<BoxPlotAggregate>> fn) {
Aggregate.Builder builder = new Aggregate.Builder();
builder.boxPlot(fn.apply(new BoxPlotAggregate.Builder()).build());
builder.boxplot(fn.apply(new BoxPlotAggregate.Builder()).build());
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static BoxPlotAggregate of(Function<Builder, ObjectBuilder<BoxPlotAggrega
*/
@Override
public Aggregate.Kind _aggregateKind() {
return Aggregate.Kind.BoxPlot;
return Aggregate.Kind.Boxplot;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,31 @@

public abstract class TermsBucketBase extends MultiBucketBase {
@Nullable
private final Long docCountError;
private final Long docCountErrorUpperBound;

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

protected TermsBucketBase(AbstractBuilder<?> builder) {
super(builder);

this.docCountError = builder.docCountError;
this.docCountErrorUpperBound = builder.docCountErrorUpperBound;

}

/**
* API name: {@code doc_count_error}
* API name: {@code doc_count_error_upper_bound}
*/
@Nullable
public final Long docCountError() {
return this.docCountError;
public final Long docCountErrorUpperBound() {
return this.docCountErrorUpperBound;
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

super.serializeInternal(generator, mapper);
if (this.docCountError != null) {
generator.writeKey("doc_count_error");
generator.write(this.docCountError);
if (this.docCountErrorUpperBound != null) {
generator.writeKey("doc_count_error_upper_bound");
generator.write(this.docCountErrorUpperBound);

}

Expand All @@ -91,13 +91,13 @@ public abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<Bu
extends
MultiBucketBase.AbstractBuilder<BuilderT> {
@Nullable
private Long docCountError;
private Long docCountErrorUpperBound;

/**
* API name: {@code doc_count_error}
* API name: {@code doc_count_error_upper_bound}
*/
public final BuilderT docCountError(@Nullable Long value) {
this.docCountError = value;
public final BuilderT docCountErrorUpperBound(@Nullable Long value) {
this.docCountErrorUpperBound = value;
return self();
}

Expand All @@ -107,7 +107,8 @@ public final BuilderT docCountError(@Nullable Long value) {
protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupTermsBucketBaseDeserializer(
ObjectDeserializer<BuilderT> op) {
MultiBucketBase.setupMultiBucketBaseDeserializer(op);
op.add(AbstractBuilder::docCountError, JsonpDeserializer.longDeserializer(), "doc_count_error");
op.add(AbstractBuilder::docCountErrorUpperBound, JsonpDeserializer.longDeserializer(),
"doc_count_error_upper_bound");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
*/
@JsonpDeserializable
public class MultiTermVectorsOperation implements JsonpSerializable {
@Nullable
private final String id;

@Nullable
Expand Down Expand Up @@ -107,7 +108,7 @@ public class MultiTermVectorsOperation implements JsonpSerializable {

private MultiTermVectorsOperation(Builder builder) {

this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id");
this.id = builder.id;
this.index = builder.index;
this.doc = builder.doc;
this.fields = ApiTypeHelper.unmodifiable(builder.fields);
Expand All @@ -128,10 +129,11 @@ public static MultiTermVectorsOperation of(Function<Builder, ObjectBuilder<Multi
}

/**
* Required - The ID of the document.
* The ID of the document.
* <p>
* API name: {@code _id}
*/
@Nullable
public final String id() {
return this.id;
}
Expand Down Expand Up @@ -271,9 +273,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("_id");
generator.write(this.id);
if (this.id != null) {
generator.writeKey("_id");
generator.write(this.id);

}
if (this.index != null) {
generator.writeKey("_index");
generator.write(this.index);
Expand Down Expand Up @@ -355,6 +359,7 @@ public String toString() {
public static class Builder extends WithJsonObjectBuilderBase<Builder>
implements
ObjectBuilder<MultiTermVectorsOperation> {
@Nullable
private String id;

@Nullable
Expand Down Expand Up @@ -394,11 +399,11 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
private VersionType versionType;

/**
* Required - The ID of the document.
* The ID of the document.
* <p>
* API name: {@code _id}
*/
public final Builder id(String value) {
public final Builder id(@Nullable String value) {
this.id = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2720,10 +2720,10 @@
if (hash.length > 1) {
hash = hash.substring(1);
}
window.location = "https://github.com/elastic/elasticsearch-specification/tree/2438c4b3e5ecd91091d9a9a75eace1c380d8e479/specification/" + (paths[hash] || "");
window.location = "https://github.com/elastic/elasticsearch-specification/tree/2a4afb9372742518b1a19ba0ca0829b50ec10926/specification/" + (paths[hash] || "");
</script>
</head>
<body>
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/2438c4b3e5ecd91091d9a9a75eace1c380d8e479/specification/">Elasticsearch API specification</a>.
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/2a4afb9372742518b1a19ba0ca0829b50ec10926/specification/">Elasticsearch API specification</a>.
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@
public class NodeInfoScript implements JsonpSerializable {
private final String allowedTypes;

@Nullable
private final String disableMaxCompilationsRate;

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

private NodeInfoScript(Builder builder) {

this.allowedTypes = ApiTypeHelper.requireNonNull(builder.allowedTypes, this, "allowedTypes");
this.disableMaxCompilationsRate = ApiTypeHelper.requireNonNull(builder.disableMaxCompilationsRate, this,
"disableMaxCompilationsRate");
this.disableMaxCompilationsRate = builder.disableMaxCompilationsRate;

}

Expand All @@ -85,8 +85,9 @@ public final String allowedTypes() {
}

/**
* Required - API name: {@code disable_max_compilations_rate}
* API name: {@code disable_max_compilations_rate}
*/
@Nullable
public final String disableMaxCompilationsRate() {
return this.disableMaxCompilationsRate;
}
Expand All @@ -105,8 +106,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("allowed_types");
generator.write(this.allowedTypes);

generator.writeKey("disable_max_compilations_rate");
generator.write(this.disableMaxCompilationsRate);
if (this.disableMaxCompilationsRate != null) {
generator.writeKey("disable_max_compilations_rate");
generator.write(this.disableMaxCompilationsRate);

}

}

Expand All @@ -124,6 +128,7 @@ public String toString() {
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<NodeInfoScript> {
private String allowedTypes;

@Nullable
private String disableMaxCompilationsRate;

/**
Expand All @@ -135,9 +140,9 @@ public final Builder allowedTypes(String value) {
}

/**
* Required - API name: {@code disable_max_compilations_rate}
* API name: {@code disable_max_compilations_rate}
*/
public final Builder disableMaxCompilationsRate(String value) {
public final Builder disableMaxCompilationsRate(@Nullable String value) {
this.disableMaxCompilationsRate = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public class NodeInfoSettings implements JsonpSerializable {
@Nullable
private final NodeInfoAction action;

@Nullable
private final NodeInfoClient client;

private final NodeInfoSettingsHttp http;
Expand Down Expand Up @@ -108,7 +109,7 @@ private NodeInfoSettings(Builder builder) {
this.repositories = builder.repositories;
this.discovery = builder.discovery;
this.action = builder.action;
this.client = ApiTypeHelper.requireNonNull(builder.client, this, "client");
this.client = builder.client;
this.http = ApiTypeHelper.requireNonNull(builder.http, this, "http");
this.bootstrap = builder.bootstrap;
this.transport = ApiTypeHelper.requireNonNull(builder.transport, this, "transport");
Expand Down Expand Up @@ -171,8 +172,9 @@ public final NodeInfoAction action() {
}

/**
* Required - API name: {@code client}
* API name: {@code client}
*/
@Nullable
public final NodeInfoClient client() {
return this.client;
}
Expand Down Expand Up @@ -276,9 +278,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
this.action.serialize(generator, mapper);

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

}
generator.writeKey("http");
this.http.serialize(generator, mapper);

Expand Down Expand Up @@ -346,6 +350,7 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
@Nullable
private NodeInfoAction action;

@Nullable
private NodeInfoClient client;

private NodeInfoSettingsHttp http;
Expand Down Expand Up @@ -463,15 +468,15 @@ public final Builder action(Function<NodeInfoAction.Builder, ObjectBuilder<NodeI
}

/**
* Required - API name: {@code client}
* API name: {@code client}
*/
public final Builder client(NodeInfoClient value) {
public final Builder client(@Nullable NodeInfoClient value) {
this.client = value;
return this;
}

/**
* Required - API name: {@code client}
* API name: {@code client}
*/
public final Builder client(Function<NodeInfoClient.Builder, ObjectBuilder<NodeInfoClient>> fn) {
return this.client(fn.apply(new NodeInfoClient.Builder()).build());
Expand Down
Loading

0 comments on commit 131c604

Please sign in to comment.