Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_http_date_set.rs

@@ -1,1 +54,76 @@
    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_http_date_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::http_date_set_unconstrained::HttpDateSetUnconstrained>,
    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   
                    _ => {
          37  +
                        /* JsonParserGenerator.kt:419 */
   27     38   
                        let value =
   28         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   29         -
                                tokens.next(),
   30         -
                                ::aws_smithy_types::date_time::Format::HttpDate,
   31         -
                            )?;
          39  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::HttpDate)?
          40  +
                        /* JsonParserGenerator.kt:419 */;
          41  +
                        /* JsonParserGenerator.kt:422 */
   32     42   
                        if let Some(value) = value {
   33     43   
                            items.push(value);
   34         -
                        } else {
          44  +
                        }
          45  +
                        /* JsonParserGenerator.kt:430 */
          46  +
                        else {
   35     47   
                            return Err(
   36     48   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     49   
                                    "dense list cannot contain null values",
   38     50   
                                ),
   39     51   
                            );
   40     52   
                        }
          53  +
                        /* JsonParserGenerator.kt:413 */
          54  +
                    } /* JsonParserGenerator.kt:409 */
   41     55   
                }
          56  +
                /* JsonParserGenerator.kt:408 */
   42     57   
            }
   43         -
            }
          58  +
            /* JsonParserGenerator.kt:444 */
   44     59   
            Ok(Some(
   45     60   
                crate::unconstrained::http_date_set_unconstrained::HttpDateSetUnconstrained(items),
   46     61   
            ))
          62  +
            /* JsonParserGenerator.kt:713 */
   47     63   
        }
   48         -
        _ => Err(
          64  +
        /* JsonParserGenerator.kt:722 */
          65  +
        _ => {
          66  +
            /* JsonParserGenerator.kt:723 */
          67  +
            Err(
   49     68   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   50     69   
                    "expected start array or null",
   51     70   
                ),
   52         -
        ),
          71  +
            )
          72  +
            /* JsonParserGenerator.kt:722 */
          73  +
        } /* JsonParserGenerator.kt:712 */
   53     74   
    }
          75  +
    /* JsonParserGenerator.kt:398 */
   54     76   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_integer_enum_set.rs

@@ -1,1 +56,80 @@
    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_integer_enum_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained>,
    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 = ::aws_smithy_json::deserialize::token::expect_number_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   30     40   
                                                .map(i32::try_from)
   31         -
                        .transpose()?;
          41  +
                                                .transpose()?
          42  +
                        /* JsonParserGenerator.kt:419 */;
          43  +
                        /* JsonParserGenerator.kt:422 */
   32     44   
                        if let Some(value) = value {
   33     45   
                            items.push(value);
   34         -
                        } else {
          46  +
                        }
          47  +
                        /* JsonParserGenerator.kt:430 */
          48  +
                        else {
   35     49   
                            return Err(
   36     50   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     51   
                                    "dense list cannot contain null values",
   38     52   
                                ),
   39     53   
                            );
   40     54   
                        }
          55  +
                        /* JsonParserGenerator.kt:413 */
          56  +
                    } /* JsonParserGenerator.kt:409 */
   41     57   
                }
          58  +
                /* JsonParserGenerator.kt:408 */
   42     59   
            }
   43         -
            }
          60  +
            /* JsonParserGenerator.kt:444 */
   44     61   
            Ok(Some(
   45     62   
                crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained(
   46     63   
                    items,
   47     64   
                ),
   48     65   
            ))
          66  +
            /* JsonParserGenerator.kt:713 */
   49     67   
        }
   50         -
        _ => Err(
          68  +
        /* JsonParserGenerator.kt:722 */
          69  +
        _ => {
          70  +
            /* JsonParserGenerator.kt:723 */
          71  +
            Err(
   51     72   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   52     73   
                    "expected start array or null",
   53     74   
                ),
   54         -
        ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
   55     78   
    }
          79  +
    /* JsonParserGenerator.kt:398 */
   56     80   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_integer_set.rs

@@ -1,1 +54,78 @@
    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_integer_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::integer_set_unconstrained::IntegerSetUnconstrained>,
    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 = ::aws_smithy_json::deserialize::token::expect_number_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   30     40   
                                                .map(i32::try_from)
   31         -
                        .transpose()?;
          41  +
                                                .transpose()?
          42  +
                        /* JsonParserGenerator.kt:419 */;
          43  +
                        /* JsonParserGenerator.kt:422 */
   32     44   
                        if let Some(value) = value {
   33     45   
                            items.push(value);
   34         -
                        } else {
          46  +
                        }
          47  +
                        /* JsonParserGenerator.kt:430 */
          48  +
                        else {
   35     49   
                            return Err(
   36     50   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     51   
                                    "dense list cannot contain null values",
   38     52   
                                ),
   39     53   
                            );
   40     54   
                        }
          55  +
                        /* JsonParserGenerator.kt:413 */
          56  +
                    } /* JsonParserGenerator.kt:409 */
   41     57   
                }
          58  +
                /* JsonParserGenerator.kt:408 */
   42     59   
            }
   43         -
            }
          60  +
            /* JsonParserGenerator.kt:444 */
   44     61   
            Ok(Some(
   45     62   
                crate::unconstrained::integer_set_unconstrained::IntegerSetUnconstrained(items),
   46     63   
            ))
          64  +
            /* JsonParserGenerator.kt:713 */
   47     65   
        }
   48         -
        _ => Err(
          66  +
        /* JsonParserGenerator.kt:722 */
          67  +
        _ => {
          68  +
            /* JsonParserGenerator.kt:723 */
          69  +
            Err(
   49     70   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   50     71   
                    "expected start array or null",
   51     72   
                ),
   52         -
        ),
          73  +
            )
          74  +
            /* JsonParserGenerator.kt:722 */
          75  +
        } /* JsonParserGenerator.kt:712 */
   53     76   
    }
          77  +
    /* JsonParserGenerator.kt:398 */
   54     78   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_length_list.rs

@@ -1,1 +54,80 @@
    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_length_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::length_list_unconstrained::LengthListUnconstrained>,
    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 = ::aws_smithy_json::deserialize::token::expect_string_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
   30         -
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   31         -
                        .transpose()?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          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:419 */;
          45  +
                        /* JsonParserGenerator.kt:422 */
   32     46   
                        if let Some(value) = value {
   33     47   
                            items.push(value);
   34         -
                        } else {
          48  +
                        }
          49  +
                        /* JsonParserGenerator.kt:430 */
          50  +
                        else {
   35     51   
                            return Err(
   36     52   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                    "dense list cannot contain null values",
   38     54   
                                ),
   39     55   
                            );
   40     56   
                        }
          57  +
                        /* JsonParserGenerator.kt:413 */
          58  +
                    } /* JsonParserGenerator.kt:409 */
   41     59   
                }
          60  +
                /* JsonParserGenerator.kt:408 */
   42     61   
            }
   43         -
            }
          62  +
            /* JsonParserGenerator.kt:444 */
   44     63   
            Ok(Some(
   45     64   
                crate::unconstrained::length_list_unconstrained::LengthListUnconstrained(items),
   46     65   
            ))
          66  +
            /* JsonParserGenerator.kt:713 */
   47     67   
        }
   48         -
        _ => Err(
          68  +
        /* JsonParserGenerator.kt:722 */
          69  +
        _ => {
          70  +
            /* JsonParserGenerator.kt:723 */
          71  +
            Err(
   49     72   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   50     73   
                    "expected start array or null",
   51     74   
                ),
   52         -
        ),
          75  +
            )
          76  +
            /* JsonParserGenerator.kt:722 */
          77  +
        } /* JsonParserGenerator.kt:712 */
   53     78   
    }
          79  +
    /* JsonParserGenerator.kt:398 */
   54     80   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_length_map.rs

@@ -1,1 +59,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_length_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::length_map_unconstrained::LengthMapUnconstrained>,
    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_length_list::de_length_list(tokens)?;
          39  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_length_list::de_length_list(tokens)?
          40  +
                        /* JsonParserGenerator.kt:474 */;
          41  +
                        /* JsonParserGenerator.kt:481 */
   27     42   
                        match value {
   28     43   
                            Some(value) => {
   29     44   
                                map.insert(key, value);
   30     45   
                            }
   31     46   
                            None => {
   32     47   
                                return Err(
   33     48   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34     49   
                                        "dense map cannot contain null values",
   35     50   
                                    ),
   36     51   
                                )
   37     52   
                            }
   38     53   
                        }
          54  +
                        /* JsonParserGenerator.kt:686 */
   39     55   
                    }
          56  +
                    /* JsonParserGenerator.kt:695 */
   40     57   
                    other => {
   41     58   
                        return Err(
   42     59   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   43     60   
                                format!("expected object key or end object, found: {:?}", other),
   44     61   
                            ),
   45     62   
                        )
          63  +
                    } /* JsonParserGenerator.kt:685 */
   46     64   
                }
          65  +
                /* JsonParserGenerator.kt:684 */
   47     66   
            }
   48         -
            }
          67  +
            /* JsonParserGenerator.kt:502 */
   49     68   
            Ok(Some(
   50     69   
                crate::unconstrained::length_map_unconstrained::LengthMapUnconstrained(map),
   51     70   
            ))
          71  +
            /* JsonParserGenerator.kt:713 */
   52     72   
        }
   53         -
        _ => Err(
          73  +
        /* JsonParserGenerator.kt:722 */
          74  +
        _ => {
          75  +
            /* JsonParserGenerator.kt:723 */
          76  +
            Err(
   54     77   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   55     78   
                    "expected start object or null",
   56     79   
                ),
   57         -
        ),
          80  +
            )
          81  +
            /* JsonParserGenerator.kt:722 */
          82  +
        } /* JsonParserGenerator.kt:712 */
   58     83   
    }
          84  +
    /* JsonParserGenerator.kt:460 */
   59     85   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_list_set.rs

@@ -1,1 +51,76 @@
    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_list_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::list_set_unconstrained::ListSetUnconstrained>,
    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   
                    _ => {
          37  +
                        /* JsonParserGenerator.kt:419 */
   27     38   
                        let value =
   28         -
                            crate::protocol_serde::shape_string_list::de_string_list(tokens)?;
          39  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_string_list::de_string_list(tokens)?
          40  +
                        /* JsonParserGenerator.kt:419 */;
          41  +
                        /* JsonParserGenerator.kt:422 */
   29     42   
                        if let Some(value) = value {
   30     43   
                            items.push(value);
   31         -
                        } else {
          44  +
                        }
          45  +
                        /* JsonParserGenerator.kt:430 */
          46  +
                        else {
   32     47   
                            return Err(
   33     48   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34     49   
                                    "dense list cannot contain null values",
   35     50   
                                ),
   36     51   
                            );
   37     52   
                        }
          53  +
                        /* JsonParserGenerator.kt:413 */
          54  +
                    } /* JsonParserGenerator.kt:409 */
   38     55   
                }
          56  +
                /* JsonParserGenerator.kt:408 */
   39     57   
            }
   40         -
            }
          58  +
            /* JsonParserGenerator.kt:444 */
   41     59   
            Ok(Some(
   42     60   
                crate::unconstrained::list_set_unconstrained::ListSetUnconstrained(items),
   43     61   
            ))
          62  +
            /* JsonParserGenerator.kt:713 */
   44     63   
        }
   45         -
        _ => Err(
          64  +
        /* JsonParserGenerator.kt:722 */
          65  +
        _ => {
          66  +
            /* JsonParserGenerator.kt:723 */
          67  +
            Err(
   46     68   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   47     69   
                    "expected start array or null",
   48     70   
                ),
   49         -
        ),
          71  +
            )
          72  +
            /* JsonParserGenerator.kt:722 */
          73  +
        } /* JsonParserGenerator.kt:712 */
   50     74   
    }
          75  +
    /* JsonParserGenerator.kt:398 */
   51     76   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_long_set.rs

@@ -1,1 +54,78 @@
    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_long_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::unconstrained::long_set_unconstrained::LongSetUnconstrained>,
    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 = ::aws_smithy_json::deserialize::token::expect_number_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   30     40   
                                                .map(i64::try_from)
   31         -
                        .transpose()?;
          41  +
                                                .transpose()?
          42  +
                        /* JsonParserGenerator.kt:419 */;
          43  +
                        /* JsonParserGenerator.kt:422 */
   32     44   
                        if let Some(value) = value {
   33     45   
                            items.push(value);
   34         -
                        } else {
          46  +
                        }
          47  +
                        /* JsonParserGenerator.kt:430 */
          48  +
                        else {
   35     49   
                            return Err(
   36     50   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     51   
                                    "dense list cannot contain null values",
   38     52   
                                ),
   39     53   
                            );
   40     54   
                        }
          55  +
                        /* JsonParserGenerator.kt:413 */
          56  +
                    } /* JsonParserGenerator.kt:409 */
   41     57   
                }
          58  +
                /* JsonParserGenerator.kt:408 */
   42     59   
            }
   43         -
            }
          60  +
            /* JsonParserGenerator.kt:444 */
   44     61   
            Ok(Some(
   45     62   
                crate::unconstrained::long_set_unconstrained::LongSetUnconstrained(items),
   46     63   
            ))
          64  +
            /* JsonParserGenerator.kt:713 */
   47     65   
        }
   48         -
        _ => Err(
          66  +
        /* JsonParserGenerator.kt:722 */
          67  +
        _ => {
          68  +
            /* JsonParserGenerator.kt:723 */
          69  +
            Err(
   49     70   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   50     71   
                    "expected start array or null",
   51     72   
                ),
   52         -
        ),
          73  +
            )
          74  +
            /* JsonParserGenerator.kt:722 */
          75  +
        } /* JsonParserGenerator.kt:712 */
   53     76   
    }
          77  +
    /* JsonParserGenerator.kt:398 */
   54     78   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_enum.rs

@@ -1,1 +173,256 @@
    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_malformed_enum_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedEnumInput,
    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::malformed_enum_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_enum::de_malformed_enum(
   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_malformed_enum_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::MalformedEnumOutput,
   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);
   54         -
        let payload = "";
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58     83   
            ::http::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:516 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     98   
pub fn ser_malformed_enum_http_error(
   68     99   
    error: &crate::error::MalformedEnumError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    109   
            crate::error::MalformedEnumError::ValidationException(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    111   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         112  +
                /* RustType.kt:516 */
   77    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81    119   
                    ::http::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "ValidationException",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92    132   
                    ::http::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    136   
                builder
   96    137   
                    .status(400)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   98    141   
        }
   99         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_malformed_enum(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::malformed_enum_input::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::malformed_enum_input::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "list" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_list(
  122         -
                            crate::protocol_serde::shape_enum_list::de_enum_list(tokens)?,
  123         -
                        );
         174  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_enum_list::de_enum_list(tokens)?
         175  +
                        /* JsonParserGenerator.kt:272 */);
         176  +
                        /* JsonParserGenerator.kt:262 */
  124    177   
                    }
         178  +
                    /* JsonParserGenerator.kt:262 */
  125    179   
                    "map" => {
  126         -
                        builder = builder
  127         -
                            .set_map(crate::protocol_serde::shape_enum_map::de_enum_map(tokens)?);
         180  +
                        /* JsonParserGenerator.kt:272 */
         181  +
                        builder = builder.set_map(
         182  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_enum_map::de_enum_map(tokens)?
         183  +
                        /* JsonParserGenerator.kt:272 */);
         184  +
                        /* JsonParserGenerator.kt:262 */
  128    185   
                    }
         186  +
                    /* JsonParserGenerator.kt:262 */
  129    187   
                    "string" => {
         188  +
                        /* JsonParserGenerator.kt:272 */
  130    189   
                        builder = builder.set_string(
         190  +
                            /* JsonParserGenerator.kt:354 */
  131    191   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  132    192   
                                tokens.next(),
  133    193   
                            )?
  134         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  135         -
                            .transpose()?,
         194  +
                            .map(|s|
         195  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         196  +
                                    /* JsonParserGenerator.kt:343 */u.into_owned()
         197  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         198  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  136    199   
                        );
         200  +
                        /* JsonParserGenerator.kt:262 */
  137    201   
                    }
         202  +
                    /* JsonParserGenerator.kt:262 */
  138    203   
                    "stringWithEnumTrait" => {
         204  +
                        /* JsonParserGenerator.kt:272 */
  139    205   
                        builder = builder.set_string_with_enum_trait(
         206  +
                            /* JsonParserGenerator.kt:354 */
  140    207   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  141    208   
                                tokens.next(),
  142    209   
                            )?
  143         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  144         -
                            .transpose()?,
         210  +
                            .map(|s|
         211  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         212  +
                                    /* JsonParserGenerator.kt:343 */u.into_owned()
         213  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         214  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  145    215   
                        );
         216  +
                        /* JsonParserGenerator.kt:262 */
  146    217   
                    }
         218  +
                    /* JsonParserGenerator.kt:262 */
  147    219   
                    "union" => {
         220  +
                        /* JsonParserGenerator.kt:272 */
  148    221   
                        builder = builder.set_union(
  149         -
                            crate::protocol_serde::shape_enum_union::de_enum_union(tokens)?,
  150         -
                        );
         222  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_enum_union::de_enum_union(tokens)?
         223  +
                        /* JsonParserGenerator.kt:272 */);
         224  +
                        /* JsonParserGenerator.kt:262 */
  151    225   
                    }
  152         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         226  +
                    /* JsonParserGenerator.kt:290 */
         227  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  153    228   
                }
         229  +
                /* JsonParserGenerator.kt:686 */
  154    230   
            }
         231  +
            /* JsonParserGenerator.kt:695 */
  155    232   
            other => {
  156    233   
                return Err(
  157    234   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  158    235   
                        "expected object key or end object, found: {:?}",
  159    236   
                        other
  160    237   
                    )),
  161    238   
                )
         239  +
            } /* JsonParserGenerator.kt:685 */
  162    240   
        }
         241  +
        /* JsonParserGenerator.kt:684 */
  163    242   
    }
  164         -
    }
         243  +
    /* JsonParserGenerator.kt:250 */
  165    244   
    if tokens.next().is_some() {
         245  +
        /* JsonParserGenerator.kt:251 */
  166    246   
        return Err(
  167    247   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  168    248   
                "found more JSON tokens after completing parsing",
  169    249   
            ),
  170    250   
        );
         251  +
        /* JsonParserGenerator.kt:250 */
  171    252   
    }
         253  +
    /* JsonParserGenerator.kt:163 */
  172    254   
    Ok(builder)
         255  +
    /* JsonParserGenerator.kt:148 */
  173    256   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_length.rs

@@ -1,1 +185,275 @@
    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_malformed_length_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedLengthInput,
    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::malformed_length_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_length::de_malformed_length(
   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_malformed_length_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::MalformedLengthOutput,
   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);
   54         -
        let payload = "";
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58     83   
            ::http::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:516 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     98   
pub fn ser_malformed_length_http_error(
   68     99   
    error: &crate::error::MalformedLengthError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    109   
            crate::error::MalformedLengthError::ValidationException(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    111   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         112  +
                /* RustType.kt:516 */
   77    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81    119   
                    ::http::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "ValidationException",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92    132   
                    ::http::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    136   
                builder
   96    137   
                    .status(400)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   98    141   
        }
   99         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_malformed_length(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::malformed_length_input::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::malformed_length_input::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "blob" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_blob(
         174  +
                            /* JsonParserGenerator.kt:326 */
  122    175   
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(
  123    176   
                                tokens.next(),
  124         -
                            )?,
         177  +
                            )?, /* JsonParserGenerator.kt:272 */
  125    178   
                        );
         179  +
                        /* JsonParserGenerator.kt:262 */
  126    180   
                    }
         181  +
                    /* JsonParserGenerator.kt:262 */
  127    182   
                    "list" => {
         183  +
                        /* JsonParserGenerator.kt:272 */
  128    184   
                        builder = builder.set_list(
  129         -
                            crate::protocol_serde::shape_length_list::de_length_list(tokens)?,
  130         -
                        );
         185  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_length_list::de_length_list(tokens)?
         186  +
                        /* JsonParserGenerator.kt:272 */);
         187  +
                        /* JsonParserGenerator.kt:262 */
  131    188   
                    }
         189  +
                    /* JsonParserGenerator.kt:262 */
  132    190   
                    "map" => {
         191  +
                        /* JsonParserGenerator.kt:272 */
  133    192   
                        builder = builder.set_map(
  134         -
                            crate::protocol_serde::shape_length_map::de_length_map(tokens)?,
  135         -
                        );
         193  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_length_map::de_length_map(tokens)?
         194  +
                        /* JsonParserGenerator.kt:272 */);
         195  +
                        /* JsonParserGenerator.kt:262 */
  136    196   
                    }
         197  +
                    /* JsonParserGenerator.kt:262 */
  137    198   
                    "maxString" => {
         199  +
                        /* JsonParserGenerator.kt:272 */
  138    200   
                        builder = builder.set_max_string(
         201  +
                            /* JsonParserGenerator.kt:354 */
  139    202   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  140    203   
                                tokens.next(),
  141    204   
                            )?
  142         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  143         -
                            .transpose()?,
         205  +
                            .map(|s|
         206  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         207  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         208  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         209  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  144    210   
                        );
         211  +
                        /* JsonParserGenerator.kt:262 */
  145    212   
                    }
         213  +
                    /* JsonParserGenerator.kt:262 */
  146    214   
                    "minString" => {
         215  +
                        /* JsonParserGenerator.kt:272 */
  147    216   
                        builder = builder.set_min_string(
         217  +
                            /* JsonParserGenerator.kt:354 */
  148    218   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  149    219   
                                tokens.next(),
  150    220   
                            )?
  151         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  152         -
                            .transpose()?,
         221  +
                            .map(|s|
         222  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         223  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         224  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         225  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  153    226   
                        );
         227  +
                        /* JsonParserGenerator.kt:262 */
  154    228   
                    }
         229  +
                    /* JsonParserGenerator.kt:262 */
  155    230   
                    "string" => {
         231  +
                        /* JsonParserGenerator.kt:272 */
  156    232   
                        builder = builder.set_string(
         233  +
                            /* JsonParserGenerator.kt:354 */
  157    234   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  158    235   
                                tokens.next(),
  159    236   
                            )?
  160         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  161         -
                            .transpose()?,
         237  +
                            .map(|s|
         238  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         239  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         240  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         241  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  162    242   
                        );
         243  +
                        /* JsonParserGenerator.kt:262 */
  163    244   
                    }
  164         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         245  +
                    /* JsonParserGenerator.kt:290 */
         246  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  165    247   
                }
         248  +
                /* JsonParserGenerator.kt:686 */
  166    249   
            }
         250  +
            /* JsonParserGenerator.kt:695 */
  167    251   
            other => {
  168    252   
                return Err(
  169    253   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  170    254   
                        "expected object key or end object, found: {:?}",
  171    255   
                        other
  172    256   
                    )),
  173    257   
                )
         258  +
            } /* JsonParserGenerator.kt:685 */
  174    259   
        }
         260  +
        /* JsonParserGenerator.kt:684 */
  175    261   
    }
  176         -
    }
         262  +
    /* JsonParserGenerator.kt:250 */
  177    263   
    if tokens.next().is_some() {
         264  +
        /* JsonParserGenerator.kt:251 */
  178    265   
        return Err(
  179    266   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  180    267   
                "found more JSON tokens after completing parsing",
  181    268   
            ),
  182    269   
        );
         270  +
        /* JsonParserGenerator.kt:250 */
  183    271   
    }
         272  +
    /* JsonParserGenerator.kt:163 */
  184    273   
    Ok(builder)
         274  +
    /* JsonParserGenerator.kt:148 */
  185    275   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_length_override.rs

@@ -1,1 +182,272 @@
    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_malformed_length_override_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedLengthOverrideInput,
    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::malformed_length_override_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_length_override::de_malformed_length_override(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_malformed_length_override_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::MalformedLengthOverrideOutput,
   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);
   51         -
        let payload = "";
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          73  +
        let payload =
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   52     77   
        let content_length = payload.len();
   53     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     79   
            builder,
   55     80   
            ::http::header::CONTENT_LENGTH,
   56     81   
            content_length,
   57     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   58     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   59     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   60     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   61     90   
}
   62     91   
          92  +
/* RustType.kt:516 */
   63     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   64     95   
pub fn ser_malformed_length_override_http_error(
   65     96   
    error: &crate::error::MalformedLengthOverrideError,
   66     97   
) -> std::result::Result<
   67     98   
    ::aws_smithy_http_server::response::Response,
   68     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   69    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   70    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   71    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   72    106   
            crate::error::MalformedLengthOverrideError::ValidationException(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   73    108   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         109  +
                /* RustType.kt:516 */
   74    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   75    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   76    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   77    115   
                    builder,
   78    116   
                    ::http::header::CONTENT_TYPE,
   79    117   
                    "application/json",
   80    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    121   
                    builder,
   83    122   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   84    123   
                    "ValidationException",
   85    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   86    126   
                let content_length = payload.len();
   87    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88    128   
                    builder,
   89    129   
                    ::http::header::CONTENT_LENGTH,
   90    130   
                    content_length,
   91    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   92    133   
                builder
   93    134   
                    .status(400)
   94    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         137  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   95    138   
        }
   96         -
        }
         139  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   97    140   
    })
         141  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   98    142   
}
   99    143   
         144  +
/* JsonParserGenerator.kt:148 */
  100    145   
pub(crate) fn de_malformed_length_override(
  101    146   
    value: &[u8],
  102    147   
    mut builder: crate::input::malformed_length_override_input::Builder,
  103    148   
) -> ::std::result::Result<
  104    149   
    crate::input::malformed_length_override_input::Builder,
  105    150   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  106    151   
> {
         152  +
    /* JsonParserGenerator.kt:153 */
  107    153   
    let mut tokens_owned =
  108    154   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  109    155   
            .peekable();
  110    156   
    let tokens = &mut tokens_owned;
  111    157   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         158  +
    /* JsonParserGenerator.kt:684 */
  112    159   
    loop {
         160  +
        /* JsonParserGenerator.kt:685 */
  113    161   
        match tokens.next().transpose()? {
         162  +
            /* JsonParserGenerator.kt:686 */
  114    163   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  115    164   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         165  +
                /* JsonParserGenerator.kt:260 */
  116    166   
                match key.to_unescaped()?.as_ref() {
         167  +
                    /* JsonParserGenerator.kt:262 */
  117    168   
                    "blob" => {
         169  +
                        /* JsonParserGenerator.kt:272 */
  118    170   
                        builder = builder.set_blob(
         171  +
                            /* JsonParserGenerator.kt:326 */
  119    172   
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(
  120    173   
                                tokens.next(),
  121         -
                            )?,
         174  +
                            )?, /* JsonParserGenerator.kt:272 */
  122    175   
                        );
         176  +
                        /* JsonParserGenerator.kt:262 */
  123    177   
                    }
         178  +
                    /* JsonParserGenerator.kt:262 */
  124    179   
                    "list" => {
         180  +
                        /* JsonParserGenerator.kt:272 */
  125    181   
                        builder = builder.set_list(
  126         -
                            crate::protocol_serde::shape_malformed_length_override_input_list::de_malformed_length_override_input_list(tokens)?
  127         -
                        );
         182  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_malformed_length_override_input_list::de_malformed_length_override_input_list(tokens)?
         183  +
                        /* JsonParserGenerator.kt:272 */);
         184  +
                        /* JsonParserGenerator.kt:262 */
  128    185   
                    }
         186  +
                    /* JsonParserGenerator.kt:262 */
  129    187   
                    "map" => {
         188  +
                        /* JsonParserGenerator.kt:272 */
  130    189   
                        builder = builder.set_map(
  131         -
                            crate::protocol_serde::shape_malformed_length_override_input_map::de_malformed_length_override_input_map(tokens)?
  132         -
                        );
         190  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_malformed_length_override_input_map::de_malformed_length_override_input_map(tokens)?
         191  +
                        /* JsonParserGenerator.kt:272 */);
         192  +
                        /* JsonParserGenerator.kt:262 */
  133    193   
                    }
         194  +
                    /* JsonParserGenerator.kt:262 */
  134    195   
                    "maxString" => {
         196  +
                        /* JsonParserGenerator.kt:272 */
  135    197   
                        builder = builder.set_max_string(
         198  +
                            /* JsonParserGenerator.kt:354 */
  136    199   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  137    200   
                                tokens.next(),
  138    201   
                            )?
  139         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  140         -
                            .transpose()?,
         202  +
                            .map(|s|
         203  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         204  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         205  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         206  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  141    207   
                        );
         208  +
                        /* JsonParserGenerator.kt:262 */
  142    209   
                    }
         210  +
                    /* JsonParserGenerator.kt:262 */
  143    211   
                    "minString" => {
         212  +
                        /* JsonParserGenerator.kt:272 */
  144    213   
                        builder = builder.set_min_string(
         214  +
                            /* JsonParserGenerator.kt:354 */
  145    215   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  146    216   
                                tokens.next(),
  147    217   
                            )?
  148         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  149         -
                            .transpose()?,
         218  +
                            .map(|s|
         219  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         220  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         221  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         222  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  150    223   
                        );
         224  +
                        /* JsonParserGenerator.kt:262 */
  151    225   
                    }
         226  +
                    /* JsonParserGenerator.kt:262 */
  152    227   
                    "string" => {
         228  +
                        /* JsonParserGenerator.kt:272 */
  153    229   
                        builder = builder.set_string(
         230  +
                            /* JsonParserGenerator.kt:354 */
  154    231   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  155    232   
                                tokens.next(),
  156    233   
                            )?
  157         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  158         -
                            .transpose()?,
         234  +
                            .map(|s|
         235  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         236  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         237  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         238  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  159    239   
                        );
         240  +
                        /* JsonParserGenerator.kt:262 */
  160    241   
                    }
  161         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         242  +
                    /* JsonParserGenerator.kt:290 */
         243  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  162    244   
                }
         245  +
                /* JsonParserGenerator.kt:686 */
  163    246   
            }
         247  +
            /* JsonParserGenerator.kt:695 */
  164    248   
            other => {
  165    249   
                return Err(
  166    250   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  167    251   
                        "expected object key or end object, found: {:?}",
  168    252   
                        other
  169    253   
                    )),
  170    254   
                )
         255  +
            } /* JsonParserGenerator.kt:685 */
  171    256   
        }
         257  +
        /* JsonParserGenerator.kt:684 */
  172    258   
    }
  173         -
    }
         259  +
    /* JsonParserGenerator.kt:250 */
  174    260   
    if tokens.next().is_some() {
         261  +
        /* JsonParserGenerator.kt:251 */
  175    262   
        return Err(
  176    263   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  177    264   
                "found more JSON tokens after completing parsing",
  178    265   
            ),
  179    266   
        );
         267  +
        /* JsonParserGenerator.kt:250 */
  180    268   
    }
         269  +
    /* JsonParserGenerator.kt:163 */
  181    270   
    Ok(builder)
         271  +
    /* JsonParserGenerator.kt:148 */
  182    272   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_length_override_input_list.rs

@@ -1,1 +40,66 @@
    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_malformed_length_override_input_list<'a, I>(tokens: &mut ::std::iter::Peekable<I>) -> ::std::result::Result<Option<crate::input::malformed_length_override_input::malformed_length_override_input_list_unconstrained::MalformedLengthOverrideInputListUnconstrained>, ::aws_smithy_json::deserialize::error::DeserializeError>
    3      4   
where I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>{
           5  +
    /* JsonParserGenerator.kt:712 */
    4      6   
    match tokens.next().transpose()? {
           7  +
        /* JsonParserGenerator.kt:713 */
    5      8   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
    6      9   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          10  +
            /* JsonParserGenerator.kt:407 */
    7     11   
            let mut items = Vec::new();
          12  +
            /* JsonParserGenerator.kt:408 */
    8     13   
            loop {
          14  +
                /* JsonParserGenerator.kt:409 */
    9     15   
                match tokens.peek() {
          16  +
                    /* JsonParserGenerator.kt:410 */
   10     17   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          18  +
                        /* JsonParserGenerator.kt:411 */
   11     19   
                        tokens.next().transpose().unwrap();
   12     20   
                        break;
          21  +
                        /* JsonParserGenerator.kt:410 */
   13     22   
                    }
          23  +
                    /* JsonParserGenerator.kt:413 */
   14     24   
                    _ => {
   15         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
   16         -
                            tokens.next(),
   17         -
                        )?
   18         -
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   19         -
                        .transpose()?;
          25  +
                        /* JsonParserGenerator.kt:419 */
          26  +
                        let value =
          27  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          28  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          29  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          30  +
                                /* JsonParserGenerator.kt:339 */)
          31  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          32  +
                        /* JsonParserGenerator.kt:419 */;
          33  +
                        /* JsonParserGenerator.kt:422 */
   20     34   
                        if let Some(value) = value {
   21     35   
                            items.push(value);
   22         -
                        } else {
          36  +
                        }
          37  +
                        /* JsonParserGenerator.kt:430 */
          38  +
                        else {
   23     39   
                            return Err(
   24     40   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   25     41   
                                    "dense list cannot contain null values",
   26     42   
                                ),
   27     43   
                            );
   28     44   
                        }
          45  +
                        /* JsonParserGenerator.kt:413 */
          46  +
                    } /* JsonParserGenerator.kt:409 */
   29     47   
                }
          48  +
                /* JsonParserGenerator.kt:408 */
   30     49   
            }
   31         -
            }
          50  +
            /* JsonParserGenerator.kt:444 */
   32     51   
            Ok(Some(crate::input::malformed_length_override_input::malformed_length_override_input_list_unconstrained::MalformedLengthOverrideInputListUnconstrained(items)))
          52  +
            /* JsonParserGenerator.kt:713 */
   33     53   
        }
   34         -
        _ => Err(
          54  +
        /* JsonParserGenerator.kt:722 */
          55  +
        _ => {
          56  +
            /* JsonParserGenerator.kt:723 */
          57  +
            Err(
   35     58   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   36     59   
                    "expected start array or null",
   37     60   
                ),
   38         -
        ),
          61  +
            )
          62  +
            /* JsonParserGenerator.kt:722 */
          63  +
        } /* JsonParserGenerator.kt:712 */
   39     64   
    }
          65  +
    /* JsonParserGenerator.kt:398 */
   40     66   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_length_override_input_map.rs

@@ -1,1 +45,71 @@
    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_malformed_length_override_input_map<'a, I>(tokens: &mut ::std::iter::Peekable<I>) -> ::std::result::Result<Option<crate::input::malformed_length_override_input::malformed_length_override_input_map_unconstrained::MalformedLengthOverrideInputMapUnconstrained>, ::aws_smithy_json::deserialize::error::DeserializeError>
    3      4   
where I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>{
           5  +
    /* JsonParserGenerator.kt:712 */
    4      6   
    match tokens.next().transpose()? {
           7  +
        /* JsonParserGenerator.kt:713 */
    5      8   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
    6      9   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          10  +
            /* JsonParserGenerator.kt:469 */
    7     11   
            let mut map = ::std::collections::HashMap::new();
          12  +
            /* JsonParserGenerator.kt:684 */
    8     13   
            loop {
          14  +
                /* JsonParserGenerator.kt:685 */
    9     15   
                match tokens.next().transpose()? {
          16  +
                    /* JsonParserGenerator.kt:686 */
   10     17   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   11     18   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   12         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
          19  +
                        /* JsonParserGenerator.kt:471 */
          20  +
                        let key =
          21  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          22  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          23  +
                            /* JsonParserGenerator.kt:339 */)
          24  +
                        /* JsonParserGenerator.kt:471 */?;
          25  +
                        /* JsonParserGenerator.kt:474 */
   13     26   
                        let value =
   14         -
                            crate::protocol_serde::shape_length_list::de_length_list(tokens)?;
          27  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_length_list::de_length_list(tokens)?
          28  +
                        /* JsonParserGenerator.kt:474 */;
          29  +
                        /* JsonParserGenerator.kt:481 */
   15     30   
                        match value {
   16     31   
                            Some(value) => {
   17     32   
                                map.insert(key, value);
   18     33   
                            }
   19     34   
                            None => {
   20     35   
                                return Err(
   21     36   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   22     37   
                                        "dense map cannot contain null values",
   23     38   
                                    ),
   24     39   
                                )
   25     40   
                            }
   26     41   
                        }
          42  +
                        /* JsonParserGenerator.kt:686 */
   27     43   
                    }
          44  +
                    /* JsonParserGenerator.kt:695 */
   28     45   
                    other => {
   29     46   
                        return Err(
   30     47   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31     48   
                                format!("expected object key or end object, found: {:?}", other),
   32     49   
                            ),
   33     50   
                        )
          51  +
                    } /* JsonParserGenerator.kt:685 */
   34     52   
                }
          53  +
                /* JsonParserGenerator.kt:684 */
   35     54   
            }
   36         -
            }
          55  +
            /* JsonParserGenerator.kt:502 */
   37     56   
            Ok(Some(crate::input::malformed_length_override_input::malformed_length_override_input_map_unconstrained::MalformedLengthOverrideInputMapUnconstrained(map)))
          57  +
            /* JsonParserGenerator.kt:713 */
   38     58   
        }
   39         -
        _ => Err(
          59  +
        /* JsonParserGenerator.kt:722 */
          60  +
        _ => {
          61  +
            /* JsonParserGenerator.kt:723 */
          62  +
            Err(
   40     63   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   41     64   
                    "expected start object or null",
   42     65   
                ),
   43         -
        ),
          66  +
            )
          67  +
            /* JsonParserGenerator.kt:722 */
          68  +
        } /* JsonParserGenerator.kt:712 */
   44     69   
    }
          70  +
    /* JsonParserGenerator.kt:460 */
   45     71   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_length_query_string.rs

@@ -1,1 +103,148 @@
    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_malformed_length_query_string_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedLengthQueryStringInput,
    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::malformed_length_query_string_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   24     33   
        let mut string_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   25     35   
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   26     37   
            if !string_seen && k == "string" {
   27     38   
                input = input.set_string(
   28     39   
                    crate::protocol_serde::shape_malformed_length_query_string_input::de_string(
   29     40   
                        &v,
   30     41   
                    )?,
   31     42   
                );
   32     43   
                string_seen = true;
   33     44   
            }
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   34     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   35     48   
        input.build()?
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   36     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   37     52   
}
   38     53   
          54  +
/* RustType.kt:516 */
   39     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   40     57   
pub fn ser_malformed_length_query_string_http_response(
   41     58   
    #[allow(unused_variables)] output: crate::output::MalformedLengthQueryStringOutput,
   42     59   
) -> std::result::Result<
   43     60   
    ::aws_smithy_http_server::response::Response,
   44     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   45     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   46     64   
    Ok({
          65  +
        /* RustType.kt:516 */
   47     66   
        #[allow(unused_mut)]
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   48     68   
        let mut builder = ::http::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   49     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     71   
            builder,
   51     72   
            ::http::header::CONTENT_TYPE,
   52     73   
            "application/json",
   53     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   54     76   
        let http_status: u16 = 200;
   55     77   
        builder = builder.status(http_status);
   56         -
        let payload = "";
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          79  +
        let payload =
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   57     83   
        let content_length = payload.len();
   58     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     85   
            builder,
   60     86   
            ::http::header::CONTENT_LENGTH,
   61     87   
            content_length,
   62     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   63     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   64     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   65     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   66     96   
}
   67     97   
          98  +
/* RustType.kt:516 */
   68     99   
#[allow(clippy::unnecessary_wraps)]
         100  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   69    101   
pub fn ser_malformed_length_query_string_http_error(
   70    102   
    error: &crate::error::MalformedLengthQueryStringError,
   71    103   
) -> std::result::Result<
   72    104   
    ::aws_smithy_http_server::response::Response,
   73    105   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    106   
> {
         107  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   75    108   
    Ok({
         109  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   76    110   
        match error {
         111  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   77    112   
            crate::error::MalformedLengthQueryStringError::ValidationException(output) => {
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   78    114   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         115  +
                /* RustType.kt:516 */
   79    116   
                #[allow(unused_mut)]
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   80    118   
                let mut builder = ::http::Response::builder();
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    121   
                    builder,
   83    122   
                    ::http::header::CONTENT_TYPE,
   84    123   
                    "application/json",
   85    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    126   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    127   
                    builder,
   88    128   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   89    129   
                    "ValidationException",
   90    130   
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   91    132   
                let content_length = payload.len();
   92    133   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    134   
                    builder,
   94    135   
                    ::http::header::CONTENT_LENGTH,
   95    136   
                    content_length,
   96    137   
                );
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   97    139   
                builder
   98    140   
                    .status(400)
   99    141   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         142  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         143  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  100    144   
        }
  101         -
        }
         145  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  102    146   
    })
         147  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  103    148   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_length_query_string_input.rs

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_string(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1309 */
    8     10   
    let value = value.to_owned();
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
    9     12   
    Ok(Some(value))
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   10     14   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_pattern.rs

@@ -1,1 +174,260 @@
    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_malformed_pattern_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedPatternInput,
    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::malformed_pattern_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_pattern::de_malformed_pattern(
   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_malformed_pattern_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::MalformedPatternOutput,
   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);
   54         -
        let payload = "";
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58     83   
            ::http::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:516 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     98   
pub fn ser_malformed_pattern_http_error(
   68     99   
    error: &crate::error::MalformedPatternError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    109   
            crate::error::MalformedPatternError::ValidationException(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    111   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         112  +
                /* RustType.kt:516 */
   77    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81    119   
                    ::http::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "ValidationException",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92    132   
                    ::http::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    136   
                builder
   96    137   
                    .status(400)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   98    141   
        }
   99         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_malformed_pattern(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::malformed_pattern_input::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::malformed_pattern_input::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "evilString" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_evil_string(
         174  +
                            /* JsonParserGenerator.kt:354 */
  122    175   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  123    176   
                                tokens.next(),
  124    177   
                            )?
  125         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  126         -
                            .transpose()?,
         178  +
                            .map(|s|
         179  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         180  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         181  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         182  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  127    183   
                        );
         184  +
                        /* JsonParserGenerator.kt:262 */
  128    185   
                    }
         186  +
                    /* JsonParserGenerator.kt:262 */
  129    187   
                    "list" => {
         188  +
                        /* JsonParserGenerator.kt:272 */
  130    189   
                        builder = builder.set_list(
  131         -
                            crate::protocol_serde::shape_pattern_list::de_pattern_list(tokens)?,
  132         -
                        );
         190  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_pattern_list::de_pattern_list(tokens)?
         191  +
                        /* JsonParserGenerator.kt:272 */);
         192  +
                        /* JsonParserGenerator.kt:262 */
  133    193   
                    }
         194  +
                    /* JsonParserGenerator.kt:262 */
  134    195   
                    "map" => {
         196  +
                        /* JsonParserGenerator.kt:272 */
  135    197   
                        builder = builder.set_map(
  136         -
                            crate::protocol_serde::shape_pattern_map::de_pattern_map(tokens)?,
  137         -
                        );
         198  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_pattern_map::de_pattern_map(tokens)?
         199  +
                        /* JsonParserGenerator.kt:272 */);
         200  +
                        /* JsonParserGenerator.kt:262 */
  138    201   
                    }
         202  +
                    /* JsonParserGenerator.kt:262 */
  139    203   
                    "string" => {
         204  +
                        /* JsonParserGenerator.kt:272 */
  140    205   
                        builder = builder.set_string(
         206  +
                            /* JsonParserGenerator.kt:354 */
  141    207   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  142    208   
                                tokens.next(),
  143    209   
                            )?
  144         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  145         -
                            .transpose()?,
         210  +
                            .map(|s|
         211  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         212  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         213  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         214  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  146    215   
                        );
         216  +
                        /* JsonParserGenerator.kt:262 */
  147    217   
                    }
         218  +
                    /* JsonParserGenerator.kt:262 */
  148    219   
                    "union" => {
  149         -
                        builder = builder.set_union(
  150         -
                            crate::protocol_serde::shape_pattern_union::de_pattern_union(tokens)?,
         220  +
                        /* JsonParserGenerator.kt:272 */
         221  +
                        builder =
         222  +
                            builder.set_union(
         223  +
                                /* JsonParserGenerator.kt:660 */
         224  +
                                crate::protocol_serde::shape_pattern_union::de_pattern_union(
         225  +
                                    tokens,
         226  +
                                )?, /* JsonParserGenerator.kt:272 */
  151    227   
                            );
         228  +
                        /* JsonParserGenerator.kt:262 */
  152    229   
                    }
  153         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         230  +
                    /* JsonParserGenerator.kt:290 */
         231  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  154    232   
                }
         233  +
                /* JsonParserGenerator.kt:686 */
  155    234   
            }
         235  +
            /* JsonParserGenerator.kt:695 */
  156    236   
            other => {
  157    237   
                return Err(
  158    238   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  159    239   
                        "expected object key or end object, found: {:?}",
  160    240   
                        other
  161    241   
                    )),
  162    242   
                )
         243  +
            } /* JsonParserGenerator.kt:685 */
  163    244   
        }
         245  +
        /* JsonParserGenerator.kt:684 */
  164    246   
    }
  165         -
    }
         247  +
    /* JsonParserGenerator.kt:250 */
  166    248   
    if tokens.next().is_some() {
         249  +
        /* JsonParserGenerator.kt:251 */
  167    250   
        return Err(
  168    251   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  169    252   
                "found more JSON tokens after completing parsing",
  170    253   
            ),
  171    254   
        );
         255  +
        /* JsonParserGenerator.kt:250 */
  172    256   
    }
         257  +
    /* JsonParserGenerator.kt:163 */
  173    258   
    Ok(builder)
         259  +
    /* JsonParserGenerator.kt:148 */
  174    260   
}

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/protocol_serde/shape_malformed_pattern_override.rs

@@ -1,1 +162,237 @@
    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_malformed_pattern_override_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedPatternOverrideInput,
    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::malformed_pattern_override_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_pattern_override::de_malformed_pattern_override(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_malformed_pattern_override_http_response(
   36     52   
    #[allow(unused_variables)] output: crate::output::MalformedPatternOverrideOutput,
   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);
   51         -
        let payload = "";
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          73  +
        let payload =
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   52     77   
        let content_length = payload.len();
   53     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     79   
            builder,
   55     80   
            ::http::header::CONTENT_LENGTH,
   56     81   
            content_length,
   57     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   58     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   59     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   60     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   61     90   
}
   62     91   
          92  +
/* RustType.kt:516 */
   63     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   64     95   
pub fn ser_malformed_pattern_override_http_error(
   65     96   
    error: &crate::error::MalformedPatternOverrideError,
   66     97   
) -> std::result::Result<
   67     98   
    ::aws_smithy_http_server::response::Response,
   68     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   69    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   70    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   71    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   72    106   
            crate::error::MalformedPatternOverrideError::ValidationException(output) => {
         107  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   73    108   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         109  +
                /* RustType.kt:516 */
   74    110   
                #[allow(unused_mut)]
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   75    112   
                let mut builder = ::http::Response::builder();
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   76    114   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   77    115   
                    builder,
   78    116   
                    ::http::header::CONTENT_TYPE,
   79    117   
                    "application/json",
   80    118   
                );
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    121   
                    builder,
   83    122   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   84    123   
                    "ValidationException",
   85    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   86    126   
                let content_length = payload.len();
   87    127   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88    128   
                    builder,
   89    129   
                    ::http::header::CONTENT_LENGTH,
   90    130   
                    content_length,
   91    131   
                );
         132  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   92    133   
                builder
   93    134   
                    .status(400)
   94    135   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         137  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   95    138   
        }
   96         -
        }
         139  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   97    140   
    })
         141  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   98    142   
}
   99    143   
         144  +
/* JsonParserGenerator.kt:148 */
  100    145   
pub(crate) fn de_malformed_pattern_override(
  101    146   
    value: &[u8],
  102    147   
    mut builder: crate::input::malformed_pattern_override_input::Builder,
  103    148   
) -> ::std::result::Result<
  104    149   
    crate::input::malformed_pattern_override_input::Builder,
  105    150   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  106    151   
> {
         152  +
    /* JsonParserGenerator.kt:153 */
  107    153   
    let mut tokens_owned =
  108    154   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  109    155   
            .peekable();
  110    156   
    let tokens = &mut tokens_owned;
  111    157   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         158  +
    /* JsonParserGenerator.kt:684 */
  112    159   
    loop {
         160  +
        /* JsonParserGenerator.kt:685 */
  113    161   
        match tokens.next().transpose()? {
         162  +
            /* JsonParserGenerator.kt:686 */
  114    163   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  115    164   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         165  +
                /* JsonParserGenerator.kt:260 */
  116    166   
                match key.to_unescaped()?.as_ref() {
         167  +
                    /* JsonParserGenerator.kt:262 */
  117    168   
                    "list" => {
         169  +
                        /* JsonParserGenerator.kt:272 */
  118    170   
                        builder = builder.set_list(
  119         -
                            crate::protocol_serde::shape_pattern_list_override::de_pattern_list_override(tokens)?
  120         -
                        );
         171  +
                            /* JsonParserGenerator.kt:451 */crate::protocol_serde::shape_pattern_list_override::de_pattern_list_override(tokens)?
         172  +
                        /* JsonParserGenerator.kt:272 */);
         173  +
                        /* JsonParserGenerator.kt:262 */
  121    174   
                    }
         175  +
                    /* JsonParserGenerator.kt:262 */
  122    176   
                    "map" => {
         177  +
                        /* JsonParserGenerator.kt:272 */
  123    178   
                        builder = builder.set_map(
  124         -
                            crate::protocol_serde::shape_pattern_map_override::de_pattern_map_override(tokens)?
  125         -
                        );
         179  +
                            /* JsonParserGenerator.kt:509 */crate::protocol_serde::shape_pattern_map_override::de_pattern_map_override(tokens)?
         180  +
                        /* JsonParserGenerator.kt:272 */);
         181  +
                        /* JsonParserGenerator.kt:262 */
  126    182   
                    }
         183  +
                    /* JsonParserGenerator.kt:262 */
  127    184   
                    "string" => {
         185  +
                        /* JsonParserGenerator.kt:272 */
  128    186   
                        builder = builder.set_string(
         187  +
                            /* JsonParserGenerator.kt:354 */
  129    188   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  130    189   
                                tokens.next(),
  131    190   
                            )?
  132         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  133         -
                            .transpose()?,
         191  +
                            .map(|s|
         192  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         193  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         194  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         195  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  134    196   
                        );
         197  +
                        /* JsonParserGenerator.kt:262 */
  135    198   
                    }
         199  +
                    /* JsonParserGenerator.kt:262 */
  136    200   
                    "union" => {
         201  +
                        /* JsonParserGenerator.kt:272 */
  137    202   
                        builder = builder.set_union(
  138         -
                            crate::protocol_serde::shape_pattern_union_override::de_pattern_union_override(tokens)?
  139         -
                        );
         203  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_pattern_union_override::de_pattern_union_override(tokens)?
         204  +
                        /* JsonParserGenerator.kt:272 */);
         205  +
                        /* JsonParserGenerator.kt:262 */
  140    206   
                    }
  141         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         207  +
                    /* JsonParserGenerator.kt:290 */
         208  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  142    209   
                }
         210  +
                /* JsonParserGenerator.kt:686 */
  143    211   
            }
         212  +
            /* JsonParserGenerator.kt:695 */
  144    213   
            other => {
  145    214   
                return Err(
  146    215   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  147    216   
                        "expected object key or end object, found: {:?}",
  148    217   
                        other
  149    218   
                    )),
  150    219   
                )
         220  +
            } /* JsonParserGenerator.kt:685 */
  151    221   
        }
         222  +
        /* JsonParserGenerator.kt:684 */
  152    223   
    }
  153         -
    }
         224  +
    /* JsonParserGenerator.kt:250 */
  154    225   
    if tokens.next().is_some() {
         226  +
        /* JsonParserGenerator.kt:251 */
  155    227   
        return Err(
  156    228   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  157    229   
                "found more JSON tokens after completing parsing",
  158    230   
            ),
  159    231   
        );
         232  +
        /* JsonParserGenerator.kt:250 */
  160    233   
    }
         234  +
    /* JsonParserGenerator.kt:163 */
  161    235   
    Ok(builder)
         236  +
    /* JsonParserGenerator.kt:148 */
  162    237   
}