diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index de1cad3599..36a0c74b71 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -43,6 +43,7 @@ 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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -67,15 +68,19 @@ public class ErrorCause implements PlainJsonSerializable { @Nullable private final String reason; + @Nonnull private final List rootCause; @Nullable private final String stackTrace; + @Nonnull private final List suppressed; + @Nonnull private final String type; + @Nonnull private final Map metadata; // --------------------------------------------------------------------------------------------- @@ -116,6 +121,7 @@ public final String reason() { /** * API name: {@code root_cause} */ + @Nonnull public final List rootCause() { return this.rootCause; } @@ -134,6 +140,7 @@ public final String stackTrace() { /** * API name: {@code suppressed} */ + @Nonnull public final List suppressed() { return this.suppressed; } @@ -144,6 +151,7 @@ public final List suppressed() { * API name: {@code type} *

*/ + @Nonnull public final String type() { return this.type; } @@ -151,6 +159,7 @@ public final String type() { /** * Additional details about the error. */ + @Nonnull public final Map metadata() { return this.metadata; } @@ -420,14 +429,14 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; ErrorCause other = (ErrorCause) o; return Objects.equals(this.causedBy, other.causedBy) && Objects.equals(this.reason, other.reason) && Objects.equals(this.rootCause, other.rootCause) && Objects.equals(this.stackTrace, other.stackTrace) && Objects.equals(this.suppressed, other.suppressed) - && Objects.equals(this.type, other.type) + && this.type.equals(other.type) && Objects.equals(this.metadata, other.metadata); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java index 702c37b8a6..36812d4783 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardFailure.java @@ -40,6 +40,7 @@ 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; @@ -63,6 +64,7 @@ public class ShardFailure implements PlainJsonSerializable { @Nullable private final String node; + @Nonnull private final ErrorCause reason; private final int shard; @@ -103,6 +105,7 @@ public final String node() { /** * Required - API name: {@code reason} */ + @Nonnull public final ErrorCause reason() { return this.reason; } @@ -259,12 +262,12 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; ShardFailure other = (ShardFailure) o; return Objects.equals(this.index, other.index) && Objects.equals(this.node, other.node) - && Objects.equals(this.reason, other.reason) - && this.shard() == other.shard() + && this.reason.equals(other.reason) + && this.shard == other.shard && Objects.equals(this.status, other.status); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java index 447e8404c7..53d36332e7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ShardStatistics.java @@ -41,6 +41,7 @@ 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; @@ -58,15 +59,19 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class ShardStatistics implements PlainJsonSerializable { + @Nonnull private final Number failed; + @Nonnull private final List failures; @Nullable private final Number skipped; + @Nonnull private final Number successful; + @Nonnull private final Number total; // --------------------------------------------------------------------------------------------- @@ -86,6 +91,7 @@ public static ShardStatistics of(Function failures() { return this.failures; } @@ -108,6 +115,7 @@ public final Number skipped() { /** * Required - API name: {@code successful} */ + @Nonnull public final Number successful() { return this.successful; } @@ -115,6 +123,7 @@ public final Number successful() { /** * Required - API name: {@code total} */ + @Nonnull public final Number total() { return this.total; } @@ -277,12 +286,12 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; ShardStatistics other = (ShardStatistics) o; - return Objects.equals(this.failed, other.failed) + return this.failed.equals(other.failed) && Objects.equals(this.failures, other.failures) && Objects.equals(this.skipped, other.skipped) - && Objects.equals(this.successful, other.successful) - && Objects.equals(this.total, other.total); + && this.successful.equals(other.successful) + && this.total.equals(other.total); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java index ce3f4c841d..851f7c50dd 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WriteResponseBase.java @@ -40,6 +40,7 @@ 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.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -57,16 +58,20 @@ public abstract class WriteResponseBase implements PlainJsonSerializable { @Nullable private final Boolean forcedRefresh; + @Nonnull private final String id; + @Nonnull private final String index; private final long primaryTerm; + @Nonnull private final Result result; private final long seqNo; + @Nonnull private final ShardStatistics shards; private final long version; @@ -95,6 +100,7 @@ public final Boolean forcedRefresh() { /** * Required - API name: {@code _id} */ + @Nonnull public final String id() { return this.id; } @@ -102,6 +108,7 @@ public final String id() { /** * Required - API name: {@code _index} */ + @Nonnull public final String index() { return this.index; } @@ -116,6 +123,7 @@ public final long primaryTerm() { /** * Required - API name: {@code result} */ + @Nonnull public final Result result() { return this.result; } @@ -130,6 +138,7 @@ public final long seqNo() { /** * Required - API name: {@code _shards} */ + @Nonnull public final ShardStatistics shards() { return this.shards; } @@ -281,7 +290,7 @@ protected static > void setupWriteRes public int hashCode() { int result = 17; - result = 31 * result + Boolean.hashCode(this.forcedRefresh); + result = 31 * result + Objects.hashCode(this.forcedRefresh); result = 31 * result + this.id.hashCode(); result = 31 * result + this.index.hashCode(); result = 31 * result + Long.hashCode(this.primaryTerm); @@ -294,15 +303,15 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; WriteResponseBase other = (WriteResponseBase) o; - return this.forcedRefresh() == other.forcedRefresh() - && Objects.equals(this.id, other.id) - && Objects.equals(this.index, other.index) - && this.primaryTerm() == other.primaryTerm() - && Objects.equals(this.result, other.result) - && this.seqNo() == other.seqNo() - && Objects.equals(this.shards, other.shards) - && this.version() == other.version(); + return Objects.equals(this.forcedRefresh, other.forcedRefresh) + && this.id.equals(other.id) + && this.index.equals(other.index) + && this.primaryTerm == other.primaryTerm + && this.result.equals(other.result) + && this.seqNo == other.seqNo + && this.shards.equals(other.shards) + && this.version == other.version; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java index 68e20bc646..38e6fa54af 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java @@ -302,7 +302,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; Action other = (Action) o; return Objects.equals(this.actionType, other.actionType) && Objects.equals(this.headers, other.headers) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java index 0a3fa1a853..bd03b5ec22 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ClientConfig.java @@ -283,26 +283,26 @@ protected static void setupClientConfigDeserializer(ObjectDeserializer actions; @Nullable private final ClientConfig clientConfig; + @Nonnull private final Credential credential; + @Nonnull private final String description; + @Nonnull private final String name; + @Nonnull private final Map parameters; + @Nonnull private final String protocol; private final int version; @@ -80,6 +87,7 @@ public static CreateConnectorRequest of(Function actions() { return this.actions; } @@ -95,6 +103,7 @@ public final ClientConfig clientConfig() { /** * Required - API name: {@code credential} */ + @Nonnull public final Credential credential() { return this.credential; } @@ -102,6 +111,7 @@ public final Credential credential() { /** * Required - API name: {@code description} */ + @Nonnull public final String description() { return this.description; } @@ -109,6 +119,7 @@ public final String description() { /** * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } @@ -116,6 +127,7 @@ public final String name() { /** * Required - API name: {@code parameters} */ + @Nonnull public final Map parameters() { return this.parameters; } @@ -123,6 +135,7 @@ public final Map parameters() { /** * Required - API name: {@code protocol} */ + @Nonnull public final String protocol() { return this.protocol; } @@ -382,15 +395,15 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; CreateConnectorRequest other = (CreateConnectorRequest) o; - return Objects.equals(this.actions, other.actions) + return this.actions.equals(other.actions) && Objects.equals(this.clientConfig, other.clientConfig) - && Objects.equals(this.credential, other.credential) - && Objects.equals(this.description, other.description) - && Objects.equals(this.name, other.name) - && Objects.equals(this.parameters, other.parameters) - && Objects.equals(this.protocol, other.protocol) - && this.version() == other.version(); + && this.credential.equals(other.credential) + && this.description.equals(other.description) + && this.name.equals(other.name) + && this.parameters.equals(other.parameters) + && this.protocol.equals(other.protocol) + && this.version == other.version; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorResponse.java index 309c8e4c95..bed71edbbc 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateConnectorResponse.java @@ -121,7 +121,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; CreateConnectorResponse other = (CreateConnectorResponse) o; return Objects.equals(this.connectorId, other.connectorId); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java index 1e465e9f59..ef7dfb84ad 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Credential.java @@ -18,6 +18,7 @@ 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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -45,6 +46,7 @@ public class Credential implements PlainJsonSerializable { @Nullable private final String sessionToken; + @Nonnull private final Map metadata; // --------------------------------------------------------------------------------------------- @@ -86,6 +88,7 @@ public final String sessionToken() { /** */ + @Nonnull public final Map metadata() { return this.metadata; } @@ -227,7 +230,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; Credential other = (Credential) o; return Objects.equals(this.accessKey, other.accessKey) && Objects.equals(this.secretKey, other.secretKey) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentRequest.java index 95483fb1fa..da99ed04fa 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteAgentRequest.java @@ -12,9 +12,9 @@ package org.opensearch.client.opensearch.ml; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -31,6 +31,7 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class DeleteAgentRequest extends RequestBase { + @Nonnull private final String agentId; // --------------------------------------------------------------------------------------------- @@ -46,6 +47,7 @@ public static DeleteAgentRequest of(Function */ + @Nonnull public final String access() { return this.access; } @@ -86,6 +91,7 @@ public final Long createdTime() { * API name: {@code description} *

*/ + @Nonnull public final String description() { return this.description; } @@ -114,6 +120,7 @@ public final int latestVersion() { * API name: {@code name} *

*/ + @Nonnull public final String name() { return this.name; } @@ -261,9 +268,9 @@ protected static void setupGetModelGroupResponseDeserializer(ObjectDeserializer< public int hashCode() { int result = 17; result = 31 * result + this.access.hashCode(); - result = 31 * result + Long.hashCode(this.createdTime); + result = 31 * result + Objects.hashCode(this.createdTime); result = 31 * result + this.description.hashCode(); - result = 31 * result + Long.hashCode(this.lastUpdatedTime); + result = 31 * result + Objects.hashCode(this.lastUpdatedTime); result = 31 * result + Integer.hashCode(this.latestVersion); result = 31 * result + this.name.hashCode(); return result; @@ -271,13 +278,13 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; GetModelGroupResponse other = (GetModelGroupResponse) o; - return Objects.equals(this.access, other.access) - && this.createdTime() == other.createdTime() - && Objects.equals(this.description, other.description) - && this.lastUpdatedTime() == other.lastUpdatedTime() - && this.latestVersion() == other.latestVersion() - && Objects.equals(this.name, other.name); + return this.access.equals(other.access) + && Objects.equals(this.createdTime, other.createdTime) + && this.description.equals(other.description) + && Objects.equals(this.lastUpdatedTime, other.lastUpdatedTime) + && this.latestVersion == other.latestVersion + && this.name.equals(other.name); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java index 76dbbc8352..664c9b3d31 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetTaskRequest.java @@ -12,9 +12,9 @@ package org.opensearch.client.opensearch.ml; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -31,6 +31,7 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class GetTaskRequest extends RequestBase { + @Nonnull private final String taskId; // --------------------------------------------------------------------------------------------- @@ -46,6 +47,7 @@ public static GetTaskRequest of(Function> workerNode; // --------------------------------------------------------------------------------------------- @@ -132,6 +135,7 @@ public final String modelId() { /** * Required - API name: {@code state} */ + @Nonnull public final String state() { return this.state; } @@ -158,6 +162,7 @@ public final String taskType() { /** * API name: {@code worker_node} */ + @Nonnull public final List> workerNode() { return this.workerNode; } @@ -396,11 +401,11 @@ protected static void setupGetTaskResponseDeserializer(ObjectDeserializer metadata; // --------------------------------------------------------------------------------------------- @@ -62,6 +64,7 @@ public final String contentType() { /** */ + @Nonnull public final Map metadata() { return this.metadata; } @@ -169,7 +172,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; Headers other = (Headers) o; return Objects.equals(this.contentType, other.contentType) && Objects.equals(this.metadata, other.metadata); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LLM.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LLM.java index 2455229411..2f0613294a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LLM.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LLM.java @@ -17,6 +17,7 @@ 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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -38,6 +39,7 @@ public class LLM implements PlainJsonSerializable { @Nullable private final String modelId; + @Nonnull private final Map parameters; // --------------------------------------------------------------------------------------------- @@ -62,6 +64,7 @@ public final String modelId() { /** * API name: {@code parameters} */ + @Nonnull public final Map parameters() { return this.parameters; } @@ -169,7 +172,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; LLM other = (LLM) o; return Objects.equals(this.modelId, other.modelId) && Objects.equals(this.parameters, other.parameters); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java index 3ae6dcaf1e..0660178e13 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java @@ -121,7 +121,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; Memory other = (Memory) o; return Objects.equals(this.type, other.type); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java index 1924edac77..2c2e560a6d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsRequest.java @@ -18,6 +18,7 @@ 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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -55,12 +56,16 @@ public class RegisterAgentsRequest extends RequestBase implements PlainJsonSeria @Nullable private final Memory memory; + @Nonnull private final String name; + @Nonnull private final Map parameters; + @Nonnull private final List tools; + @Nonnull private final String type; // --------------------------------------------------------------------------------------------- @@ -115,6 +120,7 @@ public final Memory memory() { /** * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } @@ -122,6 +128,7 @@ public final String name() { /** * API name: {@code parameters} */ + @Nonnull public final Map parameters() { return this.parameters; } @@ -129,6 +136,7 @@ public final Map parameters() { /** * API name: {@code tools} */ + @Nonnull public final List tools() { return this.tools; } @@ -136,6 +144,7 @@ public final List tools() { /** * Required - API name: {@code type} */ + @Nonnull public final String type() { return this.type; } @@ -403,15 +412,15 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; RegisterAgentsRequest other = (RegisterAgentsRequest) o; return Objects.equals(this.appType, other.appType) && Objects.equals(this.description, other.description) && Objects.equals(this.llm, other.llm) && Objects.equals(this.memory, other.memory) - && Objects.equals(this.name, other.name) + && this.name.equals(other.name) && Objects.equals(this.parameters, other.parameters) && Objects.equals(this.tools, other.tools) - && Objects.equals(this.type, other.type); + && this.type.equals(other.type); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java index 199ae5fde6..b15475a2aa 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterAgentsResponse.java @@ -121,7 +121,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; RegisterAgentsResponse other = (RegisterAgentsResponse) o; return Objects.equals(this.agentId, other.agentId); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java index b9f1b069fd..e7bc41bb13 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupRequest.java @@ -17,6 +17,7 @@ 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; @@ -47,11 +48,13 @@ public class RegisterModelGroupRequest extends RequestBase implements PlainJsonS @Nullable private final Boolean addAllBackendRoles; + @Nonnull private final List backendRoles; @Nullable private final String description; + @Nonnull private final String name; // --------------------------------------------------------------------------------------------- @@ -96,6 +99,7 @@ public final Boolean addAllBackendRoles() { * API name: {@code backend_roles} *

*/ + @Nonnull public final List backendRoles() { return this.backendRoles; } @@ -117,6 +121,7 @@ public final String description() { * API name: {@code name} *

*/ + @Nonnull public final String name() { return this.name; } @@ -299,7 +304,7 @@ protected static void setupRegisterModelGroupRequestDeserializer(ObjectDeseriali public int hashCode() { int result = 17; result = 31 * result + Objects.hashCode(this.accessMode); - result = 31 * result + Boolean.hashCode(this.addAllBackendRoles); + result = 31 * result + Objects.hashCode(this.addAllBackendRoles); result = 31 * result + Objects.hashCode(this.backendRoles); result = 31 * result + Objects.hashCode(this.description); result = 31 * result + this.name.hashCode(); @@ -308,12 +313,12 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; RegisterModelGroupRequest other = (RegisterModelGroupRequest) o; return Objects.equals(this.accessMode, other.accessMode) - && this.addAllBackendRoles() == other.addAllBackendRoles() + && Objects.equals(this.addAllBackendRoles, other.addAllBackendRoles) && Objects.equals(this.backendRoles, other.backendRoles) && Objects.equals(this.description, other.description) - && Objects.equals(this.name, other.name); + && this.name.equals(other.name); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java index 6ee1aab4cf..ac99154507 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelGroupResponse.java @@ -13,9 +13,9 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -32,8 +32,10 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class RegisterModelGroupResponse implements PlainJsonSerializable { + @Nonnull private final String modelGroupId; + @Nonnull private final String status; // --------------------------------------------------------------------------------------------- @@ -55,6 +57,7 @@ public static RegisterModelGroupResponse of( * API name: {@code model_group_id} *

*/ + @Nonnull public final String modelGroupId() { return this.modelGroupId; } @@ -65,6 +68,7 @@ public final String modelGroupId() { * API name: {@code status} *

*/ + @Nonnull public final String status() { return this.status; } @@ -154,8 +158,8 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; RegisterModelGroupResponse other = (RegisterModelGroupResponse) o; - return Objects.equals(this.modelGroupId, other.modelGroupId) && Objects.equals(this.status, other.status); + return this.modelGroupId.equals(other.modelGroupId) && this.status.equals(other.status); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java index 9536644078..5261601622 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java @@ -16,6 +16,7 @@ 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; @@ -43,13 +44,16 @@ public class RegisterModelRequest extends RequestBase implements PlainJsonSerial @Nullable private final String description; + @Nonnull private final String modelFormat; @Nullable private final String modelGroupId; + @Nonnull private final String name; + @Nonnull private final String version; // --------------------------------------------------------------------------------------------- @@ -83,6 +87,7 @@ public final String description() { * API name: {@code model_format} *

*/ + @Nonnull public final String modelFormat() { return this.modelFormat; } @@ -104,6 +109,7 @@ public final String modelGroupId() { * API name: {@code name} *

*/ + @Nonnull public final String name() { return this.name; } @@ -114,6 +120,7 @@ public final String name() { * API name: {@code version} *

*/ + @Nonnull public final String version() { return this.version; } @@ -276,12 +283,12 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; RegisterModelRequest other = (RegisterModelRequest) o; return Objects.equals(this.description, other.description) - && Objects.equals(this.modelFormat, other.modelFormat) + && this.modelFormat.equals(other.modelFormat) && Objects.equals(this.modelGroupId, other.modelGroupId) - && Objects.equals(this.name, other.name) - && Objects.equals(this.version, other.version); + && this.name.equals(other.name) + && this.version.equals(other.version); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java index 4bcac19b3b..d565876256 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelResponse.java @@ -13,9 +13,9 @@ package org.opensearch.client.opensearch.ml; import jakarta.json.stream.JsonGenerator; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -32,8 +32,10 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class RegisterModelResponse implements PlainJsonSerializable { + @Nonnull private final String status; + @Nonnull private final String taskId; // --------------------------------------------------------------------------------------------- @@ -50,6 +52,7 @@ public static RegisterModelResponse of(Function parameters; @Nullable private final String type; + @Nonnull private final Map metadata; // --------------------------------------------------------------------------------------------- @@ -70,6 +73,7 @@ public final String name() { /** * API name: {@code parameters} */ + @Nonnull public final Map parameters() { return this.parameters; } @@ -84,6 +88,7 @@ public final String type() { /** */ + @Nonnull public final Map metadata() { return this.metadata; } @@ -246,7 +251,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; ToolItems other = (ToolItems) o; return Objects.equals(this.name, other.name) && Objects.equals(this.parameters, other.parameters) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java index 0a7a3d58c7..9b9afcbc98 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelNode.java @@ -17,6 +17,7 @@ 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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -35,6 +36,7 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class UndeployModelNode implements PlainJsonSerializable { + @Nonnull private final Map stats; // --------------------------------------------------------------------------------------------- @@ -50,6 +52,7 @@ public static UndeployModelNode of(Function stats() { return this.stats; } @@ -143,7 +146,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; UndeployModelNode other = (UndeployModelNode) o; return Objects.equals(this.stats, other.stats); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java index 0b9f760371..5c5a4a4eed 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java @@ -12,9 +12,9 @@ package org.opensearch.client.opensearch.ml; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -31,6 +31,7 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class UndeployModelRequest extends RequestBase { + @Nonnull private final String modelId; // --------------------------------------------------------------------------------------------- @@ -46,6 +47,7 @@ public static UndeployModelRequest of(Function nodes; // --------------------------------------------------------------------------------------------- @@ -49,6 +51,7 @@ public static UndeployModelResponse of(Function nodes() { return this.nodes; } @@ -150,7 +153,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; - if (this.getClass() != o.getClass()) return false; + if (o == null || this.getClass() != o.getClass()) return false; UndeployModelResponse other = (UndeployModelResponse) o; return Objects.equals(this.nodes, other.nodes); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java index 03025401cb..e4d1734572 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java @@ -84,12 +84,4 @@ public String getDescription() { public Deprecation getDeprecation() { return deprecation; } - - public boolean isUnboxedPrimitive() { - return type.isUnboxedPrimitive(); - } - - public Type getBoxedType() { - return type.getBoxed(); - } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java index d9123a7eaa..f46c3f0306 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java @@ -23,25 +23,16 @@ import org.opensearch.client.codegen.utils.Strings; public class Type { - private static final Set PRIMITIVES = Set.of( - "String", - "boolean", + private static final Set PRIMITIVES = Set.of("boolean", "char", "byte", "short", "int", "long", "float", "double"); + private static final Set BOXED_PRIMITIVES = Set.of( "Boolean", - "char", "Character", - "byte", "Byte", - "short", "Short", - "int", "Integer", - "long", "Long", - "float", "Float", - "double", - "Double", - "Number" + "Double" ); @Nonnull @@ -157,16 +148,12 @@ public boolean isPrimitive() { return PRIMITIVES.contains(name); } - public boolean isUnboxedPrimitive() { - return isPrimitive() - && !name.equals("String") - && !name.equals("Boolean") - && !name.equals("Character") - && !name.equals("Integer") - && !name.equals("Long") - && !name.equals("Float") - && !name.equals("Double") - && !name.equals("Number"); + public boolean isBoxedPrimitive() { + return BOXED_PRIMITIVES.contains(name); + } + + public boolean isPotentiallyBoxedPrimitive() { + return isPrimitive() || isBoxedPrimitive(); } public boolean isNumber() { @@ -182,7 +169,7 @@ public boolean isTime() { } public boolean isBuiltIn() { - return isListOrMap() || isPrimitive() || "JsonData".equals(name); + return isPrimitive() || (packageName != null && packageName.startsWith("java.")) || "JsonData".equals(name); } public boolean hasBuilder() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java index d5f4e9a750..aff4712672 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java @@ -123,6 +123,7 @@ public static final class Javax { public static final class Annotation { public static final String PACKAGE = Javax.PACKAGE + ".annotation"; public static final Type Generated = Type.builder().withPackage(PACKAGE).withName("Generated").build(); + public static final Type Nonnull = Type.builder().withPackage(PACKAGE).withName("Nonnull").build(); public static final Type Nullable = Type.builder().withPackage(PACKAGE).withName("Nullable").build(); } } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache index 6e45e22d72..1670834380 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Equals.mustache @@ -5,7 +5,7 @@ } {{/extendsOtherShape}} if(this == o) return true; - if(this.getClass() != o.getClass()) return false; + if(o == null || this.getClass() != o.getClass()) return false; {{^hasFields}} return true; {{/hasFields}} @@ -13,12 +13,17 @@ {{className}} other = ({{className}})o; return {{#fields}} - {{#isUnboxedPrimitive}} - this.{{name}}() == other.{{name}}() - {{/isUnboxedPrimitive}} - {{^isUnboxedPrimitive}} + {{#required}} + {{#type.isPrimitive}} + this.{{name}} == other.{{name}} + {{/type.isPrimitive}} + {{^type.isPrimitive}} + this.{{name}}.equals(other.{{name}}) + {{/type.isPrimitive}} + {{/required}} + {{^required}} {{TYPES.Java.Util.Objects}}.equals(this.{{name}}, other.{{name}}) - {{/isUnboxedPrimitive}} + {{/required}} {{^-last}} && {{/-last}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldNullability.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldNullability.mustache new file mode 100644 index 0000000000..f9739563bb --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldNullability.mustache @@ -0,0 +1,13 @@ +{{#type.isListOrMap}} + @{{TYPES.Javax.Annotation.Nonnull}} +{{/type.isListOrMap}} +{{^type.isListOrMap}} + {{#required}} + {{^type.isPrimitive}} + @{{TYPES.Javax.Annotation.Nonnull}} + {{/type.isPrimitive}} + {{/required}} + {{^required}} + @{{TYPES.Javax.Annotation.Nullable}} + {{/required}} +{{/type.isListOrMap}} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache index bd320a391b..7e3bea7471 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Fields.mustache @@ -3,10 +3,6 @@ {{/-first}} {{#deprecation}}@Deprecated{{/deprecation}} -{{^required}} -{{^type.isListOrMap}} - @{{TYPES.Javax.Annotation.Nullable}} -{{/type.isListOrMap}} -{{/required}} + {{>ObjectShape/FieldNullability}} private final {{type}} {{name}}; {{/fields}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Getters.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Getters.mustache index 61fea36e57..b9742a7b13 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Getters.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Getters.mustache @@ -2,11 +2,7 @@ {{>ObjectShape/FieldDoc/Basic}} {{#deprecation}}@Deprecated{{/deprecation}} - {{^required}} - {{^type.isListOrMap}} - @{{TYPES.Javax.Annotation.Nullable}} - {{/type.isListOrMap}} - {{/required}} + {{>ObjectShape/FieldNullability}} public final {{type}} {{name}}() { return this.{{name}}; } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache index 5418321cc6..d14479eb81 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/HashCode.mustache @@ -6,17 +6,18 @@ int result = 17; {{/extendsOtherShape}} {{#fields}} - {{#isUnboxedPrimitive}} - result = 31 * result + {{getBoxedType}}.hashCode(this.{{name}}); - {{/isUnboxedPrimitive}} - {{^isUnboxedPrimitive}} - {{#isRequired}} - result = 31 * result + this.{{name}}.hashCode(); - {{/isRequired}} - {{^isRequired}} - result = 31 * result + {{TYPES.Java.Util.Objects}}.hashCode(this.{{name}}); - {{/isRequired}} - {{/isUnboxedPrimitive}} + result = 31 * result + + {{#required}} + {{#type.isPrimitive}} + {{type.boxed}}.hashCode(this.{{name}}); + {{/type.isPrimitive}} + {{^type.isPrimitive}} + this.{{name}}.hashCode(); + {{/type.isPrimitive}} + {{/required}} + {{^required}} + {{TYPES.Java.Util.Objects}}.hashCode(this.{{name}}); + {{/required}} {{/fields}} return result; } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache deleted file mode 100644 index 7a368dc538..0000000000 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionEquals.mustache +++ /dev/null @@ -1,6 +0,0 @@ - public boolean equals(Object o) { - if(this == o) return true; - if(this.getClass() != o.getClass()) return false; - {{className}} other = ({{className}})o; - return this._kind().equals(other._kind()) && this._get().equals(other._get()); - } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache deleted file mode 100644 index 8cd7137529..0000000000 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/TaggedUnionHashCode.mustache +++ /dev/null @@ -1,6 +0,0 @@ - public int hashCode() { - int result = 17; - result = 31 * result + _kind.hashCode(); - result = 31 * result + _value.hashCode(); - return result; - } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache index c59a635d39..8a584d6812 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape.mustache @@ -112,8 +112,7 @@ public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> _DESERIALIZER = {{TYPES.Client.Json.JsonpDeserializer}}.lazy({{className}}::build{{className}}Deserializer); - {{>ObjectShape/TaggedUnionHashCode}} - - {{>ObjectShape/TaggedUnionEquals}} + {{>TaggedUnionShape/HashCode}} + {{>TaggedUnionShape/Equals}} } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/Equals.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/Equals.mustache new file mode 100644 index 0000000000..ece94de59b --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/Equals.mustache @@ -0,0 +1,6 @@ + public boolean equals(Object o) { + if(this == o) return true; + if(o == null || this.getClass() != o.getClass()) return false; + {{className}} other = ({{className}})o; + return {{TYPES.Java.Util.Objects}}.equals(this._kind, other._kind) && {{TYPES.Java.Util.Objects}}.equals(this._value, other._value); + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/HashCode.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/HashCode.mustache new file mode 100644 index 0000000000..eb7a1d39a1 --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/HashCode.mustache @@ -0,0 +1,6 @@ + public int hashCode() { + int result = 17; + result = 31 * result + {{TYPES.Java.Util.Objects}}.hashCode(this._kind); + result = 31 * result + {{TYPES.Java.Util.Objects}}.hashCode(this._value); + return result; + } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache index 61fb38b72b..25d0754571 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache @@ -1,7 +1,7 @@ -{{#isPrimitive}} +{{#isPotentiallyBoxedPrimitive}} {{TYPES.Client.Json.JsonpDeserializer}}.{{#toLower}}{{boxed.name}}{{/toLower}}Deserializer() -{{/isPrimitive}} -{{^isPrimitive}} +{{/isPotentiallyBoxedPrimitive}} +{{^isPotentiallyBoxedPrimitive}} {{#isList}} {{TYPES.Client.Json.JsonpDeserializer}}.arrayDeserializer({{#listValueType}}{{>Type/deserializer}}{{/listValueType}}) {{/isList}} @@ -9,6 +9,16 @@ {{TYPES.Client.Json.JsonpDeserializer}}.stringMapDeserializer({{#mapValueType}}{{>Type/deserializer}}{{/mapValueType}}) {{/isMap}} {{^isListOrMap}} - {{name}}._DESERIALIZER + {{#isNumber}} + {{TYPES.Client.Json.JsonpDeserializer}}.numberDeserializer() + {{/isNumber}} + {{^isNumber}} + {{#isString}} + {{TYPES.Client.Json.JsonpDeserializer}}.stringDeserializer() + {{/isString}} + {{^isString}} + {{name}}._DESERIALIZER + {{/isString}} + {{/isNumber}} {{/isListOrMap}} -{{/isPrimitive}} \ No newline at end of file +{{/isPotentiallyBoxedPrimitive}} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/directSerializer.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/directSerializer.mustache index f8c2fb10cd..34f4345fca 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/directSerializer.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/directSerializer.mustache @@ -10,15 +10,20 @@ } {{/type.isList}} {{^type.isListOrMap}} - {{#type.isPrimitive}} + {{#type.isPotentiallyBoxedPrimitive}} + generator.write({{value}}); + {{/type.isPotentiallyBoxedPrimitive}} + {{^type.isPotentiallyBoxedPrimitive}} {{#type.isNumber}} generator.write({{value}}.doubleValue()); {{/type.isNumber}} {{^type.isNumber}} - generator.write({{value}}); + {{#type.isString}} + generator.write({{value}}); + {{/type.isString}} + {{^type.isString}} + {{value}}.serialize(generator, mapper); + {{/type.isString}} {{/type.isNumber}} - {{/type.isPrimitive}} - {{^type.isPrimitive}} - {{value}}.serialize(generator, mapper); - {{/type.isPrimitive}} + {{/type.isPotentiallyBoxedPrimitive}} {{/type.isListOrMap}} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/queryParamify.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/queryParamify.mustache index 1abc099c55..ebdacdc7ae 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/queryParamify.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/queryParamify.mustache @@ -6,10 +6,10 @@ {{value}}.jsonValue() {{/type.isEnum}} {{^type.isEnum}} - {{#type.isPrimitive}} + {{#type.isPotentiallyBoxedPrimitive}} String.valueOf({{value}}) - {{/type.isPrimitive}} - {{^type.isPrimitive}} + {{/type.isPotentiallyBoxedPrimitive}} + {{^type.isPotentiallyBoxedPrimitive}} {{#type.isList}} {{#type.listValueType.isString}} String.join(",", {{value}}) @@ -24,6 +24,6 @@ {{^type.isList}} {{value}}._toJsonString() {{/type.isList}} - {{/type.isPrimitive}} + {{/type.isPotentiallyBoxedPrimitive}} {{/type.isEnum}} {{/type.isString}}