Server Test

Server Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9

Files changed:

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_optional_input_output_output.rs

@@ -0,1 +0,26 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_optional_input_output_output_output_output(
           3  +
    value: &crate::output::OptionalInputOutputOutput,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
           9  +
    {
          10  +
        let encoder = &mut encoder;
          11  +
        crate::protocol_serde::shape_optional_input_output_output::ser_optional_input_output_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_optional_input_output_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::OptionalInputOutputOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    if let Some(var_1) = &input.value {
          22  +
        encoder.str("value").str(var_1.as_str());
          23  +
    }
          24  +
    encoder.end();
          25  +
    Ok(())
          26  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_recursive_shapes.rs

@@ -0,1 +0,134 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_recursive_shapes_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::RecursiveShapesInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::recursive_shapes_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/cbor"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_recursive_shapes::de_recursive_shapes(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_recursive_shapes_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::RecursiveShapesOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          43  +
> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut builder = ::http::Response::builder();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_TYPE,
          50  +
            "application/cbor",
          51  +
        );
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          55  +
            "rpc-v2-cbor",
          56  +
        );
          57  +
        let http_status: u16 = 200;
          58  +
        builder = builder.status(http_status);
          59  +
        let payload =
          60  +
            crate::protocol_serde::shape_recursive_shapes_output::ser_recursive_shapes_output_output_output(&output)?
          61  +
        ;
          62  +
        let content_length = payload.len();
          63  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          64  +
            builder,
          65  +
            ::http::header::CONTENT_LENGTH,
          66  +
            content_length,
          67  +
        );
          68  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          69  +
        builder.body(body)?
          70  +
    })
          71  +
}
          72  +
          73  +
pub(crate) fn de_recursive_shapes(
          74  +
    value: &[u8],
          75  +
    mut builder: crate::input::recursive_shapes_input::Builder,
          76  +
) -> ::std::result::Result<
          77  +
    crate::input::recursive_shapes_input::Builder,
          78  +
    ::aws_smithy_cbor::decode::DeserializeError,
          79  +
> {
          80  +
    #[allow(clippy::match_single_binding)]
          81  +
    fn pair(
          82  +
        mut builder: crate::input::recursive_shapes_input::Builder,
          83  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          84  +
    ) -> ::std::result::Result<
          85  +
        crate::input::recursive_shapes_input::Builder,
          86  +
        ::aws_smithy_cbor::decode::DeserializeError,
          87  +
    > {
          88  +
        builder = match decoder.str()?.as_ref() {
          89  +
            "nested" => {
          90  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          91  +
                    Ok(builder.set_nested(
          92  +
                Some(
          93  +
                    crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(decoder)?
          94  +
                )
          95  +
            ))
          96  +
                })?
          97  +
            }
          98  +
            _ => {
          99  +
                decoder.skip()?;
         100  +
                builder
         101  +
            }
         102  +
        };
         103  +
        Ok(builder)
         104  +
    }
         105  +
         106  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         107  +
         108  +
    match decoder.map()? {
         109  +
        None => loop {
         110  +
            match decoder.datatype()? {
         111  +
                ::aws_smithy_cbor::data::Type::Break => {
         112  +
                    decoder.skip()?;
         113  +
                    break;
         114  +
                }
         115  +
                _ => {
         116  +
                    builder = pair(builder, decoder)?;
         117  +
                }
         118  +
            };
         119  +
        },
         120  +
        Some(n) => {
         121  +
            for _ in 0..n {
         122  +
                builder = pair(builder, decoder)?;
         123  +
            }
         124  +
        }
         125  +
    };
         126  +
         127  +
    if decoder.position() != value.len() {
         128  +
        return Err(
         129  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         130  +
        );
         131  +
    }
         132  +
         133  +
    Ok(builder)
         134  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_recursive_shapes_input_output_nested1.rs

@@ -0,1 +0,82 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_recursive_shapes_input_output_nested1(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::model::RecursiveShapesInputOutputNested1,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    #[allow(clippy::match_single_binding)]
           9  +
    fn pair(
          10  +
        mut builder: crate::model::recursive_shapes_input_output_nested1::Builder,
          11  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          12  +
    ) -> ::std::result::Result<
          13  +
        crate::model::recursive_shapes_input_output_nested1::Builder,
          14  +
        ::aws_smithy_cbor::decode::DeserializeError,
          15  +
    > {
          16  +
        builder = match decoder.str()?.as_ref() {
          17  +
            "foo" => {
          18  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          19  +
                    Ok(builder.set_foo(Some(decoder.string()?)))
          20  +
                })?
          21  +
            }
          22  +
            "nested" => {
          23  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          24  +
                    Ok(builder.set_nested(
          25  +
                    Some(
          26  +
                         {
          27  +
                            let v = crate::protocol_serde::shape_recursive_shapes_input_output_nested2::de_recursive_shapes_input_output_nested2(decoder)?;
          28  +
                            Box::new(v)
          29  +
                        }
          30  +
                    )
          31  +
                ))
          32  +
                })?
          33  +
            }
          34  +
            _ => {
          35  +
                decoder.skip()?;
          36  +
                builder
          37  +
            }
          38  +
        };
          39  +
        Ok(builder)
          40  +
    }
          41  +
          42  +
    let mut builder = crate::model::recursive_shapes_input_output_nested1::Builder::default();
          43  +
          44  +
    match decoder.map()? {
          45  +
        None => loop {
          46  +
            match decoder.datatype()? {
          47  +
                ::aws_smithy_cbor::data::Type::Break => {
          48  +
                    decoder.skip()?;
          49  +
                    break;
          50  +
                }
          51  +
                _ => {
          52  +
                    builder = pair(builder, decoder)?;
          53  +
                }
          54  +
            };
          55  +
        },
          56  +
        Some(n) => {
          57  +
            for _ in 0..n {
          58  +
                builder = pair(builder, decoder)?;
          59  +
            }
          60  +
        }
          61  +
    };
          62  +
    #[allow(clippy::needless_question_mark)]
          63  +
    {
          64  +
        return Ok(builder.build());
          65  +
    }
          66  +
}
          67  +
          68  +
pub fn ser_recursive_shapes_input_output_nested1(
          69  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          70  +
    #[allow(unused)] input: &crate::model::RecursiveShapesInputOutputNested1,
          71  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          72  +
    encoder.begin_map();
          73  +
    if let Some(var_1) = &input.foo {
          74  +
        encoder.str("foo").str(var_1.as_str());
          75  +
    }
          76  +
    if let Some(var_2) = &input.nested {
          77  +
        encoder.str("nested");
          78  +
        crate::protocol_serde::shape_recursive_shapes_input_output_nested2::ser_recursive_shapes_input_output_nested2(encoder, var_2 )?;
          79  +
    }
          80  +
    encoder.end();
          81  +
    Ok(())
          82  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_recursive_shapes_input_output_nested2.rs

@@ -0,1 +0,79 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_recursive_shapes_input_output_nested2(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::model::RecursiveShapesInputOutputNested2,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    #[allow(clippy::match_single_binding)]
           9  +
    fn pair(
          10  +
        mut builder: crate::model::recursive_shapes_input_output_nested2::Builder,
          11  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          12  +
    ) -> ::std::result::Result<
          13  +
        crate::model::recursive_shapes_input_output_nested2::Builder,
          14  +
        ::aws_smithy_cbor::decode::DeserializeError,
          15  +
    > {
          16  +
        builder = match decoder.str()?.as_ref() {
          17  +
            "bar" => {
          18  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          19  +
                    Ok(builder.set_bar(Some(decoder.string()?)))
          20  +
                })?
          21  +
            }
          22  +
            "recursiveMember" => {
          23  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          24  +
                    Ok(builder.set_recursive_member(
          25  +
                    Some(
          26  +
                        crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(decoder)?
          27  +
                    )
          28  +
                ))
          29  +
                })?
          30  +
            }
          31  +
            _ => {
          32  +
                decoder.skip()?;
          33  +
                builder
          34  +
            }
          35  +
        };
          36  +
        Ok(builder)
          37  +
    }
          38  +
          39  +
    let mut builder = crate::model::recursive_shapes_input_output_nested2::Builder::default();
          40  +
          41  +
    match decoder.map()? {
          42  +
        None => loop {
          43  +
            match decoder.datatype()? {
          44  +
                ::aws_smithy_cbor::data::Type::Break => {
          45  +
                    decoder.skip()?;
          46  +
                    break;
          47  +
                }
          48  +
                _ => {
          49  +
                    builder = pair(builder, decoder)?;
          50  +
                }
          51  +
            };
          52  +
        },
          53  +
        Some(n) => {
          54  +
            for _ in 0..n {
          55  +
                builder = pair(builder, decoder)?;
          56  +
            }
          57  +
        }
          58  +
    };
          59  +
    #[allow(clippy::needless_question_mark)]
          60  +
    {
          61  +
        return Ok(builder.build());
          62  +
    }
          63  +
}
          64  +
          65  +
pub fn ser_recursive_shapes_input_output_nested2(
          66  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          67  +
    #[allow(unused)] input: &crate::model::RecursiveShapesInputOutputNested2,
          68  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          69  +
    encoder.begin_map();
          70  +
    if let Some(var_1) = &input.bar {
          71  +
        encoder.str("bar").str(var_1.as_str());
          72  +
    }
          73  +
    if let Some(var_2) = &input.recursive_member {
          74  +
        encoder.str("recursiveMember");
          75  +
        crate::protocol_serde::shape_recursive_shapes_input_output_nested1::ser_recursive_shapes_input_output_nested1(encoder, var_2 )?;
          76  +
    }
          77  +
    encoder.end();
          78  +
    Ok(())
          79  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_recursive_shapes_output.rs

@@ -0,1 +0,29 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_recursive_shapes_output_output_output(
           3  +
    value: &crate::output::RecursiveShapesOutput,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
           9  +
    {
          10  +
        let encoder = &mut encoder;
          11  +
        crate::protocol_serde::shape_recursive_shapes_output::ser_recursive_shapes_output_output(
          12  +
            encoder, value,
          13  +
        )?;
          14  +
    }
          15  +
    ::std::result::Result::Ok(encoder.into_writer())
          16  +
}
          17  +
          18  +
pub fn ser_recursive_shapes_output_output(
          19  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          20  +
    #[allow(unused)] input: &crate::output::RecursiveShapesOutput,
          21  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    encoder.begin_map();
          23  +
    if let Some(var_1) = &input.nested {
          24  +
        encoder.str("nested");
          25  +
        crate::protocol_serde::shape_recursive_shapes_input_output_nested1::ser_recursive_shapes_input_output_nested1(encoder, var_1 )?;
          26  +
    }
          27  +
    encoder.end();
          28  +
    Ok(())
          29  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_rpc_v2_cbor_dense_maps.rs

@@ -0,1 +0,205 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_rpc_v2_cbor_dense_maps_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::RpcV2CborDenseMapsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::rpc_v2_cbor_dense_maps_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/cbor"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_rpc_v2_cbor_dense_maps::de_rpc_v2_cbor_dense_maps(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()?
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_rpc_v2_cbor_dense_maps_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::RpcV2CborDenseMapsOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          43  +
> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut builder = ::http::Response::builder();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_TYPE,
          50  +
            "application/cbor",
          51  +
        );
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          55  +
            "rpc-v2-cbor",
          56  +
        );
          57  +
        let http_status: u16 = 200;
          58  +
        builder = builder.status(http_status);
          59  +
        let payload =
          60  +
            crate::protocol_serde::shape_rpc_v2_cbor_dense_maps_output::ser_rpc_v2_cbor_dense_maps_output_output_output(&output)?
          61  +
        ;
          62  +
        let content_length = payload.len();
          63  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          64  +
            builder,
          65  +
            ::http::header::CONTENT_LENGTH,
          66  +
            content_length,
          67  +
        );
          68  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          69  +
        builder.body(body)?
          70  +
    })
          71  +
}
          72  +
          73  +
#[allow(clippy::unnecessary_wraps)]
          74  +
pub fn ser_rpc_v2_cbor_dense_maps_http_error(
          75  +
    error: &crate::error::RpcV2CborDenseMapsError,
          76  +
) -> std::result::Result<
          77  +
    ::aws_smithy_legacy_http_server::response::Response,
          78  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          79  +
> {
          80  +
    Ok({
          81  +
        match error {
          82  +
            crate::error::RpcV2CborDenseMapsError::ValidationException(output) => {
          83  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          84  +
                #[allow(unused_mut)]
          85  +
                let mut builder = ::http::Response::builder();
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
                    builder,
          88  +
                    ::http::header::CONTENT_TYPE,
          89  +
                    "application/cbor",
          90  +
                );
          91  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          92  +
                    builder,
          93  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          94  +
                    "rpc-v2-cbor",
          95  +
                );
          96  +
                let content_length = payload.len();
          97  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          98  +
                    builder,
          99  +
                    ::http::header::CONTENT_LENGTH,
         100  +
                    content_length,
         101  +
                );
         102  +
                builder
         103  +
                    .status(400)
         104  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         105  +
            }
         106  +
        }
         107  +
    })
         108  +
}
         109  +
         110  +
pub(crate) fn de_rpc_v2_cbor_dense_maps(
         111  +
    value: &[u8],
         112  +
    mut builder: crate::input::rpc_v2_cbor_dense_maps_input::Builder,
         113  +
) -> ::std::result::Result<
         114  +
    crate::input::rpc_v2_cbor_dense_maps_input::Builder,
         115  +
    ::aws_smithy_cbor::decode::DeserializeError,
         116  +
> {
         117  +
    #[allow(clippy::match_single_binding)]
         118  +
    fn pair(
         119  +
        mut builder: crate::input::rpc_v2_cbor_dense_maps_input::Builder,
         120  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         121  +
    ) -> ::std::result::Result<
         122  +
        crate::input::rpc_v2_cbor_dense_maps_input::Builder,
         123  +
        ::aws_smithy_cbor::decode::DeserializeError,
         124  +
    > {
         125  +
        builder = match decoder.str()?.as_ref() {
         126  +
            "denseStructMap" => {
         127  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         128  +
                    Ok(builder.set_dense_struct_map(Some(
         129  +
                        crate::protocol_serde::shape_dense_struct_map::de_dense_struct_map(
         130  +
                            decoder,
         131  +
                        )?,
         132  +
                    )))
         133  +
                })?
         134  +
            }
         135  +
            "denseNumberMap" => {
         136  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         137  +
                    Ok(builder.set_dense_number_map(Some(
         138  +
                        crate::protocol_serde::shape_dense_number_map::de_dense_number_map(
         139  +
                            decoder,
         140  +
                        )?,
         141  +
                    )))
         142  +
                })?
         143  +
            }
         144  +
            "denseBooleanMap" => {
         145  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         146  +
                    Ok(builder.set_dense_boolean_map(Some(
         147  +
                        crate::protocol_serde::shape_dense_boolean_map::de_dense_boolean_map(
         148  +
                            decoder,
         149  +
                        )?,
         150  +
                    )))
         151  +
                })?
         152  +
            }
         153  +
            "denseStringMap" => {
         154  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         155  +
                    Ok(builder.set_dense_string_map(Some(
         156  +
                        crate::protocol_serde::shape_dense_string_map::de_dense_string_map(
         157  +
                            decoder,
         158  +
                        )?,
         159  +
                    )))
         160  +
                })?
         161  +
            }
         162  +
            "denseSetMap" => {
         163  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         164  +
                    Ok(builder.set_dense_set_map(Some(
         165  +
                        crate::protocol_serde::shape_dense_set_map::de_dense_set_map(decoder)?,
         166  +
                    )))
         167  +
                })?
         168  +
            }
         169  +
            _ => {
         170  +
                decoder.skip()?;
         171  +
                builder
         172  +
            }
         173  +
        };
         174  +
        Ok(builder)
         175  +
    }
         176  +
         177  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         178  +
         179  +
    match decoder.map()? {
         180  +
        None => loop {
         181  +
            match decoder.datatype()? {
         182  +
                ::aws_smithy_cbor::data::Type::Break => {
         183  +
                    decoder.skip()?;
         184  +
                    break;
         185  +
                }
         186  +
                _ => {
         187  +
                    builder = pair(builder, decoder)?;
         188  +
                }
         189  +
            };
         190  +
        },
         191  +
        Some(n) => {
         192  +
            for _ in 0..n {
         193  +
                builder = pair(builder, decoder)?;
         194  +
            }
         195  +
        }
         196  +
    };
         197  +
         198  +
    if decoder.position() != value.len() {
         199  +
        return Err(
         200  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         201  +
        );
         202  +
    }
         203  +
         204  +
    Ok(builder)
         205  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_rpc_v2_cbor_dense_maps_output.rs

@@ -0,1 +0,77 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_rpc_v2_cbor_dense_maps_output_output_output(
           3  +
    value: &crate::output::RpcV2CborDenseMapsOutput,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
           9  +
    {
          10  +
        let encoder = &mut encoder;
          11  +
        crate::protocol_serde::shape_rpc_v2_cbor_dense_maps_output::ser_rpc_v2_cbor_dense_maps_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_rpc_v2_cbor_dense_maps_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::RpcV2CborDenseMapsOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    if let Some(var_1) = &input.dense_struct_map {
          22  +
        encoder.str("denseStructMap");
          23  +
        encoder.map((*var_1).len());
          24  +
        for (key_2, value_3) in var_1 {
          25  +
            {
          26  +
                encoder.str(key_2.as_str());
          27  +
                crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(
          28  +
                    encoder, value_3,
          29  +
                )?;
          30  +
            }
          31  +
        }
          32  +
    }
          33  +
    if let Some(var_4) = &input.dense_number_map {
          34  +
        encoder.str("denseNumberMap");
          35  +
        encoder.map((*var_4).len());
          36  +
        for (key_5, value_6) in var_4 {
          37  +
            {
          38  +
                encoder.str(key_5.as_str()).integer(*value_6);
          39  +
            }
          40  +
        }
          41  +
    }
          42  +
    if let Some(var_7) = &input.dense_boolean_map {
          43  +
        encoder.str("denseBooleanMap");
          44  +
        encoder.map((*var_7).len());
          45  +
        for (key_8, value_9) in var_7 {
          46  +
            {
          47  +
                encoder.str(key_8.as_str()).boolean(*value_9);
          48  +
            }
          49  +
        }
          50  +
    }
          51  +
    if let Some(var_10) = &input.dense_string_map {
          52  +
        encoder.str("denseStringMap");
          53  +
        encoder.map((*var_10).len());
          54  +
        for (key_11, value_12) in var_10 {
          55  +
            {
          56  +
                encoder.str(key_11.as_str()).str(value_12.as_str());
          57  +
            }
          58  +
        }
          59  +
    }
          60  +
    if let Some(var_13) = &input.dense_set_map {
          61  +
        encoder.str("denseSetMap");
          62  +
        encoder.map((*var_13).len());
          63  +
        for (key_14, value_15) in var_13 {
          64  +
            {
          65  +
                encoder.str(key_14.as_str());
          66  +
                encoder.array((value_15.0).len());
          67  +
                for item_16 in &value_15.0 {
          68  +
                    {
          69  +
                        encoder.str(item_16.as_str());
          70  +
                    }
          71  +
                }
          72  +
            }
          73  +
        }
          74  +
    }
          75  +
    encoder.end();
          76  +
    Ok(())
          77  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_rpc_v2_cbor_lists.rs

@@ -0,1 +0,236 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_rpc_v2_cbor_lists_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::RpcV2CborListsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::rpc_v2_cbor_lists_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/cbor"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_rpc_v2_cbor_lists::de_rpc_v2_cbor_lists(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()?
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_rpc_v2_cbor_lists_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::RpcV2CborListsOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          43  +
> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut builder = ::http::Response::builder();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_TYPE,
          50  +
            "application/cbor",
          51  +
        );
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          55  +
            "rpc-v2-cbor",
          56  +
        );
          57  +
        let http_status: u16 = 200;
          58  +
        builder = builder.status(http_status);
          59  +
        let payload =
          60  +
            crate::protocol_serde::shape_rpc_v2_cbor_lists_output::ser_rpc_v2_cbor_lists_output_output_output(&output)?
          61  +
        ;
          62  +
        let content_length = payload.len();
          63  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          64  +
            builder,
          65  +
            ::http::header::CONTENT_LENGTH,
          66  +
            content_length,
          67  +
        );
          68  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          69  +
        builder.body(body)?
          70  +
    })
          71  +
}
          72  +
          73  +
#[allow(clippy::unnecessary_wraps)]
          74  +
pub fn ser_rpc_v2_cbor_lists_http_error(
          75  +
    error: &crate::error::RpcV2CborListsError,
          76  +
) -> std::result::Result<
          77  +
    ::aws_smithy_legacy_http_server::response::Response,
          78  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          79  +
> {
          80  +
    Ok({
          81  +
        match error {
          82  +
            crate::error::RpcV2CborListsError::ValidationException(output) => {
          83  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          84  +
                #[allow(unused_mut)]
          85  +
                let mut builder = ::http::Response::builder();
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
                    builder,
          88  +
                    ::http::header::CONTENT_TYPE,
          89  +
                    "application/cbor",
          90  +
                );
          91  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          92  +
                    builder,
          93  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          94  +
                    "rpc-v2-cbor",
          95  +
                );
          96  +
                let content_length = payload.len();
          97  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          98  +
                    builder,
          99  +
                    ::http::header::CONTENT_LENGTH,
         100  +
                    content_length,
         101  +
                );
         102  +
                builder
         103  +
                    .status(400)
         104  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         105  +
            }
         106  +
        }
         107  +
    })
         108  +
}
         109  +
         110  +
pub(crate) fn de_rpc_v2_cbor_lists(
         111  +
    value: &[u8],
         112  +
    mut builder: crate::input::rpc_v2_cbor_lists_input::Builder,
         113  +
) -> ::std::result::Result<
         114  +
    crate::input::rpc_v2_cbor_lists_input::Builder,
         115  +
    ::aws_smithy_cbor::decode::DeserializeError,
         116  +
> {
         117  +
    #[allow(clippy::match_single_binding)]
         118  +
    fn pair(
         119  +
        mut builder: crate::input::rpc_v2_cbor_lists_input::Builder,
         120  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         121  +
    ) -> ::std::result::Result<
         122  +
        crate::input::rpc_v2_cbor_lists_input::Builder,
         123  +
        ::aws_smithy_cbor::decode::DeserializeError,
         124  +
    > {
         125  +
        builder = match decoder.str()?.as_ref() {
         126  +
            "stringList" => {
         127  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         128  +
                    Ok(builder.set_string_list(Some(
         129  +
                        crate::protocol_serde::shape_string_list::de_string_list(decoder)?,
         130  +
                    )))
         131  +
                })?
         132  +
            }
         133  +
            "stringSet" => {
         134  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         135  +
                    Ok(builder.set_string_set(Some(
         136  +
                        crate::protocol_serde::shape_string_set::de_string_set(decoder)?,
         137  +
                    )))
         138  +
                })?
         139  +
            }
         140  +
            "integerList" => {
         141  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         142  +
                    Ok(builder.set_integer_list(Some(
         143  +
                        crate::protocol_serde::shape_integer_list::de_integer_list(decoder)?,
         144  +
                    )))
         145  +
                })?
         146  +
            }
         147  +
            "booleanList" => {
         148  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         149  +
                    Ok(builder.set_boolean_list(Some(
         150  +
                        crate::protocol_serde::shape_boolean_list::de_boolean_list(decoder)?,
         151  +
                    )))
         152  +
                })?
         153  +
            }
         154  +
            "timestampList" => {
         155  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         156  +
                    Ok(builder.set_timestamp_list(Some(
         157  +
                        crate::protocol_serde::shape_timestamp_list::de_timestamp_list(decoder)?,
         158  +
                    )))
         159  +
                })?
         160  +
            }
         161  +
            "enumList" => {
         162  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         163  +
                    Ok(builder.set_enum_list(Some(
         164  +
                        crate::protocol_serde::shape_foo_enum_list::de_foo_enum_list(decoder)?,
         165  +
                    )))
         166  +
                })?
         167  +
            }
         168  +
            "intEnumList" => {
         169  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         170  +
                    Ok(builder.set_int_enum_list(Some(
         171  +
                        crate::protocol_serde::shape_integer_enum_list::de_integer_enum_list(
         172  +
                            decoder,
         173  +
                        )?,
         174  +
                    )))
         175  +
                })?
         176  +
            }
         177  +
            "nestedStringList" => {
         178  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         179  +
                    Ok(builder.set_nested_string_list(Some(
         180  +
                        crate::protocol_serde::shape_nested_string_list::de_nested_string_list(
         181  +
                            decoder,
         182  +
                        )?,
         183  +
                    )))
         184  +
                })?
         185  +
            }
         186  +
            "structureList" => {
         187  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         188  +
                    Ok(builder.set_structure_list(Some(
         189  +
                        crate::protocol_serde::shape_structure_list::de_structure_list(decoder)?,
         190  +
                    )))
         191  +
                })?
         192  +
            }
         193  +
            "blobList" => {
         194  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         195  +
                    Ok(builder.set_blob_list(Some(
         196  +
                        crate::protocol_serde::shape_blob_list::de_blob_list(decoder)?,
         197  +
                    )))
         198  +
                })?
         199  +
            }
         200  +
            _ => {
         201  +
                decoder.skip()?;
         202  +
                builder
         203  +
            }
         204  +
        };
         205  +
        Ok(builder)
         206  +
    }
         207  +
         208  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         209  +
         210  +
    match decoder.map()? {
         211  +
        None => loop {
         212  +
            match decoder.datatype()? {
         213  +
                ::aws_smithy_cbor::data::Type::Break => {
         214  +
                    decoder.skip()?;
         215  +
                    break;
         216  +
                }
         217  +
                _ => {
         218  +
                    builder = pair(builder, decoder)?;
         219  +
                }
         220  +
            };
         221  +
        },
         222  +
        Some(n) => {
         223  +
            for _ in 0..n {
         224  +
                builder = pair(builder, decoder)?;
         225  +
            }
         226  +
        }
         227  +
    };
         228  +
         229  +
    if decoder.position() != value.len() {
         230  +
        return Err(
         231  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         232  +
        );
         233  +
    }
         234  +
         235  +
    Ok(builder)
         236  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_rpc_v2_cbor_lists_output.rs

@@ -0,1 +0,122 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_rpc_v2_cbor_lists_output_output_output(
           3  +
    value: &crate::output::RpcV2CborListsOutput,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
           9  +
    {
          10  +
        let encoder = &mut encoder;
          11  +
        crate::protocol_serde::shape_rpc_v2_cbor_lists_output::ser_rpc_v2_cbor_lists_output_output(
          12  +
            encoder, value,
          13  +
        )?;
          14  +
    }
          15  +
    ::std::result::Result::Ok(encoder.into_writer())
          16  +
}
          17  +
          18  +
pub fn ser_rpc_v2_cbor_lists_output_output(
          19  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          20  +
    #[allow(unused)] input: &crate::output::RpcV2CborListsOutput,
          21  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    encoder.begin_map();
          23  +
    if let Some(var_1) = &input.string_list {
          24  +
        encoder.str("stringList");
          25  +
        encoder.array((*var_1).len());
          26  +
        for item_2 in var_1 {
          27  +
            {
          28  +
                encoder.str(item_2.as_str());
          29  +
            }
          30  +
        }
          31  +
    }
          32  +
    if let Some(var_3) = &input.string_set {
          33  +
        encoder.str("stringSet");
          34  +
        encoder.array((var_3.0).len());
          35  +
        for item_4 in &var_3.0 {
          36  +
            {
          37  +
                encoder.str(item_4.as_str());
          38  +
            }
          39  +
        }
          40  +
    }
          41  +
    if let Some(var_5) = &input.integer_list {
          42  +
        encoder.str("integerList");
          43  +
        encoder.array((*var_5).len());
          44  +
        for item_6 in var_5 {
          45  +
            {
          46  +
                encoder.integer(*item_6);
          47  +
            }
          48  +
        }
          49  +
    }
          50  +
    if let Some(var_7) = &input.boolean_list {
          51  +
        encoder.str("booleanList");
          52  +
        encoder.array((*var_7).len());
          53  +
        for item_8 in var_7 {
          54  +
            {
          55  +
                encoder.boolean(*item_8);
          56  +
            }
          57  +
        }
          58  +
    }
          59  +
    if let Some(var_9) = &input.timestamp_list {
          60  +
        encoder.str("timestampList");
          61  +
        encoder.array((*var_9).len());
          62  +
        for item_10 in var_9 {
          63  +
            {
          64  +
                encoder.timestamp(item_10);
          65  +
            }
          66  +
        }
          67  +
    }
          68  +
    if let Some(var_11) = &input.enum_list {
          69  +
        encoder.str("enumList");
          70  +
        encoder.array((*var_11).len());
          71  +
        for item_12 in var_11 {
          72  +
            {
          73  +
                encoder.str(item_12.as_str());
          74  +
            }
          75  +
        }
          76  +
    }
          77  +
    if let Some(var_13) = &input.int_enum_list {
          78  +
        encoder.str("intEnumList");
          79  +
        encoder.array((*var_13).len());
          80  +
        for item_14 in var_13 {
          81  +
            {
          82  +
                encoder.integer(*item_14);
          83  +
            }
          84  +
        }
          85  +
    }
          86  +
    if let Some(var_15) = &input.nested_string_list {
          87  +
        encoder.str("nestedStringList");
          88  +
        encoder.array((*var_15).len());
          89  +
        for item_16 in var_15 {
          90  +
            {
          91  +
                encoder.array((*item_16).len());
          92  +
                for item_17 in item_16 {
          93  +
                    {
          94  +
                        encoder.str(item_17.as_str());
          95  +
                    }
          96  +
                }
          97  +
            }
          98  +
        }
          99  +
    }
         100  +
    if let Some(var_18) = &input.structure_list {
         101  +
        encoder.str("structureList");
         102  +
        encoder.array((*var_18).len());
         103  +
        for item_19 in var_18 {
         104  +
            {
         105  +
                crate::protocol_serde::shape_structure_list_member::ser_structure_list_member(
         106  +
                    encoder, item_19,
         107  +
                )?;
         108  +
            }
         109  +
        }
         110  +
    }
         111  +
    if let Some(var_20) = &input.blob_list {
         112  +
        encoder.str("blobList");
         113  +
        encoder.array((*var_20).len());
         114  +
        for item_21 in var_20 {
         115  +
            {
         116  +
                encoder.blob(item_21);
         117  +
            }
         118  +
        }
         119  +
    }
         120  +
    encoder.end();
         121  +
    Ok(())
         122  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_rpc_v2_cbor_sparse_maps.rs

@@ -0,1 +0,206 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_rpc_v2_cbor_sparse_maps_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::RpcV2CborSparseMapsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::rpc_v2_cbor_sparse_maps_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/cbor"),
          27  +
            )?;
          28  +
            input =
          29  +
                crate::protocol_serde::shape_rpc_v2_cbor_sparse_maps::de_rpc_v2_cbor_sparse_maps(
          30  +
                    bytes.as_ref(),
          31  +
                    input,
          32  +
                )?;
          33  +
        }
          34  +
        input.build()?
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn ser_rpc_v2_cbor_sparse_maps_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::RpcV2CborSparseMapsOutput,
          41  +
) -> std::result::Result<
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          44  +
> {
          45  +
    Ok({
          46  +
        #[allow(unused_mut)]
          47  +
        let mut builder = ::http::Response::builder();
          48  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          49  +
            builder,
          50  +
            ::http::header::CONTENT_TYPE,
          51  +
            "application/cbor",
          52  +
        );
          53  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          54  +
            builder,
          55  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          56  +
            "rpc-v2-cbor",
          57  +
        );
          58  +
        let http_status: u16 = 200;
          59  +
        builder = builder.status(http_status);
          60  +
        let payload =
          61  +
            crate::protocol_serde::shape_rpc_v2_cbor_sparse_maps_output::ser_rpc_v2_cbor_sparse_maps_output_output_output(&output)?
          62  +
        ;
          63  +
        let content_length = payload.len();
          64  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          65  +
            builder,
          66  +
            ::http::header::CONTENT_LENGTH,
          67  +
            content_length,
          68  +
        );
          69  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          70  +
        builder.body(body)?
          71  +
    })
          72  +
}
          73  +
          74  +
#[allow(clippy::unnecessary_wraps)]
          75  +
pub fn ser_rpc_v2_cbor_sparse_maps_http_error(
          76  +
    error: &crate::error::RpcV2CborSparseMapsError,
          77  +
) -> std::result::Result<
          78  +
    ::aws_smithy_legacy_http_server::response::Response,
          79  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          80  +
> {
          81  +
    Ok({
          82  +
        match error {
          83  +
            crate::error::RpcV2CborSparseMapsError::ValidationException(output) => {
          84  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          85  +
                #[allow(unused_mut)]
          86  +
                let mut builder = ::http::Response::builder();
          87  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          88  +
                    builder,
          89  +
                    ::http::header::CONTENT_TYPE,
          90  +
                    "application/cbor",
          91  +
                );
          92  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          93  +
                    builder,
          94  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          95  +
                    "rpc-v2-cbor",
          96  +
                );
          97  +
                let content_length = payload.len();
          98  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          99  +
                    builder,
         100  +
                    ::http::header::CONTENT_LENGTH,
         101  +
                    content_length,
         102  +
                );
         103  +
                builder
         104  +
                    .status(400)
         105  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         106  +
            }
         107  +
        }
         108  +
    })
         109  +
}
         110  +
         111  +
pub(crate) fn de_rpc_v2_cbor_sparse_maps(
         112  +
    value: &[u8],
         113  +
    mut builder: crate::input::rpc_v2_cbor_sparse_maps_input::Builder,
         114  +
) -> ::std::result::Result<
         115  +
    crate::input::rpc_v2_cbor_sparse_maps_input::Builder,
         116  +
    ::aws_smithy_cbor::decode::DeserializeError,
         117  +
> {
         118  +
    #[allow(clippy::match_single_binding)]
         119  +
    fn pair(
         120  +
        mut builder: crate::input::rpc_v2_cbor_sparse_maps_input::Builder,
         121  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         122  +
    ) -> ::std::result::Result<
         123  +
        crate::input::rpc_v2_cbor_sparse_maps_input::Builder,
         124  +
        ::aws_smithy_cbor::decode::DeserializeError,
         125  +
    > {
         126  +
        builder = match decoder.str()?.as_ref() {
         127  +
            "sparseStructMap" => {
         128  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         129  +
                    Ok(builder.set_sparse_struct_map(Some(
         130  +
                        crate::protocol_serde::shape_sparse_struct_map::de_sparse_struct_map(
         131  +
                            decoder,
         132  +
                        )?,
         133  +
                    )))
         134  +
                })?
         135  +
            }
         136  +
            "sparseNumberMap" => {
         137  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         138  +
                    Ok(builder.set_sparse_number_map(Some(
         139  +
                        crate::protocol_serde::shape_sparse_number_map::de_sparse_number_map(
         140  +
                            decoder,
         141  +
                        )?,
         142  +
                    )))
         143  +
                })?
         144  +
            }
         145  +
            "sparseBooleanMap" => {
         146  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         147  +
                    Ok(builder.set_sparse_boolean_map(Some(
         148  +
                        crate::protocol_serde::shape_sparse_boolean_map::de_sparse_boolean_map(
         149  +
                            decoder,
         150  +
                        )?,
         151  +
                    )))
         152  +
                })?
         153  +
            }
         154  +
            "sparseStringMap" => {
         155  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         156  +
                    Ok(builder.set_sparse_string_map(Some(
         157  +
                        crate::protocol_serde::shape_sparse_string_map::de_sparse_string_map(
         158  +
                            decoder,
         159  +
                        )?,
         160  +
                    )))
         161  +
                })?
         162  +
            }
         163  +
            "sparseSetMap" => {
         164  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         165  +
                    Ok(builder.set_sparse_set_map(Some(
         166  +
                        crate::protocol_serde::shape_sparse_set_map::de_sparse_set_map(decoder)?,
         167  +
                    )))
         168  +
                })?
         169  +
            }
         170  +
            _ => {
         171  +
                decoder.skip()?;
         172  +
                builder
         173  +
            }
         174  +
        };
         175  +
        Ok(builder)
         176  +
    }
         177  +
         178  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         179  +
         180  +
    match decoder.map()? {
         181  +
        None => loop {
         182  +
            match decoder.datatype()? {
         183  +
                ::aws_smithy_cbor::data::Type::Break => {
         184  +
                    decoder.skip()?;
         185  +
                    break;
         186  +
                }
         187  +
                _ => {
         188  +
                    builder = pair(builder, decoder)?;
         189  +
                }
         190  +
            };
         191  +
        },
         192  +
        Some(n) => {
         193  +
            for _ in 0..n {
         194  +
                builder = pair(builder, decoder)?;
         195  +
            }
         196  +
        }
         197  +
    };
         198  +
         199  +
    if decoder.position() != value.len() {
         200  +
        return Err(
         201  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         202  +
        );
         203  +
    }
         204  +
         205  +
    Ok(builder)
         206  +
}