Server Test

Server Test

rev. 03e6e47f15dfd569240d570d98975ebba692c405 (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,64 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_map_of_range_byte<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::map_of_range_byte_unconstrained::MapOfRangeByteUnconstrained>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    match tokens.next().transpose()? {
          17  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          18  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          19  +
            let mut map = ::std::collections::HashMap::new();
          20  +
            loop {
          21  +
                match tokens.next().transpose()? {
          22  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          23  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          24  +
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          25  +
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
          26  +
                            tokens.next(),
          27  +
                        )?
          28  +
                        .map(i8::try_from)
          29  +
                        .transpose()?;
          30  +
                        match value {
          31  +
                            Some(value) => {
          32  +
                                map.insert(key, value);
          33  +
                            }
          34  +
                            None => {
          35  +
                                return Err(
          36  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                        "dense map cannot contain null values",
          38  +
                                    ),
          39  +
                                )
          40  +
                            }
          41  +
                        }
          42  +
                    }
          43  +
                    other => {
          44  +
                        return Err(
          45  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          46  +
                                format!("expected object key or end object, found: {other:?}"),
          47  +
                            ),
          48  +
                        )
          49  +
                    }
          50  +
                }
          51  +
            }
          52  +
            Ok(Some(
          53  +
                crate::unconstrained::map_of_range_byte_unconstrained::MapOfRangeByteUnconstrained(
          54  +
                    map,
          55  +
                ),
          56  +
            ))
          57  +
        }
          58  +
        _ => Err(
          59  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          60  +
                "expected start object or null",
          61  +
            ),
          62  +
        ),
          63  +
    }
          64  +
}

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

@@ -0,1 +0,62 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_map_of_range_integer<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<
           6  +
        crate::unconstrained::map_of_range_integer_unconstrained::MapOfRangeIntegerUnconstrained,
           7  +
    >,
           8  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           9  +
>
          10  +
where
          11  +
    I: Iterator<
          12  +
        Item = Result<
          13  +
            ::aws_smithy_json::deserialize::Token<'a>,
          14  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          15  +
        >,
          16  +
    >,
          17  +
{
          18  +
    match tokens.next().transpose()? {
          19  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          20  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          21  +
            let mut map = ::std::collections::HashMap::new();
          22  +
            loop {
          23  +
                match tokens.next().transpose()? {
          24  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          25  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          26  +
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          27  +
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
          28  +
                            tokens.next(),
          29  +
                        )?
          30  +
                        .map(i32::try_from)
          31  +
                        .transpose()?;
          32  +
                        match value {
          33  +
                            Some(value) => {
          34  +
                                map.insert(key, value);
          35  +
                            }
          36  +
                            None => {
          37  +
                                return Err(
          38  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          39  +
                                        "dense map cannot contain null values",
          40  +
                                    ),
          41  +
                                )
          42  +
                            }
          43  +
                        }
          44  +
                    }
          45  +
                    other => {
          46  +
                        return Err(
          47  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          48  +
                                format!("expected object key or end object, found: {other:?}"),
          49  +
                            ),
          50  +
                        )
          51  +
                    }
          52  +
                }
          53  +
            }
          54  +
            Ok(Some(crate::unconstrained::map_of_range_integer_unconstrained::MapOfRangeIntegerUnconstrained(map)))
          55  +
        }
          56  +
        _ => Err(
          57  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          58  +
                "expected start object or null",
          59  +
            ),
          60  +
        ),
          61  +
    }
          62  +
}

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

@@ -0,1 +0,64 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_map_of_range_long<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::map_of_range_long_unconstrained::MapOfRangeLongUnconstrained>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    match tokens.next().transpose()? {
          17  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          18  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          19  +
            let mut map = ::std::collections::HashMap::new();
          20  +
            loop {
          21  +
                match tokens.next().transpose()? {
          22  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          23  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          24  +
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          25  +
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
          26  +
                            tokens.next(),
          27  +
                        )?
          28  +
                        .map(i64::try_from)
          29  +
                        .transpose()?;
          30  +
                        match value {
          31  +
                            Some(value) => {
          32  +
                                map.insert(key, value);
          33  +
                            }
          34  +
                            None => {
          35  +
                                return Err(
          36  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                        "dense map cannot contain null values",
          38  +
                                    ),
          39  +
                                )
          40  +
                            }
          41  +
                        }
          42  +
                    }
          43  +
                    other => {
          44  +
                        return Err(
          45  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          46  +
                                format!("expected object key or end object, found: {other:?}"),
          47  +
                            ),
          48  +
                        )
          49  +
                    }
          50  +
                }
          51  +
            }
          52  +
            Ok(Some(
          53  +
                crate::unconstrained::map_of_range_long_unconstrained::MapOfRangeLongUnconstrained(
          54  +
                    map,
          55  +
                ),
          56  +
            ))
          57  +
        }
          58  +
        _ => Err(
          59  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          60  +
                "expected start object or null",
          61  +
            ),
          62  +
        ),
          63  +
    }
          64  +
}

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

@@ -0,1 +0,60 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_map_of_range_short<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::map_of_range_short_unconstrained::MapOfRangeShortUnconstrained>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    match tokens.next().transpose()? {
          17  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          18  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          19  +
            let mut map = ::std::collections::HashMap::new();
          20  +
            loop {
          21  +
                match tokens.next().transpose()? {
          22  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          23  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          24  +
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          25  +
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
          26  +
                            tokens.next(),
          27  +
                        )?
          28  +
                        .map(i16::try_from)
          29  +
                        .transpose()?;
          30  +
                        match value {
          31  +
                            Some(value) => {
          32  +
                                map.insert(key, value);
          33  +
                            }
          34  +
                            None => {
          35  +
                                return Err(
          36  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                        "dense map cannot contain null values",
          38  +
                                    ),
          39  +
                                )
          40  +
                            }
          41  +
                        }
          42  +
                    }
          43  +
                    other => {
          44  +
                        return Err(
          45  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          46  +
                                format!("expected object key or end object, found: {other:?}"),
          47  +
                            ),
          48  +
                        )
          49  +
                    }
          50  +
                }
          51  +
            }
          52  +
            Ok(Some(crate::unconstrained::map_of_range_short_unconstrained::MapOfRangeShortUnconstrained(map)))
          53  +
        }
          54  +
        _ => Err(
          55  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          56  +
                "expected start object or null",
          57  +
            ),
          58  +
        ),
          59  +
    }
          60  +
}

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

@@ -0,1 +0,57 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_non_streaming_blob_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::NonStreamingBlobOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::non_streaming_blob_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  +
        if let Some(value) = {
          23  +
            let bytes = ::hyper::body::to_bytes(body).await?;
          24  +
          25  +
            crate::protocol_serde::shape_non_streaming_blob_operation_input::de_non_streaming_blob_payload(&bytes)?
          26  +
        } {
          27  +
            input = input.set_non_streaming_blob(Some(value))
          28  +
        }
          29  +
        input.build()
          30  +
    })
          31  +
}
          32  +
          33  +
#[allow(clippy::unnecessary_wraps)]
          34  +
pub fn ser_non_streaming_blob_operation_http_response(
          35  +
    #[allow(unused_variables)] output: crate::output::NonStreamingBlobOperationOutput,
          36  +
) -> std::result::Result<
          37  +
    ::aws_smithy_legacy_http_server::response::Response,
          38  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          39  +
> {
          40  +
    Ok({
          41  +
        #[allow(unused_mut)]
          42  +
        let mut builder = ::http::Response::builder();
          43  +
        let http_status: u16 = 200;
          44  +
        builder = builder.status(http_status);
          45  +
        let payload =
          46  +
            crate::protocol_serde::shape_non_streaming_blob_operation_output::ser_non_streaming_blob_http_payload( output.non_streaming_blob)?
          47  +
        ;
          48  +
        let content_length = payload.len();
          49  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          50  +
            builder,
          51  +
            ::http::header::CONTENT_LENGTH,
          52  +
            content_length,
          53  +
        );
          54  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          55  +
        builder.body(body)?
          56  +
    })
          57  +
}

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

@@ -0,1 +0,11 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_non_streaming_blob_payload(
           3  +
    body: &[u8],
           4  +
) -> std::result::Result<
           5  +
    ::std::option::Option<::aws_smithy_types::Blob>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
> {
           8  +
    (!body.is_empty())
           9  +
        .then(|| Ok(::aws_smithy_types::Blob::new(body)))
          10  +
        .transpose()
          11  +
}

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

@@ -0,1 +0,10 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_non_streaming_blob_http_payload(
           3  +
    payload: ::std::option::Option<::aws_smithy_types::Blob>,
           4  +
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           5  +
    let payload = match payload {
           6  +
        Some(t) => t,
           7  +
        None => return Ok(Vec::new()),
           8  +
    };
           9  +
    Ok(payload.into_inner())
          10  +
}

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

@@ -0,1 +0,108 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_query_params_targeting_length_map_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::QueryParamsTargetingLengthMapOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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 =
          18  +
            crate::input::query_params_targeting_length_map_operation_input::Builder::default();
          19  +
        #[allow(unused_variables)]
          20  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          21  +
            uri, headers, body, ..
          22  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          23  +
        let query_string = uri.query().unwrap_or("");
          24  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          25  +
        let mut query_params: crate::unconstrained::con_b_map_unconstrained::ConBMapUnconstrained =
          26  +
            crate::unconstrained::con_b_map_unconstrained::ConBMapUnconstrained(
          27  +
                ::std::collections::HashMap::new(),
          28  +
            );
          29  +
        for (k, v) in pairs {
          30  +
            query_params
          31  +
                .0
          32  +
                .entry(String::from(k))
          33  +
                .or_insert_with(|| String::from(v));
          34  +
        }
          35  +
        input = input.set_length_map(Some(query_params));
          36  +
        input.build()?
          37  +
    })
          38  +
}
          39  +
          40  +
#[allow(clippy::unnecessary_wraps)]
          41  +
pub fn ser_query_params_targeting_length_map_operation_http_response(
          42  +
    #[allow(unused_variables)] output: crate::output::QueryParamsTargetingLengthMapOperationOutput,
          43  +
) -> std::result::Result<
          44  +
    ::aws_smithy_legacy_http_server::response::Response,
          45  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          46  +
> {
          47  +
    Ok({
          48  +
        #[allow(unused_mut)]
          49  +
        let mut builder = ::http::Response::builder();
          50  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          51  +
            builder,
          52  +
            ::http::header::CONTENT_TYPE,
          53  +
            "application/json",
          54  +
        );
          55  +
        let http_status: u16 = 200;
          56  +
        builder = builder.status(http_status);
          57  +
        let payload =
          58  +
            crate::protocol_serde::shape_query_params_targeting_length_map_operation_output::ser_query_params_targeting_length_map_operation_output_output_output(&output)?
          59  +
        ;
          60  +
        let content_length = payload.len();
          61  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          62  +
            builder,
          63  +
            ::http::header::CONTENT_LENGTH,
          64  +
            content_length,
          65  +
        );
          66  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          67  +
        builder.body(body)?
          68  +
    })
          69  +
}
          70  +
          71  +
#[allow(clippy::unnecessary_wraps)]
          72  +
pub fn ser_query_params_targeting_length_map_operation_http_error(
          73  +
    error: &crate::error::QueryParamsTargetingLengthMapOperationError,
          74  +
) -> std::result::Result<
          75  +
    ::aws_smithy_legacy_http_server::response::Response,
          76  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          77  +
> {
          78  +
    Ok({
          79  +
        match error {
          80  +
            crate::error::QueryParamsTargetingLengthMapOperationError::ValidationException(
          81  +
                output,
          82  +
            ) => {
          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/json",
          90  +
                );
          91  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          92  +
                    builder,
          93  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          94  +
                    "ValidationException",
          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  +
}

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

@@ -0,1 +0,27 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_query_params_targeting_length_map_operation_output_output_output(
           3  +
    value: &crate::output::QueryParamsTargetingLengthMapOperationOutput,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_query_params_targeting_length_map_operation_output::ser_query_params_targeting_length_map_operation_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_query_params_targeting_length_map_operation_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::QueryParamsTargetingLengthMapOperationOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.length_map {
          17  +
        #[allow(unused_mut)]
          18  +
        let mut object_2 = object.key("lengthMap").start_object();
          19  +
        for (key_3, value_4) in &var_1.0 {
          20  +
            {
          21  +
                object_2.key(key_3.as_str()).string(value_4.as_str());
          22  +
            }
          23  +
        }
          24  +
        object_2.finish();
          25  +
    }
          26  +
    Ok(())
          27  +
}

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

@@ -0,1 +0,101 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_query_params_targeting_map_of_enum_string_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::QueryParamsTargetingMapOfEnumStringOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::query_params_targeting_map_of_enum_string_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 query_string = uri.query().unwrap_or("");
          23  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          24  +
        let mut query_params: crate::unconstrained::map_of_enum_string_unconstrained::MapOfEnumStringUnconstrained =
          25  +
            crate::unconstrained::map_of_enum_string_unconstrained::MapOfEnumStringUnconstrained(
          26  +
                ::std::collections::HashMap::new()
          27  +
            )
          28  +
        ;
          29  +
        for (k, v) in pairs {
          30  +
            query_params
          31  +
                .0
          32  +
                .entry(String::from(k))
          33  +
                .or_insert_with(|| String::from(v));
          34  +
        }
          35  +
        input = input.set_map_of_enum_string(Some(query_params));
          36  +
        input.build()?
          37  +
    })
          38  +
}
          39  +
          40  +
#[allow(clippy::unnecessary_wraps)]
          41  +
pub fn ser_query_params_targeting_map_of_enum_string_operation_http_response(
          42  +
    #[allow(unused_variables)]
          43  +
    output: crate::output::QueryParamsTargetingMapOfEnumStringOperationOutput,
          44  +
) -> std::result::Result<
          45  +
    ::aws_smithy_legacy_http_server::response::Response,
          46  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          47  +
> {
          48  +
    Ok({
          49  +
        #[allow(unused_mut)]
          50  +
        let mut builder = ::http::Response::builder();
          51  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          52  +
            builder,
          53  +
            ::http::header::CONTENT_TYPE,
          54  +
            "application/json",
          55  +
        );
          56  +
        let http_status: u16 = 200;
          57  +
        builder = builder.status(http_status);
          58  +
        let payload =
          59  +
            crate::protocol_serde::shape_query_params_targeting_map_of_enum_string_operation_output::ser_query_params_targeting_map_of_enum_string_operation_output_output_output(&output)?
          60  +
        ;
          61  +
        let content_length = payload.len();
          62  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          63  +
            builder,
          64  +
            ::http::header::CONTENT_LENGTH,
          65  +
            content_length,
          66  +
        );
          67  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          68  +
        builder.body(body)?
          69  +
    })
          70  +
}
          71  +
          72  +
#[allow(clippy::unnecessary_wraps)]
          73  +
pub fn ser_query_params_targeting_map_of_enum_string_operation_http_error(
          74  +
    error: &crate::error::QueryParamsTargetingMapOfEnumStringOperationError,
          75  +
) -> std::result::Result<
          76  +
    ::aws_smithy_legacy_http_server::response::Response,
          77  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          78  +
> {
          79  +
    Ok({
          80  +
        match error {
          81  +
            crate::error::QueryParamsTargetingMapOfEnumStringOperationError::ValidationException(output) => {
          82  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          83  +
                #[allow(unused_mut)]
          84  +
                let mut builder = ::http::Response::builder();
          85  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          86  +
                                builder,
          87  +
                                ::http::header::CONTENT_TYPE,
          88  +
                                "application/json",
          89  +
                            );
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
                                builder,
          92  +
                                ::http::header::HeaderName::from_static("x-amzn-errortype"),
          93  +
                                "ValidationException",
          94  +
                            );
          95  +
                let content_length = payload.len();
          96  +
                            builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(builder, ::http::header::CONTENT_LENGTH, content_length);
          97  +
                builder.status(400).body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          98  +
            }
          99  +
        }
         100  +
    })
         101  +
}

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

@@ -0,1 +0,27 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_query_params_targeting_map_of_enum_string_operation_output_output_output(
           3  +
    value: &crate::output::QueryParamsTargetingMapOfEnumStringOperationOutput,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_query_params_targeting_map_of_enum_string_operation_output::ser_query_params_targeting_map_of_enum_string_operation_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_query_params_targeting_map_of_enum_string_operation_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::QueryParamsTargetingMapOfEnumStringOperationOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.map_of_enum_string {
          17  +
        #[allow(unused_mut)]
          18  +
        let mut object_2 = object.key("mapOfEnumString").start_object();
          19  +
        for (key_3, value_4) in var_1 {
          20  +
            {
          21  +
                object_2.key(key_3.as_str()).string(value_4.as_str());
          22  +
            }
          23  +
        }
          24  +
        object_2.finish();
          25  +
    }
          26  +
    Ok(())
          27  +
}

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

@@ -0,1 +0,101 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_query_params_targeting_map_of_length_list_of_pattern_string_operation_http_request<
           4  +
    B,
           5  +
>(
           6  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           7  +
) -> std::result::Result<
           8  +
    crate::input::QueryParamsTargetingMapOfLengthListOfPatternStringOperationInput,
           9  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
          10  +
>
          11  +
where
          12  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          13  +
    B::Data: Send,
          14  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          15  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          16  +
{
          17  +
    Ok({
          18  +
        #[allow(unused_mut)]
          19  +
        let mut input = crate::input::query_params_targeting_map_of_length_list_of_pattern_string_operation_input::Builder::default();
          20  +
        #[allow(unused_variables)]
          21  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          22  +
            uri, headers, body, ..
          23  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          24  +
        let query_string = uri.query().unwrap_or("");
          25  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          26  +
        let mut query_params: crate::unconstrained::map_of_length_list_of_pattern_string_unconstrained::MapOfLengthListOfPatternStringUnconstrained =
          27  +
            crate::unconstrained::map_of_length_list_of_pattern_string_unconstrained::MapOfLengthListOfPatternStringUnconstrained(
          28  +
                ::std::collections::HashMap::new()
          29  +
            )
          30  +
        ;
          31  +
        for (k, v) in pairs {
          32  +
            let entry = query_params.0.entry(String::from(k)).or_insert_with(|| crate::unconstrained::length_list_of_pattern_string_unconstrained::LengthListOfPatternStringUnconstrained(std::vec::Vec::new()));
          33  +
            entry.0.push(String::from(v));
          34  +
        }
          35  +
        input = input.set_map_of_length_list_of_pattern_string(Some(query_params));
          36  +
        input.build()?
          37  +
    })
          38  +
}
          39  +
          40  +
#[allow(clippy::unnecessary_wraps)]
          41  +
pub fn ser_query_params_targeting_map_of_length_list_of_pattern_string_operation_http_response(
          42  +
    #[allow(unused_variables)]
          43  +
    output: crate::output::QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput,
          44  +
) -> std::result::Result<
          45  +
    ::aws_smithy_legacy_http_server::response::Response,
          46  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          47  +
> {
          48  +
    Ok({
          49  +
        #[allow(unused_mut)]
          50  +
        let mut builder = ::http::Response::builder();
          51  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          52  +
            builder,
          53  +
            ::http::header::CONTENT_TYPE,
          54  +
            "application/json",
          55  +
        );
          56  +
        let http_status: u16 = 200;
          57  +
        builder = builder.status(http_status);
          58  +
        let payload =
          59  +
            crate::protocol_serde::shape_query_params_targeting_map_of_length_list_of_pattern_string_operation_output::ser_query_params_targeting_map_of_length_list_of_pattern_string_operation_output_output_output(&output)?
          60  +
        ;
          61  +
        let content_length = payload.len();
          62  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          63  +
            builder,
          64  +
            ::http::header::CONTENT_LENGTH,
          65  +
            content_length,
          66  +
        );
          67  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          68  +
        builder.body(body)?
          69  +
    })
          70  +
}
          71  +
          72  +
#[allow(clippy::unnecessary_wraps)]
          73  +
pub fn ser_query_params_targeting_map_of_length_list_of_pattern_string_operation_http_error(
          74  +
    error: &crate::error::QueryParamsTargetingMapOfLengthListOfPatternStringOperationError,
          75  +
) -> std::result::Result<
          76  +
    ::aws_smithy_legacy_http_server::response::Response,
          77  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          78  +
> {
          79  +
    Ok({
          80  +
        match error {
          81  +
            crate::error::QueryParamsTargetingMapOfLengthListOfPatternStringOperationError::ValidationException(output) => {
          82  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          83  +
                #[allow(unused_mut)]
          84  +
                let mut builder = ::http::Response::builder();
          85  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          86  +
                                builder,
          87  +
                                ::http::header::CONTENT_TYPE,
          88  +
                                "application/json",
          89  +
                            );
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
                                builder,
          92  +
                                ::http::header::HeaderName::from_static("x-amzn-errortype"),
          93  +
                                "ValidationException",
          94  +
                            );
          95  +
                let content_length = payload.len();
          96  +
                            builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(builder, ::http::header::CONTENT_LENGTH, content_length);
          97  +
                builder.status(400).body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          98  +
            }
          99  +
        }
         100  +
    })
         101  +
}

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

@@ -0,1 +0,33 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_query_params_targeting_map_of_length_list_of_pattern_string_operation_output_output_output(
           3  +
    value: &crate::output::QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_query_params_targeting_map_of_length_list_of_pattern_string_operation_output::ser_query_params_targeting_map_of_length_list_of_pattern_string_operation_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_query_params_targeting_map_of_length_list_of_pattern_string_operation_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::QueryParamsTargetingMapOfLengthListOfPatternStringOperationOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.map_of_length_list_of_pattern_string {
          17  +
        #[allow(unused_mut)]
          18  +
        let mut object_2 = object.key("mapOfLengthListOfPatternString").start_object();
          19  +
        for (key_3, value_4) in var_1 {
          20  +
            {
          21  +
                let mut array_5 = object_2.key(key_3.as_str()).start_array();
          22  +
                for item_6 in &value_4.0 {
          23  +
                    {
          24  +
                        array_5.value().string(item_6.as_str());
          25  +
                    }
          26  +
                }
          27  +
                array_5.finish();
          28  +
            }
          29  +
        }
          30  +
        object_2.finish();
          31  +
    }
          32  +
    Ok(())
          33  +
}

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

@@ -0,1 +0,101 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_query_params_targeting_map_of_length_pattern_string_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::QueryParamsTargetingMapOfLengthPatternStringOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::query_params_targeting_map_of_length_pattern_string_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 query_string = uri.query().unwrap_or("");
          23  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          24  +
        let mut query_params: crate::unconstrained::map_of_length_pattern_string_unconstrained::MapOfLengthPatternStringUnconstrained =
          25  +
            crate::unconstrained::map_of_length_pattern_string_unconstrained::MapOfLengthPatternStringUnconstrained(
          26  +
                ::std::collections::HashMap::new()
          27  +
            )
          28  +
        ;
          29  +
        for (k, v) in pairs {
          30  +
            query_params
          31  +
                .0
          32  +
                .entry(String::from(k))
          33  +
                .or_insert_with(|| String::from(v));
          34  +
        }
          35  +
        input = input.set_map_of_length_pattern_string(Some(query_params));
          36  +
        input.build()?
          37  +
    })
          38  +
}
          39  +
          40  +
#[allow(clippy::unnecessary_wraps)]
          41  +
pub fn ser_query_params_targeting_map_of_length_pattern_string_operation_http_response(
          42  +
    #[allow(unused_variables)]
          43  +
    output: crate::output::QueryParamsTargetingMapOfLengthPatternStringOperationOutput,
          44  +
) -> std::result::Result<
          45  +
    ::aws_smithy_legacy_http_server::response::Response,
          46  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          47  +
> {
          48  +
    Ok({
          49  +
        #[allow(unused_mut)]
          50  +
        let mut builder = ::http::Response::builder();
          51  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          52  +
            builder,
          53  +
            ::http::header::CONTENT_TYPE,
          54  +
            "application/json",
          55  +
        );
          56  +
        let http_status: u16 = 200;
          57  +
        builder = builder.status(http_status);
          58  +
        let payload =
          59  +
            crate::protocol_serde::shape_query_params_targeting_map_of_length_pattern_string_operation_output::ser_query_params_targeting_map_of_length_pattern_string_operation_output_output_output(&output)?
          60  +
        ;
          61  +
        let content_length = payload.len();
          62  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          63  +
            builder,
          64  +
            ::http::header::CONTENT_LENGTH,
          65  +
            content_length,
          66  +
        );
          67  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          68  +
        builder.body(body)?
          69  +
    })
          70  +
}
          71  +
          72  +
#[allow(clippy::unnecessary_wraps)]
          73  +
pub fn ser_query_params_targeting_map_of_length_pattern_string_operation_http_error(
          74  +
    error: &crate::error::QueryParamsTargetingMapOfLengthPatternStringOperationError,
          75  +
) -> std::result::Result<
          76  +
    ::aws_smithy_legacy_http_server::response::Response,
          77  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          78  +
> {
          79  +
    Ok({
          80  +
        match error {
          81  +
            crate::error::QueryParamsTargetingMapOfLengthPatternStringOperationError::ValidationException(output) => {
          82  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          83  +
                #[allow(unused_mut)]
          84  +
                let mut builder = ::http::Response::builder();
          85  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          86  +
                                builder,
          87  +
                                ::http::header::CONTENT_TYPE,
          88  +
                                "application/json",
          89  +
                            );
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
                                builder,
          92  +
                                ::http::header::HeaderName::from_static("x-amzn-errortype"),
          93  +
                                "ValidationException",
          94  +
                            );
          95  +
                let content_length = payload.len();
          96  +
                            builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(builder, ::http::header::CONTENT_LENGTH, content_length);
          97  +
                builder.status(400).body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          98  +
            }
          99  +
        }
         100  +
    })
         101  +
}

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

@@ -0,1 +0,27 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_query_params_targeting_map_of_length_pattern_string_operation_output_output_output(
           3  +
    value: &crate::output::QueryParamsTargetingMapOfLengthPatternStringOperationOutput,
           4  +
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = ::std::string::String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_query_params_targeting_map_of_length_pattern_string_operation_output::ser_query_params_targeting_map_of_length_pattern_string_operation_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_query_params_targeting_map_of_length_pattern_string_operation_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::QueryParamsTargetingMapOfLengthPatternStringOperationOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.map_of_length_pattern_string {
          17  +
        #[allow(unused_mut)]
          18  +
        let mut object_2 = object.key("mapOfLengthPatternString").start_object();
          19  +
        for (key_3, value_4) in var_1 {
          20  +
            {
          21  +
                object_2.key(key_3.as_str()).string(value_4.as_str());
          22  +
            }
          23  +
        }
          24  +
        object_2.finish();
          25  +
    }
          26  +
    Ok(())
          27  +
}

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

@@ -0,1 +0,101 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_query_params_targeting_map_of_length_string_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::QueryParamsTargetingMapOfLengthStringOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::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::rest_json_1::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::query_params_targeting_map_of_length_string_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 query_string = uri.query().unwrap_or("");
          23  +
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          24  +
        let mut query_params: crate::unconstrained::map_of_length_string_unconstrained::MapOfLengthStringUnconstrained =
          25  +
            crate::unconstrained::map_of_length_string_unconstrained::MapOfLengthStringUnconstrained(
          26  +
                ::std::collections::HashMap::new()
          27  +
            )
          28  +
        ;
          29  +
        for (k, v) in pairs {
          30  +
            query_params
          31  +
                .0
          32  +
                .entry(String::from(k))
          33  +
                .or_insert_with(|| String::from(v));
          34  +
        }
          35  +
        input = input.set_map_of_length_string(Some(query_params));
          36  +
        input.build()?
          37  +
    })
          38  +
}
          39  +
          40  +
#[allow(clippy::unnecessary_wraps)]
          41  +
pub fn ser_query_params_targeting_map_of_length_string_operation_http_response(
          42  +
    #[allow(unused_variables)]
          43  +
    output: crate::output::QueryParamsTargetingMapOfLengthStringOperationOutput,
          44  +
) -> std::result::Result<
          45  +
    ::aws_smithy_legacy_http_server::response::Response,
          46  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          47  +
> {
          48  +
    Ok({
          49  +
        #[allow(unused_mut)]
          50  +
        let mut builder = ::http::Response::builder();
          51  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          52  +
            builder,
          53  +
            ::http::header::CONTENT_TYPE,
          54  +
            "application/json",
          55  +
        );
          56  +
        let http_status: u16 = 200;
          57  +
        builder = builder.status(http_status);
          58  +
        let payload =
          59  +
            crate::protocol_serde::shape_query_params_targeting_map_of_length_string_operation_output::ser_query_params_targeting_map_of_length_string_operation_output_output_output(&output)?
          60  +
        ;
          61  +
        let content_length = payload.len();
          62  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          63  +
            builder,
          64  +
            ::http::header::CONTENT_LENGTH,
          65  +
            content_length,
          66  +
        );
          67  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          68  +
        builder.body(body)?
          69  +
    })
          70  +
}
          71  +
          72  +
#[allow(clippy::unnecessary_wraps)]
          73  +
pub fn ser_query_params_targeting_map_of_length_string_operation_http_error(
          74  +
    error: &crate::error::QueryParamsTargetingMapOfLengthStringOperationError,
          75  +
) -> std::result::Result<
          76  +
    ::aws_smithy_legacy_http_server::response::Response,
          77  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          78  +
> {
          79  +
    Ok({
          80  +
        match error {
          81  +
            crate::error::QueryParamsTargetingMapOfLengthStringOperationError::ValidationException(output) => {
          82  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          83  +
                #[allow(unused_mut)]
          84  +
                let mut builder = ::http::Response::builder();
          85  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          86  +
                                builder,
          87  +
                                ::http::header::CONTENT_TYPE,
          88  +
                                "application/json",
          89  +
                            );
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
                                builder,
          92  +
                                ::http::header::HeaderName::from_static("x-amzn-errortype"),
          93  +
                                "ValidationException",
          94  +
                            );
          95  +
                let content_length = payload.len();
          96  +
                            builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(builder, ::http::header::CONTENT_LENGTH, content_length);
          97  +
                builder.status(400).body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          98  +
            }
          99  +
        }
         100  +
    })
         101  +
}