Skip to content

Commit bac198e

Browse files
committed
Added bwc checks
Signed-off-by: Owais Kazi <[email protected]>
1 parent f208b34 commit bac198e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

common/src/main/java/org/opensearch/ml/common/transport/agent/MLAgentUpdateInput.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import static org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken;
99
import static org.opensearch.ml.common.CommonValue.TENANT_ID_FIELD;
1010
import static org.opensearch.ml.common.CommonValue.VERSION_2_19_0;
11+
import static org.opensearch.ml.common.CommonValue.VERSION_3_3_0;
1112

1213
import java.io.IOException;
1314
import java.time.Instant;
@@ -108,7 +109,7 @@ public MLAgentUpdateInput(StreamInput in) throws IOException {
108109
Version streamInputVersion = in.getVersion();
109110
agentId = in.readString();
110111
name = in.readOptionalString();
111-
type = in.readOptionalString();
112+
type = streamInputVersion.onOrAfter(VERSION_3_3_0) ? in.readOptionalString() : null;
112113
description = in.readOptionalString();
113114
llmModelId = in.readOptionalString();
114115
if (in.readBoolean()) {
@@ -192,7 +193,9 @@ public void writeTo(StreamOutput out) throws IOException {
192193
Version streamOutputVersion = out.getVersion();
193194
out.writeString(agentId);
194195
out.writeOptionalString(name);
195-
out.writeOptionalString(type);
196+
if (streamOutputVersion.onOrAfter(VERSION_3_3_0)) {
197+
out.writeOptionalString(type);
198+
}
196199
out.writeOptionalString(description);
197200
out.writeOptionalString(llmModelId);
198201
if (llmParameters != null && !llmParameters.isEmpty()) {

0 commit comments

Comments
 (0)