Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,60 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) mod shape_required_header_collection_operation;
           3  +
           4  +
pub(crate) mod shape_required_inner_shape_operation;
           5  +
           6  +
pub(crate) mod shape_response_code_default_operation;
           7  +
           8  +
pub(crate) mod shape_response_code_http_fallback_operation;
           9  +
          10  +
pub(crate) mod shape_response_code_required_operation;
          11  +
          12  +
pub(crate) mod shape_type_complexity_operation;
          13  +
          14  +
pub(crate) mod shape_required_header_collection_operation_input;
          15  +
          16  +
pub(crate) mod shape_required_header_collection_operation_output;
          17  +
          18  +
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
          19  +
    if data.is_empty() {
          20  +
        b"{}"
          21  +
    } else {
          22  +
        data
          23  +
    }
          24  +
}
          25  +
          26  +
pub(crate) mod shape_required_inner_shape_operation_output;
          27  +
          28  +
pub(crate) mod shape_response_code_default_operation_output;
          29  +
          30  +
pub(crate) mod shape_response_code_http_fallback_operation_output;
          31  +
          32  +
pub(crate) mod shape_response_code_required_operation_output;
          33  +
          34  +
pub(crate) mod shape_type_complexity_operation_output;
          35  +
          36  +
pub(crate) mod shape_validation_exception;
          37  +
          38  +
pub(crate) mod shape_inner_shape;
          39  +
          40  +
pub(crate) mod shape_list_a;
          41  +
          42  +
pub(crate) mod shape_empty_structure;
          43  +
          44  +
pub(crate) mod shape_innermost_shape;
          45  +
          46  +
pub(crate) mod shape_list_b;
          47  +
          48  +
pub(crate) mod shape_validation_exception_field;
          49  +
          50  +
pub(crate) mod shape_a_map;
          51  +
          52  +
pub(crate) mod shape_a_string_list;
          53  +
          54  +
pub(crate) mod shape_a_string_set;
          55  +
          56  +
pub(crate) mod shape_a_union;
          57  +
          58  +
pub(crate) mod shape_list_c;
          59  +
          60  +
pub(crate) mod shape_map_a;

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

@@ -0,1 +0,60 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_a_map<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::collections::HashMap<::std::string::String, ::aws_smithy_types::DateTime>>,
           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 =
          26  +
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
          27  +
                                tokens.next(),
          28  +
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
          29  +
                            )?;
          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(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/misc-http0x/rust-server-codegen/src/protocol_serde/shape_a_string_list.rs

@@ -0,1 +0,52 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_a_string_list<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::vec::Vec<::std::string::String>>,
           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::StartArray { .. }) => {
          19  +
            let mut items = Vec::new();
          20  +
            loop {
          21  +
                match tokens.peek() {
          22  +
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          23  +
                        tokens.next().transpose().unwrap();
          24  +
                        break;
          25  +
                    }
          26  +
                    _ => {
          27  +
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
          28  +
                            tokens.next(),
          29  +
                        )?
          30  +
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          31  +
                        .transpose()?;
          32  +
                        if let Some(value) = value {
          33  +
                            items.push(value);
          34  +
                        } else {
          35  +
                            return Err(
          36  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                    "dense list cannot contain null values",
          38  +
                                ),
          39  +
                            );
          40  +
                        }
          41  +
                    }
          42  +
                }
          43  +
            }
          44  +
            Ok(Some(items))
          45  +
        }
          46  +
        _ => Err(
          47  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          48  +
                "expected start array or null",
          49  +
            ),
          50  +
        ),
          51  +
    }
          52  +
}

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

@@ -0,1 +0,52 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_a_string_set<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::vec::Vec<::std::string::String>>,
           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::StartArray { .. }) => {
          19  +
            let mut items = Vec::new();
          20  +
            loop {
          21  +
                match tokens.peek() {
          22  +
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          23  +
                        tokens.next().transpose().unwrap();
          24  +
                        break;
          25  +
                    }
          26  +
                    _ => {
          27  +
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
          28  +
                            tokens.next(),
          29  +
                        )?
          30  +
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          31  +
                        .transpose()?;
          32  +
                        if let Some(value) = value {
          33  +
                            items.push(value);
          34  +
                        } else {
          35  +
                            return Err(
          36  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                    "dense list cannot contain null values",
          38  +
                                ),
          39  +
                            );
          40  +
                        }
          41  +
                    }
          42  +
                }
          43  +
            }
          44  +
            Ok(Some(items))
          45  +
        }
          46  +
        _ => Err(
          47  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          48  +
                "expected start array or null",
          49  +
            ),
          50  +
        ),
          51  +
    }
          52  +
}

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

@@ -0,1 +0,135 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_a_union<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::model::AUnion>,
           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  +
    let mut variant = None;
          17  +
    match tokens.next().transpose()? {
          18  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
          19  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          20  +
            match tokens.next().transpose()? {
          21  +
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          23  +
                    if let ::std::option::Option::Some(::std::result::Result::Ok(
          24  +
                        ::aws_smithy_json::deserialize::Token::ValueNull { .. },
          25  +
                    )) = tokens.peek()
          26  +
                    {
          27  +
                        let _ = tokens.next().expect("peek returned a token")?;
          28  +
                        continue;
          29  +
                    }
          30  +
                    let key = key.to_unescaped()?;
          31  +
                    if key == "__type" {
          32  +
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          33  +
                        continue;
          34  +
                    }
          35  +
                    if variant.is_some() {
          36  +
                        return Err(
          37  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          38  +
                                "encountered mixed variants in union",
          39  +
                            ),
          40  +
                        );
          41  +
                    }
          42  +
                    variant = match key.as_ref() {
          43  +
                        "i32" => Some(crate::model::AUnion::I32(
          44  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
          45  +
                                tokens.next(),
          46  +
                            )?
          47  +
                            .map(i32::try_from)
          48  +
                            .transpose()?
          49  +
                            .ok_or_else(|| {
          50  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          51  +
                                    "value for 'i32' cannot be null",
          52  +
                                )
          53  +
                            })?,
          54  +
                        )),
          55  +
                        "string" => Some(crate::model::AUnion::String(
          56  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
          57  +
                                tokens.next(),
          58  +
                            )?
          59  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          60  +
                            .transpose()?
          61  +
                            .ok_or_else(|| {
          62  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          63  +
                                    "value for 'string' cannot be null",
          64  +
                                )
          65  +
                            })?,
          66  +
                        )),
          67  +
                        "time" => Some(crate::model::AUnion::Time(
          68  +
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
          69  +
                                tokens.next(),
          70  +
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
          71  +
                            )?
          72  +
                            .ok_or_else(|| {
          73  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          74  +
                                    "value for 'time' cannot be null",
          75  +
                                )
          76  +
                            })?,
          77  +
                        )),
          78  +
                        variant => {
          79  +
                            return Err(
          80  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          81  +
                                    format!("unexpected union variant: {variant}"),
          82  +
                                ),
          83  +
                            )
          84  +
                        }
          85  +
                    };
          86  +
                }
          87  +
                other => {
          88  +
                    return Err(
          89  +
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          90  +
                            "expected object key or end object, found: {other:?}"
          91  +
                        )),
          92  +
                    )
          93  +
                }
          94  +
            }
          95  +
        },
          96  +
        _ => {
          97  +
            return Err(
          98  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          99  +
                    "expected start object or null",
         100  +
                ),
         101  +
            )
         102  +
        }
         103  +
    }
         104  +
    if variant.is_none() {
         105  +
        return Err(
         106  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         107  +
                "Union did not contain a valid variant.",
         108  +
            ),
         109  +
        );
         110  +
    }
         111  +
    Ok(variant)
         112  +
}
         113  +
         114  +
pub fn ser_a_union(
         115  +
    object_8: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
         116  +
    input: &crate::model::AUnion,
         117  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         118  +
    match input {
         119  +
        crate::model::AUnion::I32(inner) => {
         120  +
            object_8.key("i32").number(
         121  +
                #[allow(clippy::useless_conversion)]
         122  +
                ::aws_smithy_types::Number::NegInt((*inner).into()),
         123  +
            );
         124  +
        }
         125  +
        crate::model::AUnion::String(inner) => {
         126  +
            object_8.key("string").string(inner.as_str());
         127  +
        }
         128  +
        crate::model::AUnion::Time(inner) => {
         129  +
            object_8
         130  +
                .key("time")
         131  +
                .date_time(inner, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         132  +
        }
         133  +
    }
         134  +
    Ok(())
         135  +
}

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

@@ -0,1 +0,37 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_empty_structure(
           3  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    #[allow(unused_variables)] input: &crate::model::EmptyStructure,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    Ok(())
           7  +
}
           8  +
           9  +
pub(crate) fn de_empty_structure<'a, I>(
          10  +
    tokens: &mut ::std::iter::Peekable<I>,
          11  +
) -> ::std::result::Result<
          12  +
    Option<crate::model::EmptyStructure>,
          13  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          14  +
>
          15  +
where
          16  +
    I: Iterator<
          17  +
        Item = Result<
          18  +
            ::aws_smithy_json::deserialize::Token<'a>,
          19  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          20  +
        >,
          21  +
    >,
          22  +
{
          23  +
    match tokens.next().transpose()? {
          24  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          25  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          26  +
            #[allow(unused_mut)]
          27  +
            let mut builder = crate::model::empty_structure::Builder::default();
          28  +
            ::aws_smithy_json::deserialize::token::skip_to_end(tokens)?;
          29  +
            Ok(Some(builder.build()))
          30  +
        }
          31  +
        _ => Err(
          32  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          33  +
                "expected start object or null",
          34  +
            ),
          35  +
        ),
          36  +
    }
          37  +
}

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

@@ -0,1 +0,69 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_inner_shape<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::model::inner_shape::Builder>,
           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  +
            #[allow(unused_mut)]
          20  +
            let mut builder = crate::model::inner_shape::Builder::default();
          21  +
            loop {
          22  +
                match tokens.next().transpose()? {
          23  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          24  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          25  +
                        match key.to_unescaped()?.as_ref() {
          26  +
                            "requiredInnerMostShape" => {
          27  +
                                if let Some(v) =
          28  +
                                crate::protocol_serde::shape_innermost_shape::de_innermost_shape(tokens)?
          29  +
                                {
          30  +
                                                                            builder = builder.set_required_inner_most_shape(v);
          31  +
                                                                        }
          32  +
                            }
          33  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          34  +
                        }
          35  +
                    }
          36  +
                    other => {
          37  +
                        return Err(
          38  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          39  +
                                format!("expected object key or end object, found: {other:?}"),
          40  +
                            ),
          41  +
                        )
          42  +
                    }
          43  +
                }
          44  +
            }
          45  +
            Ok(Some(builder))
          46  +
        }
          47  +
        _ => Err(
          48  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          49  +
                "expected start object or null",
          50  +
            ),
          51  +
        ),
          52  +
    }
          53  +
}
          54  +
          55  +
pub fn ser_inner_shape(
          56  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          57  +
    input: &crate::model::InnerShape,
          58  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          59  +
    {
          60  +
        #[allow(unused_mut)]
          61  +
        let mut object_1 = object.key("requiredInnerMostShape").start_object();
          62  +
        crate::protocol_serde::shape_innermost_shape::ser_innermost_shape(
          63  +
            &mut object_1,
          64  +
            &input.required_inner_most_shape,
          65  +
        )?;
          66  +
        object_1.finish();
          67  +
    }
          68  +
    Ok(())
          69  +
}

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

@@ -0,1 +0,290 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_innermost_shape<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::model::innermost_shape::Builder>,
           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  +
            #[allow(unused_mut)]
          20  +
            let mut builder = crate::model::innermost_shape::Builder::default();
          21  +
            loop {
          22  +
                match tokens.next().transpose()? {
          23  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          24  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key
          25  +
                        .to_unescaped()?
          26  +
                        .as_ref()
          27  +
                    {
          28  +
                        "aString" => {
          29  +
                            if let Some(v) =
          30  +
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(
          31  +
                                    tokens.next(),
          32  +
                                )?
          33  +
                                .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          34  +
                                .transpose()?
          35  +
                            {
          36  +
                                builder = builder.set_a_string(v);
          37  +
                            }
          38  +
                        }
          39  +
                        "aBoolean" => {
          40  +
                            if let Some(v) =
          41  +
                                ::aws_smithy_json::deserialize::token::expect_bool_or_null(
          42  +
                                    tokens.next(),
          43  +
                                )?
          44  +
                            {
          45  +
                                builder = builder.set_a_boolean(v);
          46  +
                            }
          47  +
                        }
          48  +
                        "aByte" => {
          49  +
                            if let Some(v) =
          50  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(
          51  +
                                    tokens.next(),
          52  +
                                )?
          53  +
                                .map(i8::try_from)
          54  +
                                .transpose()?
          55  +
                            {
          56  +
                                builder = builder.set_a_byte(v);
          57  +
                            }
          58  +
                        }
          59  +
                        "aShort" => {
          60  +
                            if let Some(v) =
          61  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(
          62  +
                                    tokens.next(),
          63  +
                                )?
          64  +
                                .map(i16::try_from)
          65  +
                                .transpose()?
          66  +
                            {
          67  +
                                builder = builder.set_a_short(v);
          68  +
                            }
          69  +
                        }
          70  +
                        "anInt" => {
          71  +
                            if let Some(v) =
          72  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(
          73  +
                                    tokens.next(),
          74  +
                                )?
          75  +
                                .map(i32::try_from)
          76  +
                                .transpose()?
          77  +
                            {
          78  +
                                builder = builder.set_an_int(v);
          79  +
                            }
          80  +
                        }
          81  +
                        "aLong" => {
          82  +
                            if let Some(v) =
          83  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(
          84  +
                                    tokens.next(),
          85  +
                                )?
          86  +
                                .map(i64::try_from)
          87  +
                                .transpose()?
          88  +
                            {
          89  +
                                builder = builder.set_a_long(v);
          90  +
                            }
          91  +
                        }
          92  +
                        "aFloat" => {
          93  +
                            if let Some(v) =
          94  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(
          95  +
                                    tokens.next(),
          96  +
                                )?
          97  +
                                .map(|v| v.to_f32_lossy())
          98  +
                            {
          99  +
                                builder = builder.set_a_float(v);
         100  +
                            }
         101  +
                        }
         102  +
                        "aDouble" => {
         103  +
                            if let Some(v) =
         104  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(
         105  +
                                    tokens.next(),
         106  +
                                )?
         107  +
                                .map(|v| v.to_f64_lossy())
         108  +
                            {
         109  +
                                builder = builder.set_a_double(v);
         110  +
                            }
         111  +
                        }
         112  +
                        "aTimestamp" => {
         113  +
                            if let Some(v) =
         114  +
                                ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
         115  +
                                    tokens.next(),
         116  +
                                    ::aws_smithy_types::date_time::Format::EpochSeconds,
         117  +
                                )?
         118  +
                            {
         119  +
                                builder = builder.set_a_timestamp(v);
         120  +
                            }
         121  +
                        }
         122  +
                        "aDocument" => {
         123  +
                            if let Some(v) =
         124  +
                                ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
         125  +
                                    tokens.next(),
         126  +
                                    ::aws_smithy_types::date_time::Format::EpochSeconds,
         127  +
                                )?
         128  +
                            {
         129  +
                                builder = builder.set_a_document(v);
         130  +
                            }
         131  +
                        }
         132  +
                        "aStringList" => {
         133  +
                            if let Some(v) =
         134  +
                                crate::protocol_serde::shape_a_string_list::de_a_string_list(
         135  +
                                    tokens,
         136  +
                                )?
         137  +
                            {
         138  +
                                builder = builder.set_a_string_list(v);
         139  +
                            }
         140  +
                        }
         141  +
                        "aStringMap" => {
         142  +
                            if let Some(v) = crate::protocol_serde::shape_a_map::de_a_map(tokens)? {
         143  +
                                builder = builder.set_a_string_map(v);
         144  +
                            }
         145  +
                        }
         146  +
                        "aStringSet" => {
         147  +
                            if let Some(v) =
         148  +
                                crate::protocol_serde::shape_a_string_set::de_a_string_set(tokens)?
         149  +
                            {
         150  +
                                builder = builder.set_a_string_set(v);
         151  +
                            }
         152  +
                        }
         153  +
                        "aBlob" => {
         154  +
                            if let Some(v) =
         155  +
                                ::aws_smithy_json::deserialize::token::expect_blob_or_null(
         156  +
                                    tokens.next(),
         157  +
                                )?
         158  +
                            {
         159  +
                                builder = builder.set_a_blob(v);
         160  +
                            }
         161  +
                        }
         162  +
                        "aUnion" => {
         163  +
                            if let Some(v) =
         164  +
                                crate::protocol_serde::shape_a_union::de_a_union(tokens)?
         165  +
                            {
         166  +
                                builder = builder.set_a_union(v);
         167  +
                            }
         168  +
                        }
         169  +
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         170  +
                    },
         171  +
                    other => {
         172  +
                        return Err(
         173  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         174  +
                                format!("expected object key or end object, found: {other:?}"),
         175  +
                            ),
         176  +
                        )
         177  +
                    }
         178  +
                }
         179  +
            }
         180  +
            Ok(Some(builder))
         181  +
        }
         182  +
        _ => Err(
         183  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         184  +
                "expected start object or null",
         185  +
            ),
         186  +
        ),
         187  +
    }
         188  +
}
         189  +
         190  +
pub fn ser_innermost_shape(
         191  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
         192  +
    input: &crate::model::InnermostShape,
         193  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         194  +
    {
         195  +
        object.key("aString").string(input.a_string.as_str());
         196  +
    }
         197  +
    {
         198  +
        object.key("aBoolean").boolean(input.a_boolean);
         199  +
    }
         200  +
    {
         201  +
        object.key("aByte").number(
         202  +
            #[allow(clippy::useless_conversion)]
         203  +
            ::aws_smithy_types::Number::NegInt((input.a_byte).into()),
         204  +
        );
         205  +
    }
         206  +
    {
         207  +
        object.key("aShort").number(
         208  +
            #[allow(clippy::useless_conversion)]
         209  +
            ::aws_smithy_types::Number::NegInt((input.a_short).into()),
         210  +
        );
         211  +
    }
         212  +
    {
         213  +
        object.key("anInt").number(
         214  +
            #[allow(clippy::useless_conversion)]
         215  +
            ::aws_smithy_types::Number::NegInt((input.an_int).into()),
         216  +
        );
         217  +
    }
         218  +
    {
         219  +
        object.key("aLong").number(
         220  +
            #[allow(clippy::useless_conversion)]
         221  +
            ::aws_smithy_types::Number::NegInt((input.a_long).into()),
         222  +
        );
         223  +
    }
         224  +
    {
         225  +
        object.key("aFloat").number(
         226  +
            #[allow(clippy::useless_conversion)]
         227  +
            ::aws_smithy_types::Number::Float((input.a_float).into()),
         228  +
        );
         229  +
    }
         230  +
    {
         231  +
        object.key("aDouble").number(
         232  +
            #[allow(clippy::useless_conversion)]
         233  +
            ::aws_smithy_types::Number::Float((input.a_double).into()),
         234  +
        );
         235  +
    }
         236  +
    {
         237  +
        object.key("aTimestamp").date_time(
         238  +
            &input.a_timestamp,
         239  +
            ::aws_smithy_types::date_time::Format::EpochSeconds,
         240  +
        )?;
         241  +
    }
         242  +
    {
         243  +
        object.key("aDocument").date_time(
         244  +
            &input.a_document,
         245  +
            ::aws_smithy_types::date_time::Format::EpochSeconds,
         246  +
        )?;
         247  +
    }
         248  +
    {
         249  +
        let mut array_1 = object.key("aStringList").start_array();
         250  +
        for item_2 in &input.a_string_list {
         251  +
            {
         252  +
                array_1.value().string(item_2.as_str());
         253  +
            }
         254  +
        }
         255  +
        array_1.finish();
         256  +
    }
         257  +
    {
         258  +
        #[allow(unused_mut)]
         259  +
        let mut object_3 = object.key("aStringMap").start_object();
         260  +
        for (key_4, value_5) in &input.a_string_map {
         261  +
            {
         262  +
                object_3
         263  +
                    .key(key_4.as_str())
         264  +
                    .date_time(value_5, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         265  +
            }
         266  +
        }
         267  +
        object_3.finish();
         268  +
    }
         269  +
    {
         270  +
        let mut array_6 = object.key("aStringSet").start_array();
         271  +
        for item_7 in &input.a_string_set {
         272  +
            {
         273  +
                array_6.value().string(item_7.as_str());
         274  +
            }
         275  +
        }
         276  +
        array_6.finish();
         277  +
    }
         278  +
    {
         279  +
        object
         280  +
            .key("aBlob")
         281  +
            .string_unchecked(&::aws_smithy_types::base64::encode(&input.a_blob));
         282  +
    }
         283  +
    {
         284  +
        #[allow(unused_mut)]
         285  +
        let mut object_8 = object.key("aUnion").start_object();
         286  +
        crate::protocol_serde::shape_a_union::ser_a_union(&mut object_8, &input.a_union)?;
         287  +
        object_8.finish();
         288  +
    }
         289  +
    Ok(())
         290  +
}

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

@@ -0,1 +0,59 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_list_a<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<
           6  +
        ::std::vec::Vec<
           7  +
            ::std::vec::Vec<
           8  +
                ::std::vec::Vec<
           9  +
                    ::std::collections::HashMap<
          10  +
                        ::std::string::String,
          11  +
                        crate::model::EmptyStructure,
          12  +
                    >,
          13  +
                >,
          14  +
            >,
          15  +
        >,
          16  +
    >,
          17  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          18  +
>
          19  +
where
          20  +
    I: Iterator<
          21  +
        Item = Result<
          22  +
            ::aws_smithy_json::deserialize::Token<'a>,
          23  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          24  +
        >,
          25  +
    >,
          26  +
{
          27  +
    match tokens.next().transpose()? {
          28  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          29  +
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          30  +
            let mut items = Vec::new();
          31  +
            loop {
          32  +
                match tokens.peek() {
          33  +
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          34  +
                        tokens.next().transpose().unwrap();
          35  +
                        break;
          36  +
                    }
          37  +
                    _ => {
          38  +
                        let value = crate::protocol_serde::shape_list_b::de_list_b(tokens)?;
          39  +
                        if let Some(value) = value {
          40  +
                            items.push(value);
          41  +
                        } else {
          42  +
                            return Err(
          43  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          44  +
                                    "dense list cannot contain null values",
          45  +
                                ),
          46  +
                            );
          47  +
                        }
          48  +
                    }
          49  +
                }
          50  +
            }
          51  +
            Ok(Some(items))
          52  +
        }
          53  +
        _ => Err(
          54  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          55  +
                "expected start array or null",
          56  +
            ),
          57  +
        ),
          58  +
    }
          59  +
}

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

@@ -0,1 +0,54 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_list_b<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<
           6  +
        ::std::vec::Vec<
           7  +
            ::std::vec::Vec<
           8  +
                ::std::collections::HashMap<::std::string::String, crate::model::EmptyStructure>,
           9  +
            >,
          10  +
        >,
          11  +
    >,
          12  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
>
          14  +
where
          15  +
    I: Iterator<
          16  +
        Item = Result<
          17  +
            ::aws_smithy_json::deserialize::Token<'a>,
          18  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          19  +
        >,
          20  +
    >,
          21  +
{
          22  +
    match tokens.next().transpose()? {
          23  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          24  +
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          25  +
            let mut items = Vec::new();
          26  +
            loop {
          27  +
                match tokens.peek() {
          28  +
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          29  +
                        tokens.next().transpose().unwrap();
          30  +
                        break;
          31  +
                    }
          32  +
                    _ => {
          33  +
                        let value = crate::protocol_serde::shape_list_c::de_list_c(tokens)?;
          34  +
                        if let Some(value) = value {
          35  +
                            items.push(value);
          36  +
                        } else {
          37  +
                            return Err(
          38  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          39  +
                                    "dense list cannot contain null values",
          40  +
                                ),
          41  +
                            );
          42  +
                        }
          43  +
                    }
          44  +
                }
          45  +
            }
          46  +
            Ok(Some(items))
          47  +
        }
          48  +
        _ => Err(
          49  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          50  +
                "expected start array or null",
          51  +
            ),
          52  +
        ),
          53  +
    }
          54  +
}

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

@@ -0,1 +0,52 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_list_c<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<
           6  +
        ::std::vec::Vec<
           7  +
            ::std::collections::HashMap<::std::string::String, crate::model::EmptyStructure>,
           8  +
        >,
           9  +
    >,
          10  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          11  +
>
          12  +
where
          13  +
    I: Iterator<
          14  +
        Item = Result<
          15  +
            ::aws_smithy_json::deserialize::Token<'a>,
          16  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          17  +
        >,
          18  +
    >,
          19  +
{
          20  +
    match tokens.next().transpose()? {
          21  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          22  +
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          23  +
            let mut items = Vec::new();
          24  +
            loop {
          25  +
                match tokens.peek() {
          26  +
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          27  +
                        tokens.next().transpose().unwrap();
          28  +
                        break;
          29  +
                    }
          30  +
                    _ => {
          31  +
                        let value = crate::protocol_serde::shape_map_a::de_map_a(tokens)?;
          32  +
                        if let Some(value) = value {
          33  +
                            items.push(value);
          34  +
                        } else {
          35  +
                            return Err(
          36  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
                                    "dense list cannot contain null values",
          38  +
                                ),
          39  +
                            );
          40  +
                        }
          41  +
                    }
          42  +
                }
          43  +
            }
          44  +
            Ok(Some(items))
          45  +
        }
          46  +
        _ => Err(
          47  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          48  +
                "expected start array or null",
          49  +
            ),
          50  +
        ),
          51  +
    }
          52  +
}

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

@@ -0,1 +0,59 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_map_a<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<::std::collections::HashMap<::std::string::String, crate::model::EmptyStructure>>,
           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 =
          26  +
                            crate::protocol_serde::shape_empty_structure::de_empty_structure(
          27  +
                                tokens,
          28  +
                            )?;
          29  +
                        match value {
          30  +
                            Some(value) => {
          31  +
                                map.insert(key, value);
          32  +
                            }
          33  +
                            None => {
          34  +
                                return Err(
          35  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          36  +
                                        "dense map cannot contain null values",
          37  +
                                    ),
          38  +
                                )
          39  +
                            }
          40  +
                        }
          41  +
                    }
          42  +
                    other => {
          43  +
                        return Err(
          44  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          45  +
                                format!("expected object key or end object, found: {other:?}"),
          46  +
                            ),
          47  +
                        )
          48  +
                    }
          49  +
                }
          50  +
            }
          51  +
            Ok(Some(map))
          52  +
        }
          53  +
        _ => Err(
          54  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          55  +
                "expected start object or null",
          56  +
            ),
          57  +
        ),
          58  +
    }
          59  +
}

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

@@ -0,1 +0,140 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_required_header_collection_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::RequiredHeaderCollectionOperationInput,
           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::required_header_collection_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  +
        if let Some(value) = crate::protocol_serde::shape_required_header_collection_operation_input::de_required_header_list_header(&headers)? {
          24  +
                                input = input.set_required_header_list(value)
          25  +
                            }
          26  +
        if let Some(value) = crate::protocol_serde::shape_required_header_collection_operation_input::de_required_header_set_header(&headers)? {
          27  +
                                input = input.set_required_header_set(value)
          28  +
                            }
          29  +
        input.build()?
          30  +
    })
          31  +
}
          32  +
          33  +
#[allow(clippy::unnecessary_wraps)]
          34  +
pub fn ser_required_header_collection_operation_http_response(
          35  +
    #[allow(unused_variables)] output: crate::output::RequiredHeaderCollectionOperationOutput,
          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  +
        builder = crate::protocol_serde::shape_required_header_collection_operation::ser_required_header_collection_operation_headers(&output, builder)?;
          44  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          45  +
            builder,
          46  +
            ::http::header::CONTENT_TYPE,
          47  +
            "application/json",
          48  +
        );
          49  +
        let http_status: u16 = 200;
          50  +
        builder = builder.status(http_status);
          51  +
        let payload =
          52  +
            crate::protocol_serde::shape_required_header_collection_operation_output::ser_required_header_collection_operation_output_output_output(&output)?
          53  +
        ;
          54  +
        let content_length = payload.len();
          55  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          56  +
            builder,
          57  +
            ::http::header::CONTENT_LENGTH,
          58  +
            content_length,
          59  +
        );
          60  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          61  +
        builder.body(body)?
          62  +
    })
          63  +
}
          64  +
          65  +
#[allow(clippy::unnecessary_wraps)]
          66  +
pub fn ser_required_header_collection_operation_http_error(
          67  +
    error: &crate::error::RequiredHeaderCollectionOperationError,
          68  +
) -> std::result::Result<
          69  +
    ::aws_smithy_legacy_http_server::response::Response,
          70  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          71  +
> {
          72  +
    Ok({
          73  +
        match error {
          74  +
            crate::error::RequiredHeaderCollectionOperationError::ValidationException(output) => {
          75  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          76  +
                #[allow(unused_mut)]
          77  +
                let mut builder = ::http::Response::builder();
          78  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          79  +
                    builder,
          80  +
                    ::http::header::CONTENT_TYPE,
          81  +
                    "application/json",
          82  +
                );
          83  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          84  +
                    builder,
          85  +
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
          86  +
                    "ValidationException",
          87  +
                );
          88  +
                let content_length = payload.len();
          89  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          90  +
                    builder,
          91  +
                    ::http::header::CONTENT_LENGTH,
          92  +
                    content_length,
          93  +
                );
          94  +
                builder
          95  +
                    .status(400)
          96  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          97  +
            }
          98  +
        }
          99  +
    })
         100  +
}
         101  +
         102  +
pub fn ser_required_header_collection_operation_headers(
         103  +
    input: &crate::output::RequiredHeaderCollectionOperationOutput,
         104  +
    mut builder: ::http::response::Builder,
         105  +
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
         106  +
{
         107  +
    for inner_1 in &input.required_header_list {
         108  +
        let formatted_2 = ::aws_smithy_legacy_http::header::quote_header_value(inner_1.as_str());
         109  +
        if !formatted_2.is_empty() {
         110  +
            let header_value = formatted_2;
         111  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         112  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
         113  +
                    "required_header_list",
         114  +
                    format!(
         115  +
                        "`{}` cannot be used as a header value: {}",
         116  +
                        &header_value, err
         117  +
                    ),
         118  +
                )
         119  +
            })?;
         120  +
            builder = builder.header("X-Required-List", header_value);
         121  +
        }
         122  +
    }
         123  +
    for inner_3 in &input.required_header_set.0 {
         124  +
        let formatted_4 = ::aws_smithy_legacy_http::header::quote_header_value(inner_3.as_str());
         125  +
        if !formatted_4.is_empty() {
         126  +
            let header_value = formatted_4;
         127  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         128  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
         129  +
                    "required_header_set",
         130  +
                    format!(
         131  +
                        "`{}` cannot be used as a header value: {}",
         132  +
                        &header_value, err
         133  +
                    ),
         134  +
                )
         135  +
            })?;
         136  +
            builder = builder.header("X-Required-Set", header_value);
         137  +
        }
         138  +
    }
         139  +
    Ok(builder)
         140  +
}