fun requiresDocumentDeserializer()

in smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/model/knowledge/SerdeIndex.kt [58:85]


    fun requiresDocumentDeserializer(operations: List<OperationShape>): Set<Shape> {
        // All top level operation outputs and errors get an HttpDeserialize implementation.
        // Any structure or union shape that shows up as a nested member, direct or indirect (of either the operation
        // or it's errors), as well as collections of the same requires a deserializer implementation though.

        // add shapes reachable from the operational output itself
        val topLevelMembers = operations
            .filter { it.output.isPresent }
            .flatMap {
                val outputShape = model.expectShape(it.output.get())
                outputShape.members()
            }
            .map { model.expectShape(it.target) }
            .filter { it.isStructureShape || it.isUnionShape || it is CollectionShape || it.isMapShape }
            .toMutableSet()

        // add shapes reachable from operational errors
        val modeledErrors = operations
            .flatMap { it.errors }
            .flatMap { model.expectShape(it).members() }
            .map { model.expectShape(it.target) }
            .filter { it.isStructureShape || it.isUnionShape || it is CollectionShape || it.isMapShape }
            .toSet()

        topLevelMembers += modeledErrors

        return walkNestedShapesRequiringSerde(model, topLevelMembers)
    }