Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb (ignoring whitespace)

Files changed:

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

@@ -1,1 +58,83 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_dense_boolean_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, bool>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    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_bool_or_null(
   26         -
                            tokens.next(),
   27         -
                        )?;
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:298 */::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?
          40  +
                        /* JsonParserGenerator.kt:474 */;
          41  +
                        /* JsonParserGenerator.kt:481 */
   28     42   
                        match value {
   29     43   
                            Some(value) => {
   30     44   
                                map.insert(key, value);
   31     45   
                            }
   32     46   
                            None => {
   33     47   
                                return Err(
   34     48   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   35     49   
                                        "dense map cannot contain null values",
   36     50   
                                    ),
   37     51   
                                )
   38     52   
                            }
   39     53   
                        }
          54  +
                        /* JsonParserGenerator.kt:686 */
   40     55   
                    }
          56  +
                    /* JsonParserGenerator.kt:695 */
   41     57   
                    other => {
   42     58   
                        return Err(
   43     59   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   44     60   
                                format!("expected object key or end object, found: {other:?}"),
   45     61   
                            ),
   46     62   
                        )
          63  +
                    } /* JsonParserGenerator.kt:685 */
   47     64   
                }
          65  +
                /* JsonParserGenerator.kt:684 */
   48     66   
            }
   49         -
            }
          67  +
            /* JsonParserGenerator.kt:504 */
   50     68   
            Ok(Some(map))
          69  +
            /* JsonParserGenerator.kt:713 */
   51     70   
        }
   52         -
        _ => Err(
          71  +
        /* JsonParserGenerator.kt:722 */
          72  +
        _ => {
          73  +
            /* JsonParserGenerator.kt:723 */
          74  +
            Err(
   53     75   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   54     76   
                    "expected start object or null",
   55     77   
                ),
   56         -
        ),
          78  +
            )
          79  +
            /* JsonParserGenerator.kt:722 */
          80  +
        } /* JsonParserGenerator.kt:712 */
   57     81   
    }
          82  +
    /* JsonParserGenerator.kt:460 */
   58     83   
}

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

@@ -1,1 +60,85 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_dense_number_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, i32>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   24         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   25         -
                        let value = ::aws_smithy_json::deserialize::token::expect_number_or_null(
   26         -
                            tokens.next(),
   27         -
                        )?
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   28     40   
                                                .map(i32::try_from)
   29         -
                        .transpose()?;
          41  +
                                                .transpose()?
          42  +
                        /* JsonParserGenerator.kt:474 */;
          43  +
                        /* JsonParserGenerator.kt:481 */
   30     44   
                        match value {
   31     45   
                            Some(value) => {
   32     46   
                                map.insert(key, value);
   33     47   
                            }
   34     48   
                            None => {
   35     49   
                                return Err(
   36     50   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     51   
                                        "dense map cannot contain null values",
   38     52   
                                    ),
   39     53   
                                )
   40     54   
                            }
   41     55   
                        }
          56  +
                        /* JsonParserGenerator.kt:686 */
   42     57   
                    }
          58  +
                    /* JsonParserGenerator.kt:695 */
   43     59   
                    other => {
   44     60   
                        return Err(
   45     61   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46     62   
                                format!("expected object key or end object, found: {other:?}"),
   47     63   
                            ),
   48     64   
                        )
          65  +
                    } /* JsonParserGenerator.kt:685 */
   49     66   
                }
          67  +
                /* JsonParserGenerator.kt:684 */
   50     68   
            }
   51         -
            }
          69  +
            /* JsonParserGenerator.kt:504 */
   52     70   
            Ok(Some(map))
          71  +
            /* JsonParserGenerator.kt:713 */
   53     72   
        }
   54         -
        _ => Err(
          73  +
        /* JsonParserGenerator.kt:722 */
          74  +
        _ => {
          75  +
            /* JsonParserGenerator.kt:723 */
          76  +
            Err(
   55     77   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   56     78   
                    "expected start object or null",
   57     79   
                ),
   58         -
        ),
          80  +
            )
          81  +
            /* JsonParserGenerator.kt:722 */
          82  +
        } /* JsonParserGenerator.kt:712 */
   59     83   
    }
          84  +
    /* JsonParserGenerator.kt:460 */
   60     85   
}

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

@@ -1,1 +58,85 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_dense_set_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::dense_set_map_unconstrained::DenseSetMapUnconstrained>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    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_string_set::de_string_set(tokens)?;
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_set::de_string_set(tokens)?
          40  +
                        /* JsonParserGenerator.kt:474 */;
          41  +
                        /* JsonParserGenerator.kt:481 */
   26     42   
                        match value {
   27     43   
                            Some(value) => {
   28     44   
                                map.insert(key, value);
   29     45   
                            }
   30     46   
                            None => {
   31     47   
                                return Err(
   32     48   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   33     49   
                                        "dense map cannot contain null values",
   34     50   
                                    ),
   35     51   
                                )
   36     52   
                            }
   37     53   
                        }
          54  +
                        /* JsonParserGenerator.kt:686 */
   38     55   
                    }
          56  +
                    /* JsonParserGenerator.kt:695 */
   39     57   
                    other => {
   40     58   
                        return Err(
   41     59   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   42     60   
                                format!("expected object key or end object, found: {other:?}"),
   43     61   
                            ),
   44     62   
                        )
          63  +
                    } /* JsonParserGenerator.kt:685 */
   45     64   
                }
          65  +
                /* JsonParserGenerator.kt:684 */
   46     66   
            }
   47         -
            }
          67  +
            /* JsonParserGenerator.kt:502 */
   48     68   
            Ok(Some(
   49     69   
                crate::unconstrained::dense_set_map_unconstrained::DenseSetMapUnconstrained(map),
   50     70   
            ))
          71  +
            /* JsonParserGenerator.kt:713 */
   51     72   
        }
   52         -
        _ => Err(
          73  +
        /* JsonParserGenerator.kt:722 */
          74  +
        _ => {
          75  +
            /* JsonParserGenerator.kt:723 */
          76  +
            Err(
   53     77   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   54     78   
                    "expected start object or null",
   55     79   
                ),
   56         -
        ),
          80  +
            )
          81  +
            /* JsonParserGenerator.kt:722 */
          82  +
        } /* JsonParserGenerator.kt:712 */
   57     83   
    }
          84  +
    /* JsonParserGenerator.kt:460 */
   58     85   
}

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

@@ -1,1 +60,87 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_dense_string_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    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()?;
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:474 */;
          45  +
                        /* JsonParserGenerator.kt:481 */
   30     46   
                        match value {
   31     47   
                            Some(value) => {
   32     48   
                                map.insert(key, value);
   33     49   
                            }
   34     50   
                            None => {
   35     51   
                                return Err(
   36     52   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                        "dense map cannot contain null values",
   38     54   
                                    ),
   39     55   
                                )
   40     56   
                            }
   41     57   
                        }
          58  +
                        /* JsonParserGenerator.kt:686 */
   42     59   
                    }
          60  +
                    /* JsonParserGenerator.kt:695 */
   43     61   
                    other => {
   44     62   
                        return Err(
   45     63   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46     64   
                                format!("expected object key or end object, found: {other:?}"),
   47     65   
                            ),
   48     66   
                        )
          67  +
                    } /* JsonParserGenerator.kt:685 */
   49     68   
                }
          69  +
                /* JsonParserGenerator.kt:684 */
   50     70   
            }
   51         -
            }
          71  +
            /* JsonParserGenerator.kt:504 */
   52     72   
            Ok(Some(map))
          73  +
            /* JsonParserGenerator.kt:713 */
   53     74   
        }
   54         -
        _ => Err(
          75  +
        /* JsonParserGenerator.kt:722 */
          76  +
        _ => {
          77  +
            /* JsonParserGenerator.kt:723 */
          78  +
            Err(
   55     79   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   56     80   
                    "expected start object or null",
   57     81   
                ),
   58         -
        ),
          82  +
            )
          83  +
            /* JsonParserGenerator.kt:722 */
          84  +
        } /* JsonParserGenerator.kt:712 */
   59     85   
    }
          86  +
    /* JsonParserGenerator.kt:460 */
   60     87   
}

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

@@ -1,1 +59,83 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_dense_struct_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, crate::model::GreetingStruct>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   24         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
   25     38   
                        let value =
   26         -
                            crate::protocol_serde::shape_greeting_struct::de_greeting_struct(
   27         -
                                tokens,
   28         -
                            )?;
          39  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens)?
          40  +
                        /* JsonParserGenerator.kt:474 */;
          41  +
                        /* JsonParserGenerator.kt:481 */
   29     42   
                        match value {
   30     43   
                            Some(value) => {
   31     44   
                                map.insert(key, value);
   32     45   
                            }
   33     46   
                            None => {
   34     47   
                                return Err(
   35     48   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   36     49   
                                        "dense map cannot contain null values",
   37     50   
                                    ),
   38     51   
                                )
   39     52   
                            }
   40     53   
                        }
          54  +
                        /* JsonParserGenerator.kt:686 */
   41     55   
                    }
          56  +
                    /* JsonParserGenerator.kt:695 */
   42     57   
                    other => {
   43     58   
                        return Err(
   44     59   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   45     60   
                                format!("expected object key or end object, found: {other:?}"),
   46     61   
                            ),
   47     62   
                        )
          63  +
                    } /* JsonParserGenerator.kt:685 */
   48     64   
                }
          65  +
                /* JsonParserGenerator.kt:684 */
   49     66   
            }
   50         -
            }
          67  +
            /* JsonParserGenerator.kt:504 */
   51     68   
            Ok(Some(map))
          69  +
            /* JsonParserGenerator.kt:713 */
   52     70   
        }
   53         -
        _ => Err(
          71  +
        /* JsonParserGenerator.kt:722 */
          72  +
        _ => {
          73  +
            /* JsonParserGenerator.kt:723 */
          74  +
            Err(
   54     75   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   55     76   
                    "expected start object or null",
   56     77   
                ),
   57         -
        ),
          78  +
            )
          79  +
            /* JsonParserGenerator.kt:722 */
          80  +
        } /* JsonParserGenerator.kt:712 */
   58     81   
    }
          82  +
    /* JsonParserGenerator.kt:460 */
   59     83   
}

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

@@ -1,1 +90,135 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_dialog(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::model::Dialog,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.language {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("language").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
    8     12   
    }
          13  +
    /* SerializerUtil.kt:46 */
    9     14   
    {
          15  +
        /* JsonSerializerGenerator.kt:423 */
   10     16   
        object.key("greeting").string(input.greeting.as_str());
          17  +
        /* SerializerUtil.kt:46 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:382 */
   12     20   
    if let Some(var_2) = &input.farewell {
          21  +
        /* JsonSerializerGenerator.kt:495 */
   13     22   
        #[allow(unused_mut)]
          23  +
        /* JsonSerializerGenerator.kt:496 */
   14     24   
        let mut object_3 = object.key("farewell").start_object();
          25  +
        /* JsonSerializerGenerator.kt:375 */
   15     26   
        crate::protocol_serde::shape_farewell::ser_farewell(&mut object_3, var_2)?;
          27  +
        /* JsonSerializerGenerator.kt:515 */
   16     28   
        object_3.finish();
          29  +
        /* JsonSerializerGenerator.kt:382 */
   17     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:372 */
   18     32   
    Ok(())
          33  +
    /* JsonSerializerGenerator.kt:358 */
   19     34   
}
   20     35   
          36  +
/* JsonParserGenerator.kt:516 */
   21     37   
pub(crate) fn de_dialog<'a, I>(
   22     38   
    tokens: &mut ::std::iter::Peekable<I>,
   23     39   
) -> ::std::result::Result<
   24     40   
    Option<crate::model::Dialog>,
   25     41   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   26     42   
>
   27     43   
where
   28     44   
    I: Iterator<
   29     45   
        Item = Result<
   30     46   
            ::aws_smithy_json::deserialize::Token<'a>,
   31     47   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   32     48   
        >,
   33     49   
    >,
   34     50   
{
          51  +
    /* JsonParserGenerator.kt:712 */
   35     52   
    match tokens.next().transpose()? {
          53  +
        /* JsonParserGenerator.kt:713 */
   36     54   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   37     55   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          56  +
            /* RustType.kt:534 */
   38     57   
            #[allow(unused_mut)]
          58  +
            /* JsonParserGenerator.kt:526 */
   39     59   
            let mut builder = crate::model::dialog::Builder::default();
          60  +
            /* JsonParserGenerator.kt:684 */
   40     61   
            loop {
          62  +
                /* JsonParserGenerator.kt:685 */
   41     63   
                match tokens.next().transpose()? {
          64  +
                    /* JsonParserGenerator.kt:686 */
   42     65   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   43     66   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          67  +
                        /* JsonParserGenerator.kt:260 */
   44     68   
                        match key.to_unescaped()?.as_ref() {
          69  +
                            /* JsonParserGenerator.kt:262 */
   45     70   
                            "language" => {
          71  +
                                /* JsonParserGenerator.kt:272 */
   46     72   
                                builder = builder.set_language(
   47         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   48         -
                                        tokens.next(),
   49         -
                                    )?
   50         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   51         -
                                    .transpose()?,
   52         -
                                );
          73  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          74  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          75  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          76  +
                                        /* JsonParserGenerator.kt:339 */)
          77  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          78  +
                                /* JsonParserGenerator.kt:272 */);
          79  +
                                /* JsonParserGenerator.kt:262 */
   53     80   
                            }
          81  +
                            /* JsonParserGenerator.kt:262 */
   54     82   
                            "greeting" => {
          83  +
                                /* JsonParserGenerator.kt:276 */
   55     84   
                                if let Some(v) =
   56         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   57         -
                                        tokens.next(),
   58         -
                                    )?
   59         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   60         -
                                    .transpose()?
   61         -
                                {
          85  +
                                /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          86  +
                                    /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          87  +
                                        /* JsonParserGenerator.kt:348 */u.into_owned()
          88  +
                                    /* JsonParserGenerator.kt:339 */)
          89  +
                                /* JsonParserGenerator.kt:354 */).transpose()?
          90  +
                                /* JsonParserGenerator.kt:278 */{
   62     91   
                                                                            builder = builder.set_greeting(v);
   63     92   
                                                                        }
          93  +
                                /* JsonParserGenerator.kt:262 */
   64     94   
                            }
          95  +
                            /* JsonParserGenerator.kt:262 */
   65     96   
                            "farewell" => {
          97  +
                                /* JsonParserGenerator.kt:272 */
   66     98   
                                builder = builder.set_farewell(
   67         -
                                    crate::protocol_serde::shape_farewell::de_farewell(tokens)?,
   68         -
                                );
          99  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_farewell::de_farewell(tokens)?
         100  +
                                /* JsonParserGenerator.kt:272 */);
         101  +
                                /* JsonParserGenerator.kt:262 */
   69    102   
                            }
   70         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         103  +
                            /* JsonParserGenerator.kt:290 */
         104  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   71    105   
                        }
         106  +
                        /* JsonParserGenerator.kt:686 */
   72    107   
                    }
         108  +
                    /* JsonParserGenerator.kt:695 */
   73    109   
                    other => {
   74    110   
                        return Err(
   75    111   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   76    112   
                                format!("expected object key or end object, found: {other:?}"),
   77    113   
                            ),
   78    114   
                        )
         115  +
                    } /* JsonParserGenerator.kt:685 */
   79    116   
                }
         117  +
                /* JsonParserGenerator.kt:684 */
   80    118   
            }
   81         -
            }
         119  +
            /* JsonParserGenerator.kt:540 */
   82    120   
            Ok(Some(builder.build()))
         121  +
            /* JsonParserGenerator.kt:713 */
   83    122   
        }
   84         -
        _ => Err(
         123  +
        /* JsonParserGenerator.kt:722 */
         124  +
        _ => {
         125  +
            /* JsonParserGenerator.kt:723 */
         126  +
            Err(
   85    127   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   86    128   
                    "expected start object or null",
   87    129   
                ),
   88         -
        ),
         130  +
            )
         131  +
            /* JsonParserGenerator.kt:722 */
         132  +
        } /* JsonParserGenerator.kt:712 */
   89    133   
    }
         134  +
    /* JsonParserGenerator.kt:516 */
   90    135   
}

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

@@ -1,1 +48,74 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_dialog_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<crate::model::Dialog>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
   27         -
                        let value = crate::protocol_serde::shape_dialog::de_dialog(tokens)?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_dialog::de_dialog(tokens)?
          40  +
                        /* JsonParserGenerator.kt:419 */;
          41  +
                        /* JsonParserGenerator.kt:422 */
   28     42   
                        if let Some(value) = value {
   29     43   
                            items.push(value);
   30         -
                        } else {
          44  +
                        }
          45  +
                        /* JsonParserGenerator.kt:430 */
          46  +
                        else {
   31     47   
                            return Err(
   32     48   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   33     49   
                                    "dense list cannot contain null values",
   34     50   
                                ),
   35     51   
                            );
   36     52   
                        }
          53  +
                        /* JsonParserGenerator.kt:413 */
          54  +
                    } /* JsonParserGenerator.kt:409 */
   37     55   
                }
          56  +
                /* JsonParserGenerator.kt:408 */
   38     57   
            }
   39         -
            }
          58  +
            /* JsonParserGenerator.kt:446 */
   40     59   
            Ok(Some(items))
          60  +
            /* JsonParserGenerator.kt:713 */
   41     61   
        }
   42         -
        _ => Err(
          62  +
        /* JsonParserGenerator.kt:722 */
          63  +
        _ => {
          64  +
            /* JsonParserGenerator.kt:723 */
          65  +
            Err(
   43     66   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   44     67   
                    "expected start array or null",
   45     68   
                ),
   46         -
        ),
          69  +
            )
          70  +
            /* JsonParserGenerator.kt:722 */
          71  +
        } /* JsonParserGenerator.kt:712 */
   47     72   
    }
          73  +
    /* JsonParserGenerator.kt:398 */
   48     74   
}

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

@@ -1,1 +56,83 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_dialog_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, crate::model::Dialog>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    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)?;
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_dialog::de_dialog(tokens)?
          40  +
                        /* JsonParserGenerator.kt:474 */;
          41  +
                        /* JsonParserGenerator.kt:481 */
   26     42   
                        match value {
   27     43   
                            Some(value) => {
   28     44   
                                map.insert(key, value);
   29     45   
                            }
   30     46   
                            None => {
   31     47   
                                return Err(
   32     48   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   33     49   
                                        "dense map cannot contain null values",
   34     50   
                                    ),
   35     51   
                                )
   36     52   
                            }
   37     53   
                        }
          54  +
                        /* JsonParserGenerator.kt:686 */
   38     55   
                    }
          56  +
                    /* JsonParserGenerator.kt:695 */
   39     57   
                    other => {
   40     58   
                        return Err(
   41     59   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   42     60   
                                format!("expected object key or end object, found: {other:?}"),
   43     61   
                            ),
   44     62   
                        )
          63  +
                    } /* JsonParserGenerator.kt:685 */
   45     64   
                }
          65  +
                /* JsonParserGenerator.kt:684 */
   46     66   
            }
   47         -
            }
          67  +
            /* JsonParserGenerator.kt:504 */
   48     68   
            Ok(Some(map))
          69  +
            /* JsonParserGenerator.kt:713 */
   49     70   
        }
   50         -
        _ => Err(
          71  +
        /* JsonParserGenerator.kt:722 */
          72  +
        _ => {
          73  +
            /* JsonParserGenerator.kt:723 */
          74  +
            Err(
   51     75   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   52     76   
                    "expected start object or null",
   53     77   
                ),
   54         -
        ),
          78  +
            )
          79  +
            /* JsonParserGenerator.kt:722 */
          80  +
        } /* JsonParserGenerator.kt:712 */
   55     81   
    }
          82  +
    /* JsonParserGenerator.kt:460 */
   56     83   
}

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

@@ -1,1 +26,29 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:175 */
    2      3   
pub(crate) fn de_document_payload(
    3      4   
    input: &[u8],
    4      5   
) -> ::std::result::Result<
    5      6   
    ::aws_smithy_types::Document,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* JsonParserGenerator.kt:187 */
    8     10   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(input).peekable();
    9     11   
    let tokens = &mut tokens_owned;
   10         -
    let result = Some(::aws_smithy_json::deserialize::token::expect_document(
   11         -
        tokens,
   12         -
    )?)
   13         -
    .ok_or_else(|| {
   14         -
        ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   15         -
            "expected payload member value",
   16         -
        )
   17         -
    });
          12  +
    /* JsonParserGenerator.kt:194 */
          13  +
    let result =
          14  +
    /* JsonParserGenerator.kt:319 */Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?)
          15  +
    /* JsonParserGenerator.kt:196 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          16  +
    /* JsonParserGenerator.kt:250 */
   18     17   
    if tokens.next().is_some() {
          18  +
        /* JsonParserGenerator.kt:251 */
   19     19   
        return Err(
   20     20   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   21     21   
                "found more JSON tokens after completing parsing",
   22     22   
            ),
   23     23   
        );
          24  +
        /* JsonParserGenerator.kt:250 */
   24     25   
    }
          26  +
    /* JsonParserGenerator.kt:198 */
   25     27   
    result
          28  +
    /* JsonParserGenerator.kt:175 */
   26     29   
}

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

@@ -1,1 +119,177 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_document_type_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::DocumentTypeInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::document_type_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_document_type::de_document_type(
   29     42   
                bytes.as_ref(),
   30     43   
                input,
   31     44   
            )?;
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   32     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   33     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   34     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   35     52   
}
   36     53   
          54  +
/* RustType.kt:534 */
   37     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   38     57   
pub fn ser_document_type_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::DocumentTypeOutput,
   40     59   
) -> std::result::Result<
   41     60   
    ::aws_smithy_http_server::response::Response,
   42     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   44     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   45     66   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     71   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          72  +
            ::http_1x::header::CONTENT_TYPE,
   50     73   
            "application/json",
   51     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     76   
        let http_status: u16 = 200;
   53     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     79   
        let payload =
   55         -
            crate::protocol_serde::shape_document_type_output::ser_document_type_output_output_output(&output)?
   56         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_document_type_output::ser_document_type_output_output_output(&output)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   57     83   
        let content_length = payload.len();
   58     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     85   
            builder,
   60         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   61     87   
            content_length,
   62     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   63     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   64     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   65     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   66     96   
}
   67     97   
          98  +
/* JsonParserGenerator.kt:148 */
   68     99   
pub(crate) fn de_document_type(
   69    100   
    value: &[u8],
   70    101   
    mut builder: crate::input::document_type_input::Builder,
   71    102   
) -> ::std::result::Result<
   72    103   
    crate::input::document_type_input::Builder,
   73    104   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   74    105   
> {
         106  +
    /* JsonParserGenerator.kt:153 */
   75    107   
    let mut tokens_owned =
   76    108   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   77    109   
            .peekable();
   78    110   
    let tokens = &mut tokens_owned;
   79    111   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         112  +
    /* JsonParserGenerator.kt:684 */
   80    113   
    loop {
         114  +
        /* JsonParserGenerator.kt:685 */
   81    115   
        match tokens.next().transpose()? {
         116  +
            /* JsonParserGenerator.kt:686 */
   82    117   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   83    118   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         119  +
                /* JsonParserGenerator.kt:260 */
   84    120   
                match key.to_unescaped()?.as_ref() {
         121  +
                    /* JsonParserGenerator.kt:262 */
   85    122   
                    "documentValue" => {
   86         -
                        builder = builder.set_document_value(Some(
   87         -
                            ::aws_smithy_json::deserialize::token::expect_document(tokens)?,
   88         -
                        ));
         123  +
                        /* JsonParserGenerator.kt:272 */
         124  +
                        builder = builder.set_document_value(
         125  +
                            /* JsonParserGenerator.kt:319 */
         126  +
                            Some(::aws_smithy_json::deserialize::token::expect_document(
         127  +
                                tokens,
         128  +
                            )?), /* JsonParserGenerator.kt:272 */
         129  +
                        );
         130  +
                        /* JsonParserGenerator.kt:262 */
   89    131   
                    }
         132  +
                    /* JsonParserGenerator.kt:262 */
   90    133   
                    "stringValue" => {
         134  +
                        /* JsonParserGenerator.kt:272 */
   91    135   
                        builder = builder.set_string_value(
         136  +
                            /* JsonParserGenerator.kt:354 */
   92    137   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   93    138   
                                tokens.next(),
   94    139   
                            )?
   95         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   96         -
                            .transpose()?,
         140  +
                            .map(|s|
         141  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         142  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         143  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         144  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   97    145   
                        );
         146  +
                        /* JsonParserGenerator.kt:262 */
   98    147   
                    }
   99         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         148  +
                    /* JsonParserGenerator.kt:290 */
         149  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  100    150   
                }
         151  +
                /* JsonParserGenerator.kt:686 */
  101    152   
            }
         153  +
            /* JsonParserGenerator.kt:695 */
  102    154   
            other => {
  103    155   
                return Err(
  104    156   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  105    157   
                        "expected object key or end object, found: {other:?}"
  106    158   
                    )),
  107    159   
                )
         160  +
            } /* JsonParserGenerator.kt:685 */
  108    161   
        }
         162  +
        /* JsonParserGenerator.kt:684 */
  109    163   
    }
  110         -
    }
         164  +
    /* JsonParserGenerator.kt:250 */
  111    165   
    if tokens.next().is_some() {
         166  +
        /* JsonParserGenerator.kt:251 */
  112    167   
        return Err(
  113    168   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  114    169   
                "found more JSON tokens after completing parsing",
  115    170   
            ),
  116    171   
        );
         172  +
        /* JsonParserGenerator.kt:250 */
  117    173   
    }
         174  +
    /* JsonParserGenerator.kt:163 */
  118    175   
    Ok(builder)
         176  +
    /* JsonParserGenerator.kt:148 */
  119    177   
}

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

@@ -1,1 +107,155 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_document_type_as_map_value_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::DocumentTypeAsMapValueInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::document_type_as_map_value_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_document_type_as_map_value::de_document_type_as_map_value(bytes.as_ref(), input)?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   29     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   30     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   31     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   32     49   
}
   33     50   
          51  +
/* RustType.kt:534 */
   34     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   35     54   
pub fn ser_document_type_as_map_value_http_response(
   36     55   
    #[allow(unused_variables)] output: crate::output::DocumentTypeAsMapValueOutput,
   37     56   
) -> std::result::Result<
   38     57   
    ::aws_smithy_http_server::response::Response,
   39     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   41     61   
    Ok({
          62  +
        /* RustType.kt:534 */
   42     63   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          65  +
        let mut builder = ::http_1x::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   44     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     68   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          69  +
            ::http_1x::header::CONTENT_TYPE,
   47     70   
            "application/json",
   48     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   49     73   
        let http_status: u16 = 200;
   50     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     76   
        let payload =
   52         -
            crate::protocol_serde::shape_document_type_as_map_value_output::ser_document_type_as_map_value_output_output_output(&output)?
   53         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_document_type_as_map_value_output::ser_document_type_as_map_value_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   54     80   
        let content_length = payload.len();
   55     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     82   
            builder,
   57         -
            ::http::header::CONTENT_LENGTH,
          83  +
            ::http_1x::header::CONTENT_LENGTH,
   58     84   
            content_length,
   59     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   60     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   61     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   62     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   63     93   
}
   64     94   
          95  +
/* JsonParserGenerator.kt:148 */
   65     96   
pub(crate) fn de_document_type_as_map_value(
   66     97   
    value: &[u8],
   67     98   
    mut builder: crate::input::document_type_as_map_value_input::Builder,
   68     99   
) -> ::std::result::Result<
   69    100   
    crate::input::document_type_as_map_value_input::Builder,
   70    101   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   71    102   
> {
         103  +
    /* JsonParserGenerator.kt:153 */
   72    104   
    let mut tokens_owned =
   73    105   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   74    106   
            .peekable();
   75    107   
    let tokens = &mut tokens_owned;
   76    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   77    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   78    112   
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
   79    114   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   80    115   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
   81    117   
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
   82    119   
                    "docValuedMap" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
   83    121   
                        builder = builder.set_doc_valued_map(
   84         -
                            crate::protocol_serde::shape_document_valued_map::de_document_valued_map(tokens)?
   85         -
                        );
         122  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_document_valued_map::de_document_valued_map(tokens)?
         123  +
                        /* JsonParserGenerator.kt:272 */);
         124  +
                        /* JsonParserGenerator.kt:262 */
   86    125   
                    }
   87         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         126  +
                    /* JsonParserGenerator.kt:290 */
         127  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   88    128   
                }
         129  +
                /* JsonParserGenerator.kt:686 */
   89    130   
            }
         131  +
            /* JsonParserGenerator.kt:695 */
   90    132   
            other => {
   91    133   
                return Err(
   92    134   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   93    135   
                        "expected object key or end object, found: {other:?}"
   94    136   
                    )),
   95    137   
                )
         138  +
            } /* JsonParserGenerator.kt:685 */
   96    139   
        }
         140  +
        /* JsonParserGenerator.kt:684 */
   97    141   
    }
   98         -
    }
         142  +
    /* JsonParserGenerator.kt:250 */
   99    143   
    if tokens.next().is_some() {
         144  +
        /* JsonParserGenerator.kt:251 */
  100    145   
        return Err(
  101    146   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  102    147   
                "found more JSON tokens after completing parsing",
  103    148   
            ),
  104    149   
        );
         150  +
        /* JsonParserGenerator.kt:250 */
  105    151   
    }
         152  +
    /* JsonParserGenerator.kt:163 */
  106    153   
    Ok(builder)
         154  +
    /* JsonParserGenerator.kt:148 */
  107    155   
}

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

@@ -1,1 +27,45 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_document_type_as_map_value_output_output_output(
    3      4   
    value: &crate::output::DocumentTypeAsMapValueOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_document_type_as_map_value_output::ser_document_type_as_map_value_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_document_type_as_map_value_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::DocumentTypeAsMapValueOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.doc_valued_map {
          24  +
        /* JsonSerializerGenerator.kt:495 */
   17     25   
        #[allow(unused_mut)]
          26  +
        /* JsonSerializerGenerator.kt:496 */
   18     27   
        let mut object_2 = object.key("docValuedMap").start_object();
          28  +
        /* JsonSerializerGenerator.kt:537 */
   19     29   
        for (key_3, value_4) in var_1 {
          30  +
            /* SerializerUtil.kt:42 */
   20     31   
            {
          32  +
                /* JsonSerializerGenerator.kt:474 */
   21     33   
                object_2.key(key_3.as_str()).document(value_4);
          34  +
                /* SerializerUtil.kt:42 */
   22     35   
            }
          36  +
            /* JsonSerializerGenerator.kt:537 */
   23     37   
        }
          38  +
        /* JsonSerializerGenerator.kt:515 */
   24     39   
        object_2.finish();
          40  +
        /* JsonSerializerGenerator.kt:382 */
   25     41   
    }
          42  +
    /* JsonSerializerGenerator.kt:372 */
   26     43   
    Ok(())
          44  +
    /* JsonSerializerGenerator.kt:358 */
   27     45   
}

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

@@ -1,1 +69,96 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_document_type_as_payload_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::DocumentTypeAsPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::document_type_as_payload_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) = {
   23         -
            let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
            let bytes = {
          32  +
                use ::http_body_util::BodyExt;
          33  +
                body.collect().await?.to_bytes()
          34  +
            };
   24     35   
            if !bytes.is_empty() {
   25     36   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     37   
                    &headers,
   27     38   
                    Some("application/json"),
   28     39   
                )?;
   29     40   
            }
   30     41   
            crate::protocol_serde::shape_document_type_as_payload_input::de_document_value_payload(
   31     42   
                &bytes,
   32     43   
            )?
   33     44   
        } {
   34     45   
            input = input.set_document_value(Some(value))
   35     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   36     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   37     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   38     52   
}
   39     53   
          54  +
/* RustType.kt:534 */
   40     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   41     57   
pub fn ser_document_type_as_payload_http_response(
   42     58   
    #[allow(unused_variables)] output: crate::output::DocumentTypeAsPayloadOutput,
   43     59   
) -> std::result::Result<
   44     60   
    ::aws_smithy_http_server::response::Response,
   45     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   46     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   47     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   48     66   
        #[allow(unused_mut)]
   49         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   50     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   51     71   
            builder,
   52         -
            ::http::header::CONTENT_TYPE,
          72  +
            ::http_1x::header::CONTENT_TYPE,
   53     73   
            "application/json",
   54     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   55     76   
        let http_status: u16 = 200;
   56     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   57     79   
        let payload =
   58         -
            crate::protocol_serde::shape_document_type_as_payload_output::ser_document_value_http_payload(& output.document_value)?
   59         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_document_type_as_payload_output::ser_document_value_http_payload(& output.document_value)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   60     83   
        let content_length = payload.len();
   61     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   62     85   
            builder,
   63         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   64     87   
            content_length,
   65     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   66     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   67     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   68     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   69     96   
}

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

@@ -1,1 +11,18 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:254 */
    2      3   
pub(crate) fn de_document_value_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::Document>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:342 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| crate::protocol_serde::shape_document::de_document_payload(body))
          11  +
        .then(|| {
          12  +
            /* ServerHttpBoundProtocolGenerator.kt:914 */
          13  +
            crate::protocol_serde::shape_document::de_document_payload(body)
          14  +
            /* HttpBindingGenerator.kt:342 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:254 */
   11     18   
}

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

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
    2      3   
pub fn ser_document_value_http_payload(
    3      4   
    payload: &::std::option::Option<::aws_smithy_types::Document>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:318 */
    5      7   
    let payload = match payload.as_ref() {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:330 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:318 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(crate::protocol_serde::serialize_document(payload))
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:391 */
          19  +
        crate::protocol_serde::serialize_document(payload), /* HttpBoundProtocolPayloadGenerator.kt:343 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
   10     22   
}

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

@@ -1,1 +26,40 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_document_type_output_output_output(
    3      4   
    value: &crate::output::DocumentTypeOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_document_type_output::ser_document_type_output_output(
    8     11   
        &mut object,
    9     12   
        value,
   10     13   
    )?;
          14  +
    /* JsonSerializerGenerator.kt:227 */
   11     15   
    object.finish();
   12     16   
    Ok(out)
          17  +
    /* JsonSerializerGenerator.kt:213 */
   13     18   
}
   14     19   
          20  +
/* JsonSerializerGenerator.kt:358 */
   15     21   
pub fn ser_document_type_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::DocumentTypeOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.document_value {
          27  +
        /* JsonSerializerGenerator.kt:474 */
   20     28   
        object.key("documentValue").document(var_1);
          29  +
        /* JsonSerializerGenerator.kt:382 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:382 */
   22     32   
    if let Some(var_2) = &input.string_value {
          33  +
        /* JsonSerializerGenerator.kt:423 */
   23     34   
        object.key("stringValue").string(var_2.as_str());
          35  +
        /* JsonSerializerGenerator.kt:382 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:372 */
   25     38   
    Ok(())
          39  +
    /* JsonSerializerGenerator.kt:358 */
   26     40   
}