Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5

Files changed:

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

@@ -0,1 +0,84 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) mod shape_complex_struct_operation;
           3  +
           4  +
pub(crate) mod shape_empty_struct_operation;
           5  +
           6  +
pub(crate) mod shape_error_serialization_operation;
           7  +
           8  +
pub(crate) mod shape_recursive_union_operation;
           9  +
          10  +
pub(crate) mod shape_simple_struct_operation;
          11  +
          12  +
pub(crate) mod shape_single_member_struct_operation;
          13  +
          14  +
pub(crate) mod shape_streaming_operation;
          15  +
          16  +
pub(crate) mod shape_streaming_operation_with_initial_data;
          17  +
          18  +
pub(crate) mod shape_streaming_operation_with_initial_response;
          19  +
          20  +
pub(crate) mod shape_streaming_operation_with_optional_data;
          21  +
          22  +
pub(crate) mod shape_complex_struct_operation_output;
          23  +
          24  +
pub(crate) mod shape_empty_struct_operation_output;
          25  +
          26  +
pub(crate) mod shape_error_serialization_operation_output;
          27  +
          28  +
pub(crate) mod shape_recursive_union_operation_output;
          29  +
          30  +
pub(crate) mod shape_simple_struct_operation_output;
          31  +
          32  +
pub(crate) mod shape_single_member_struct_operation_output;
          33  +
          34  +
pub(crate) mod shape_streaming_operation_input;
          35  +
          36  +
pub(crate) mod shape_streaming_operation_output;
          37  +
          38  +
pub(crate) mod shape_streaming_operation_with_initial_data_input;
          39  +
          40  +
pub(crate) mod shape_streaming_operation_with_initial_data_output;
          41  +
          42  +
pub(crate) mod shape_streaming_operation_with_initial_response_input;
          43  +
          44  +
pub(crate) mod shape_streaming_operation_with_initial_response_output;
          45  +
          46  +
pub(crate) mod shape_streaming_operation_with_optional_data_input;
          47  +
          48  +
pub(crate) mod shape_streaming_operation_with_optional_data_output;
          49  +
          50  +
pub(crate) mod shape_validation_exception;
          51  +
          52  +
pub(crate) mod shape_complex_list;
          53  +
          54  +
pub(crate) mod shape_complex_map;
          55  +
          56  +
pub(crate) mod shape_complex_union;
          57  +
          58  +
pub(crate) mod shape_empty_struct;
          59  +
          60  +
pub(crate) mod shape_events;
          61  +
          62  +
pub(crate) mod shape_recursive_operation_input_output_nested1;
          63  +
          64  +
pub(crate) mod shape_simple_list;
          65  +
          66  +
pub(crate) mod shape_simple_map;
          67  +
          68  +
pub(crate) mod shape_simple_struct;
          69  +
          70  +
pub(crate) mod shape_simple_union;
          71  +
          72  +
pub(crate) mod shape_struct_list;
          73  +
          74  +
pub(crate) mod shape_unit_union;
          75  +
          76  +
pub(crate) mod shape_complex_struct;
          77  +
          78  +
pub(crate) mod shape_event;
          79  +
          80  +
pub(crate) mod shape_foo_choice;
          81  +
          82  +
pub(crate) mod shape_recursive_operation_input_output_nested2;
          83  +
          84  +
pub(crate) mod shape_validation_exception_field;

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_complex_list.rs

@@ -0,1 +0,54 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_complex_list(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::unconstrained::complex_list_unconstrained::ComplexListUnconstrained,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    fn member(
           9  +
        mut list: crate::unconstrained::complex_list_unconstrained::ComplexListUnconstrained,
          10  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          11  +
    ) -> ::std::result::Result<
          12  +
        crate::unconstrained::complex_list_unconstrained::ComplexListUnconstrained,
          13  +
        ::aws_smithy_cbor::decode::DeserializeError,
          14  +
    > {
          15  +
        let value = match decoder.datatype()? {
          16  +
            ::aws_smithy_cbor::data::Type::Null => {
          17  +
                return ::std::result::Result::Err(
          18  +
                    ::aws_smithy_cbor::decode::DeserializeError::custom(
          19  +
                        "dense list cannot contain null values",
          20  +
                        decoder.position(),
          21  +
                    ),
          22  +
                )
          23  +
            }
          24  +
            _ => crate::protocol_serde::shape_complex_map::de_complex_map(decoder)?,
          25  +
        };
          26  +
        list.0.push(value);
          27  +
        Ok(list)
          28  +
    }
          29  +
          30  +
    let mut list = crate::unconstrained::complex_list_unconstrained::ComplexListUnconstrained(
          31  +
        ::std::vec::Vec::new(),
          32  +
    );
          33  +
          34  +
    match decoder.list()? {
          35  +
        None => loop {
          36  +
            match decoder.datatype()? {
          37  +
                ::aws_smithy_cbor::data::Type::Break => {
          38  +
                    decoder.skip()?;
          39  +
                    break;
          40  +
                }
          41  +
                _ => {
          42  +
                    list = member(list, decoder)?;
          43  +
                }
          44  +
            };
          45  +
        },
          46  +
        Some(n) => {
          47  +
            for _ in 0..n {
          48  +
                list = member(list, decoder)?;
          49  +
            }
          50  +
        }
          51  +
    };
          52  +
          53  +
    Ok(list)
          54  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_complex_map.rs

@@ -0,1 +0,55 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_complex_map(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::unconstrained::complex_map_unconstrained::ComplexMapUnconstrained,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    fn pair(
           9  +
        mut map: crate::unconstrained::complex_map_unconstrained::ComplexMapUnconstrained,
          10  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          11  +
    ) -> ::std::result::Result<
          12  +
        crate::unconstrained::complex_map_unconstrained::ComplexMapUnconstrained,
          13  +
        ::aws_smithy_cbor::decode::DeserializeError,
          14  +
    > {
          15  +
        let key = decoder.string()?;
          16  +
        let value = match decoder.datatype()? {
          17  +
            ::aws_smithy_cbor::data::Type::Null => {
          18  +
                return ::std::result::Result::Err(
          19  +
                    ::aws_smithy_cbor::decode::DeserializeError::custom(
          20  +
                        "dense map cannot contain null values",
          21  +
                        decoder.position(),
          22  +
                    ),
          23  +
                )
          24  +
            }
          25  +
            _ => crate::protocol_serde::shape_complex_union::de_complex_union(decoder)?,
          26  +
        };
          27  +
        map.0.insert(key, value);
          28  +
        Ok(map)
          29  +
    }
          30  +
          31  +
    let mut map = crate::unconstrained::complex_map_unconstrained::ComplexMapUnconstrained(
          32  +
        ::std::collections::HashMap::new(),
          33  +
    );
          34  +
          35  +
    match decoder.map()? {
          36  +
        None => loop {
          37  +
            match decoder.datatype()? {
          38  +
                ::aws_smithy_cbor::data::Type::Break => {
          39  +
                    decoder.skip()?;
          40  +
                    break;
          41  +
                }
          42  +
                _ => {
          43  +
                    map = pair(map, decoder)?;
          44  +
                }
          45  +
            };
          46  +
        },
          47  +
        Some(n) => {
          48  +
            for _ in 0..n {
          49  +
                map = pair(map, decoder)?;
          50  +
            }
          51  +
        }
          52  +
    };
          53  +
          54  +
    Ok(map)
          55  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_complex_struct.rs

@@ -0,1 +0,192 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_complex_struct(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::model::complex_struct::Builder,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    #[allow(clippy::match_single_binding)]
           9  +
    fn pair(
          10  +
        mut builder: crate::model::complex_struct::Builder,
          11  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          12  +
    ) -> ::std::result::Result<
          13  +
        crate::model::complex_struct::Builder,
          14  +
        ::aws_smithy_cbor::decode::DeserializeError,
          15  +
    > {
          16  +
        builder = match decoder.str()?.as_ref() {
          17  +
            "structure" => {
          18  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          19  +
                    Ok(builder.set_structure(Some(
          20  +
                        crate::protocol_serde::shape_simple_struct::de_simple_struct(decoder)?,
          21  +
                    )))
          22  +
                })?
          23  +
            }
          24  +
            "emptyStructure" => {
          25  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          26  +
                    Ok(builder.set_empty_structure(Some(
          27  +
                        crate::protocol_serde::shape_empty_struct::de_empty_struct(decoder)?,
          28  +
                    )))
          29  +
                })?
          30  +
            }
          31  +
            "list" => {
          32  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          33  +
                    Ok(builder.set_list(Some(
          34  +
                        crate::protocol_serde::shape_simple_list::de_simple_list(decoder)?,
          35  +
                    )))
          36  +
                })?
          37  +
            }
          38  +
            "map" => {
          39  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          40  +
                    Ok(builder.set_map(Some(
          41  +
                        crate::protocol_serde::shape_simple_map::de_simple_map(decoder)?,
          42  +
                    )))
          43  +
                })?
          44  +
            }
          45  +
            "union" => {
          46  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          47  +
                    Ok(builder.set_union(Some(
          48  +
                        crate::protocol_serde::shape_simple_union::de_simple_union(decoder)?,
          49  +
                    )))
          50  +
                })?
          51  +
            }
          52  +
            "unitUnion" => {
          53  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          54  +
                    Ok(builder.set_unit_union(Some(
          55  +
                        crate::protocol_serde::shape_unit_union::de_unit_union(decoder)?,
          56  +
                    )))
          57  +
                })?
          58  +
            }
          59  +
            "structureList" => {
          60  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          61  +
                    Ok(builder.set_structure_list(Some(
          62  +
                        crate::protocol_serde::shape_struct_list::de_struct_list(decoder)?,
          63  +
                    )))
          64  +
                })?
          65  +
            }
          66  +
            "complexList" => builder.set_complex_list(
          67  +
                crate::protocol_serde::shape_complex_list::de_complex_list(decoder)?,
          68  +
            ),
          69  +
            "complexMap" => builder.set_complex_map(
          70  +
                crate::protocol_serde::shape_complex_map::de_complex_map(decoder)?,
          71  +
            ),
          72  +
            "complexUnion" => builder.set_complex_union({
          73  +
                let v = crate::protocol_serde::shape_complex_union::de_complex_union(decoder)?;
          74  +
                let v = v.into();
          75  +
                Box::new(v)
          76  +
            }),
          77  +
            _ => {
          78  +
                decoder.skip()?;
          79  +
                builder
          80  +
            }
          81  +
        };
          82  +
        Ok(builder)
          83  +
    }
          84  +
          85  +
    let mut builder = crate::model::complex_struct::Builder::default();
          86  +
          87  +
    match decoder.map()? {
          88  +
        None => loop {
          89  +
            match decoder.datatype()? {
          90  +
                ::aws_smithy_cbor::data::Type::Break => {
          91  +
                    decoder.skip()?;
          92  +
                    break;
          93  +
                }
          94  +
                _ => {
          95  +
                    builder = pair(builder, decoder)?;
          96  +
                }
          97  +
            };
          98  +
        },
          99  +
        Some(n) => {
         100  +
            for _ in 0..n {
         101  +
                builder = pair(builder, decoder)?;
         102  +
            }
         103  +
        }
         104  +
    };
         105  +
    Ok(builder)
         106  +
}
         107  +
         108  +
pub fn ser_complex_struct(
         109  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
         110  +
    #[allow(unused)] input: &crate::model::ComplexStruct,
         111  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         112  +
    encoder.begin_map();
         113  +
    if let Some(var_1) = &input.structure {
         114  +
        encoder.str("structure");
         115  +
        crate::protocol_serde::shape_simple_struct::ser_simple_struct(encoder, var_1)?;
         116  +
    }
         117  +
    if let Some(var_2) = &input.empty_structure {
         118  +
        encoder.str("emptyStructure");
         119  +
        crate::protocol_serde::shape_empty_struct::ser_empty_struct(encoder, var_2)?;
         120  +
    }
         121  +
    if let Some(var_3) = &input.list {
         122  +
        encoder.str("list");
         123  +
        encoder.array((*var_3).len());
         124  +
        for item_4 in var_3 {
         125  +
            {
         126  +
                encoder.str(item_4.as_str());
         127  +
            }
         128  +
        }
         129  +
    }
         130  +
    if let Some(var_5) = &input.map {
         131  +
        encoder.str("map");
         132  +
        encoder.map((*var_5).len());
         133  +
        for (key_6, value_7) in var_5 {
         134  +
            {
         135  +
                encoder.str(key_6.as_str()).integer(*value_7);
         136  +
            }
         137  +
        }
         138  +
    }
         139  +
    if let Some(var_8) = &input.union {
         140  +
        encoder.str("union");
         141  +
        crate::protocol_serde::shape_simple_union::ser_simple_union(encoder, var_8)?;
         142  +
    }
         143  +
    if let Some(var_9) = &input.unit_union {
         144  +
        encoder.str("unitUnion");
         145  +
        crate::protocol_serde::shape_unit_union::ser_unit_union(encoder, var_9)?;
         146  +
    }
         147  +
    if let Some(var_10) = &input.structure_list {
         148  +
        encoder.str("structureList");
         149  +
        encoder.array((*var_10).len());
         150  +
        for item_11 in var_10 {
         151  +
            {
         152  +
                crate::protocol_serde::shape_simple_struct::ser_simple_struct(encoder, item_11)?;
         153  +
            }
         154  +
        }
         155  +
    }
         156  +
    {
         157  +
        encoder.str("complexList");
         158  +
        encoder.array((input.complex_list).len());
         159  +
        for item_12 in &input.complex_list {
         160  +
            {
         161  +
                encoder.map((*item_12).len());
         162  +
                for (key_13, value_14) in item_12 {
         163  +
                    {
         164  +
                        encoder.str(key_13.as_str());
         165  +
                        crate::protocol_serde::shape_complex_union::ser_complex_union(
         166  +
                            encoder, value_14,
         167  +
                        )?;
         168  +
                    }
         169  +
                }
         170  +
            }
         171  +
        }
         172  +
    }
         173  +
    {
         174  +
        encoder.str("complexMap");
         175  +
        encoder.map((input.complex_map).len());
         176  +
        for (key_15, value_16) in &input.complex_map {
         177  +
            {
         178  +
                encoder.str(key_15.as_str());
         179  +
                crate::protocol_serde::shape_complex_union::ser_complex_union(encoder, value_16)?;
         180  +
            }
         181  +
        }
         182  +
    }
         183  +
    {
         184  +
        encoder.str("complexUnion");
         185  +
        crate::protocol_serde::shape_complex_union::ser_complex_union(
         186  +
            encoder,
         187  +
            &input.complex_union,
         188  +
        )?;
         189  +
    }
         190  +
    encoder.end();
         191  +
    Ok(())
         192  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_complex_struct_operation.rs

@@ -0,1 +0,223 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_complex_struct_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ComplexStructOperationInput,
           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::complex_struct_operation_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_complex_struct_operation::de_complex_struct_operation(
          30  +
                    bytes.as_ref(),
          31  +
                    input,
          32  +
                )?;
          33  +
        }
          34  +
        input.build()?
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn ser_complex_struct_operation_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::ComplexStructOperationOutput,
          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_complex_struct_operation_output::ser_complex_struct_operation_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_complex_struct_operation_http_error(
          76  +
    error: &crate::error::ComplexStructOperationError,
          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::ComplexStructOperationError::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_complex_struct_operation(
         112  +
    value: &[u8],
         113  +
    mut builder: crate::input::complex_struct_operation_input::Builder,
         114  +
) -> ::std::result::Result<
         115  +
    crate::input::complex_struct_operation_input::Builder,
         116  +
    ::aws_smithy_cbor::decode::DeserializeError,
         117  +
> {
         118  +
    #[allow(clippy::match_single_binding)]
         119  +
    fn pair(
         120  +
        mut builder: crate::input::complex_struct_operation_input::Builder,
         121  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         122  +
    ) -> ::std::result::Result<
         123  +
        crate::input::complex_struct_operation_input::Builder,
         124  +
        ::aws_smithy_cbor::decode::DeserializeError,
         125  +
    > {
         126  +
        builder = match decoder.str()?.as_ref() {
         127  +
            "structure" => {
         128  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         129  +
                    Ok(builder.set_structure(Some(
         130  +
                        crate::protocol_serde::shape_simple_struct::de_simple_struct(decoder)?,
         131  +
                    )))
         132  +
                })?
         133  +
            }
         134  +
            "emptyStructure" => {
         135  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         136  +
                    Ok(builder.set_empty_structure(Some(
         137  +
                        crate::protocol_serde::shape_empty_struct::de_empty_struct(decoder)?,
         138  +
                    )))
         139  +
                })?
         140  +
            }
         141  +
            "list" => {
         142  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         143  +
                    Ok(builder.set_list(Some(
         144  +
                        crate::protocol_serde::shape_simple_list::de_simple_list(decoder)?,
         145  +
                    )))
         146  +
                })?
         147  +
            }
         148  +
            "map" => {
         149  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         150  +
                    Ok(builder.set_map(Some(
         151  +
                        crate::protocol_serde::shape_simple_map::de_simple_map(decoder)?,
         152  +
                    )))
         153  +
                })?
         154  +
            }
         155  +
            "union" => {
         156  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         157  +
                    Ok(builder.set_union(Some(
         158  +
                        crate::protocol_serde::shape_simple_union::de_simple_union(decoder)?,
         159  +
                    )))
         160  +
                })?
         161  +
            }
         162  +
            "unitUnion" => {
         163  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         164  +
                    Ok(builder.set_unit_union(Some(
         165  +
                        crate::protocol_serde::shape_unit_union::de_unit_union(decoder)?,
         166  +
                    )))
         167  +
                })?
         168  +
            }
         169  +
            "structureList" => {
         170  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         171  +
                    Ok(builder.set_structure_list(Some(
         172  +
                        crate::protocol_serde::shape_struct_list::de_struct_list(decoder)?,
         173  +
                    )))
         174  +
                })?
         175  +
            }
         176  +
            "complexList" => builder.set_complex_list(
         177  +
                crate::protocol_serde::shape_complex_list::de_complex_list(decoder)?,
         178  +
            ),
         179  +
            "complexMap" => builder.set_complex_map(
         180  +
                crate::protocol_serde::shape_complex_map::de_complex_map(decoder)?,
         181  +
            ),
         182  +
            "complexUnion" => builder.set_complex_union({
         183  +
                let v = crate::protocol_serde::shape_complex_union::de_complex_union(decoder)?;
         184  +
                let v = v.into();
         185  +
                Box::new(v)
         186  +
            }),
         187  +
            _ => {
         188  +
                decoder.skip()?;
         189  +
                builder
         190  +
            }
         191  +
        };
         192  +
        Ok(builder)
         193  +
    }
         194  +
         195  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         196  +
         197  +
    match decoder.map()? {
         198  +
        None => loop {
         199  +
            match decoder.datatype()? {
         200  +
                ::aws_smithy_cbor::data::Type::Break => {
         201  +
                    decoder.skip()?;
         202  +
                    break;
         203  +
                }
         204  +
                _ => {
         205  +
                    builder = pair(builder, decoder)?;
         206  +
                }
         207  +
            };
         208  +
        },
         209  +
        Some(n) => {
         210  +
            for _ in 0..n {
         211  +
                builder = pair(builder, decoder)?;
         212  +
            }
         213  +
        }
         214  +
    };
         215  +
         216  +
    if decoder.position() != value.len() {
         217  +
        return Err(
         218  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         219  +
        );
         220  +
    }
         221  +
         222  +
    Ok(builder)
         223  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_complex_struct_operation_output.rs

@@ -0,1 +0,100 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_complex_struct_operation_output_output_output(
           3  +
    value: &crate::output::ComplexStructOperationOutput,
           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_complex_struct_operation_output::ser_complex_struct_operation_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_complex_struct_operation_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::ComplexStructOperationOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    if let Some(var_1) = &input.structure {
          22  +
        encoder.str("structure");
          23  +
        crate::protocol_serde::shape_simple_struct::ser_simple_struct(encoder, var_1)?;
          24  +
    }
          25  +
    if let Some(var_2) = &input.empty_structure {
          26  +
        encoder.str("emptyStructure");
          27  +
        crate::protocol_serde::shape_empty_struct::ser_empty_struct(encoder, var_2)?;
          28  +
    }
          29  +
    if let Some(var_3) = &input.list {
          30  +
        encoder.str("list");
          31  +
        encoder.array((*var_3).len());
          32  +
        for item_4 in var_3 {
          33  +
            {
          34  +
                encoder.str(item_4.as_str());
          35  +
            }
          36  +
        }
          37  +
    }
          38  +
    if let Some(var_5) = &input.map {
          39  +
        encoder.str("map");
          40  +
        encoder.map((*var_5).len());
          41  +
        for (key_6, value_7) in var_5 {
          42  +
            {
          43  +
                encoder.str(key_6.as_str()).integer(*value_7);
          44  +
            }
          45  +
        }
          46  +
    }
          47  +
    if let Some(var_8) = &input.union {
          48  +
        encoder.str("union");
          49  +
        crate::protocol_serde::shape_simple_union::ser_simple_union(encoder, var_8)?;
          50  +
    }
          51  +
    if let Some(var_9) = &input.unit_union {
          52  +
        encoder.str("unitUnion");
          53  +
        crate::protocol_serde::shape_unit_union::ser_unit_union(encoder, var_9)?;
          54  +
    }
          55  +
    if let Some(var_10) = &input.structure_list {
          56  +
        encoder.str("structureList");
          57  +
        encoder.array((*var_10).len());
          58  +
        for item_11 in var_10 {
          59  +
            {
          60  +
                crate::protocol_serde::shape_simple_struct::ser_simple_struct(encoder, item_11)?;
          61  +
            }
          62  +
        }
          63  +
    }
          64  +
    {
          65  +
        encoder.str("complexList");
          66  +
        encoder.array((input.complex_list).len());
          67  +
        for item_12 in &input.complex_list {
          68  +
            {
          69  +
                encoder.map((*item_12).len());
          70  +
                for (key_13, value_14) in item_12 {
          71  +
                    {
          72  +
                        encoder.str(key_13.as_str());
          73  +
                        crate::protocol_serde::shape_complex_union::ser_complex_union(
          74  +
                            encoder, value_14,
          75  +
                        )?;
          76  +
                    }
          77  +
                }
          78  +
            }
          79  +
        }
          80  +
    }
          81  +
    {
          82  +
        encoder.str("complexMap");
          83  +
        encoder.map((input.complex_map).len());
          84  +
        for (key_15, value_16) in &input.complex_map {
          85  +
            {
          86  +
                encoder.str(key_15.as_str());
          87  +
                crate::protocol_serde::shape_complex_union::ser_complex_union(encoder, value_16)?;
          88  +
            }
          89  +
        }
          90  +
    }
          91  +
    {
          92  +
        encoder.str("complexUnion");
          93  +
        crate::protocol_serde::shape_complex_union::ser_complex_union(
          94  +
            encoder,
          95  +
            &input.complex_union,
          96  +
        )?;
          97  +
    }
          98  +
    encoder.end();
          99  +
    Ok(())
         100  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_complex_union.rs

@@ -0,1 +0,95 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_complex_union(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    fn pair(
           9  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          10  +
    ) -> ::std::result::Result<
          11  +
        crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained,
          12  +
        ::aws_smithy_cbor::decode::DeserializeError,
          13  +
    > {
          14  +
        Ok(match decoder.str()?.as_ref() {
          15  +
    "complexStruct" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::ComplexStruct(
          16  +
        crate::protocol_serde::shape_complex_struct::de_complex_struct(decoder)
          17  +
    ?),
          18  +
    "structure" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Structure(
          19  +
        crate::protocol_serde::shape_simple_struct::de_simple_struct(decoder)
          20  +
    ?),
          21  +
    "list" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::List(
          22  +
        crate::protocol_serde::shape_simple_list::de_simple_list(decoder)
          23  +
    ?),
          24  +
    "map" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Map(
          25  +
        crate::protocol_serde::shape_simple_map::de_simple_map(decoder)
          26  +
    ?),
          27  +
    "union" => crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Union(
          28  +
        crate::protocol_serde::shape_simple_union::de_simple_union(decoder)
          29  +
    ?),
          30  +
    variant => return Err(::aws_smithy_cbor::decode::DeserializeError::unknown_union_variant(variant, decoder.position()))
          31  +
    })
          32  +
    }
          33  +
          34  +
    match decoder.map()? {
          35  +
        None => {
          36  +
            let variant = pair(decoder)?;
          37  +
            match decoder.datatype()? {
          38  +
                ::aws_smithy_cbor::data::Type::Break => {
          39  +
                    decoder.skip()?;
          40  +
                    Ok(variant)
          41  +
                }
          42  +
                ty => Err(
          43  +
                    ::aws_smithy_cbor::decode::DeserializeError::unexpected_union_variant(
          44  +
                        ty,
          45  +
                        decoder.position(),
          46  +
                    ),
          47  +
                ),
          48  +
            }
          49  +
        }
          50  +
        Some(1) => pair(decoder),
          51  +
        Some(_) => Err(
          52  +
            ::aws_smithy_cbor::decode::DeserializeError::mixed_union_variants(decoder.position()),
          53  +
        ),
          54  +
    }
          55  +
}
          56  +
          57  +
pub fn ser_complex_union(
          58  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          59  +
    input: &crate::model::ComplexUnion,
          60  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          61  +
    encoder.map(1);
          62  +
    match input {
          63  +
        crate::model::ComplexUnion::ComplexStruct(inner) => {
          64  +
            encoder.str("complexStruct");
          65  +
            crate::protocol_serde::shape_complex_struct::ser_complex_struct(encoder, inner)?;
          66  +
        }
          67  +
        crate::model::ComplexUnion::Structure(inner) => {
          68  +
            encoder.str("structure");
          69  +
            crate::protocol_serde::shape_simple_struct::ser_simple_struct(encoder, inner)?;
          70  +
        }
          71  +
        crate::model::ComplexUnion::List(inner) => {
          72  +
            encoder.str("list");
          73  +
            encoder.array((*inner).len());
          74  +
            for item_1 in inner {
          75  +
                {
          76  +
                    encoder.str(item_1.as_str());
          77  +
                }
          78  +
            }
          79  +
        }
          80  +
        crate::model::ComplexUnion::Map(inner) => {
          81  +
            encoder.str("map");
          82  +
            encoder.map((*inner).len());
          83  +
            for (key_2, value_3) in inner {
          84  +
                {
          85  +
                    encoder.str(key_2.as_str()).integer(*value_3);
          86  +
                }
          87  +
            }
          88  +
        }
          89  +
        crate::model::ComplexUnion::Union(inner) => {
          90  +
            encoder.str("union");
          91  +
            crate::protocol_serde::shape_simple_union::ser_simple_union(encoder, inner)?;
          92  +
        }
          93  +
    }
          94  +
    ::std::result::Result::Ok(())
          95  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_empty_struct.rs

@@ -0,1 +0,55 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_empty_struct(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<crate::model::EmptyStruct, ::aws_smithy_cbor::decode::DeserializeError> {
           5  +
    #[allow(clippy::match_single_binding)]
           6  +
    fn pair(
           7  +
        mut builder: crate::model::empty_struct::Builder,
           8  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
           9  +
    ) -> ::std::result::Result<
          10  +
        crate::model::empty_struct::Builder,
          11  +
        ::aws_smithy_cbor::decode::DeserializeError,
          12  +
    > {
          13  +
        builder = match decoder.str()?.as_ref() {
          14  +
            _ => {
          15  +
                decoder.skip()?;
          16  +
                builder
          17  +
            }
          18  +
        };
          19  +
        Ok(builder)
          20  +
    }
          21  +
          22  +
    let mut builder = crate::model::empty_struct::Builder::default();
          23  +
          24  +
    match decoder.map()? {
          25  +
        None => loop {
          26  +
            match decoder.datatype()? {
          27  +
                ::aws_smithy_cbor::data::Type::Break => {
          28  +
                    decoder.skip()?;
          29  +
                    break;
          30  +
                }
          31  +
                _ => {
          32  +
                    builder = pair(builder, decoder)?;
          33  +
                }
          34  +
            };
          35  +
        },
          36  +
        Some(n) => {
          37  +
            for _ in 0..n {
          38  +
                builder = pair(builder, decoder)?;
          39  +
            }
          40  +
        }
          41  +
    };
          42  +
    #[allow(clippy::needless_question_mark)]
          43  +
    {
          44  +
        return Ok(builder.build());
          45  +
    }
          46  +
}
          47  +
          48  +
pub fn ser_empty_struct(
          49  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          50  +
    #[allow(unused)] input: &crate::model::EmptyStruct,
          51  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          52  +
    encoder.begin_map();
          53  +
    encoder.end();
          54  +
    Ok(())
          55  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_empty_struct_operation.rs

@@ -0,1 +0,60 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_empty_struct_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::EmptyStructOperationInput,
           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::empty_struct_operation_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  +
        input.build()
          23  +
    })
          24  +
}
          25  +
          26  +
#[allow(clippy::unnecessary_wraps)]
          27  +
pub fn ser_empty_struct_operation_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::EmptyStructOperationOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::CONTENT_TYPE,
          39  +
            "application/cbor",
          40  +
        );
          41  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          42  +
            builder,
          43  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          44  +
            "rpc-v2-cbor",
          45  +
        );
          46  +
        let http_status: u16 = 200;
          47  +
        builder = builder.status(http_status);
          48  +
        let payload =
          49  +
            crate::protocol_serde::shape_empty_struct_operation_output::ser_empty_struct_operation_output_output_output(&output)?
          50  +
        ;
          51  +
        let content_length = payload.len();
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::CONTENT_LENGTH,
          55  +
            content_length,
          56  +
        );
          57  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          58  +
        builder.body(body)?
          59  +
    })
          60  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_empty_struct_operation_output.rs

@@ -0,1 +0,23 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_empty_struct_operation_output_output_output(
           3  +
    value: &crate::output::EmptyStructOperationOutput,
           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_empty_struct_operation_output::ser_empty_struct_operation_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_empty_struct_operation_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::EmptyStructOperationOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    encoder.end();
          22  +
    Ok(())
          23  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/protocol_serde/shape_error_serialization_operation.rs

@@ -0,1 +0,225 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_error_serialization_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ErrorSerializationOperationInput,
           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::error_serialization_operation_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_error_serialization_operation::de_error_serialization_operation(bytes.as_ref(), input)?;
          29  +
        }
          30  +
        input.build()?
          31  +
    })
          32  +
}
          33  +
          34  +
#[allow(clippy::unnecessary_wraps)]
          35  +
pub fn ser_error_serialization_operation_http_response(
          36  +
    #[allow(unused_variables)] output: crate::output::ErrorSerializationOperationOutput,
          37  +
) -> std::result::Result<
          38  +
    ::aws_smithy_legacy_http_server::response::Response,
          39  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          40  +
> {
          41  +
    Ok({
          42  +
        #[allow(unused_mut)]
          43  +
        let mut builder = ::http::Response::builder();
          44  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          45  +
            builder,
          46  +
            ::http::header::CONTENT_TYPE,
          47  +
            "application/cbor",
          48  +
        );
          49  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          50  +
            builder,
          51  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          52  +
            "rpc-v2-cbor",
          53  +
        );
          54  +
        let http_status: u16 = 200;
          55  +
        builder = builder.status(http_status);
          56  +
        let payload =
          57  +
            crate::protocol_serde::shape_error_serialization_operation_output::ser_error_serialization_operation_output_output_output(&output)?
          58  +
        ;
          59  +
        let content_length = payload.len();
          60  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          61  +
            builder,
          62  +
            ::http::header::CONTENT_LENGTH,
          63  +
            content_length,
          64  +
        );
          65  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          66  +
        builder.body(body)?
          67  +
    })
          68  +
}
          69  +
          70  +
#[allow(clippy::unnecessary_wraps)]
          71  +
pub fn ser_error_serialization_operation_http_error(
          72  +
    error: &crate::error::ErrorSerializationOperationError,
          73  +
) -> std::result::Result<
          74  +
    ::aws_smithy_legacy_http_server::response::Response,
          75  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          76  +
> {
          77  +
    Ok({
          78  +
        match error {
          79  +
            crate::error::ErrorSerializationOperationError::ValidationException(output) => {
          80  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          81  +
                #[allow(unused_mut)]
          82  +
                let mut builder = ::http::Response::builder();
          83  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          84  +
                    builder,
          85  +
                    ::http::header::CONTENT_TYPE,
          86  +
                    "application/cbor",
          87  +
                );
          88  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          89  +
                    builder,
          90  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          91  +
                    "rpc-v2-cbor",
          92  +
                );
          93  +
                let content_length = payload.len();
          94  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          95  +
                    builder,
          96  +
                    ::http::header::CONTENT_LENGTH,
          97  +
                    content_length,
          98  +
                );
          99  +
                builder
         100  +
                    .status(400)
         101  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         102  +
            }
         103  +
        }
         104  +
    })
         105  +
}
         106  +
         107  +
pub(crate) fn de_error_serialization_operation(
         108  +
    value: &[u8],
         109  +
    mut builder: crate::input::error_serialization_operation_input::Builder,
         110  +
) -> ::std::result::Result<
         111  +
    crate::input::error_serialization_operation_input::Builder,
         112  +
    ::aws_smithy_cbor::decode::DeserializeError,
         113  +
> {
         114  +
    #[allow(clippy::match_single_binding)]
         115  +
    fn pair(
         116  +
        mut builder: crate::input::error_serialization_operation_input::Builder,
         117  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         118  +
    ) -> ::std::result::Result<
         119  +
        crate::input::error_serialization_operation_input::Builder,
         120  +
        ::aws_smithy_cbor::decode::DeserializeError,
         121  +
    > {
         122  +
        builder = match decoder.str()?.as_ref() {
         123  +
            "blob" => {
         124  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         125  +
                    Ok(builder.set_blob(Some(decoder.blob()?)))
         126  +
                })?
         127  +
            }
         128  +
            "boolean" => {
         129  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         130  +
                    Ok(builder.set_boolean(Some(decoder.boolean()?)))
         131  +
                })?
         132  +
            }
         133  +
            "string" => {
         134  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         135  +
                    Ok(builder.set_string(Some(decoder.string()?)))
         136  +
                })?
         137  +
            }
         138  +
            "byte" => {
         139  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         140  +
                    Ok(builder.set_byte(Some(decoder.byte()?)))
         141  +
                })?
         142  +
            }
         143  +
            "short" => {
         144  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         145  +
                    Ok(builder.set_short(Some(decoder.short()?)))
         146  +
                })?
         147  +
            }
         148  +
            "integer" => {
         149  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         150  +
                    Ok(builder.set_integer(Some(decoder.integer()?)))
         151  +
                })?
         152  +
            }
         153  +
            "long" => {
         154  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         155  +
                    Ok(builder.set_long(Some(decoder.long()?)))
         156  +
                })?
         157  +
            }
         158  +
            "float" => {
         159  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         160  +
                    Ok(builder.set_float(Some(decoder.float()?)))
         161  +
                })?
         162  +
            }
         163  +
            "double" => {
         164  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         165  +
                    Ok(builder.set_double(Some(decoder.double()?)))
         166  +
                })?
         167  +
            }
         168  +
            "timestamp" => {
         169  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         170  +
                    Ok(builder.set_timestamp(Some(decoder.timestamp()?)))
         171  +
                })?
         172  +
            }
         173  +
            "enum" => {
         174  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         175  +
                    Ok(builder.set_enum(Some(decoder.string()?)))
         176  +
                })?
         177  +
            }
         178  +
            "requiredBlob" => builder.set_required_blob(decoder.blob()?),
         179  +
            "requiredBoolean" => builder.set_required_boolean(decoder.boolean()?),
         180  +
            "requiredString" => builder.set_required_string(decoder.string()?),
         181  +
            "requiredByte" => builder.set_required_byte(decoder.byte()?),
         182  +
            "requiredShort" => builder.set_required_short(decoder.short()?),
         183  +
            "requiredInteger" => builder.set_required_integer(decoder.integer()?),
         184  +
            "requiredLong" => builder.set_required_long(decoder.long()?),
         185  +
            "requiredFloat" => builder.set_required_float(decoder.float()?),
         186  +
            "requiredDouble" => builder.set_required_double(decoder.double()?),
         187  +
            "requiredTimestamp" => builder.set_required_timestamp(decoder.timestamp()?),
         188  +
            "requiredEnum" => builder.set_required_enum(decoder.string()?),
         189  +
            _ => {
         190  +
                decoder.skip()?;
         191  +
                builder
         192  +
            }
         193  +
        };
         194  +
        Ok(builder)
         195  +
    }
         196  +
         197  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         198  +
         199  +
    match decoder.map()? {
         200  +
        None => loop {
         201  +
            match decoder.datatype()? {
         202  +
                ::aws_smithy_cbor::data::Type::Break => {
         203  +
                    decoder.skip()?;
         204  +
                    break;
         205  +
                }
         206  +
                _ => {
         207  +
                    builder = pair(builder, decoder)?;
         208  +
                }
         209  +
            };
         210  +
        },
         211  +
        Some(n) => {
         212  +
            for _ in 0..n {
         213  +
                builder = pair(builder, decoder)?;
         214  +
            }
         215  +
        }
         216  +
    };
         217  +
         218  +
    if decoder.position() != value.len() {
         219  +
        return Err(
         220  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         221  +
        );
         222  +
    }
         223  +
         224  +
    Ok(builder)
         225  +
}