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

commonMain.aws.sdk.kotlin.services.glue.serde.MappingDocumentDeserializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.glue.serde

import aws.sdk.kotlin.services.glue.model.Mapping
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 deserializeMappingDocument(deserializer: Deserializer): Mapping {
    val builder = Mapping.Builder()
    val CHILDREN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Children"))
    val DROPPED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("Dropped"))
    val FROMPATH_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("FromPath"))
    val FROMTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FromType"))
    val TOKEY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ToKey"))
    val TOTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ToType"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CHILDREN_DESCRIPTOR)
        field(DROPPED_DESCRIPTOR)
        field(FROMPATH_DESCRIPTOR)
        field(FROMTYPE_DESCRIPTOR)
        field(TOKEY_DESCRIPTOR)
        field(TOTYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CHILDREN_DESCRIPTOR.index -> builder.children =
                    deserializer.deserializeList(CHILDREN_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeMappingDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                DROPPED_DESCRIPTOR.index -> builder.dropped = deserializeBoolean()
                FROMPATH_DESCRIPTOR.index -> builder.fromPath =
                    deserializer.deserializeList(FROMPATH_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                FROMTYPE_DESCRIPTOR.index -> builder.fromType = deserializeString()
                TOKEY_DESCRIPTOR.index -> builder.toKey = deserializeString()
                TOTYPE_DESCRIPTOR.index -> builder.toType = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy