From 9daa8faa99f24362f2b6547da7cebd769d4c7503 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 6 Jan 2025 12:28:59 +1300 Subject: [PATCH] Fix tests Signed-off-by: Thomas Farr --- .../nodes/info/NodeInfoSearchPipelines.java | 55 +++++---- .../nodes/info/NodeInfoSettingsNode.java | 27 +++-- java-codegen/opensearch-openapi.yaml | 113 ++---------------- 3 files changed, 55 insertions(+), 140 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSearchPipelines.java b/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSearchPipelines.java index 89075f988..1a3efba54 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSearchPipelines.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSearchPipelines.java @@ -38,9 +38,11 @@ import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -71,8 +73,8 @@ public class NodeInfoSearchPipelines // --------------------------------------------------------------------------------------------- private NodeInfoSearchPipelines(Builder builder) { - this.requestProcessors = ApiTypeHelper.unmodifiableRequired(builder.requestProcessors, this, "requestProcessors"); - this.responseProcessors = ApiTypeHelper.unmodifiableRequired(builder.responseProcessors, this, "responseProcessors"); + this.requestProcessors = ApiTypeHelper.unmodifiable(builder.requestProcessors); + this.responseProcessors = ApiTypeHelper.unmodifiable(builder.responseProcessors); } public static NodeInfoSearchPipelines of(Function> fn) { @@ -80,7 +82,7 @@ public static NodeInfoSearchPipelines of(Function requestProcessors() { @@ -88,7 +90,7 @@ public final List requestProcessors() { } /** - * Required - API name: {@code response_processors} + * API name: {@code response_processors} */ @Nonnull public final List responseProcessors() { @@ -106,19 +108,23 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("request_processors"); - generator.writeStartArray(); - for (NodeInfoIngestProcessor item0 : this.requestProcessors) { - item0.serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.requestProcessors)) { + generator.writeKey("request_processors"); + generator.writeStartArray(); + for (NodeInfoIngestProcessor item0 : this.requestProcessors) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); } - generator.writeEnd(); - generator.writeKey("response_processors"); - generator.writeStartArray(); - for (NodeInfoIngestProcessor item0 : this.responseProcessors) { - item0.serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.responseProcessors)) { + generator.writeKey("response_processors"); + generator.writeStartArray(); + for (NodeInfoIngestProcessor item0 : this.responseProcessors) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); } - generator.writeEnd(); } // --------------------------------------------------------------------------------------------- @@ -138,7 +144,9 @@ public static Builder builder() { * Builder for {@link NodeInfoSearchPipelines}. */ public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable private List requestProcessors; + @Nullable private List responseProcessors; public Builder() {} @@ -160,7 +168,7 @@ public Builder copy() { } /** - * Required - API name: {@code request_processors} + * API name: {@code request_processors} * *

* Adds all elements of list to requestProcessors. @@ -173,7 +181,7 @@ public final Builder requestProcessors(List list) { } /** - * Required - API name: {@code request_processors} + * API name: {@code request_processors} * *

* Adds one or more values to requestProcessors. @@ -186,7 +194,7 @@ public final Builder requestProcessors(NodeInfoIngestProcessor value, NodeInfoIn } /** - * Required - API name: {@code request_processors} + * API name: {@code request_processors} * *

* Adds a value to requestProcessors using a builder lambda. @@ -198,7 +206,7 @@ public final Builder requestProcessors(Function * Adds all elements of list to responseProcessors. @@ -211,7 +219,7 @@ public final Builder responseProcessors(List list) { } /** - * Required - API name: {@code response_processors} + * API name: {@code response_processors} * *

* Adds one or more values to responseProcessors. @@ -224,7 +232,7 @@ public final Builder responseProcessors(NodeInfoIngestProcessor value, NodeInfoI } /** - * Required - API name: {@code response_processors} + * API name: {@code response_processors} * *

* Adds a value to responseProcessors using a builder lambda. @@ -275,8 +283,8 @@ protected static void setupNodeInfoSearchPipelinesDeserializer(ObjectDeserialize @Override public int hashCode() { int result = 17; - result = 31 * result + this.requestProcessors.hashCode(); - result = 31 * result + this.responseProcessors.hashCode(); + result = 31 * result + Objects.hashCode(this.requestProcessors); + result = 31 * result + Objects.hashCode(this.responseProcessors); return result; } @@ -285,6 +293,7 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; NodeInfoSearchPipelines other = (NodeInfoSearchPipelines) o; - return this.requestProcessors.equals(other.requestProcessors) && this.responseProcessors.equals(other.responseProcessors); + return Objects.equals(this.requestProcessors, other.requestProcessors) + && Objects.equals(this.responseProcessors, other.responseProcessors); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsNode.java index 3a04268ad..f480a65e2 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/info/NodeInfoSettingsNode.java @@ -74,7 +74,7 @@ public class NodeInfoSettingsNode implements PlainJsonSerializable, ToCopyableBu // --------------------------------------------------------------------------------------------- private NodeInfoSettingsNode(Builder builder) { - this.attr = ApiTypeHelper.unmodifiableRequired(builder.attr, this, "attr"); + this.attr = ApiTypeHelper.unmodifiable(builder.attr); this.maxLocalStorageNodes = builder.maxLocalStorageNodes; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); } @@ -84,7 +84,7 @@ public static NodeInfoSettingsNode of(Function attr() { @@ -118,13 +118,15 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("attr"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attr.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.attr)) { + generator.writeKey("attr"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attr.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); } - generator.writeEnd(); if (this.maxLocalStorageNodes != null) { generator.writeKey("max_local_storage_nodes"); @@ -152,6 +154,7 @@ public static Builder builder() { * Builder for {@link NodeInfoSettingsNode}. */ public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable private Map attr; @Nullable private String maxLocalStorageNodes; @@ -178,7 +181,7 @@ public Builder copy() { } /** - * Required - API name: {@code attr} + * API name: {@code attr} * *

* Adds all elements of map to attr. @@ -191,7 +194,7 @@ public final Builder attr(Map map) { } /** - * Required - API name: {@code attr} + * API name: {@code attr} * *

* Adds an entry to attr. @@ -254,7 +257,7 @@ protected static void setupNodeInfoSettingsNodeDeserializer(ObjectDeserializer