commonMain.aws.sdk.kotlin.services.bedrockagent.serde.FlowNodeDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockagent.serde
import aws.sdk.kotlin.services.bedrockagent.model.FlowNode
import aws.sdk.kotlin.services.bedrockagent.model.FlowNodeInput
import aws.sdk.kotlin.services.bedrockagent.model.FlowNodeOutput
import aws.sdk.kotlin.services.bedrockagent.model.FlowNodeType
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import kotlin.collections.mutableListOf
internal fun deserializeFlowNodeDocument(deserializer: Deserializer): FlowNode {
val builder = FlowNode.Builder()
val CONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("configuration"))
val INPUTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("inputs"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val OUTPUTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("outputs"))
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("type"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CONFIGURATION_DESCRIPTOR)
field(INPUTS_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(OUTPUTS_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CONFIGURATION_DESCRIPTOR.index -> builder.configuration = deserializeFlowNodeConfigurationDocument(deserializer)
INPUTS_DESCRIPTOR.index -> builder.inputs =
deserializer.deserializeList(INPUTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeFlowNodeInputDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
OUTPUTS_DESCRIPTOR.index -> builder.outputs =
deserializer.deserializeList(OUTPUTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeFlowNodeOutputDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { FlowNodeType.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}