Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/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_internal::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-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_document.rs

@@ -1,1 +27,30 @@
    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_http_server_python::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         -
    .map(::aws_smithy_http_server_python::types::Document::from)
   14         -
    .ok_or_else(|| {
   15         -
        ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   16         -
            "expected payload member value",
   17         -
        )
   18         -
    });
          12  +
    /* JsonParserGenerator.kt:194 */
          13  +
    let result =
          14  +
    /* JsonParserGenerator.kt:319 */Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?)
          15  +
    /* PythonServerProtocolLoader.kt:52 */.map(::aws_smithy_http_server_python::types::Document::from)
          16  +
    /* JsonParserGenerator.kt:196 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          17  +
    /* JsonParserGenerator.kt:250 */
   19     18   
    if tokens.next().is_some() {
          19  +
        /* JsonParserGenerator.kt:251 */
   20     20   
        return Err(
   21     21   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   22     22   
                "found more JSON tokens after completing parsing",
   23     23   
            ),
   24     24   
        );
          25  +
        /* JsonParserGenerator.kt:250 */
   25     26   
    }
          27  +
    /* JsonParserGenerator.kt:198 */
   26     28   
    result
          29  +
    /* JsonParserGenerator.kt:175 */
   27     30   
}

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

@@ -1,1 +160,225 @@
    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_internal::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  +
/* RustType.kt:516 */
   68     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   69     98   
pub fn ser_document_type_http_error(
   70     99   
    error: &crate::error::DocumentTypeError,
   71    100   
) -> std::result::Result<
   72    101   
    ::aws_smithy_http_server::response::Response,
   73    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   75    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   76    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   77    109   
            crate::error::DocumentTypeError::InternalServerError(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   78    111   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         112  +
                /* RustType.kt:516 */
   79    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   80    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    118   
                    builder,
   83    119   
                    ::http::header::CONTENT_TYPE,
   84    120   
                    "application/json",
   85    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    124   
                    builder,
   88    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   89    126   
                    "InternalServerError",
   90    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   91    129   
                let content_length = payload.len();
   92    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    131   
                    builder,
   94    132   
                    ::http::header::CONTENT_LENGTH,
   95    133   
                    content_length,
   96    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   97    136   
                builder
   98    137   
                    .status(500)
   99    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  100    141   
        }
  101         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  102    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  103    145   
}
  104    146   
         147  +
/* JsonParserGenerator.kt:148 */
  105    148   
pub(crate) fn de_document_type(
  106    149   
    value: &[u8],
  107    150   
    mut builder: crate::input::document_type_input_internal::Builder,
  108    151   
) -> ::std::result::Result<
  109    152   
    crate::input::document_type_input_internal::Builder,
  110    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  111    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  112    156   
    let mut tokens_owned =
  113    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  114    158   
            .peekable();
  115    159   
    let tokens = &mut tokens_owned;
  116    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  117    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  118    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  119    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  120    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  121    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  122    171   
                    "documentValue" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  123    173   
                        builder = builder.set_document_value(
  124         -
                            Some(::aws_smithy_json::deserialize::token::expect_document(
  125         -
                                tokens,
  126         -
                            )?)
  127         -
                            .map(::aws_smithy_http_server_python::types::Document::from),
  128         -
                        );
         174  +
                            /* JsonParserGenerator.kt:319 */Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?)
         175  +
                            /* PythonServerProtocolLoader.kt:52 */.map(::aws_smithy_http_server_python::types::Document::from)
         176  +
                        /* JsonParserGenerator.kt:272 */);
         177  +
                        /* JsonParserGenerator.kt:262 */
  129    178   
                    }
         179  +
                    /* JsonParserGenerator.kt:262 */
  130    180   
                    "stringValue" => {
         181  +
                        /* JsonParserGenerator.kt:272 */
  131    182   
                        builder = builder.set_string_value(
         183  +
                            /* JsonParserGenerator.kt:354 */
  132    184   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  133    185   
                                tokens.next(),
  134    186   
                            )?
  135         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  136         -
                            .transpose()?,
         187  +
                            .map(|s|
         188  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         189  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         190  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         191  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  137    192   
                        );
         193  +
                        /* JsonParserGenerator.kt:262 */
  138    194   
                    }
  139         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         195  +
                    /* JsonParserGenerator.kt:290 */
         196  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  140    197   
                }
         198  +
                /* JsonParserGenerator.kt:686 */
  141    199   
            }
         200  +
            /* JsonParserGenerator.kt:695 */
  142    201   
            other => {
  143    202   
                return Err(
  144    203   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  145    204   
                        "expected object key or end object, found: {:?}",
  146    205   
                        other
  147    206   
                    )),
  148    207   
                )
         208  +
            } /* JsonParserGenerator.kt:685 */
  149    209   
        }
         210  +
        /* JsonParserGenerator.kt:684 */
  150    211   
    }
  151         -
    }
         212  +
    /* JsonParserGenerator.kt:250 */
  152    213   
    if tokens.next().is_some() {
         214  +
        /* JsonParserGenerator.kt:251 */
  153    215   
        return Err(
  154    216   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  155    217   
                "found more JSON tokens after completing parsing",
  156    218   
            ),
  157    219   
        );
         220  +
        /* JsonParserGenerator.kt:250 */
  158    221   
    }
         222  +
    /* JsonParserGenerator.kt:163 */
  159    223   
    Ok(builder)
         224  +
    /* JsonParserGenerator.kt:148 */
  160    225   
}

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

@@ -1,1 +145,205 @@
    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_internal::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  +
/* RustType.kt:516 */
   65     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   66     95   
pub fn ser_document_type_as_map_value_http_error(
   67     96   
    error: &crate::error::DocumentTypeAsMapValueError,
   68     97   
) -> std::result::Result<
   69     98   
    ::aws_smithy_http_server::response::Response,
   70     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   71    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   72    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   73    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   74    106   
            crate::error::DocumentTypeAsMapValueError::InternalServerError(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   75    108   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         109  +
                /* RustType.kt:516 */
   76    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   77    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   78    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    115   
                    builder,
   80    116   
                    ::http::header::CONTENT_TYPE,
   81    117   
                    "application/json",
   82    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    121   
                    builder,
   85    122   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   86    123   
                    "InternalServerError",
   87    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   88    126   
                let content_length = payload.len();
   89    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    128   
                    builder,
   91    129   
                    ::http::header::CONTENT_LENGTH,
   92    130   
                    content_length,
   93    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   94    133   
                builder
   95    134   
                    .status(500)
   96    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         137  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   97    138   
        }
   98         -
        }
         139  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   99    140   
    })
         141  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  100    142   
}
  101    143   
         144  +
/* JsonParserGenerator.kt:148 */
  102    145   
pub(crate) fn de_document_type_as_map_value(
  103    146   
    value: &[u8],
  104    147   
    mut builder: crate::input::document_type_as_map_value_input_internal::Builder,
  105    148   
) -> ::std::result::Result<
  106    149   
    crate::input::document_type_as_map_value_input_internal::Builder,
  107    150   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  108    151   
> {
         152  +
    /* JsonParserGenerator.kt:153 */
  109    153   
    let mut tokens_owned =
  110    154   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  111    155   
            .peekable();
  112    156   
    let tokens = &mut tokens_owned;
  113    157   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         158  +
    /* JsonParserGenerator.kt:684 */
  114    159   
    loop {
         160  +
        /* JsonParserGenerator.kt:685 */
  115    161   
        match tokens.next().transpose()? {
         162  +
            /* JsonParserGenerator.kt:686 */
  116    163   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  117    164   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         165  +
                /* JsonParserGenerator.kt:260 */
  118    166   
                match key.to_unescaped()?.as_ref() {
         167  +
                    /* JsonParserGenerator.kt:262 */
  119    168   
                    "docValuedMap" => {
         169  +
                        /* JsonParserGenerator.kt:272 */
  120    170   
                        builder = builder.set_doc_valued_map(
  121         -
                            crate::protocol_serde::shape_document_valued_map::de_document_valued_map(tokens)?
  122         -
                        );
         171  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_document_valued_map::de_document_valued_map(tokens)?
         172  +
                        /* JsonParserGenerator.kt:272 */);
         173  +
                        /* JsonParserGenerator.kt:262 */
  123    174   
                    }
  124         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         175  +
                    /* JsonParserGenerator.kt:290 */
         176  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  125    177   
                }
         178  +
                /* JsonParserGenerator.kt:686 */
  126    179   
            }
         180  +
            /* JsonParserGenerator.kt:695 */
  127    181   
            other => {
  128    182   
                return Err(
  129    183   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  130    184   
                        "expected object key or end object, found: {:?}",
  131    185   
                        other
  132    186   
                    )),
  133    187   
                )
         188  +
            } /* JsonParserGenerator.kt:685 */
  134    189   
        }
         190  +
        /* JsonParserGenerator.kt:684 */
  135    191   
    }
  136         -
    }
         192  +
    /* JsonParserGenerator.kt:250 */
  137    193   
    if tokens.next().is_some() {
         194  +
        /* JsonParserGenerator.kt:251 */
  138    195   
        return Err(
  139    196   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  140    197   
                "found more JSON tokens after completing parsing",
  141    198   
            ),
  142    199   
        );
         200  +
        /* JsonParserGenerator.kt:250 */
  143    201   
    }
         202  +
    /* JsonParserGenerator.kt:163 */
  144    203   
    Ok(builder)
         204  +
    /* JsonParserGenerator.kt:148 */
  145    205   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_document_type_as_payload.rs

@@ -1,1 +106,145 @@
    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_internal::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   
}
   70     94   
          95  +
/* RustType.kt:516 */
   71     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   72     98   
pub fn ser_document_type_as_payload_http_error(
   73     99   
    error: &crate::error::DocumentTypeAsPayloadError,
   74    100   
) -> std::result::Result<
   75    101   
    ::aws_smithy_http_server::response::Response,
   76    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   77    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   78    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   79    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   80    109   
            crate::error::DocumentTypeAsPayloadError::InternalServerError(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   81    111   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         112  +
                /* RustType.kt:516 */
   82    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   83    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    118   
                    builder,
   86    119   
                    ::http::header::CONTENT_TYPE,
   87    120   
                    "application/json",
   88    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   89    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    124   
                    builder,
   91    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   92    126   
                    "InternalServerError",
   93    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   94    129   
                let content_length = payload.len();
   95    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   96    131   
                    builder,
   97    132   
                    ::http::header::CONTENT_LENGTH,
   98    133   
                    content_length,
   99    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  100    136   
                builder
  101    137   
                    .status(500)
  102    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  103    141   
        }
  104         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  105    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  106    145   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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_http_server_python::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-python/rest_json/rust-server-codegen-python/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_http_server_python::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-python/rest_json/rust-server-codegen-python/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   
}