Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,141 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_json_unions_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::JsonUnionsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::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::aws_json::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::json_unions_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/x-amz-json-1.1"),
          27  +
            )?;
          28  +
            input =
          29  +
                crate::protocol_serde::shape_json_unions::de_json_unions(bytes.as_ref(), input)?;
          30  +
        }
          31  +
        input.build()?
          32  +
    })
          33  +
}
          34  +
          35  +
#[allow(clippy::unnecessary_wraps)]
          36  +
pub fn ser_json_unions_http_response(
          37  +
    #[allow(unused_variables)] output: crate::output::JsonUnionsOutput,
          38  +
) -> std::result::Result<
          39  +
    ::aws_smithy_legacy_http_server::response::Response,
          40  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          41  +
> {
          42  +
    Ok({
          43  +
        #[allow(unused_mut)]
          44  +
        let mut builder = ::http::Response::builder();
          45  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          46  +
            builder,
          47  +
            ::http::header::CONTENT_TYPE,
          48  +
            "application/x-amz-json-1.1",
          49  +
        );
          50  +
        let http_status: u16 = 200;
          51  +
        builder = builder.status(http_status);
          52  +
        let payload =
          53  +
            crate::protocol_serde::shape_json_unions_output::ser_json_unions_output_output_output(
          54  +
                &output,
          55  +
            )?;
          56  +
        let content_length = payload.len();
          57  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          58  +
            builder,
          59  +
            ::http::header::CONTENT_LENGTH,
          60  +
            content_length,
          61  +
        );
          62  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          63  +
        builder.body(body)?
          64  +
    })
          65  +
}
          66  +
          67  +
#[allow(clippy::unnecessary_wraps)]
          68  +
pub fn ser_json_unions_http_error(
          69  +
    error: &crate::error::JsonUnionsError,
          70  +
) -> std::result::Result<
          71  +
    ::aws_smithy_legacy_http_server::response::Response,
          72  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          73  +
> {
          74  +
    Ok({
          75  +
        match error {
          76  +
            crate::error::JsonUnionsError::ValidationException(output) => {
          77  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          78  +
                #[allow(unused_mut)]
          79  +
                let mut builder = ::http::Response::builder();
          80  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          81  +
                    builder,
          82  +
                    ::http::header::CONTENT_TYPE,
          83  +
                    "application/x-amz-json-1.1",
          84  +
                );
          85  +
                let content_length = payload.len();
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          87  +
                    builder,
          88  +
                    ::http::header::CONTENT_LENGTH,
          89  +
                    content_length,
          90  +
                );
          91  +
                builder
          92  +
                    .status(400)
          93  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          94  +
            }
          95  +
        }
          96  +
    })
          97  +
}
          98  +
          99  +
pub(crate) fn de_json_unions(
         100  +
    value: &[u8],
         101  +
    mut builder: crate::input::json_unions_input::Builder,
         102  +
) -> ::std::result::Result<
         103  +
    crate::input::json_unions_input::Builder,
         104  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         105  +
> {
         106  +
    let mut tokens_owned =
         107  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         108  +
            .peekable();
         109  +
    let tokens = &mut tokens_owned;
         110  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         111  +
    loop {
         112  +
        match tokens.next().transpose()? {
         113  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         114  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         115  +
                match key.to_unescaped()?.as_ref() {
         116  +
                    "contents" => {
         117  +
                        builder = builder.set_contents(
         118  +
                            crate::protocol_serde::shape_my_union::de_my_union(tokens)?,
         119  +
                        );
         120  +
                    }
         121  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         122  +
                }
         123  +
            }
         124  +
            other => {
         125  +
                return Err(
         126  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         127  +
                        "expected object key or end object, found: {other:?}"
         128  +
                    )),
         129  +
                )
         130  +
            }
         131  +
        }
         132  +
    }
         133  +
    if tokens.next().is_some() {
         134  +
        return Err(
         135  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         136  +
                "found more JSON tokens after completing parsing",
         137  +
            ),
         138  +
        );
         139  +
    }
         140  +
    Ok(builder)
         141  +
}

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

@@ -0,1 +0,26 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_json_unions_output_output_output(
           3  +
    value: &crate::output::JsonUnionsOutput,
           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_json_unions_output::ser_json_unions_output_output(
           8  +
        &mut object,
           9  +
        value,
          10  +
    )?;
          11  +
    object.finish();
          12  +
    Ok(out)
          13  +
}
          14  +
          15  +
pub fn ser_json_unions_output_output(
          16  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          17  +
    input: &crate::output::JsonUnionsOutput,
          18  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          19  +
    if let Some(var_1) = &input.contents {
          20  +
        #[allow(unused_mut)]
          21  +
        let mut object_2 = object.key("contents").start_object();
          22  +
        crate::protocol_serde::shape_my_union::ser_my_union(&mut object_2, var_1)?;
          23  +
        object_2.finish();
          24  +
    }
          25  +
    Ok(())
          26  +
}

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

@@ -0,1 +0,450 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_kitchen_sink<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::model::KitchenSink>,
           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::kitchen_sink::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  +
                            "Blob" => {
          27  +
                                builder = builder.set_blob(
          28  +
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(
          29  +
                                        tokens.next(),
          30  +
                                    )?,
          31  +
                                );
          32  +
                            }
          33  +
                            "Boolean" => {
          34  +
                                builder = builder.set_boolean(
          35  +
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(
          36  +
                                        tokens.next(),
          37  +
                                    )?,
          38  +
                                );
          39  +
                            }
          40  +
                            "Double" => {
          41  +
                                builder = builder.set_double(
          42  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
          43  +
                                        tokens.next(),
          44  +
                                    )?
          45  +
                                    .map(|v| v.to_f64_lossy()),
          46  +
                                );
          47  +
                            }
          48  +
                            "EmptyStruct" => {
          49  +
                                builder = builder.set_empty_struct(
          50  +
                                    crate::protocol_serde::shape_empty_struct::de_empty_struct(
          51  +
                                        tokens,
          52  +
                                    )?,
          53  +
                                );
          54  +
                            }
          55  +
                            "Float" => {
          56  +
                                builder = builder.set_float(
          57  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
          58  +
                                        tokens.next(),
          59  +
                                    )?
          60  +
                                    .map(|v| v.to_f32_lossy()),
          61  +
                                );
          62  +
                            }
          63  +
                            "HttpdateTimestamp" => {
          64  +
                                builder = builder.set_httpdate_timestamp(
          65  +
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::HttpDate)?
          66  +
                                );
          67  +
                            }
          68  +
                            "Integer" => {
          69  +
                                builder = builder.set_integer(
          70  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
          71  +
                                        tokens.next(),
          72  +
                                    )?
          73  +
                                    .map(i32::try_from)
          74  +
                                    .transpose()?,
          75  +
                                );
          76  +
                            }
          77  +
                            "Iso8601Timestamp" => {
          78  +
                                builder = builder.set_iso8601_timestamp(
          79  +
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTime)?
          80  +
                                );
          81  +
                            }
          82  +
                            "JsonValue" => {
          83  +
                                builder = builder.set_json_value(
          84  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
          85  +
                                        tokens.next(),
          86  +
                                    )?
          87  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          88  +
                                    .transpose()?,
          89  +
                                );
          90  +
                            }
          91  +
                            "ListOfLists" => {
          92  +
                                builder = builder.set_list_of_lists(
          93  +
                                    crate::protocol_serde::shape_list_of_list_of_strings::de_list_of_list_of_strings(tokens)?
          94  +
                                );
          95  +
                            }
          96  +
                            "ListOfMapsOfStrings" => {
          97  +
                                builder = builder.set_list_of_maps_of_strings(
          98  +
                                    crate::protocol_serde::shape_list_of_maps_of_strings::de_list_of_maps_of_strings(tokens)?
          99  +
                                );
         100  +
                            }
         101  +
                            "ListOfStrings" => {
         102  +
                                builder = builder.set_list_of_strings(
         103  +
                                    crate::protocol_serde::shape_list_of_strings::de_list_of_strings(tokens)?
         104  +
                                );
         105  +
                            }
         106  +
                            "ListOfStructs" => {
         107  +
                                builder = builder.set_list_of_structs(
         108  +
                                    crate::protocol_serde::shape_list_of_structs::de_list_of_structs(tokens)?
         109  +
                                );
         110  +
                            }
         111  +
                            "Long" => {
         112  +
                                builder = builder.set_long(
         113  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         114  +
                                        tokens.next(),
         115  +
                                    )?
         116  +
                                    .map(i64::try_from)
         117  +
                                    .transpose()?,
         118  +
                                );
         119  +
                            }
         120  +
                            "MapOfListsOfStrings" => {
         121  +
                                builder = builder.set_map_of_lists_of_strings(
         122  +
                                    crate::protocol_serde::shape_map_of_lists_of_strings::de_map_of_lists_of_strings(tokens)?
         123  +
                                );
         124  +
                            }
         125  +
                            "MapOfMaps" => {
         126  +
                                builder = builder.set_map_of_maps(
         127  +
                                    crate::protocol_serde::shape_map_of_map_of_strings::de_map_of_map_of_strings(tokens)?
         128  +
                                );
         129  +
                            }
         130  +
                            "MapOfStrings" => {
         131  +
                                builder = builder.set_map_of_strings(
         132  +
                                    crate::protocol_serde::shape_map_of_strings::de_map_of_strings(
         133  +
                                        tokens,
         134  +
                                    )?,
         135  +
                                );
         136  +
                            }
         137  +
                            "MapOfStructs" => {
         138  +
                                builder = builder.set_map_of_structs(
         139  +
                                    crate::protocol_serde::shape_map_of_structs::de_map_of_structs(
         140  +
                                        tokens,
         141  +
                                    )?,
         142  +
                                );
         143  +
                            }
         144  +
                            "RecursiveList" => {
         145  +
                                builder = builder.set_recursive_list(
         146  +
                                    crate::protocol_serde::shape_list_of_kitchen_sinks::de_list_of_kitchen_sinks(tokens)?
         147  +
                                );
         148  +
                            }
         149  +
                            "RecursiveMap" => {
         150  +
                                builder = builder.set_recursive_map(
         151  +
                                    crate::protocol_serde::shape_map_of_kitchen_sinks::de_map_of_kitchen_sinks(tokens)?
         152  +
                                );
         153  +
                            }
         154  +
                            "RecursiveStruct" => {
         155  +
                                builder = builder.set_recursive_struct(
         156  +
                                    crate::protocol_serde::shape_kitchen_sink::de_kitchen_sink(
         157  +
                                        tokens,
         158  +
                                    )?
         159  +
                                    .map(Box::new),
         160  +
                                );
         161  +
                            }
         162  +
                            "SimpleStruct" => {
         163  +
                                builder = builder.set_simple_struct(
         164  +
                                    crate::protocol_serde::shape_simple_struct::de_simple_struct(
         165  +
                                        tokens,
         166  +
                                    )?,
         167  +
                                );
         168  +
                            }
         169  +
                            "String" => {
         170  +
                                builder = builder.set_string(
         171  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
         172  +
                                        tokens.next(),
         173  +
                                    )?
         174  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         175  +
                                    .transpose()?,
         176  +
                                );
         177  +
                            }
         178  +
                            "StructWithJsonName" => {
         179  +
                                builder = builder.set_struct_with_json_name(
         180  +
                                    crate::protocol_serde::shape_struct_with_json_name::de_struct_with_json_name(tokens)?
         181  +
                                );
         182  +
                            }
         183  +
                            "Timestamp" => {
         184  +
                                builder = builder.set_timestamp(
         185  +
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
         186  +
                                );
         187  +
                            }
         188  +
                            "UnixTimestamp" => {
         189  +
                                builder = builder.set_unix_timestamp(
         190  +
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
         191  +
                                );
         192  +
                            }
         193  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         194  +
                        }
         195  +
                    }
         196  +
                    other => {
         197  +
                        return Err(
         198  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         199  +
                                format!("expected object key or end object, found: {other:?}"),
         200  +
                            ),
         201  +
                        )
         202  +
                    }
         203  +
                }
         204  +
            }
         205  +
            Ok(Some(builder.build()))
         206  +
        }
         207  +
        _ => Err(
         208  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         209  +
                "expected start object or null",
         210  +
            ),
         211  +
        ),
         212  +
    }
         213  +
}
         214  +
         215  +
pub fn ser_kitchen_sink(
         216  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
         217  +
    input: &crate::model::KitchenSink,
         218  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         219  +
    if let Some(var_1) = &input.blob {
         220  +
        object
         221  +
            .key("Blob")
         222  +
            .string_unchecked(&::aws_smithy_types::base64::encode(var_1));
         223  +
    }
         224  +
    if let Some(var_2) = &input.boolean {
         225  +
        object.key("Boolean").boolean(*var_2);
         226  +
    }
         227  +
    if let Some(var_3) = &input.double {
         228  +
        object.key("Double").number(
         229  +
            #[allow(clippy::useless_conversion)]
         230  +
            ::aws_smithy_types::Number::Float((*var_3).into()),
         231  +
        );
         232  +
    }
         233  +
    if let Some(var_4) = &input.empty_struct {
         234  +
        #[allow(unused_mut)]
         235  +
        let mut object_5 = object.key("EmptyStruct").start_object();
         236  +
        crate::protocol_serde::shape_empty_struct::ser_empty_struct(&mut object_5, var_4)?;
         237  +
        object_5.finish();
         238  +
    }
         239  +
    if let Some(var_6) = &input.float {
         240  +
        object.key("Float").number(
         241  +
            #[allow(clippy::useless_conversion)]
         242  +
            ::aws_smithy_types::Number::Float((*var_6).into()),
         243  +
        );
         244  +
    }
         245  +
    if let Some(var_7) = &input.httpdate_timestamp {
         246  +
        object
         247  +
            .key("HttpdateTimestamp")
         248  +
            .date_time(var_7, ::aws_smithy_types::date_time::Format::HttpDate)?;
         249  +
    }
         250  +
    if let Some(var_8) = &input.integer {
         251  +
        object.key("Integer").number(
         252  +
            #[allow(clippy::useless_conversion)]
         253  +
            ::aws_smithy_types::Number::NegInt((*var_8).into()),
         254  +
        );
         255  +
    }
         256  +
    if let Some(var_9) = &input.iso8601_timestamp {
         257  +
        object
         258  +
            .key("Iso8601Timestamp")
         259  +
            .date_time(var_9, ::aws_smithy_types::date_time::Format::DateTime)?;
         260  +
    }
         261  +
    if let Some(var_10) = &input.json_value {
         262  +
        object.key("JsonValue").string(var_10.as_str());
         263  +
    }
         264  +
    if let Some(var_11) = &input.list_of_lists {
         265  +
        let mut array_12 = object.key("ListOfLists").start_array();
         266  +
        for item_13 in var_11 {
         267  +
            {
         268  +
                let mut array_14 = array_12.value().start_array();
         269  +
                for item_15 in item_13 {
         270  +
                    {
         271  +
                        array_14.value().string(item_15.as_str());
         272  +
                    }
         273  +
                }
         274  +
                array_14.finish();
         275  +
            }
         276  +
        }
         277  +
        array_12.finish();
         278  +
    }
         279  +
    if let Some(var_16) = &input.list_of_maps_of_strings {
         280  +
        let mut array_17 = object.key("ListOfMapsOfStrings").start_array();
         281  +
        for item_18 in var_16 {
         282  +
            {
         283  +
                #[allow(unused_mut)]
         284  +
                let mut object_19 = array_17.value().start_object();
         285  +
                for (key_20, value_21) in item_18 {
         286  +
                    {
         287  +
                        object_19.key(key_20.as_str()).string(value_21.as_str());
         288  +
                    }
         289  +
                }
         290  +
                object_19.finish();
         291  +
            }
         292  +
        }
         293  +
        array_17.finish();
         294  +
    }
         295  +
    if let Some(var_22) = &input.list_of_strings {
         296  +
        let mut array_23 = object.key("ListOfStrings").start_array();
         297  +
        for item_24 in var_22 {
         298  +
            {
         299  +
                array_23.value().string(item_24.as_str());
         300  +
            }
         301  +
        }
         302  +
        array_23.finish();
         303  +
    }
         304  +
    if let Some(var_25) = &input.list_of_structs {
         305  +
        let mut array_26 = object.key("ListOfStructs").start_array();
         306  +
        for item_27 in var_25 {
         307  +
            {
         308  +
                #[allow(unused_mut)]
         309  +
                let mut object_28 = array_26.value().start_object();
         310  +
                crate::protocol_serde::shape_simple_struct::ser_simple_struct(
         311  +
                    &mut object_28,
         312  +
                    item_27,
         313  +
                )?;
         314  +
                object_28.finish();
         315  +
            }
         316  +
        }
         317  +
        array_26.finish();
         318  +
    }
         319  +
    if let Some(var_29) = &input.long {
         320  +
        object.key("Long").number(
         321  +
            #[allow(clippy::useless_conversion)]
         322  +
            ::aws_smithy_types::Number::NegInt((*var_29).into()),
         323  +
        );
         324  +
    }
         325  +
    if let Some(var_30) = &input.map_of_lists_of_strings {
         326  +
        #[allow(unused_mut)]
         327  +
        let mut object_31 = object.key("MapOfListsOfStrings").start_object();
         328  +
        for (key_32, value_33) in var_30 {
         329  +
            {
         330  +
                let mut array_34 = object_31.key(key_32.as_str()).start_array();
         331  +
                for item_35 in value_33 {
         332  +
                    {
         333  +
                        array_34.value().string(item_35.as_str());
         334  +
                    }
         335  +
                }
         336  +
                array_34.finish();
         337  +
            }
         338  +
        }
         339  +
        object_31.finish();
         340  +
    }
         341  +
    if let Some(var_36) = &input.map_of_maps {
         342  +
        #[allow(unused_mut)]
         343  +
        let mut object_37 = object.key("MapOfMaps").start_object();
         344  +
        for (key_38, value_39) in var_36 {
         345  +
            {
         346  +
                #[allow(unused_mut)]
         347  +
                let mut object_40 = object_37.key(key_38.as_str()).start_object();
         348  +
                for (key_41, value_42) in value_39 {
         349  +
                    {
         350  +
                        object_40.key(key_41.as_str()).string(value_42.as_str());
         351  +
                    }
         352  +
                }
         353  +
                object_40.finish();
         354  +
            }
         355  +
        }
         356  +
        object_37.finish();
         357  +
    }
         358  +
    if let Some(var_43) = &input.map_of_strings {
         359  +
        #[allow(unused_mut)]
         360  +
        let mut object_44 = object.key("MapOfStrings").start_object();
         361  +
        for (key_45, value_46) in var_43 {
         362  +
            {
         363  +
                object_44.key(key_45.as_str()).string(value_46.as_str());
         364  +
            }
         365  +
        }
         366  +
        object_44.finish();
         367  +
    }
         368  +
    if let Some(var_47) = &input.map_of_structs {
         369  +
        #[allow(unused_mut)]
         370  +
        let mut object_48 = object.key("MapOfStructs").start_object();
         371  +
        for (key_49, value_50) in var_47 {
         372  +
            {
         373  +
                #[allow(unused_mut)]
         374  +
                let mut object_51 = object_48.key(key_49.as_str()).start_object();
         375  +
                crate::protocol_serde::shape_simple_struct::ser_simple_struct(
         376  +
                    &mut object_51,
         377  +
                    value_50,
         378  +
                )?;
         379  +
                object_51.finish();
         380  +
            }
         381  +
        }
         382  +
        object_48.finish();
         383  +
    }
         384  +
    if let Some(var_52) = &input.recursive_list {
         385  +
        let mut array_53 = object.key("RecursiveList").start_array();
         386  +
        for item_54 in var_52 {
         387  +
            {
         388  +
                #[allow(unused_mut)]
         389  +
                let mut object_55 = array_53.value().start_object();
         390  +
                crate::protocol_serde::shape_kitchen_sink::ser_kitchen_sink(
         391  +
                    &mut object_55,
         392  +
                    item_54,
         393  +
                )?;
         394  +
                object_55.finish();
         395  +
            }
         396  +
        }
         397  +
        array_53.finish();
         398  +
    }
         399  +
    if let Some(var_56) = &input.recursive_map {
         400  +
        #[allow(unused_mut)]
         401  +
        let mut object_57 = object.key("RecursiveMap").start_object();
         402  +
        for (key_58, value_59) in var_56 {
         403  +
            {
         404  +
                #[allow(unused_mut)]
         405  +
                let mut object_60 = object_57.key(key_58.as_str()).start_object();
         406  +
                crate::protocol_serde::shape_kitchen_sink::ser_kitchen_sink(
         407  +
                    &mut object_60,
         408  +
                    value_59,
         409  +
                )?;
         410  +
                object_60.finish();
         411  +
            }
         412  +
        }
         413  +
        object_57.finish();
         414  +
    }
         415  +
    if let Some(var_61) = &input.recursive_struct {
         416  +
        #[allow(unused_mut)]
         417  +
        let mut object_62 = object.key("RecursiveStruct").start_object();
         418  +
        crate::protocol_serde::shape_kitchen_sink::ser_kitchen_sink(&mut object_62, var_61)?;
         419  +
        object_62.finish();
         420  +
    }
         421  +
    if let Some(var_63) = &input.simple_struct {
         422  +
        #[allow(unused_mut)]
         423  +
        let mut object_64 = object.key("SimpleStruct").start_object();
         424  +
        crate::protocol_serde::shape_simple_struct::ser_simple_struct(&mut object_64, var_63)?;
         425  +
        object_64.finish();
         426  +
    }
         427  +
    if let Some(var_65) = &input.string {
         428  +
        object.key("String").string(var_65.as_str());
         429  +
    }
         430  +
    if let Some(var_66) = &input.struct_with_json_name {
         431  +
        #[allow(unused_mut)]
         432  +
        let mut object_67 = object.key("StructWithJsonName").start_object();
         433  +
        crate::protocol_serde::shape_struct_with_json_name::ser_struct_with_json_name(
         434  +
            &mut object_67,
         435  +
            var_66,
         436  +
        )?;
         437  +
        object_67.finish();
         438  +
    }
         439  +
    if let Some(var_68) = &input.timestamp {
         440  +
        object
         441  +
            .key("Timestamp")
         442  +
            .date_time(var_68, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         443  +
    }
         444  +
    if let Some(var_69) = &input.unix_timestamp {
         445  +
        object
         446  +
            .key("UnixTimestamp")
         447  +
            .date_time(var_69, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         448  +
    }
         449  +
    Ok(())
         450  +
}

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

@@ -0,1 +0,332 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_kitchen_sink_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::KitchenSinkOperationInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::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::aws_json::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::kitchen_sink_operation_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/x-amz-json-1.1"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_kitchen_sink_operation_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::KitchenSinkOperationOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          43  +
> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut builder = ::http::Response::builder();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_TYPE,
          50  +
            "application/x-amz-json-1.1",
          51  +
        );
          52  +
        let http_status: u16 = 200;
          53  +
        builder = builder.status(http_status);
          54  +
        let payload =
          55  +
            crate::protocol_serde::shape_kitchen_sink_operation_output::ser_kitchen_sink_operation_output_output_output(&output)?
          56  +
        ;
          57  +
        let content_length = payload.len();
          58  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          59  +
            builder,
          60  +
            ::http::header::CONTENT_LENGTH,
          61  +
            content_length,
          62  +
        );
          63  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          64  +
        builder.body(body)?
          65  +
    })
          66  +
}
          67  +
          68  +
#[allow(clippy::unnecessary_wraps)]
          69  +
pub fn ser_kitchen_sink_operation_http_error(
          70  +
    error: &crate::error::KitchenSinkOperationError,
          71  +
) -> std::result::Result<
          72  +
    ::aws_smithy_legacy_http_server::response::Response,
          73  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::ResponseRejection,
          74  +
> {
          75  +
    Ok({
          76  +
        match error {
          77  +
            crate::error::KitchenSinkOperationError::ErrorWithMembers(output) => {
          78  +
                let payload =
          79  +
                    crate::protocol_serde::shape_error_with_members::ser_error_with_members_error(
          80  +
                        output,
          81  +
                    )?;
          82  +
                #[allow(unused_mut)]
          83  +
                let mut builder = ::http::Response::builder();
          84  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          85  +
                    builder,
          86  +
                    ::http::header::CONTENT_TYPE,
          87  +
                    "application/x-amz-json-1.1",
          88  +
                );
          89  +
                let content_length = payload.len();
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          91  +
                    builder,
          92  +
                    ::http::header::CONTENT_LENGTH,
          93  +
                    content_length,
          94  +
                );
          95  +
                builder
          96  +
                    .status(400)
          97  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          98  +
            }
          99  +
            crate::error::KitchenSinkOperationError::ErrorWithoutMembers(output) => {
         100  +
                let payload = crate::protocol_serde::shape_error_without_members::ser_error_without_members_error(output)?;
         101  +
                #[allow(unused_mut)]
         102  +
                let mut builder = ::http::Response::builder();
         103  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         104  +
                    builder,
         105  +
                    ::http::header::CONTENT_TYPE,
         106  +
                    "application/x-amz-json-1.1",
         107  +
                );
         108  +
                let content_length = payload.len();
         109  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         110  +
                    builder,
         111  +
                    ::http::header::CONTENT_LENGTH,
         112  +
                    content_length,
         113  +
                );
         114  +
                builder
         115  +
                    .status(500)
         116  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         117  +
            }
         118  +
        }
         119  +
    })
         120  +
}
         121  +
         122  +
pub(crate) fn de_kitchen_sink_operation(
         123  +
    value: &[u8],
         124  +
    mut builder: crate::input::kitchen_sink_operation_input::Builder,
         125  +
) -> ::std::result::Result<
         126  +
    crate::input::kitchen_sink_operation_input::Builder,
         127  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         128  +
> {
         129  +
    let mut tokens_owned =
         130  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         131  +
            .peekable();
         132  +
    let tokens = &mut tokens_owned;
         133  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         134  +
    loop {
         135  +
        match tokens.next().transpose()? {
         136  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         137  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         138  +
                match key.to_unescaped()?.as_ref() {
         139  +
                    "Blob" => {
         140  +
                        builder = builder.set_blob(
         141  +
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(
         142  +
                                tokens.next(),
         143  +
                            )?,
         144  +
                        );
         145  +
                    }
         146  +
                    "Boolean" => {
         147  +
                        builder = builder.set_boolean(
         148  +
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(
         149  +
                                tokens.next(),
         150  +
                            )?,
         151  +
                        );
         152  +
                    }
         153  +
                    "Double" => {
         154  +
                        builder = builder.set_double(
         155  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
         156  +
                                tokens.next(),
         157  +
                            )?
         158  +
                            .map(|v| v.to_f64_lossy()),
         159  +
                        );
         160  +
                    }
         161  +
                    "EmptyStruct" => {
         162  +
                        builder = builder.set_empty_struct(
         163  +
                            crate::protocol_serde::shape_empty_struct::de_empty_struct(tokens)?,
         164  +
                        );
         165  +
                    }
         166  +
                    "Float" => {
         167  +
                        builder = builder.set_float(
         168  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
         169  +
                                tokens.next(),
         170  +
                            )?
         171  +
                            .map(|v| v.to_f32_lossy()),
         172  +
                        );
         173  +
                    }
         174  +
                    "HttpdateTimestamp" => {
         175  +
                        builder = builder.set_httpdate_timestamp(
         176  +
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
         177  +
                                tokens.next(),
         178  +
                                ::aws_smithy_types::date_time::Format::HttpDate,
         179  +
                            )?,
         180  +
                        );
         181  +
                    }
         182  +
                    "Integer" => {
         183  +
                        builder = builder.set_integer(
         184  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
         185  +
                                tokens.next(),
         186  +
                            )?
         187  +
                            .map(i32::try_from)
         188  +
                            .transpose()?,
         189  +
                        );
         190  +
                    }
         191  +
                    "Iso8601Timestamp" => {
         192  +
                        builder = builder.set_iso8601_timestamp(
         193  +
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
         194  +
                                tokens.next(),
         195  +
                                ::aws_smithy_types::date_time::Format::DateTime,
         196  +
                            )?,
         197  +
                        );
         198  +
                    }
         199  +
                    "JsonValue" => {
         200  +
                        builder = builder.set_json_value(
         201  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         202  +
                                tokens.next(),
         203  +
                            )?
         204  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         205  +
                            .transpose()?,
         206  +
                        );
         207  +
                    }
         208  +
                    "ListOfLists" => {
         209  +
                        builder = builder.set_list_of_lists(
         210  +
                            crate::protocol_serde::shape_list_of_list_of_strings::de_list_of_list_of_strings(tokens)?
         211  +
                        );
         212  +
                    }
         213  +
                    "ListOfMapsOfStrings" => {
         214  +
                        builder = builder.set_list_of_maps_of_strings(
         215  +
                            crate::protocol_serde::shape_list_of_maps_of_strings::de_list_of_maps_of_strings(tokens)?
         216  +
                        );
         217  +
                    }
         218  +
                    "ListOfStrings" => {
         219  +
                        builder = builder.set_list_of_strings(
         220  +
                            crate::protocol_serde::shape_list_of_strings::de_list_of_strings(
         221  +
                                tokens,
         222  +
                            )?,
         223  +
                        );
         224  +
                    }
         225  +
                    "ListOfStructs" => {
         226  +
                        builder = builder.set_list_of_structs(
         227  +
                            crate::protocol_serde::shape_list_of_structs::de_list_of_structs(
         228  +
                                tokens,
         229  +
                            )?,
         230  +
                        );
         231  +
                    }
         232  +
                    "Long" => {
         233  +
                        builder = builder.set_long(
         234  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
         235  +
                                tokens.next(),
         236  +
                            )?
         237  +
                            .map(i64::try_from)
         238  +
                            .transpose()?,
         239  +
                        );
         240  +
                    }
         241  +
                    "MapOfListsOfStrings" => {
         242  +
                        builder = builder.set_map_of_lists_of_strings(
         243  +
                            crate::protocol_serde::shape_map_of_lists_of_strings::de_map_of_lists_of_strings(tokens)?
         244  +
                        );
         245  +
                    }
         246  +
                    "MapOfMaps" => {
         247  +
                        builder = builder.set_map_of_maps(
         248  +
                            crate::protocol_serde::shape_map_of_map_of_strings::de_map_of_map_of_strings(tokens)?
         249  +
                        );
         250  +
                    }
         251  +
                    "MapOfStrings" => {
         252  +
                        builder = builder.set_map_of_strings(
         253  +
                            crate::protocol_serde::shape_map_of_strings::de_map_of_strings(tokens)?,
         254  +
                        );
         255  +
                    }
         256  +
                    "MapOfStructs" => {
         257  +
                        builder = builder.set_map_of_structs(
         258  +
                            crate::protocol_serde::shape_map_of_structs::de_map_of_structs(tokens)?,
         259  +
                        );
         260  +
                    }
         261  +
                    "RecursiveList" => {
         262  +
                        builder = builder.set_recursive_list(
         263  +
                            crate::protocol_serde::shape_list_of_kitchen_sinks::de_list_of_kitchen_sinks(tokens)?
         264  +
                        );
         265  +
                    }
         266  +
                    "RecursiveMap" => {
         267  +
                        builder = builder.set_recursive_map(
         268  +
                            crate::protocol_serde::shape_map_of_kitchen_sinks::de_map_of_kitchen_sinks(tokens)?
         269  +
                        );
         270  +
                    }
         271  +
                    "RecursiveStruct" => {
         272  +
                        builder = builder.set_recursive_struct(
         273  +
                            crate::protocol_serde::shape_kitchen_sink::de_kitchen_sink(tokens)?
         274  +
                                .map(Box::new),
         275  +
                        );
         276  +
                    }
         277  +
                    "SimpleStruct" => {
         278  +
                        builder = builder.set_simple_struct(
         279  +
                            crate::protocol_serde::shape_simple_struct::de_simple_struct(tokens)?,
         280  +
                        );
         281  +
                    }
         282  +
                    "String" => {
         283  +
                        builder = builder.set_string(
         284  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         285  +
                                tokens.next(),
         286  +
                            )?
         287  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         288  +
                            .transpose()?,
         289  +
                        );
         290  +
                    }
         291  +
                    "StructWithJsonName" => {
         292  +
                        builder = builder.set_struct_with_json_name(
         293  +
                            crate::protocol_serde::shape_struct_with_json_name::de_struct_with_json_name(tokens)?
         294  +
                        );
         295  +
                    }
         296  +
                    "Timestamp" => {
         297  +
                        builder = builder.set_timestamp(
         298  +
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
         299  +
                                tokens.next(),
         300  +
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
         301  +
                            )?,
         302  +
                        );
         303  +
                    }
         304  +
                    "UnixTimestamp" => {
         305  +
                        builder = builder.set_unix_timestamp(
         306  +
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
         307  +
                                tokens.next(),
         308  +
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
         309  +
                            )?,
         310  +
                        );
         311  +
                    }
         312  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         313  +
                }
         314  +
            }
         315  +
            other => {
         316  +
                return Err(
         317  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         318  +
                        "expected object key or end object, found: {other:?}"
         319  +
                    )),
         320  +
                )
         321  +
            }
         322  +
        }
         323  +
    }
         324  +
    if tokens.next().is_some() {
         325  +
        return Err(
         326  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         327  +
                "found more JSON tokens after completing parsing",
         328  +
            ),
         329  +
        );
         330  +
    }
         331  +
    Ok(builder)
         332  +
}

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

@@ -0,1 +0,247 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_kitchen_sink_operation_output_output_output(
           3  +
    value: &crate::output::KitchenSinkOperationOutput,
           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_kitchen_sink_operation_output::ser_kitchen_sink_operation_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_kitchen_sink_operation_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::KitchenSinkOperationOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.blob {
          17  +
        object
          18  +
            .key("Blob")
          19  +
            .string_unchecked(&::aws_smithy_types::base64::encode(var_1));
          20  +
    }
          21  +
    if let Some(var_2) = &input.boolean {
          22  +
        object.key("Boolean").boolean(*var_2);
          23  +
    }
          24  +
    if let Some(var_3) = &input.double {
          25  +
        object.key("Double").number(
          26  +
            #[allow(clippy::useless_conversion)]
          27  +
            ::aws_smithy_types::Number::Float((*var_3).into()),
          28  +
        );
          29  +
    }
          30  +
    if let Some(var_4) = &input.empty_struct {
          31  +
        #[allow(unused_mut)]
          32  +
        let mut object_5 = object.key("EmptyStruct").start_object();
          33  +
        crate::protocol_serde::shape_empty_struct::ser_empty_struct(&mut object_5, var_4)?;
          34  +
        object_5.finish();
          35  +
    }
          36  +
    if let Some(var_6) = &input.float {
          37  +
        object.key("Float").number(
          38  +
            #[allow(clippy::useless_conversion)]
          39  +
            ::aws_smithy_types::Number::Float((*var_6).into()),
          40  +
        );
          41  +
    }
          42  +
    if let Some(var_7) = &input.httpdate_timestamp {
          43  +
        object
          44  +
            .key("HttpdateTimestamp")
          45  +
            .date_time(var_7, ::aws_smithy_types::date_time::Format::HttpDate)?;
          46  +
    }
          47  +
    if let Some(var_8) = &input.integer {
          48  +
        object.key("Integer").number(
          49  +
            #[allow(clippy::useless_conversion)]
          50  +
            ::aws_smithy_types::Number::NegInt((*var_8).into()),
          51  +
        );
          52  +
    }
          53  +
    if let Some(var_9) = &input.iso8601_timestamp {
          54  +
        object
          55  +
            .key("Iso8601Timestamp")
          56  +
            .date_time(var_9, ::aws_smithy_types::date_time::Format::DateTime)?;
          57  +
    }
          58  +
    if let Some(var_10) = &input.json_value {
          59  +
        object.key("JsonValue").string(var_10.as_str());
          60  +
    }
          61  +
    if let Some(var_11) = &input.list_of_lists {
          62  +
        let mut array_12 = object.key("ListOfLists").start_array();
          63  +
        for item_13 in var_11 {
          64  +
            {
          65  +
                let mut array_14 = array_12.value().start_array();
          66  +
                for item_15 in item_13 {
          67  +
                    {
          68  +
                        array_14.value().string(item_15.as_str());
          69  +
                    }
          70  +
                }
          71  +
                array_14.finish();
          72  +
            }
          73  +
        }
          74  +
        array_12.finish();
          75  +
    }
          76  +
    if let Some(var_16) = &input.list_of_maps_of_strings {
          77  +
        let mut array_17 = object.key("ListOfMapsOfStrings").start_array();
          78  +
        for item_18 in var_16 {
          79  +
            {
          80  +
                #[allow(unused_mut)]
          81  +
                let mut object_19 = array_17.value().start_object();
          82  +
                for (key_20, value_21) in item_18 {
          83  +
                    {
          84  +
                        object_19.key(key_20.as_str()).string(value_21.as_str());
          85  +
                    }
          86  +
                }
          87  +
                object_19.finish();
          88  +
            }
          89  +
        }
          90  +
        array_17.finish();
          91  +
    }
          92  +
    if let Some(var_22) = &input.list_of_strings {
          93  +
        let mut array_23 = object.key("ListOfStrings").start_array();
          94  +
        for item_24 in var_22 {
          95  +
            {
          96  +
                array_23.value().string(item_24.as_str());
          97  +
            }
          98  +
        }
          99  +
        array_23.finish();
         100  +
    }
         101  +
    if let Some(var_25) = &input.list_of_structs {
         102  +
        let mut array_26 = object.key("ListOfStructs").start_array();
         103  +
        for item_27 in var_25 {
         104  +
            {
         105  +
                #[allow(unused_mut)]
         106  +
                let mut object_28 = array_26.value().start_object();
         107  +
                crate::protocol_serde::shape_simple_struct::ser_simple_struct(
         108  +
                    &mut object_28,
         109  +
                    item_27,
         110  +
                )?;
         111  +
                object_28.finish();
         112  +
            }
         113  +
        }
         114  +
        array_26.finish();
         115  +
    }
         116  +
    if let Some(var_29) = &input.long {
         117  +
        object.key("Long").number(
         118  +
            #[allow(clippy::useless_conversion)]
         119  +
            ::aws_smithy_types::Number::NegInt((*var_29).into()),
         120  +
        );
         121  +
    }
         122  +
    if let Some(var_30) = &input.map_of_lists_of_strings {
         123  +
        #[allow(unused_mut)]
         124  +
        let mut object_31 = object.key("MapOfListsOfStrings").start_object();
         125  +
        for (key_32, value_33) in var_30 {
         126  +
            {
         127  +
                let mut array_34 = object_31.key(key_32.as_str()).start_array();
         128  +
                for item_35 in value_33 {
         129  +
                    {
         130  +
                        array_34.value().string(item_35.as_str());
         131  +
                    }
         132  +
                }
         133  +
                array_34.finish();
         134  +
            }
         135  +
        }
         136  +
        object_31.finish();
         137  +
    }
         138  +
    if let Some(var_36) = &input.map_of_maps {
         139  +
        #[allow(unused_mut)]
         140  +
        let mut object_37 = object.key("MapOfMaps").start_object();
         141  +
        for (key_38, value_39) in var_36 {
         142  +
            {
         143  +
                #[allow(unused_mut)]
         144  +
                let mut object_40 = object_37.key(key_38.as_str()).start_object();
         145  +
                for (key_41, value_42) in value_39 {
         146  +
                    {
         147  +
                        object_40.key(key_41.as_str()).string(value_42.as_str());
         148  +
                    }
         149  +
                }
         150  +
                object_40.finish();
         151  +
            }
         152  +
        }
         153  +
        object_37.finish();
         154  +
    }
         155  +
    if let Some(var_43) = &input.map_of_strings {
         156  +
        #[allow(unused_mut)]
         157  +
        let mut object_44 = object.key("MapOfStrings").start_object();
         158  +
        for (key_45, value_46) in var_43 {
         159  +
            {
         160  +
                object_44.key(key_45.as_str()).string(value_46.as_str());
         161  +
            }
         162  +
        }
         163  +
        object_44.finish();
         164  +
    }
         165  +
    if let Some(var_47) = &input.map_of_structs {
         166  +
        #[allow(unused_mut)]
         167  +
        let mut object_48 = object.key("MapOfStructs").start_object();
         168  +
        for (key_49, value_50) in var_47 {
         169  +
            {
         170  +
                #[allow(unused_mut)]
         171  +
                let mut object_51 = object_48.key(key_49.as_str()).start_object();
         172  +
                crate::protocol_serde::shape_simple_struct::ser_simple_struct(
         173  +
                    &mut object_51,
         174  +
                    value_50,
         175  +
                )?;
         176  +
                object_51.finish();
         177  +
            }
         178  +
        }
         179  +
        object_48.finish();
         180  +
    }
         181  +
    if let Some(var_52) = &input.recursive_list {
         182  +
        let mut array_53 = object.key("RecursiveList").start_array();
         183  +
        for item_54 in var_52 {
         184  +
            {
         185  +
                #[allow(unused_mut)]
         186  +
                let mut object_55 = array_53.value().start_object();
         187  +
                crate::protocol_serde::shape_kitchen_sink::ser_kitchen_sink(
         188  +
                    &mut object_55,
         189  +
                    item_54,
         190  +
                )?;
         191  +
                object_55.finish();
         192  +
            }
         193  +
        }
         194  +
        array_53.finish();
         195  +
    }
         196  +
    if let Some(var_56) = &input.recursive_map {
         197  +
        #[allow(unused_mut)]
         198  +
        let mut object_57 = object.key("RecursiveMap").start_object();
         199  +
        for (key_58, value_59) in var_56 {
         200  +
            {
         201  +
                #[allow(unused_mut)]
         202  +
                let mut object_60 = object_57.key(key_58.as_str()).start_object();
         203  +
                crate::protocol_serde::shape_kitchen_sink::ser_kitchen_sink(
         204  +
                    &mut object_60,
         205  +
                    value_59,
         206  +
                )?;
         207  +
                object_60.finish();
         208  +
            }
         209  +
        }
         210  +
        object_57.finish();
         211  +
    }
         212  +
    if let Some(var_61) = &input.recursive_struct {
         213  +
        #[allow(unused_mut)]
         214  +
        let mut object_62 = object.key("RecursiveStruct").start_object();
         215  +
        crate::protocol_serde::shape_kitchen_sink::ser_kitchen_sink(&mut object_62, var_61)?;
         216  +
        object_62.finish();
         217  +
    }
         218  +
    if let Some(var_63) = &input.simple_struct {
         219  +
        #[allow(unused_mut)]
         220  +
        let mut object_64 = object.key("SimpleStruct").start_object();
         221  +
        crate::protocol_serde::shape_simple_struct::ser_simple_struct(&mut object_64, var_63)?;
         222  +
        object_64.finish();
         223  +
    }
         224  +
    if let Some(var_65) = &input.string {
         225  +
        object.key("String").string(var_65.as_str());
         226  +
    }
         227  +
    if let Some(var_66) = &input.struct_with_json_name {
         228  +
        #[allow(unused_mut)]
         229  +
        let mut object_67 = object.key("StructWithJsonName").start_object();
         230  +
        crate::protocol_serde::shape_struct_with_json_name::ser_struct_with_json_name(
         231  +
            &mut object_67,
         232  +
            var_66,
         233  +
        )?;
         234  +
        object_67.finish();
         235  +
    }
         236  +
    if let Some(var_68) = &input.timestamp {
         237  +
        object
         238  +
            .key("Timestamp")
         239  +
            .date_time(var_68, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         240  +
    }
         241  +
    if let Some(var_69) = &input.unix_timestamp {
         242  +
        object
         243  +
            .key("UnixTimestamp")
         244  +
            .date_time(var_69, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         245  +
    }
         246  +
    Ok(())
         247  +
}