From 0d215268815a550168a102c0a1f80dc216c30b42 Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Wed, 5 Jun 2024 18:34:30 +0000 Subject: [PATCH] fix serde of RemoteDocLevelMonitorInput (#666) Signed-off-by: Subhobrata Dey --- .../model/remote/monitors/RemoteDocLevelMonitorInput.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/opensearch/commons/alerting/model/remote/monitors/RemoteDocLevelMonitorInput.kt b/src/main/kotlin/org/opensearch/commons/alerting/model/remote/monitors/RemoteDocLevelMonitorInput.kt index fa76cf95..4d1911df 100644 --- a/src/main/kotlin/org/opensearch/commons/alerting/model/remote/monitors/RemoteDocLevelMonitorInput.kt +++ b/src/main/kotlin/org/opensearch/commons/alerting/model/remote/monitors/RemoteDocLevelMonitorInput.kt @@ -68,7 +68,10 @@ data class RemoteDocLevelMonitorInput(val input: BytesReference, val docLevelMon when (fieldName) { RemoteMonitorInput.INPUT_FIELD -> bytes = xcp.binaryValue() RemoteMonitorInput.INPUT_SIZE -> size = xcp.intValue() - Input.Type.DOCUMENT_LEVEL_INPUT.value -> docLevelMonitorInput = DocLevelMonitorInput.parse(xcp) + Input.Type.DOCUMENT_LEVEL_INPUT.value -> { + docLevelMonitorInput = DocLevelMonitorInput.parse(xcp) + XContentParserUtils.ensureExpectedToken(XContentParser.Token.END_OBJECT, xcp.nextToken(), xcp) + } } } val input = BytesReference.fromByteBuffer(ByteBuffer.wrap(bytes, 0, size))