Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5

Files changed:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -0,1 +0,197 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_my_union<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<
           5  +
    Option<crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained>,
           6  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
           7  +
>
           8  +
where
           9  +
    I: Iterator<
          10  +
        Item = Result<
          11  +
            ::aws_smithy_json::deserialize::Token<'a>,
          12  +
            ::aws_smithy_json::deserialize::error::DeserializeError,
          13  +
        >,
          14  +
    >,
          15  +
{
          16  +
    let mut variant = None;
          17  +
    match tokens.next().transpose()? {
          18  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
          19  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          20  +
            match tokens.next().transpose()? {
          21  +
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          23  +
                    if let ::std::option::Option::Some(::std::result::Result::Ok(
          24  +
                        ::aws_smithy_json::deserialize::Token::ValueNull { .. },
          25  +
                    )) = tokens.peek()
          26  +
                    {
          27  +
                        let _ = tokens.next().expect("peek returned a token")?;
          28  +
                        continue;
          29  +
                    }
          30  +
                    let key = key.to_unescaped()?;
          31  +
                    if key == "__type" {
          32  +
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          33  +
                        continue;
          34  +
                    }
          35  +
                    if variant.is_some() {
          36  +
                        return Err(
          37  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          38  +
                                "encountered mixed variants in union",
          39  +
                            ),
          40  +
                        );
          41  +
                    }
          42  +
                    variant = match key.as_ref() {
          43  +
                            "stringValue" => {
          44  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StringValue(
          45  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          46  +
                                        s.to_unescaped().map(|u|
          47  +
                                            u.into_owned()
          48  +
                                        )
          49  +
                                    ).transpose()?
          50  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'stringValue' cannot be null"))?
          51  +
                                ))
          52  +
                            }
          53  +
                            "booleanValue" => {
          54  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BooleanValue(
          55  +
                                    ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
          56  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'booleanValue' cannot be null"))?
          57  +
                                ))
          58  +
                            }
          59  +
                            "numberValue" => {
          60  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::NumberValue(
          61  +
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          62  +
                                                        .map(i32::try_from)
          63  +
                                                        .transpose()?
          64  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'numberValue' cannot be null"))?
          65  +
                                ))
          66  +
                            }
          67  +
                            "blobValue" => {
          68  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BlobValue(
          69  +
                                    ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
          70  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'blobValue' cannot be null"))?
          71  +
                                ))
          72  +
                            }
          73  +
                            "timestampValue" => {
          74  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::TimestampValue(
          75  +
                                    ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          76  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'timestampValue' cannot be null"))?
          77  +
                                ))
          78  +
                            }
          79  +
                            "enumValue" => {
          80  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::EnumValue(
          81  +
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          82  +
                                        s.to_unescaped().map(|u|
          83  +
                                            u.into_owned()
          84  +
                                        )
          85  +
                                    ).transpose()?
          86  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'enumValue' cannot be null"))?
          87  +
                                ))
          88  +
                            }
          89  +
                            "listValue" => {
          90  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::ListValue(
          91  +
                                    crate::protocol_serde::shape_string_list::de_string_list(tokens)?
          92  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'listValue' cannot be null"))?
          93  +
                                ))
          94  +
                            }
          95  +
                            "mapValue" => {
          96  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::MapValue(
          97  +
                                    crate::protocol_serde::shape_string_map::de_string_map(tokens)?
          98  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'mapValue' cannot be null"))?
          99  +
                                ))
         100  +
                            }
         101  +
                            "structureValue" => {
         102  +
                                Some(crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StructureValue(
         103  +
                                    crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens)?
         104  +
                                    .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'structureValue' cannot be null"))?
         105  +
                                ))
         106  +
                            }
         107  +
                            variant => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("unexpected union variant: {variant}")))
         108  +
                        };
         109  +
                }
         110  +
                other => {
         111  +
                    return Err(
         112  +
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         113  +
                            "expected object key or end object, found: {other:?}"
         114  +
                        )),
         115  +
                    )
         116  +
                }
         117  +
            }
         118  +
        },
         119  +
        _ => {
         120  +
            return Err(
         121  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         122  +
                    "expected start object or null",
         123  +
                ),
         124  +
            )
         125  +
        }
         126  +
    }
         127  +
    if variant.is_none() {
         128  +
        return Err(
         129  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         130  +
                "Union did not contain a valid variant.",
         131  +
            ),
         132  +
        );
         133  +
    }
         134  +
    Ok(variant)
         135  +
}
         136  +
         137  +
pub fn ser_my_union(
         138  +
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
         139  +
    input: &crate::model::MyUnion,
         140  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         141  +
    match input {
         142  +
        crate::model::MyUnion::StringValue(inner) => {
         143  +
            object_2.key("stringValue").string(inner.as_str());
         144  +
        }
         145  +
        crate::model::MyUnion::BooleanValue(inner) => {
         146  +
            object_2.key("booleanValue").boolean(*inner);
         147  +
        }
         148  +
        crate::model::MyUnion::NumberValue(inner) => {
         149  +
            object_2.key("numberValue").number(
         150  +
                #[allow(clippy::useless_conversion)]
         151  +
                ::aws_smithy_types::Number::NegInt((*inner).into()),
         152  +
            );
         153  +
        }
         154  +
        crate::model::MyUnion::BlobValue(inner) => {
         155  +
            object_2
         156  +
                .key("blobValue")
         157  +
                .string_unchecked(&::aws_smithy_types::base64::encode(inner));
         158  +
        }
         159  +
        crate::model::MyUnion::TimestampValue(inner) => {
         160  +
            object_2
         161  +
                .key("timestampValue")
         162  +
                .date_time(inner, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
         163  +
        }
         164  +
        crate::model::MyUnion::EnumValue(inner) => {
         165  +
            object_2.key("enumValue").string(inner.as_str());
         166  +
        }
         167  +
        crate::model::MyUnion::ListValue(inner) => {
         168  +
            let mut array_1 = object_2.key("listValue").start_array();
         169  +
            for item_2 in inner {
         170  +
                {
         171  +
                    array_1.value().string(item_2.as_str());
         172  +
                }
         173  +
            }
         174  +
            array_1.finish();
         175  +
        }
         176  +
        crate::model::MyUnion::MapValue(inner) => {
         177  +
            #[allow(unused_mut)]
         178  +
            let mut object_3 = object_2.key("mapValue").start_object();
         179  +
            for (key_4, value_5) in inner {
         180  +
                {
         181  +
                    object_3.key(key_4.as_str()).string(value_5.as_str());
         182  +
                }
         183  +
            }
         184  +
            object_3.finish();
         185  +
        }
         186  +
        crate::model::MyUnion::StructureValue(inner) => {
         187  +
            #[allow(unused_mut)]
         188  +
            let mut object_6 = object_2.key("structureValue").start_object();
         189  +
            crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(
         190  +
                &mut object_6,
         191  +
                inner,
         192  +
            )?;
         193  +
            object_6.finish();
         194  +
        }
         195  +
    }
         196  +
    Ok(())
         197  +
}

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

@@ -0,1 +0,114 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_null_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::NullOperationInput,
           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::null_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_null_operation::de_null_operation(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_null_operation_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::NullOperationOutput,
          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_null_operation_output::ser_null_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  +
pub(crate) fn de_null_operation(
          69  +
    value: &[u8],
          70  +
    mut builder: crate::input::null_operation_input::Builder,
          71  +
) -> ::std::result::Result<
          72  +
    crate::input::null_operation_input::Builder,
          73  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          74  +
> {
          75  +
    let mut tokens_owned =
          76  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
          77  +
            .peekable();
          78  +
    let tokens = &mut tokens_owned;
          79  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          80  +
    loop {
          81  +
        match tokens.next().transpose()? {
          82  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          83  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          84  +
                match key.to_unescaped()?.as_ref() {
          85  +
                    "string" => {
          86  +
                        builder = builder.set_string(
          87  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
          88  +
                                tokens.next(),
          89  +
                            )?
          90  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          91  +
                            .transpose()?,
          92  +
                        );
          93  +
                    }
          94  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          95  +
                }
          96  +
            }
          97  +
            other => {
          98  +
                return Err(
          99  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         100  +
                        "expected object key or end object, found: {other:?}"
         101  +
                    )),
         102  +
                )
         103  +
            }
         104  +
        }
         105  +
    }
         106  +
    if tokens.next().is_some() {
         107  +
        return Err(
         108  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         109  +
                "found more JSON tokens after completing parsing",
         110  +
            ),
         111  +
        );
         112  +
    }
         113  +
    Ok(builder)
         114  +
}

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

@@ -0,1 +0,23 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_null_operation_output_output_output(
           3  +
    value: &crate::output::NullOperationOutput,
           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_null_operation_output::ser_null_operation_output_output(
           8  +
        &mut object,
           9  +
        value,
          10  +
    )?;
          11  +
    object.finish();
          12  +
    Ok(out)
          13  +
}
          14  +
          15  +
pub fn ser_null_operation_output_output(
          16  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          17  +
    input: &crate::output::NullOperationOutput,
          18  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          19  +
    if let Some(var_1) = &input.string {
          20  +
        object.key("string").string(var_1.as_str());
          21  +
    }
          22  +
    Ok(())
          23  +
}

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

@@ -0,1 +0,112 @@
           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_optional_input_output_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::OperationWithOptionalInputOutputInput,
           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 =
          18  +
            crate::input::operation_with_optional_input_output_input::Builder::default();
          19  +
        #[allow(unused_variables)]
          20  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          21  +
            uri, headers, body, ..
          22  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          23  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          24  +
        if !bytes.is_empty() {
          25  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          26  +
                &headers,
          27  +
                Some("application/x-amz-json-1.1"),
          28  +
            )?;
          29  +
            input = crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output(bytes.as_ref(), input)?;
          30  +
        }
          31  +
        input.build()
          32  +
    })
          33  +
}
          34  +
          35  +
#[allow(clippy::unnecessary_wraps)]
          36  +
pub fn ser_operation_with_optional_input_output_http_response(
          37  +
    #[allow(unused_variables)] output: crate::output::OperationWithOptionalInputOutputOutput,
          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_operation_with_optional_input_output_output::ser_operation_with_optional_input_output_output_output_output(&output)?
          54  +
        ;
          55  +
        let content_length = payload.len();
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          57  +
            builder,
          58  +
            ::http::header::CONTENT_LENGTH,
          59  +
            content_length,
          60  +
        );
          61  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          62  +
        builder.body(body)?
          63  +
    })
          64  +
}
          65  +
          66  +
pub(crate) fn de_operation_with_optional_input_output(
          67  +
    value: &[u8],
          68  +
    mut builder: crate::input::operation_with_optional_input_output_input::Builder,
          69  +
) -> ::std::result::Result<
          70  +
    crate::input::operation_with_optional_input_output_input::Builder,
          71  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          72  +
> {
          73  +
    let mut tokens_owned =
          74  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
          75  +
            .peekable();
          76  +
    let tokens = &mut tokens_owned;
          77  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          78  +
    loop {
          79  +
        match tokens.next().transpose()? {
          80  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          81  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          82  +
                match key.to_unescaped()?.as_ref() {
          83  +
                    "Value" => {
          84  +
                        builder = builder.set_value(
          85  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
          86  +
                                tokens.next(),
          87  +
                            )?
          88  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          89  +
                            .transpose()?,
          90  +
                        );
          91  +
                    }
          92  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          93  +
                }
          94  +
            }
          95  +
            other => {
          96  +
                return Err(
          97  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          98  +
                        "expected object key or end object, found: {other:?}"
          99  +
                    )),
         100  +
                )
         101  +
            }
         102  +
        }
         103  +
    }
         104  +
    if tokens.next().is_some() {
         105  +
        return Err(
         106  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         107  +
                "found more JSON tokens after completing parsing",
         108  +
            ),
         109  +
        );
         110  +
    }
         111  +
    Ok(builder)
         112  +
}

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

@@ -0,1 +0,20 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_operation_with_optional_input_output_output_output_output(
           3  +
    value: &crate::output::OperationWithOptionalInputOutputOutput,
           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_operation_with_optional_input_output_output::ser_operation_with_optional_input_output_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_operation_with_optional_input_output_output_output(
          13  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    input: &crate::output::OperationWithOptionalInputOutputOutput,
          15  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    if let Some(var_1) = &input.value {
          17  +
        object.key("Value").string(var_1.as_str());
          18  +
    }
          19  +
    Ok(())
          20  +
}