All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.lexmodelbuildingservice.serde.SlotDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.99
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.lexmodelbuildingservice.serde

import aws.sdk.kotlin.services.lexmodelbuildingservice.model.ObfuscationSetting
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.Slot
import aws.sdk.kotlin.services.lexmodelbuildingservice.model.SlotConstraint
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 deserializeSlotDocument(deserializer: Deserializer): Slot {
    val builder = Slot.Builder()
    val DEFAULTVALUESPEC_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("defaultValueSpec"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val OBFUSCATIONSETTING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("obfuscationSetting"))
    val PRIORITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("priority"))
    val RESPONSECARD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("responseCard"))
    val SAMPLEUTTERANCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("sampleUtterances"))
    val SLOTCONSTRAINT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("slotConstraint"))
    val SLOTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("slotType"))
    val SLOTTYPEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("slotTypeVersion"))
    val VALUEELICITATIONPROMPT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("valueElicitationPrompt"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DEFAULTVALUESPEC_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(OBFUSCATIONSETTING_DESCRIPTOR)
        field(PRIORITY_DESCRIPTOR)
        field(RESPONSECARD_DESCRIPTOR)
        field(SAMPLEUTTERANCES_DESCRIPTOR)
        field(SLOTCONSTRAINT_DESCRIPTOR)
        field(SLOTTYPE_DESCRIPTOR)
        field(SLOTTYPEVERSION_DESCRIPTOR)
        field(VALUEELICITATIONPROMPT_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                DEFAULTVALUESPEC_DESCRIPTOR.index -> builder.defaultValueSpec = deserializeSlotDefaultValueSpecDocument(deserializer)
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                OBFUSCATIONSETTING_DESCRIPTOR.index -> builder.obfuscationSetting = deserializeString().let { ObfuscationSetting.fromValue(it) }
                PRIORITY_DESCRIPTOR.index -> builder.priority = deserializeInt()
                RESPONSECARD_DESCRIPTOR.index -> builder.responseCard = deserializeString()
                SAMPLEUTTERANCES_DESCRIPTOR.index -> builder.sampleUtterances =
                    deserializer.deserializeList(SAMPLEUTTERANCES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                SLOTCONSTRAINT_DESCRIPTOR.index -> builder.slotConstraint = deserializeString().let { SlotConstraint.fromValue(it) }
                SLOTTYPE_DESCRIPTOR.index -> builder.slotType = deserializeString()
                SLOTTYPEVERSION_DESCRIPTOR.index -> builder.slotTypeVersion = deserializeString()
                VALUEELICITATIONPROMPT_DESCRIPTOR.index -> builder.valueElicitationPrompt = deserializePromptDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy