Unverified Commit 7e6f2c97 authored by david-perez's avatar david-perez Committed by GitHub
Browse files

Remove parameter from `Protocol`s `structuredDataParser`, `structuredDataSerializer` (#2536)

No implementation of the `Protocol` interface makes use of the
`OperationShape` parameter in the `structuredDataParser` and
`structuredDataSerializer` methods.
parent 8bc93fc0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ class ProtocolParserGenerator(
        customizations: List<OperationCustomization>,
    ) {
        val httpBindingGenerator = ResponseBindingGenerator(protocol, codegenContext, operationShape)
        val structuredDataParser = protocol.structuredDataParser(operationShape)
        val structuredDataParser = protocol.structuredDataParser()
        Attribute.AllowUnusedMut.render(this)
        rust("let mut output = #T::default();", symbolProvider.symbolForBuilder(outputShape))
        if (outputShape.id == operationShape.output.get()) {
+3 −4
Original line number Diff line number Diff line
@@ -143,15 +143,14 @@ open class AwsJson(
    override fun additionalRequestHeaders(operationShape: OperationShape): List<Pair<String, String>> =
        listOf("x-amz-target" to "${codegenContext.serviceShape.id.name}.${operationShape.id.name}")

    override fun structuredDataParser(operationShape: OperationShape): StructuredDataParserGenerator {
        return JsonParserGenerator(
    override fun structuredDataParser(): StructuredDataParserGenerator =
        JsonParserGenerator(
            codegenContext,
            httpBindingResolver,
            ::awsJsonFieldName,
        )
    }

    override fun structuredDataSerializer(operationShape: OperationShape): StructuredDataSerializerGenerator =
    override fun structuredDataSerializer(): StructuredDataSerializerGenerator =
        AwsJsonSerializerGenerator(codegenContext, httpBindingResolver)

    override fun parseHttpErrorMetadata(operationShape: OperationShape): RuntimeType =
+2 −2
Original line number Diff line number Diff line
@@ -51,10 +51,10 @@ class AwsQueryProtocol(private val codegenContext: CodegenContext) : Protocol {

    override val defaultTimestampFormat: TimestampFormatTrait.Format = TimestampFormatTrait.Format.DATE_TIME

    override fun structuredDataParser(operationShape: OperationShape): StructuredDataParserGenerator =
    override fun structuredDataParser(): StructuredDataParserGenerator =
        AwsQueryParserGenerator(codegenContext, awsQueryErrors)

    override fun structuredDataSerializer(operationShape: OperationShape): StructuredDataSerializerGenerator =
    override fun structuredDataSerializer(): StructuredDataSerializerGenerator =
        AwsQuerySerializerGenerator(codegenContext)

    override fun parseHttpErrorMetadata(operationShape: OperationShape): RuntimeType =
+4 −4
Original line number Diff line number Diff line
@@ -64,11 +64,11 @@ class AwsQueryCompatible(

    override val defaultTimestampFormat = awsJson.defaultTimestampFormat

    override fun structuredDataParser(operationShape: OperationShape): StructuredDataParserGenerator =
        awsJson.structuredDataParser(operationShape)
    override fun structuredDataParser(): StructuredDataParserGenerator =
        awsJson.structuredDataParser()

    override fun structuredDataSerializer(operationShape: OperationShape): StructuredDataSerializerGenerator =
        awsJson.structuredDataSerializer(operationShape)
    override fun structuredDataSerializer(): StructuredDataSerializerGenerator =
        awsJson.structuredDataSerializer()

    override fun parseHttpErrorMetadata(operationShape: OperationShape): RuntimeType =
        ProtocolFunctions.crossOperationFn("parse_http_error_metadata") { fnName ->
+3 −4
Original line number Diff line number Diff line
@@ -42,11 +42,10 @@ class Ec2QueryProtocol(private val codegenContext: CodegenContext) : Protocol {

    override val defaultTimestampFormat: TimestampFormatTrait.Format = TimestampFormatTrait.Format.DATE_TIME

    override fun structuredDataParser(operationShape: OperationShape): StructuredDataParserGenerator {
        return Ec2QueryParserGenerator(codegenContext, ec2QueryErrors)
    }
    override fun structuredDataParser(): StructuredDataParserGenerator =
        Ec2QueryParserGenerator(codegenContext, ec2QueryErrors)

    override fun structuredDataSerializer(operationShape: OperationShape): StructuredDataSerializerGenerator =
    override fun structuredDataSerializer(): StructuredDataSerializerGenerator =
        Ec2QuerySerializerGenerator(codegenContext)

    override fun parseHttpErrorMetadata(operationShape: OperationShape): RuntimeType =
Loading