Server Test

Server Test

rev. 0b749be6d000fdc7ef59d1bc26f1dce00358d95c (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_content_type_parameters_output.rs

@@ -0,1 +0,17 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_content_type_parameters_output_output_output(
           3  +
    value: &crate::output::ContentTypeParametersOutput,
           4  +
) -> Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_content_type_parameters_output_output(
          13  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    #[allow(unused_variables)] input: &crate::output::ContentTypeParametersOutput,
          15  +
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    Ok(())
          17  +
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_defaults.rs

@@ -0,1 +0,311 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_defaults<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> Result<
           5  +
    Option<crate::model::defaults::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::defaults::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  +
                            "defaultString" => {
          27  +
                                if let Some(v) =
          28  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
          29  +
                                        tokens.next(),
          30  +
                                    )?
          31  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          32  +
                                    .transpose()?
          33  +
                                {
          34  +
                                    builder = builder.set_default_string(v);
          35  +
                                }
          36  +
                            }
          37  +
                            "defaultBoolean" => {
          38  +
                                if let Some(v) =
          39  +
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(
          40  +
                                        tokens.next(),
          41  +
                                    )?
          42  +
                                {
          43  +
                                    builder = builder.set_default_boolean(v);
          44  +
                                }
          45  +
                            }
          46  +
                            "defaultList" => {
          47  +
                                if let Some(v) =
          48  +
                                crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens)?
          49  +
                                {
          50  +
                                                                            builder = builder.set_default_list(v);
          51  +
                                                                        }
          52  +
                            }
          53  +
                            "defaultDocumentMap" => {
          54  +
                                if let Some(v) = Some(
          55  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          56  +
                                ) {
          57  +
                                    builder = builder.set_default_document_map(v);
          58  +
                                }
          59  +
                            }
          60  +
                            "defaultDocumentString" => {
          61  +
                                if let Some(v) = Some(
          62  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          63  +
                                ) {
          64  +
                                    builder = builder.set_default_document_string(v);
          65  +
                                }
          66  +
                            }
          67  +
                            "defaultDocumentBoolean" => {
          68  +
                                if let Some(v) = Some(
          69  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          70  +
                                ) {
          71  +
                                    builder = builder.set_default_document_boolean(v);
          72  +
                                }
          73  +
                            }
          74  +
                            "defaultDocumentList" => {
          75  +
                                if let Some(v) = Some(
          76  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          77  +
                                ) {
          78  +
                                    builder = builder.set_default_document_list(v);
          79  +
                                }
          80  +
                            }
          81  +
                            "defaultNullDocument" => {
          82  +
                                builder = builder.set_default_null_document(Some(
          83  +
                                    ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
          84  +
                                ));
          85  +
                            }
          86  +
                            "defaultTimestamp" => {
          87  +
                                if let Some(v) =
          88  +
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
          89  +
                                        tokens.next(),
          90  +
                                        ::aws_smithy_types::date_time::Format::EpochSeconds,
          91  +
                                    )?
          92  +
                                {
          93  +
                                    builder = builder.set_default_timestamp(v);
          94  +
                                }
          95  +
                            }
          96  +
                            "defaultBlob" => {
          97  +
                                if let Some(v) =
          98  +
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(
          99  +
                                        tokens.next(),
         100  +
                                    )?
         101  +
                                {
         102  +
                                    builder = builder.set_default_blob(v);
         103  +
                                }
         104  +
                            }
         105  +
                            "defaultByte" => {
         106  +
                                if let Some(v) =
         107  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         108  +
                                        tokens.next(),
         109  +
                                    )?
         110  +
                                    .map(i8::try_from)
         111  +
                                    .transpose()?
         112  +
                                {
         113  +
                                    builder = builder.set_default_byte(v);
         114  +
                                }
         115  +
                            }
         116  +
                            "defaultShort" => {
         117  +
                                if let Some(v) =
         118  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         119  +
                                        tokens.next(),
         120  +
                                    )?
         121  +
                                    .map(i16::try_from)
         122  +
                                    .transpose()?
         123  +
                                {
         124  +
                                    builder = builder.set_default_short(v);
         125  +
                                }
         126  +
                            }
         127  +
                            "defaultInteger" => {
         128  +
                                if let Some(v) =
         129  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         130  +
                                        tokens.next(),
         131  +
                                    )?
         132  +
                                    .map(i32::try_from)
         133  +
                                    .transpose()?
         134  +
                                {
         135  +
                                    builder = builder.set_default_integer(v);
         136  +
                                }
         137  +
                            }
         138  +
                            "defaultLong" => {
         139  +
                                if let Some(v) =
         140  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         141  +
                                        tokens.next(),
         142  +
                                    )?
         143  +
                                    .map(i64::try_from)
         144  +
                                    .transpose()?
         145  +
                                {
         146  +
                                    builder = builder.set_default_long(v);
         147  +
                                }
         148  +
                            }
         149  +
                            "defaultFloat" => {
         150  +
                                if let Some(v) =
         151  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         152  +
                                        tokens.next(),
         153  +
                                    )?
         154  +
                                    .map(|v| v.to_f32_lossy())
         155  +
                                {
         156  +
                                    builder = builder.set_default_float(v);
         157  +
                                }
         158  +
                            }
         159  +
                            "defaultDouble" => {
         160  +
                                if let Some(v) =
         161  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         162  +
                                        tokens.next(),
         163  +
                                    )?
         164  +
                                    .map(|v| v.to_f64_lossy())
         165  +
                                {
         166  +
                                    builder = builder.set_default_double(v);
         167  +
                                }
         168  +
                            }
         169  +
                            "defaultMap" => {
         170  +
                                if let Some(v) =
         171  +
                                crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens)?
         172  +
                                {
         173  +
                                                                            builder = builder.set_default_map(v);
         174  +
                                                                        }
         175  +
                            }
         176  +
                            "defaultEnum" => {
         177  +
                                if let Some(v) =
         178  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
         179  +
                                        tokens.next(),
         180  +
                                    )?
         181  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         182  +
                                    .transpose()?
         183  +
                                {
         184  +
                                    builder = builder.set_default_enum(v);
         185  +
                                }
         186  +
                            }
         187  +
                            "defaultIntEnum" => {
         188  +
                                if let Some(v) =
         189  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         190  +
                                        tokens.next(),
         191  +
                                    )?
         192  +
                                    .map(i32::try_from)
         193  +
                                    .transpose()?
         194  +
                                {
         195  +
                                    builder = builder.set_default_int_enum(v);
         196  +
                                }
         197  +
                            }
         198  +
                            "emptyString" => {
         199  +
                                if let Some(v) =
         200  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
         201  +
                                        tokens.next(),
         202  +
                                    )?
         203  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         204  +
                                    .transpose()?
         205  +
                                {
         206  +
                                    builder = builder.set_empty_string(v);
         207  +
                                }
         208  +
                            }
         209  +
                            "falseBoolean" => {
         210  +
                                if let Some(v) =
         211  +
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(
         212  +
                                        tokens.next(),
         213  +
                                    )?
         214  +
                                {
         215  +
                                    builder = builder.set_false_boolean(v);
         216  +
                                }
         217  +
                            }
         218  +
                            "emptyBlob" => {
         219  +
                                if let Some(v) =
         220  +
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(
         221  +
                                        tokens.next(),
         222  +
                                    )?
         223  +
                                {
         224  +
                                    builder = builder.set_empty_blob(v);
         225  +
                                }
         226  +
                            }
         227  +
                            "zeroByte" => {
         228  +
                                if let Some(v) =
         229  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         230  +
                                        tokens.next(),
         231  +
                                    )?
         232  +
                                    .map(i8::try_from)
         233  +
                                    .transpose()?
         234  +
                                {
         235  +
                                    builder = builder.set_zero_byte(v);
         236  +
                                }
         237  +
                            }
         238  +
                            "zeroShort" => {
         239  +
                                if let Some(v) =
         240  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         241  +
                                        tokens.next(),
         242  +
                                    )?
         243  +
                                    .map(i16::try_from)
         244  +
                                    .transpose()?
         245  +
                                {
         246  +
                                    builder = builder.set_zero_short(v);
         247  +
                                }
         248  +
                            }
         249  +
                            "zeroInteger" => {
         250  +
                                if let Some(v) =
         251  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         252  +
                                        tokens.next(),
         253  +
                                    )?
         254  +
                                    .map(i32::try_from)
         255  +
                                    .transpose()?
         256  +
                                {
         257  +
                                    builder = builder.set_zero_integer(v);
         258  +
                                }
         259  +
                            }
         260  +
                            "zeroLong" => {
         261  +
                                if let Some(v) =
         262  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         263  +
                                        tokens.next(),
         264  +
                                    )?
         265  +
                                    .map(i64::try_from)
         266  +
                                    .transpose()?
         267  +
                                {
         268  +
                                    builder = builder.set_zero_long(v);
         269  +
                                }
         270  +
                            }
         271  +
                            "zeroFloat" => {
         272  +
                                if let Some(v) =
         273  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         274  +
                                        tokens.next(),
         275  +
                                    )?
         276  +
                                    .map(|v| v.to_f32_lossy())
         277  +
                                {
         278  +
                                    builder = builder.set_zero_float(v);
         279  +
                                }
         280  +
                            }
         281  +
                            "zeroDouble" => {
         282  +
                                if let Some(v) =
         283  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
         284  +
                                        tokens.next(),
         285  +
                                    )?
         286  +
                                    .map(|v| v.to_f64_lossy())
         287  +
                                {
         288  +
                                    builder = builder.set_zero_double(v);
         289  +
                                }
         290  +
                            }
         291  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         292  +
                        }
         293  +
                    }
         294  +
                    other => {
         295  +
                        return Err(
         296  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         297  +
                                format!("expected object key or end object, found: {:?}", other),
         298  +
                            ),
         299  +
                        )
         300  +
                    }
         301  +
                }
         302  +
            }
         303  +
            Ok(Some(builder))
         304  +
        }
         305  +
        _ => Err(
         306  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         307  +
                "expected start object or null",
         308  +
            ),
         309  +
        ),
         310  +
    }
         311  +
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_dialog.rs

@@ -0,1 +0,87 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_dialog(
           3  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::model::Dialog,
           5  +
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    if let Some(var_1) = &input.language {
           7  +
        object.key("language").string(var_1.as_str());
           8  +
    }
           9  +
    {
          10  +
        object.key("greeting").string(input.greeting.as_str());
          11  +
    }
          12  +
    if let Some(var_2) = &input.farewell {
          13  +
        #[allow(unused_mut)]
          14  +
        let mut object_3 = object.key("farewell").start_object();
          15  +
        crate::protocol_serde::shape_farewell::ser_farewell(&mut object_3, var_2)?;
          16  +
        object_3.finish();
          17  +
    }
          18  +
    Ok(())
          19  +
}
          20  +
          21  +
pub(crate) fn de_dialog<'a, I>(
          22  +
    tokens: &mut ::std::iter::Peekable<I>,
          23  +
) -> Result<Option<crate::model::Dialog>, ::aws_smithy_json::deserialize::error::DeserializeError>
          24  +
where
          25  +
    I: Iterator<
          26  +
        Item = Result<
          27  +
            ::aws_smithy_json::deserialize::Token<'a>,
          28  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          29  +
        >,
          30  +
    >,
          31  +
{
          32  +
    match tokens.next().transpose()? {
          33  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          34  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          35  +
            #[allow(unused_mut)]
          36  +
            let mut builder = crate::model::dialog::Builder::default();
          37  +
            loop {
          38  +
                match tokens.next().transpose()? {
          39  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          40  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          41  +
                        match key.to_unescaped()?.as_ref() {
          42  +
                            "language" => {
          43  +
                                builder = builder.set_language(
          44  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
          45  +
                                        tokens.next(),
          46  +
                                    )?
          47  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          48  +
                                    .transpose()?,
          49  +
                                );
          50  +
                            }
          51  +
                            "greeting" => {
          52  +
                                if let Some(v) =
          53  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
          54  +
                                        tokens.next(),
          55  +
                                    )?
          56  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          57  +
                                    .transpose()?
          58  +
                                {
          59  +
                                    builder = builder.set_greeting(v);
          60  +
                                }
          61  +
                            }
          62  +
                            "farewell" => {
          63  +
                                builder = builder.set_farewell(
          64  +
                                    crate::protocol_serde::shape_farewell::de_farewell(tokens)?,
          65  +
                                );
          66  +
                            }
          67  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          68  +
                        }
          69  +
                    }
          70  +
                    other => {
          71  +
                        return Err(
          72  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          73  +
                                format!("expected object key or end object, found: {:?}", other),
          74  +
                            ),
          75  +
                        )
          76  +
                    }
          77  +
                }
          78  +
            }
          79  +
            Ok(Some(builder.build()))
          80  +
        }
          81  +
        _ => Err(
          82  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          83  +
                "expected start object or null",
          84  +
            ),
          85  +
        ),
          86  +
    }
          87  +
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_dialog_list.rs

@@ -0,1 +0,48 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_dialog_list<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> Result<
           5  +
    Option<::std::vec::Vec<crate::model::Dialog>>,
           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 = crate::protocol_serde::shape_dialog::de_dialog(tokens)?;
          28  +
                        if let Some(value) = value {
          29  +
                            items.push(value);
          30  +
                        } else {
          31  +
                            return Err(
          32  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          33  +
                                    "dense list cannot contain null values",
          34  +
                                ),
          35  +
                            );
          36  +
                        }
          37  +
                    }
          38  +
                }
          39  +
            }
          40  +
            Ok(Some(items))
          41  +
        }
          42  +
        _ => Err(
          43  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          44  +
                "expected start array or null",
          45  +
            ),
          46  +
        ),
          47  +
    }
          48  +
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_dialog_map.rs

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

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_farewell.rs

@@ -0,1 +0,64 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_farewell(
           3  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::model::Farewell,
           5  +
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    {
           7  +
        object.key("phrase").string(input.phrase.as_str());
           8  +
    }
           9  +
    Ok(())
          10  +
}
          11  +
          12  +
pub(crate) fn de_farewell<'a, I>(
          13  +
    tokens: &mut ::std::iter::Peekable<I>,
          14  +
) -> Result<Option<crate::model::Farewell>, ::aws_smithy_json::deserialize::error::DeserializeError>
          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::farewell::Builder::default();
          28  +
            loop {
          29  +
                match tokens.next().transpose()? {
          30  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          31  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          32  +
                        match key.to_unescaped()?.as_ref() {
          33  +
                            "phrase" => {
          34  +
                                if let Some(v) =
          35  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
          36  +
                                        tokens.next(),
          37  +
                                    )?
          38  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          39  +
                                    .transpose()?
          40  +
                                {
          41  +
                                    builder = builder.set_phrase(v);
          42  +
                                }
          43  +
                            }
          44  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          45  +
                        }
          46  +
                    }
          47  +
                    other => {
          48  +
                        return Err(
          49  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          50  +
                                format!("expected object key or end object, found: {:?}", other),
          51  +
                            ),
          52  +
                        )
          53  +
                    }
          54  +
                }
          55  +
            }
          56  +
            Ok(Some(builder.build()))
          57  +
        }
          58  +
        _ => Err(
          59  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          60  +
                "expected start object or null",
          61  +
            ),
          62  +
        ),
          63  +
    }
          64  +
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_operation_with_defaults.rs

@@ -0,1 +0,176 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_operation_with_defaults_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::OperationWithDefaultsInput,
           7  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::operation_with_defaults_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_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/json"),
          27  +
            )?;
          28  +
            input =
          29  +
                crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults(
          30  +
                    bytes.as_ref(),
          31  +
                    input,
          32  +
                )?;
          33  +
        }
          34  +
        input.build()?
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn ser_operation_with_defaults_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::OperationWithDefaultsOutput,
          41  +
) -> std::result::Result<
          42  +
    ::aws_smithy_http_server::response::Response,
          43  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          44  +
> {
          45  +
    Ok({
          46  +
        #[allow(unused_mut)]
          47  +
        let mut builder = ::http::Response::builder();
          48  +
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          49  +
            builder,
          50  +
            ::http::header::CONTENT_TYPE,
          51  +
            "application/json",
          52  +
        );
          53  +
        let http_status: u16 = 200;
          54  +
        builder = builder.status(http_status);
          55  +
        let payload =
          56  +
            crate::protocol_serde::shape_operation_with_defaults_output::ser_operation_with_defaults_output_output_output(&output)?
          57  +
        ;
          58  +
        let content_length = payload.len();
          59  +
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          60  +
            builder,
          61  +
            ::http::header::CONTENT_LENGTH,
          62  +
            content_length,
          63  +
        );
          64  +
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          65  +
        builder.body(body)?
          66  +
    })
          67  +
}
          68  +
          69  +
#[allow(clippy::unnecessary_wraps)]
          70  +
pub fn ser_operation_with_defaults_http_error(
          71  +
    error: &crate::error::OperationWithDefaultsError,
          72  +
) -> std::result::Result<
          73  +
    ::aws_smithy_http_server::response::Response,
          74  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          75  +
> {
          76  +
    Ok({
          77  +
        match error {
          78  +
            crate::error::OperationWithDefaultsError::ValidationException(output) => {
          79  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          80  +
                #[allow(unused_mut)]
          81  +
                let mut builder = ::http::Response::builder();
          82  +
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          83  +
                    builder,
          84  +
                    ::http::header::CONTENT_TYPE,
          85  +
                    "application/json",
          86  +
                );
          87  +
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          88  +
                    builder,
          89  +
                    http::header::HeaderName::from_static("x-amzn-errortype"),
          90  +
                    "ValidationException",
          91  +
                );
          92  +
                let content_length = payload.len();
          93  +
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          94  +
                    builder,
          95  +
                    ::http::header::CONTENT_LENGTH,
          96  +
                    content_length,
          97  +
                );
          98  +
                builder
          99  +
                    .status(400)
         100  +
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         101  +
            }
         102  +
        }
         103  +
    })
         104  +
}
         105  +
         106  +
pub(crate) fn de_operation_with_defaults(
         107  +
    value: &[u8],
         108  +
    mut builder: crate::input::operation_with_defaults_input::Builder,
         109  +
) -> Result<
         110  +
    crate::input::operation_with_defaults_input::Builder,
         111  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         112  +
> {
         113  +
    let mut tokens_owned =
         114  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         115  +
            .peekable();
         116  +
    let tokens = &mut tokens_owned;
         117  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         118  +
    loop {
         119  +
        match tokens.next().transpose()? {
         120  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         121  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         122  +
                match key.to_unescaped()?.as_ref() {
         123  +
                    "clientOptionalDefaults" => {
         124  +
                        builder = builder.set_client_optional_defaults(
         125  +
                            crate::protocol_serde::shape_client_optional_defaults::de_client_optional_defaults(tokens)?
         126  +
                        );
         127  +
                    }
         128  +
                    "defaults" => {
         129  +
                        builder = builder.set_defaults(
         130  +
                            crate::protocol_serde::shape_defaults::de_defaults(tokens)?,
         131  +
                        );
         132  +
                    }
         133  +
                    "otherTopLevelDefault" => {
         134  +
                        if let Some(v) =
         135  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
         136  +
                                tokens.next(),
         137  +
                            )?
         138  +
                            .map(i32::try_from)
         139  +
                            .transpose()?
         140  +
                        {
         141  +
                            builder = builder.set_other_top_level_default(v);
         142  +
                        }
         143  +
                    }
         144  +
                    "topLevelDefault" => {
         145  +
                        if let Some(v) =
         146  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
         147  +
                                tokens.next(),
         148  +
                            )?
         149  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
         150  +
                            .transpose()?
         151  +
                        {
         152  +
                            builder = builder.set_top_level_default(v);
         153  +
                        }
         154  +
                    }
         155  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         156  +
                }
         157  +
            }
         158  +
            other => {
         159  +
                return Err(
         160  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         161  +
                        "expected object key or end object, found: {:?}",
         162  +
                        other
         163  +
                    )),
         164  +
                )
         165  +
            }
         166  +
        }
         167  +
    }
         168  +
    if tokens.next().is_some() {
         169  +
        return Err(
         170  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         171  +
                "found more JSON tokens after completing parsing",
         172  +
            ),
         173  +
        );
         174  +
    }
         175  +
    Ok(builder)
         176  +
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_operation_with_defaults_output.rs

@@ -0,1 +0,174 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_operation_with_defaults_output_output_output(
           3  +
    value: &crate::output::OperationWithDefaultsOutput,
           4  +
) -> Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_operation_with_defaults_output::ser_operation_with_defaults_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_operation_with_defaults_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::OperationWithDefaultsOutput,
          15  +
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    {
          17  +
        object
          18  +
            .key("defaultBlob")
          19  +
            .string_unchecked(&::aws_smithy_types::base64::encode(&input.default_blob));
          20  +
    }
          21  +
    {
          22  +
        object.key("defaultBoolean").boolean(input.default_boolean);
          23  +
    }
          24  +
    {
          25  +
        object.key("defaultByte").number(
          26  +
            #[allow(clippy::useless_conversion)]
          27  +
            ::aws_smithy_types::Number::NegInt((input.default_byte).into()),
          28  +
        );
          29  +
    }
          30  +
    {
          31  +
        object
          32  +
            .key("defaultDocumentBoolean")
          33  +
            .document(&input.default_document_boolean);
          34  +
    }
          35  +
    {
          36  +
        object
          37  +
            .key("defaultDocumentList")
          38  +
            .document(&input.default_document_list);
          39  +
    }
          40  +
    {
          41  +
        object
          42  +
            .key("defaultDocumentMap")
          43  +
            .document(&input.default_document_map);
          44  +
    }
          45  +
    {
          46  +
        object
          47  +
            .key("defaultDocumentString")
          48  +
            .document(&input.default_document_string);
          49  +
    }
          50  +
    {
          51  +
        object.key("defaultDouble").number(
          52  +
            #[allow(clippy::useless_conversion)]
          53  +
            ::aws_smithy_types::Number::Float((input.default_double).into()),
          54  +
        );
          55  +
    }
          56  +
    {
          57  +
        object
          58  +
            .key("defaultEnum")
          59  +
            .string(input.default_enum.as_str());
          60  +
    }
          61  +
    {
          62  +
        object.key("defaultFloat").number(
          63  +
            #[allow(clippy::useless_conversion)]
          64  +
            ::aws_smithy_types::Number::Float((input.default_float).into()),
          65  +
        );
          66  +
    }
          67  +
    {
          68  +
        object.key("defaultIntEnum").number(
          69  +
            #[allow(clippy::useless_conversion)]
          70  +
            ::aws_smithy_types::Number::NegInt((input.default_int_enum).into()),
          71  +
        );
          72  +
    }
          73  +
    {
          74  +
        object.key("defaultInteger").number(
          75  +
            #[allow(clippy::useless_conversion)]
          76  +
            ::aws_smithy_types::Number::NegInt((input.default_integer).into()),
          77  +
        );
          78  +
    }
          79  +
    {
          80  +
        let mut array_1 = object.key("defaultList").start_array();
          81  +
        for item_2 in &input.default_list {
          82  +
            {
          83  +
                array_1.value().string(item_2.as_str());
          84  +
            }
          85  +
        }
          86  +
        array_1.finish();
          87  +
    }
          88  +
    {
          89  +
        object.key("defaultLong").number(
          90  +
            #[allow(clippy::useless_conversion)]
          91  +
            ::aws_smithy_types::Number::NegInt((input.default_long).into()),
          92  +
        );
          93  +
    }
          94  +
    {
          95  +
        #[allow(unused_mut)]
          96  +
        let mut object_3 = object.key("defaultMap").start_object();
          97  +
        for (key_4, value_5) in &input.default_map {
          98  +
            {
          99  +
                object_3.key(key_4.as_str()).string(value_5.as_str());
         100  +
            }
         101  +
        }
         102  +
        object_3.finish();
         103  +
    }
         104  +
    if let Some(var_6) = &input.default_null_document {
         105  +
        object.key("defaultNullDocument").document(var_6);
         106  +
    }
         107  +
    {
         108  +
        object.key("defaultShort").number(
         109  +
            #[allow(clippy::useless_conversion)]
         110  +
            ::aws_smithy_types::Number::NegInt((input.default_short).into()),
         111  +
        );
         112  +
    }
         113  +
    {
         114  +
        object
         115  +
            .key("defaultString")
         116  +
            .string(input.default_string.as_str());
         117  +
    }
         118  +
    {
         119  +
        object.key("defaultTimestamp").date_time(
         120  +
            &input.default_timestamp,
         121  +
            ::aws_smithy_types::date_time::Format::EpochSeconds,
         122  +
        )?;
         123  +
    }
         124  +
    {
         125  +
        object
         126  +
            .key("emptyBlob")
         127  +
            .string_unchecked(&::aws_smithy_types::base64::encode(&input.empty_blob));
         128  +
    }
         129  +
    {
         130  +
        object
         131  +
            .key("emptyString")
         132  +
            .string(input.empty_string.as_str());
         133  +
    }
         134  +
    {
         135  +
        object.key("falseBoolean").boolean(input.false_boolean);
         136  +
    }
         137  +
    {
         138  +
        object.key("zeroByte").number(
         139  +
            #[allow(clippy::useless_conversion)]
         140  +
            ::aws_smithy_types::Number::NegInt((input.zero_byte).into()),
         141  +
        );
         142  +
    }
         143  +
    {
         144  +
        object.key("zeroDouble").number(
         145  +
            #[allow(clippy::useless_conversion)]
         146  +
            ::aws_smithy_types::Number::Float((input.zero_double).into()),
         147  +
        );
         148  +
    }
         149  +
    {
         150  +
        object.key("zeroFloat").number(
         151  +
            #[allow(clippy::useless_conversion)]
         152  +
            ::aws_smithy_types::Number::Float((input.zero_float).into()),
         153  +
        );
         154  +
    }
         155  +
    {
         156  +
        object.key("zeroInteger").number(
         157  +
            #[allow(clippy::useless_conversion)]
         158  +
            ::aws_smithy_types::Number::NegInt((input.zero_integer).into()),
         159  +
        );
         160  +
    }
         161  +
    {
         162  +
        object.key("zeroLong").number(
         163  +
            #[allow(clippy::useless_conversion)]
         164  +
            ::aws_smithy_types::Number::NegInt((input.zero_long).into()),
         165  +
        );
         166  +
    }
         167  +
    {
         168  +
        object.key("zeroShort").number(
         169  +
            #[allow(clippy::useless_conversion)]
         170  +
            ::aws_smithy_types::Number::NegInt((input.zero_short).into()),
         171  +
        );
         172  +
    }
         173  +
    Ok(())
         174  +
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_operation_with_nested_structure.rs

Renamed from tmp-codegen-diff/codegen-server-test/rest_json_extras/rust-server-codegen/src/protocol_serde/shape_malformed_content_type_with_body2.rs

@@ -1,1 +148,147 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3         -
pub async fn de_malformed_content_type_with_body2_http_request<B>(
           3  +
pub async fn de_operation_with_nested_structure_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6         -
    crate::input::MalformedContentTypeWithBody2Input,
           6  +
    crate::input::OperationWithNestedStructureInput,
    7      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12     12   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17         -
        let mut input = crate::input::malformed_content_type_with_body2_input::Builder::default();
          17  +
        let mut input = crate::input::operation_with_nested_structure_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22     22   
        let bytes = ::hyper::body::to_bytes(body).await?;
   23     23   
        if !bytes.is_empty() {
   24     24   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     25   
                &headers,
   26     26   
                Some("application/json"),
   27     27   
            )?;
   28         -
            input = crate::protocol_serde::shape_malformed_content_type_with_body2::de_malformed_content_type_with_body2(bytes.as_ref(), input)?;
          28  +
            input = crate::protocol_serde::shape_operation_with_nested_structure::de_operation_with_nested_structure(bytes.as_ref(), input)?;
   29     29   
        }
   30         -
        input.build()
          30  +
        input.build()?
   31     31   
    })
   32     32   
}
   33     33   
   34     34   
#[allow(clippy::unnecessary_wraps)]
   35         -
pub fn ser_malformed_content_type_with_body2_http_response(
   36         -
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithBody2Output,
          35  +
pub fn ser_operation_with_nested_structure_http_response(
          36  +
    #[allow(unused_variables)] output: crate::output::OperationWithNestedStructureOutput,
   37     37   
) -> std::result::Result<
   38     38   
    ::aws_smithy_http_server::response::Response,
   39     39   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     40   
> {
   41     41   
    Ok({
   42     42   
        #[allow(unused_mut)]
   43     43   
        let mut builder = ::http::Response::builder();
   44     44   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     45   
            builder,
   46     46   
            ::http::header::CONTENT_TYPE,
   47     47   
            "application/json",
   48     48   
        );
   49     49   
        let http_status: u16 = 200;
   50     50   
        builder = builder.status(http_status);
   51         -
        let payload = "";
          51  +
        let payload =
          52  +
            crate::protocol_serde::shape_operation_with_nested_structure_output::ser_operation_with_nested_structure_output_output_output(&output)?
          53  +
        ;
   52     54   
        let content_length = payload.len();
   53     55   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     56   
            builder,
   55     57   
            ::http::header::CONTENT_LENGTH,
   56     58   
            content_length,
   57     59   
        );
   58     60   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   59     61   
        builder.body(body)?
   60     62   
    })
   61     63   
}
   62     64   
   63     65   
#[allow(clippy::unnecessary_wraps)]
   64         -
pub fn ser_malformed_content_type_with_body2_http_error(
   65         -
    error: &crate::error::MalformedContentTypeWithBody2Error,
          66  +
pub fn ser_operation_with_nested_structure_http_error(
          67  +
    error: &crate::error::OperationWithNestedStructureError,
   66     68   
) -> std::result::Result<
   67     69   
    ::aws_smithy_http_server::response::Response,
   68     70   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   69     71   
> {
   70     72   
    Ok({
   71     73   
        match error {
   72         -
            crate::error::MalformedContentTypeWithBody2Error::ExtraError(output) => {
   73         -
                let payload =
   74         -
                    crate::protocol_serde::shape_extra_error::ser_extra_error_error(output)?;
          74  +
            crate::error::OperationWithNestedStructureError::ValidationException(output) => {
          75  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   75     76   
                #[allow(unused_mut)]
   76     77   
                let mut builder = ::http::Response::builder();
   77     78   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78     79   
                    builder,
   79     80   
                    ::http::header::CONTENT_TYPE,
   80     81   
                    "application/json",
   81     82   
                );
   82     83   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83     84   
                    builder,
   84     85   
                    http::header::HeaderName::from_static("x-amzn-errortype"),
   85         -
                    "ExtraError",
          86  +
                    "ValidationException",
   86     87   
                );
   87     88   
                let content_length = payload.len();
   88     89   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89     90   
                    builder,
   90     91   
                    ::http::header::CONTENT_LENGTH,
   91     92   
                    content_length,
   92     93   
                );
   93     94   
                builder
   94         -
                    .status(500)
          95  +
                    .status(400)
   95     96   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   96     97   
            }
   97     98   
        }
   98     99   
    })
   99    100   
}
  100    101   
  101         -
pub(crate) fn de_malformed_content_type_with_body2(
         102  +
pub(crate) fn de_operation_with_nested_structure(
  102    103   
    value: &[u8],
  103         -
    mut builder: crate::input::malformed_content_type_with_body2_input::Builder,
         104  +
    mut builder: crate::input::operation_with_nested_structure_input::Builder,
  104    105   
) -> Result<
  105         -
    crate::input::malformed_content_type_with_body2_input::Builder,
         106  +
    crate::input::operation_with_nested_structure_input::Builder,
  106    107   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  107    108   
> {
  108    109   
    let mut tokens_owned =
  109    110   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  110    111   
            .peekable();
  111    112   
    let tokens = &mut tokens_owned;
  112    113   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
  113    114   
    loop {
  114    115   
        match tokens.next().transpose()? {
  115    116   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  116    117   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
  117    118   
                match key.to_unescaped()?.as_ref() {
  118         -
                    "salutation" => {
  119         -
                        builder = builder.set_salutation(
  120         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  121         -
                                tokens.next(),
  122         -
                            )?
  123         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  124         -
                            .transpose()?,
  125         -
                        );
         119  +
                    "topLevel" => {
         120  +
                        if let Some(v) =
         121  +
                            crate::protocol_serde::shape_top_level::de_top_level(tokens)?
         122  +
                        {
         123  +
                            builder = builder.set_top_level(v);
         124  +
                        }
  126    125   
                    }
  127    126   
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  128    127   
                }
  129    128   
            }
  130    129   
            other => {
  131    130   
                return Err(
  132    131   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  133    132   
                        "expected object key or end object, found: {:?}",
  134    133   
                        other
  135    134   
                    )),

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_operation_with_nested_structure_output.rs

@@ -0,1 +0,48 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_operation_with_nested_structure_output_output_output(
           3  +
    value: &crate::output::OperationWithNestedStructureOutput,
           4  +
) -> Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_operation_with_nested_structure_output::ser_operation_with_nested_structure_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_operation_with_nested_structure_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::OperationWithNestedStructureOutput,
          15  +
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    {
          17  +
        #[allow(unused_mut)]
          18  +
        let mut object_1 = object.key("dialog").start_object();
          19  +
        crate::protocol_serde::shape_dialog::ser_dialog(&mut object_1, &input.dialog)?;
          20  +
        object_1.finish();
          21  +
    }
          22  +
    {
          23  +
        let mut array_2 = object.key("dialogList").start_array();
          24  +
        for item_3 in &input.dialog_list {
          25  +
            {
          26  +
                #[allow(unused_mut)]
          27  +
                let mut object_4 = array_2.value().start_object();
          28  +
                crate::protocol_serde::shape_dialog::ser_dialog(&mut object_4, item_3)?;
          29  +
                object_4.finish();
          30  +
            }
          31  +
        }
          32  +
        array_2.finish();
          33  +
    }
          34  +
    {
          35  +
        #[allow(unused_mut)]
          36  +
        let mut object_5 = object.key("dialogMap").start_object();
          37  +
        for (key_6, value_7) in &input.dialog_map {
          38  +
            {
          39  +
                #[allow(unused_mut)]
          40  +
                let mut object_8 = object_5.key(key_6.as_str()).start_object();
          41  +
                crate::protocol_serde::shape_dialog::ser_dialog(&mut object_8, value_7)?;
          42  +
                object_8.finish();
          43  +
            }
          44  +
        }
          45  +
        object_5.finish();
          46  +
    }
          47  +
    Ok(())
          48  +
}