Server Test

Server Test

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

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

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

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,93 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_document_type_as_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::document_type_as_payload_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   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:794 */
   22     30   
        if let Some(value) = {
   23     31   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     32   
            if !bytes.is_empty() {
   25     33   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     34   
                    &headers,
   27     35   
                    Some("application/json"),
   28     36   
                )?;
   29     37   
            }
   30     38   
            crate::protocol_serde::shape_document_type_as_payload_input::de_document_value_payload(
   31     39   
                &bytes,
   32     40   
            )?
   33     41   
        } {
   34     42   
            input = input.set_document_value(Some(value))
   35     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   36     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   37     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   38     49   
}
   39     50   
          51  +
/* RustType.kt:516 */
   40     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   41     54   
pub fn ser_document_type_as_payload_http_response(
   42     55   
    #[allow(unused_variables)] output: crate::output::DocumentTypeAsPayloadOutput,
   43     56   
) -> std::result::Result<
   44     57   
    ::aws_smithy_http_server::response::Response,
   45     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   46     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   47     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   48     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   49     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   50     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   51     68   
            builder,
   52     69   
            ::http::header::CONTENT_TYPE,
   53     70   
            "application/json",
   54     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   55     73   
        let http_status: u16 = 200;
   56     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   57     76   
        let payload =
   58         -
            crate::protocol_serde::shape_document_type_as_payload_output::ser_document_value_http_payload(& output.document_value)?
   59         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_document_type_as_payload_output::ser_document_value_http_payload(& output.document_value)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   60     80   
        let content_length = payload.len();
   61     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   62     82   
            builder,
   63     83   
            ::http::header::CONTENT_LENGTH,
   64     84   
            content_length,
   65     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   66     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   67     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   68     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   69     93   
}

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:248 */
    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:319 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| crate::protocol_serde::shape_document::de_document_payload(body))
          11  +
        .then(|| {
          12  +
            /* ServerHttpBoundProtocolGenerator.kt:850 */
          13  +
            crate::protocol_serde::shape_document::de_document_payload(body)
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
   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:311 */
    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:320 */
    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:332 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(crate::protocol_serde::serialize_document(payload))
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:393 */
          19  +
        crate::protocol_serde::serialize_document(payload), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   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   
}