Server Test

Server Test

rev. 03e6e47f15dfd569240d570d98975ebba692c405 (ignoring whitespace)

Files changed:

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

@@ -1,1 +78,117 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_recursive_shapes_input_output_nested1<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::RecursiveShapesInputOutputNested1>,
    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  +
            /* RustType.kt:534 */
   19     23   
            #[allow(unused_mut)]
          24  +
            /* JsonParserGenerator.kt:526 */
   20     25   
            let mut builder =
   21     26   
                crate::model::recursive_shapes_input_output_nested1::Builder::default();
          27  +
            /* JsonParserGenerator.kt:684 */
   22     28   
            loop {
          29  +
                /* JsonParserGenerator.kt:685 */
   23     30   
                match tokens.next().transpose()? {
          31  +
                    /* JsonParserGenerator.kt:686 */
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   25     33   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          34  +
                        /* JsonParserGenerator.kt:260 */
   26     35   
                        match key.to_unescaped()?.as_ref() {
          36  +
                            /* JsonParserGenerator.kt:262 */
   27     37   
                            "foo" => {
          38  +
                                /* JsonParserGenerator.kt:272 */
   28     39   
                                builder = builder.set_foo(
   29         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   30         -
                                        tokens.next(),
   31         -
                                    )?
   32         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   33         -
                                    .transpose()?,
   34         -
                                );
          40  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          41  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          42  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          43  +
                                        /* JsonParserGenerator.kt:339 */)
          44  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          45  +
                                /* JsonParserGenerator.kt:272 */);
          46  +
                                /* JsonParserGenerator.kt:262 */
   35     47   
                            }
          48  +
                            /* JsonParserGenerator.kt:262 */
   36     49   
                            "nested" => {
          50  +
                                /* JsonParserGenerator.kt:272 */
   37     51   
                                builder = builder.set_nested(
   38         -
                                    crate::protocol_serde::shape_recursive_shapes_input_output_nested2::de_recursive_shapes_input_output_nested2(tokens)?
   39         -
                                    .map(Box::new)
   40         -
                                );
          52  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_recursive_shapes_input_output_nested2::de_recursive_shapes_input_output_nested2(tokens)?
          53  +
                                    /* JsonParserGenerator.kt:314 */.map(Box::new)
          54  +
                                /* JsonParserGenerator.kt:272 */);
          55  +
                                /* JsonParserGenerator.kt:262 */
   41     56   
                            }
   42         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          57  +
                            /* JsonParserGenerator.kt:290 */
          58  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   43     59   
                        }
          60  +
                        /* JsonParserGenerator.kt:686 */
   44     61   
                    }
          62  +
                    /* JsonParserGenerator.kt:695 */
   45     63   
                    other => {
   46     64   
                        return Err(
   47     65   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48     66   
                                format!("expected object key or end object, found: {other:?}"),
   49     67   
                            ),
   50     68   
                        )
          69  +
                    } /* JsonParserGenerator.kt:685 */
   51     70   
                }
          71  +
                /* JsonParserGenerator.kt:684 */
   52     72   
            }
   53         -
            }
          73  +
            /* JsonParserGenerator.kt:540 */
   54     74   
            Ok(Some(builder.build()))
          75  +
            /* JsonParserGenerator.kt:713 */
   55     76   
        }
   56         -
        _ => Err(
          77  +
        /* JsonParserGenerator.kt:722 */
          78  +
        _ => {
          79  +
            /* JsonParserGenerator.kt:723 */
          80  +
            Err(
   57     81   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   58     82   
                    "expected start object or null",
   59     83   
                ),
   60         -
        ),
          84  +
            )
          85  +
            /* JsonParserGenerator.kt:722 */
          86  +
        } /* JsonParserGenerator.kt:712 */
   61     87   
    }
          88  +
    /* JsonParserGenerator.kt:516 */
   62     89   
}
   63     90   
          91  +
/* JsonSerializerGenerator.kt:358 */
   64     92   
pub fn ser_recursive_shapes_input_output_nested1(
   65     93   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   66     94   
    input: &crate::model::RecursiveShapesInputOutputNested1,
   67     95   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          96  +
    /* JsonSerializerGenerator.kt:382 */
   68     97   
    if let Some(var_1) = &input.foo {
          98  +
        /* JsonSerializerGenerator.kt:423 */
   69     99   
        object.key("foo").string(var_1.as_str());
         100  +
        /* JsonSerializerGenerator.kt:382 */
   70    101   
    }
         102  +
    /* JsonSerializerGenerator.kt:382 */
   71    103   
    if let Some(var_2) = &input.nested {
         104  +
        /* JsonSerializerGenerator.kt:495 */
   72    105   
        #[allow(unused_mut)]
         106  +
        /* JsonSerializerGenerator.kt:496 */
   73    107   
        let mut object_3 = object.key("nested").start_object();
         108  +
        /* JsonSerializerGenerator.kt:375 */
   74    109   
        crate::protocol_serde::shape_recursive_shapes_input_output_nested2::ser_recursive_shapes_input_output_nested2(&mut object_3, var_2)?;
         110  +
        /* JsonSerializerGenerator.kt:515 */
   75    111   
        object_3.finish();
         112  +
        /* JsonSerializerGenerator.kt:382 */
   76    113   
    }
         114  +
    /* JsonSerializerGenerator.kt:372 */
   77    115   
    Ok(())
         116  +
    /* JsonSerializerGenerator.kt:358 */
   78    117   
}

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

@@ -1,1 +77,116 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_recursive_shapes_input_output_nested2<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::RecursiveShapesInputOutputNested2>,
    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  +
            /* RustType.kt:534 */
   19     23   
            #[allow(unused_mut)]
          24  +
            /* JsonParserGenerator.kt:526 */
   20     25   
            let mut builder =
   21     26   
                crate::model::recursive_shapes_input_output_nested2::Builder::default();
          27  +
            /* JsonParserGenerator.kt:684 */
   22     28   
            loop {
          29  +
                /* JsonParserGenerator.kt:685 */
   23     30   
                match tokens.next().transpose()? {
          31  +
                    /* JsonParserGenerator.kt:686 */
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   25     33   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          34  +
                        /* JsonParserGenerator.kt:260 */
   26     35   
                        match key.to_unescaped()?.as_ref() {
          36  +
                            /* JsonParserGenerator.kt:262 */
   27     37   
                            "bar" => {
          38  +
                                /* JsonParserGenerator.kt:272 */
   28     39   
                                builder = builder.set_bar(
   29         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   30         -
                                        tokens.next(),
   31         -
                                    )?
   32         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   33         -
                                    .transpose()?,
   34         -
                                );
          40  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          41  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          42  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          43  +
                                        /* JsonParserGenerator.kt:339 */)
          44  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          45  +
                                /* JsonParserGenerator.kt:272 */);
          46  +
                                /* JsonParserGenerator.kt:262 */
   35     47   
                            }
          48  +
                            /* JsonParserGenerator.kt:262 */
   36     49   
                            "recursiveMember" => {
          50  +
                                /* JsonParserGenerator.kt:272 */
   37     51   
                                builder = builder.set_recursive_member(
   38         -
                                    crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
   39         -
                                );
          52  +
                                    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
          53  +
                                /* JsonParserGenerator.kt:272 */);
          54  +
                                /* JsonParserGenerator.kt:262 */
   40     55   
                            }
   41         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          56  +
                            /* JsonParserGenerator.kt:290 */
          57  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   42     58   
                        }
          59  +
                        /* JsonParserGenerator.kt:686 */
   43     60   
                    }
          61  +
                    /* JsonParserGenerator.kt:695 */
   44     62   
                    other => {
   45     63   
                        return Err(
   46     64   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   47     65   
                                format!("expected object key or end object, found: {other:?}"),
   48     66   
                            ),
   49     67   
                        )
          68  +
                    } /* JsonParserGenerator.kt:685 */
   50     69   
                }
          70  +
                /* JsonParserGenerator.kt:684 */
   51     71   
            }
   52         -
            }
          72  +
            /* JsonParserGenerator.kt:540 */
   53     73   
            Ok(Some(builder.build()))
          74  +
            /* JsonParserGenerator.kt:713 */
   54     75   
        }
   55         -
        _ => Err(
          76  +
        /* JsonParserGenerator.kt:722 */
          77  +
        _ => {
          78  +
            /* JsonParserGenerator.kt:723 */
          79  +
            Err(
   56     80   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   57     81   
                    "expected start object or null",
   58     82   
                ),
   59         -
        ),
          83  +
            )
          84  +
            /* JsonParserGenerator.kt:722 */
          85  +
        } /* JsonParserGenerator.kt:712 */
   60     86   
    }
          87  +
    /* JsonParserGenerator.kt:516 */
   61     88   
}
   62     89   
          90  +
/* JsonSerializerGenerator.kt:358 */
   63     91   
pub fn ser_recursive_shapes_input_output_nested2(
   64     92   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   65     93   
    input: &crate::model::RecursiveShapesInputOutputNested2,
   66     94   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          95  +
    /* JsonSerializerGenerator.kt:382 */
   67     96   
    if let Some(var_1) = &input.bar {
          97  +
        /* JsonSerializerGenerator.kt:423 */
   68     98   
        object.key("bar").string(var_1.as_str());
          99  +
        /* JsonSerializerGenerator.kt:382 */
   69    100   
    }
         101  +
    /* JsonSerializerGenerator.kt:382 */
   70    102   
    if let Some(var_2) = &input.recursive_member {
         103  +
        /* JsonSerializerGenerator.kt:495 */
   71    104   
        #[allow(unused_mut)]
         105  +
        /* JsonSerializerGenerator.kt:496 */
   72    106   
        let mut object_3 = object.key("recursiveMember").start_object();
         107  +
        /* JsonSerializerGenerator.kt:375 */
   73    108   
        crate::protocol_serde::shape_recursive_shapes_input_output_nested1::ser_recursive_shapes_input_output_nested1(&mut object_3, var_2)?;
         109  +
        /* JsonSerializerGenerator.kt:515 */
   74    110   
        object_3.finish();
         111  +
        /* JsonSerializerGenerator.kt:382 */
   75    112   
    }
         113  +
    /* JsonSerializerGenerator.kt:372 */
   76    114   
    Ok(())
         115  +
    /* JsonSerializerGenerator.kt:358 */
   77    116   
}

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

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

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

@@ -1,1 +65,95 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_renamed_greeting<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::RenamedGreeting>,
    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  +
            /* RustType.kt:534 */
   19     23   
            #[allow(unused_mut)]
          24  +
            /* JsonParserGenerator.kt:526 */
   20     25   
            let mut builder = crate::model::renamed_greeting::Builder::default();
          26  +
            /* JsonParserGenerator.kt:684 */
   21     27   
            loop {
          28  +
                /* JsonParserGenerator.kt:685 */
   22     29   
                match tokens.next().transpose()? {
          30  +
                    /* JsonParserGenerator.kt:686 */
   23     31   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   24     32   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          33  +
                        /* JsonParserGenerator.kt:260 */
   25     34   
                        match key.to_unescaped()?.as_ref() {
          35  +
                            /* JsonParserGenerator.kt:262 */
   26     36   
                            "salutation" => {
          37  +
                                /* JsonParserGenerator.kt:272 */
   27     38   
                                builder = builder.set_salutation(
   28         -
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(
   29         -
                                        tokens.next(),
   30         -
                                    )?
   31         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   32         -
                                    .transpose()?,
   33         -
                                );
          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:272 */);
          45  +
                                /* JsonParserGenerator.kt:262 */
   34     46   
                            }
   35         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          47  +
                            /* JsonParserGenerator.kt:290 */
          48  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   36     49   
                        }
          50  +
                        /* JsonParserGenerator.kt:686 */
   37     51   
                    }
          52  +
                    /* JsonParserGenerator.kt:695 */
   38     53   
                    other => {
   39     54   
                        return Err(
   40     55   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   41     56   
                                format!("expected object key or end object, found: {other:?}"),
   42     57   
                            ),
   43     58   
                        )
          59  +
                    } /* JsonParserGenerator.kt:685 */
   44     60   
                }
          61  +
                /* JsonParserGenerator.kt:684 */
   45     62   
            }
   46         -
            }
          63  +
            /* JsonParserGenerator.kt:540 */
   47     64   
            Ok(Some(builder.build()))
          65  +
            /* JsonParserGenerator.kt:713 */
   48     66   
        }
   49         -
        _ => Err(
          67  +
        /* JsonParserGenerator.kt:722 */
          68  +
        _ => {
          69  +
            /* JsonParserGenerator.kt:723 */
          70  +
            Err(
   50     71   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   51     72   
                    "expected start object or null",
   52     73   
                ),
   53         -
        ),
          74  +
            )
          75  +
            /* JsonParserGenerator.kt:722 */
          76  +
        } /* JsonParserGenerator.kt:712 */
   54     77   
    }
          78  +
    /* JsonParserGenerator.kt:516 */
   55     79   
}
   56     80   
          81  +
/* JsonSerializerGenerator.kt:358 */
   57     82   
pub fn ser_renamed_greeting(
   58     83   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   59     84   
    input: &crate::model::RenamedGreeting,
   60     85   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          86  +
    /* JsonSerializerGenerator.kt:382 */
   61     87   
    if let Some(var_1) = &input.salutation {
          88  +
        /* JsonSerializerGenerator.kt:423 */
   62     89   
        object.key("salutation").string(var_1.as_str());
          90  +
        /* JsonSerializerGenerator.kt:382 */
   63     91   
    }
          92  +
    /* JsonSerializerGenerator.kt:372 */
   64     93   
    Ok(())
          94  +
    /* JsonSerializerGenerator.kt:358 */
   65     95   
}

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

@@ -1,1 +55,78 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_response_code_http_fallback_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::ResponseCodeHttpFallbackInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::response_code_http_fallback_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   22     30   
        input.build()
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   23     32   
    })
          33  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   24     34   
}
   25     35   
          36  +
/* RustType.kt:534 */
   26     37   
#[allow(clippy::unnecessary_wraps)]
          38  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   27     39   
pub fn ser_response_code_http_fallback_http_response(
   28     40   
    #[allow(unused_variables)] output: crate::output::ResponseCodeHttpFallbackOutput,
   29     41   
) -> std::result::Result<
   30     42   
    ::aws_smithy_http_server::response::Response,
   31     43   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   32     44   
> {
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   33     46   
    Ok({
          47  +
        /* RustType.kt:534 */
   34     48   
        #[allow(unused_mut)]
   35         -
        let mut builder = ::http::Response::builder();
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          50  +
        let mut builder = ::http_1x::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   36     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     53   
            builder,
   38         -
            ::http::header::CONTENT_TYPE,
          54  +
            ::http_1x::header::CONTENT_TYPE,
   39     55   
            "application/json",
   40     56   
        );
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   41     58   
        let http_status: u16 = 201;
   42     59   
        builder = builder.status(http_status);
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   43     61   
        let payload =
   44         -
            crate::protocol_serde::shape_response_code_http_fallback_output::ser_response_code_http_fallback_output_output_output(&output)?
   45         -
        ;
          62  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_response_code_http_fallback_output::ser_response_code_http_fallback_output_output_output(&output)?
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   46     65   
        let content_length = payload.len();
   47     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     67   
            builder,
   49         -
            ::http::header::CONTENT_LENGTH,
          68  +
            ::http_1x::header::CONTENT_LENGTH,
   50     69   
            content_length,
   51     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   52     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   53     74   
        builder.body(body)?
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   54     76   
    })
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   55     78   
}

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

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_response_code_http_fallback_output_output_output(
    3      4   
    value: &crate::output::ResponseCodeHttpFallbackOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_response_code_http_fallback_output::ser_response_code_http_fallback_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_response_code_http_fallback_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::ResponseCodeHttpFallbackOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

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

@@ -1,1 +57,83 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_response_code_required_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::ResponseCodeRequiredInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::response_code_required_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:873 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:534 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   28     41   
pub fn ser_response_code_required_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::ResponseCodeRequiredOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:534 */
   35     50   
        #[allow(unused_mut)]
   36         -
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          52  +
        let mut builder = ::http_1x::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39         -
            ::http::header::CONTENT_TYPE,
          56  +
            ::http_1x::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
   42         -
        let status = output.response_code;
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:737 */
          60  +
        let status = output.response_code
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:737 */;
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:742 */
   43     63   
        let http_status: u16 = status.try_into().map_err(::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection::InvalidHttpStatusCode)?;
   44     64   
        builder = builder.status(http_status);
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     66   
        let payload =
   46         -
            crate::protocol_serde::shape_response_code_required_output::ser_response_code_required_output_output_output(&output)?
   47         -
        ;
          67  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_response_code_required_output::ser_response_code_required_output_output_output(&output)?
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   48     70   
        let content_length = payload.len();
   49     71   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     72   
            builder,
   51         -
            ::http::header::CONTENT_LENGTH,
          73  +
            ::http_1x::header::CONTENT_LENGTH,
   52     74   
            content_length,
   53     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   54     77   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   55     79   
        builder.body(body)?
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   56     81   
    })
          82  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   57     83   
}

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

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_response_code_required_output_output_output(
    3      4   
    value: &crate::output::ResponseCodeRequiredOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_response_code_required_output::ser_response_code_required_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_response_code_required_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::ResponseCodeRequiredOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

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

@@ -1,1 +52,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_simple_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<::std::string::String>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::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:446 */
   44     63   
            Ok(Some(items))
          64  +
            /* JsonParserGenerator.kt:713 */
   45     65   
        }
   46         -
        _ => Err(
          66  +
        /* JsonParserGenerator.kt:722 */
          67  +
        _ => {
          68  +
            /* JsonParserGenerator.kt:723 */
          69  +
            Err(
   47     70   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48     71   
                    "expected start array or null",
   49     72   
                ),
   50         -
        ),
          73  +
            )
          74  +
            /* JsonParserGenerator.kt:722 */
          75  +
        } /* JsonParserGenerator.kt:712 */
   51     76   
    }
          77  +
    /* JsonParserGenerator.kt:398 */
   52     78   
}

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

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

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

@@ -1,1 +211,308 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_simple_scalar_properties_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::SimpleScalarPropertiesInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::simple_scalar_properties_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input =
   29     42   
                crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties(
   30     43   
                    bytes.as_ref(),
   31     44   
                    input,
   32     45   
                )?;
          46  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   33     47   
        }
          48  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   34     49   
        if let Some(value) =
   35     50   
            crate::protocol_serde::shape_simple_scalar_properties_input::de_foo_header(&headers)?
   36     51   
        {
   37     52   
            input = input.set_foo(Some(value))
   38     53   
        }
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   39     55   
        input.build()
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   40     57   
    })
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   41     59   
}
   42     60   
          61  +
/* RustType.kt:534 */
   43     62   
#[allow(clippy::unnecessary_wraps)]
          63  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   44     64   
pub fn ser_simple_scalar_properties_http_response(
   45     65   
    #[allow(unused_variables)] output: crate::output::SimpleScalarPropertiesOutput,
   46     66   
) -> std::result::Result<
   47     67   
    ::aws_smithy_http_server::response::Response,
   48     68   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   49     69   
> {
          70  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   50     71   
    Ok({
          72  +
        /* RustType.kt:534 */
   51     73   
        #[allow(unused_mut)]
   52         -
        let mut builder = ::http::Response::builder();
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          75  +
        let mut builder = ::http_1x::Response::builder();
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   53     77   
        builder = crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_headers(&output, builder)?;
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   54     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     80   
            builder,
   56         -
            ::http::header::CONTENT_TYPE,
          81  +
            ::http_1x::header::CONTENT_TYPE,
   57     82   
            "application/json",
   58     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   59     85   
        let http_status: u16 = 200;
   60     86   
        builder = builder.status(http_status);
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   61     88   
        let payload =
   62         -
            crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
   63         -
        ;
          89  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output_output(&output)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   64     92   
        let content_length = payload.len();
   65     93   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   66     94   
            builder,
   67         -
            ::http::header::CONTENT_LENGTH,
          95  +
            ::http_1x::header::CONTENT_LENGTH,
   68     96   
            content_length,
   69     97   
        );
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   70     99   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   71    101   
        builder.body(body)?
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   72    103   
    })
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   73    105   
}
   74    106   
         107  +
/* JsonParserGenerator.kt:148 */
   75    108   
pub(crate) fn de_simple_scalar_properties(
   76    109   
    value: &[u8],
   77    110   
    mut builder: crate::input::simple_scalar_properties_input::Builder,
   78    111   
) -> ::std::result::Result<
   79    112   
    crate::input::simple_scalar_properties_input::Builder,
   80    113   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   81    114   
> {
         115  +
    /* JsonParserGenerator.kt:153 */
   82    116   
    let mut tokens_owned =
   83    117   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   84    118   
            .peekable();
   85    119   
    let tokens = &mut tokens_owned;
   86    120   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         121  +
    /* JsonParserGenerator.kt:684 */
   87    122   
    loop {
         123  +
        /* JsonParserGenerator.kt:685 */
   88    124   
        match tokens.next().transpose()? {
         125  +
            /* JsonParserGenerator.kt:686 */
   89    126   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   90    127   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         128  +
                /* JsonParserGenerator.kt:260 */
   91    129   
                match key.to_unescaped()?.as_ref() {
         130  +
                    /* JsonParserGenerator.kt:262 */
   92    131   
                    "byteValue" => {
         132  +
                        /* JsonParserGenerator.kt:272 */
   93    133   
                        builder = builder.set_byte_value(
         134  +
                            /* JsonParserGenerator.kt:365 */
   94    135   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
   95    136   
                                tokens.next(),
   96    137   
                            )?
   97    138   
                            .map(i8::try_from)
   98         -
                            .transpose()?,
         139  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   99    140   
                        );
         141  +
                        /* JsonParserGenerator.kt:262 */
  100    142   
                    }
         143  +
                    /* JsonParserGenerator.kt:262 */
  101    144   
                    "DoubleDribble" => {
         145  +
                        /* JsonParserGenerator.kt:272 */
  102    146   
                        builder = builder.set_double_value(
         147  +
                            /* JsonParserGenerator.kt:363 */
  103    148   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  104    149   
                                tokens.next(),
  105    150   
                            )?
  106         -
                            .map(|v| v.to_f64_lossy()),
         151  +
                            .map(|v| v.to_f64_lossy()), /* JsonParserGenerator.kt:272 */
  107    152   
                        );
         153  +
                        /* JsonParserGenerator.kt:262 */
  108    154   
                    }
         155  +
                    /* JsonParserGenerator.kt:262 */
  109    156   
                    "falseBooleanValue" => {
         157  +
                        /* JsonParserGenerator.kt:272 */
  110    158   
                        builder = builder.set_false_boolean_value(
         159  +
                            /* JsonParserGenerator.kt:298 */
  111    160   
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(
  112    161   
                                tokens.next(),
  113         -
                            )?,
         162  +
                            )?, /* JsonParserGenerator.kt:272 */
  114    163   
                        );
         164  +
                        /* JsonParserGenerator.kt:262 */
  115    165   
                    }
         166  +
                    /* JsonParserGenerator.kt:262 */
  116    167   
                    "floatValue" => {
         168  +
                        /* JsonParserGenerator.kt:272 */
  117    169   
                        builder = builder.set_float_value(
         170  +
                            /* JsonParserGenerator.kt:361 */
  118    171   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  119    172   
                                tokens.next(),
  120    173   
                            )?
  121         -
                            .map(|v| v.to_f32_lossy()),
         174  +
                            .map(|v| v.to_f32_lossy()), /* JsonParserGenerator.kt:272 */
  122    175   
                        );
         176  +
                        /* JsonParserGenerator.kt:262 */
  123    177   
                    }
         178  +
                    /* JsonParserGenerator.kt:262 */
  124    179   
                    "integerValue" => {
         180  +
                        /* JsonParserGenerator.kt:272 */
  125    181   
                        builder = builder.set_integer_value(
         182  +
                            /* JsonParserGenerator.kt:365 */
  126    183   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  127    184   
                                tokens.next(),
  128    185   
                            )?
  129    186   
                            .map(i32::try_from)
  130         -
                            .transpose()?,
         187  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  131    188   
                        );
         189  +
                        /* JsonParserGenerator.kt:262 */
  132    190   
                    }
         191  +
                    /* JsonParserGenerator.kt:262 */
  133    192   
                    "longValue" => {
         193  +
                        /* JsonParserGenerator.kt:272 */
  134    194   
                        builder = builder.set_long_value(
         195  +
                            /* JsonParserGenerator.kt:365 */
  135    196   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  136    197   
                                tokens.next(),
  137    198   
                            )?
  138    199   
                            .map(i64::try_from)
  139         -
                            .transpose()?,
         200  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  140    201   
                        );
         202  +
                        /* JsonParserGenerator.kt:262 */
  141    203   
                    }
         204  +
                    /* JsonParserGenerator.kt:262 */
  142    205   
                    "shortValue" => {
         206  +
                        /* JsonParserGenerator.kt:272 */
  143    207   
                        builder = builder.set_short_value(
         208  +
                            /* JsonParserGenerator.kt:365 */
  144    209   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  145    210   
                                tokens.next(),
  146    211   
                            )?
  147    212   
                            .map(i16::try_from)
  148         -
                            .transpose()?,
         213  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  149    214   
                        );
         215  +
                        /* JsonParserGenerator.kt:262 */
  150    216   
                    }
         217  +
                    /* JsonParserGenerator.kt:262 */
  151    218   
                    "stringValue" => {
         219  +
                        /* JsonParserGenerator.kt:272 */
  152    220   
                        builder = builder.set_string_value(
         221  +
                            /* JsonParserGenerator.kt:354 */
  153    222   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  154    223   
                                tokens.next(),
  155    224   
                            )?
  156         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  157         -
                            .transpose()?,
         225  +
                            .map(|s|
         226  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         227  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         228  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         229  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  158    230   
                        );
         231  +
                        /* JsonParserGenerator.kt:262 */
  159    232   
                    }
         233  +
                    /* JsonParserGenerator.kt:262 */
  160    234   
                    "trueBooleanValue" => {
         235  +
                        /* JsonParserGenerator.kt:272 */
  161    236   
                        builder = builder.set_true_boolean_value(
         237  +
                            /* JsonParserGenerator.kt:298 */
  162    238   
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(
  163    239   
                                tokens.next(),
  164         -
                            )?,
         240  +
                            )?, /* JsonParserGenerator.kt:272 */
  165    241   
                        );
         242  +
                        /* JsonParserGenerator.kt:262 */
  166    243   
                    }
  167         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         244  +
                    /* JsonParserGenerator.kt:290 */
         245  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  168    246   
                }
         247  +
                /* JsonParserGenerator.kt:686 */
  169    248   
            }
         249  +
            /* JsonParserGenerator.kt:695 */
  170    250   
            other => {
  171    251   
                return Err(
  172    252   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  173    253   
                        "expected object key or end object, found: {other:?}"
  174    254   
                    )),
  175    255   
                )
         256  +
            } /* JsonParserGenerator.kt:685 */
  176    257   
        }
         258  +
        /* JsonParserGenerator.kt:684 */
  177    259   
    }
  178         -
    }
         260  +
    /* JsonParserGenerator.kt:250 */
  179    261   
    if tokens.next().is_some() {
         262  +
        /* JsonParserGenerator.kt:251 */
  180    263   
        return Err(
  181    264   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  182    265   
                "found more JSON tokens after completing parsing",
  183    266   
            ),
  184    267   
        );
         268  +
        /* JsonParserGenerator.kt:250 */
  185    269   
    }
         270  +
    /* JsonParserGenerator.kt:163 */
  186    271   
    Ok(builder)
         272  +
    /* JsonParserGenerator.kt:148 */
  187    273   
}
  188    274   
         275  +
/* HttpBindingGenerator.kt:565 */
  189    276   
pub fn ser_simple_scalar_properties_headers(
  190    277   
    input: &crate::output::SimpleScalarPropertiesOutput,
  191         -
    mut builder: ::http::response::Builder,
  192         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  193         -
{
         278  +
    mut builder: ::http_1x::response::Builder,
         279  +
) -> std::result::Result<
         280  +
    ::http_1x::response::Builder,
         281  +
    ::aws_smithy_types::error::operation::BuildError,
         282  +
> {
         283  +
    /* HttpBindingGenerator.kt:615 */
  194    284   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         285  +
        /* HttpBindingGenerator.kt:727 */
  195    286   
        let formatted_2 = inner_1.as_str();
         287  +
        /* HttpBindingGenerator.kt:728 */
  196    288   
        if !formatted_2.is_empty() {
         289  +
            /* HttpBindingGenerator.kt:729 */
  197    290   
            let header_value = formatted_2;
  198         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         291  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  199    292   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  200    293   
                    "foo",
  201    294   
                    format!(
  202    295   
                        "`{}` cannot be used as a header value: {}",
  203    296   
                        &header_value, err
  204    297   
                    ),
  205    298   
                )
  206    299   
            })?;
  207    300   
            builder = builder.header("X-Foo", header_value);
         301  +
            /* HttpBindingGenerator.kt:728 */
  208    302   
        }
         303  +
        /* HttpBindingGenerator.kt:615 */
  209    304   
    }
         305  +
    /* HttpBindingGenerator.kt:578 */
  210    306   
    Ok(builder)
         307  +
    /* HttpBindingGenerator.kt:565 */
  211    308   
}

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
    2      3   
pub(crate) fn de_foo_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:166 */
    8     10   
    let headers = header_map.get_all("X-Foo");
          11  +
    /* HttpBindingGenerator.kt:398 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:159 */
   10     14   
}

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

@@ -1,1 +62,97 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_simple_scalar_properties_output_output_output(
    3      4   
    value: &crate::output::SimpleScalarPropertiesOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_simple_scalar_properties_output::ser_simple_scalar_properties_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_simple_scalar_properties_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::SimpleScalarPropertiesOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.byte_value {
          24  +
        /* JsonSerializerGenerator.kt:432 */
   17     25   
        object.key("byteValue").number(
   18     26   
            #[allow(clippy::useless_conversion)]
   19     27   
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   20     28   
        );
          29  +
        /* JsonSerializerGenerator.kt:382 */
   21     30   
    }
          31  +
    /* JsonSerializerGenerator.kt:382 */
   22     32   
    if let Some(var_2) = &input.double_value {
          33  +
        /* JsonSerializerGenerator.kt:432 */
   23     34   
        object.key("DoubleDribble").number(
   24     35   
            #[allow(clippy::useless_conversion)]
   25     36   
            ::aws_smithy_types::Number::Float((*var_2).into()),
   26     37   
        );
          38  +
        /* JsonSerializerGenerator.kt:382 */
   27     39   
    }
          40  +
    /* JsonSerializerGenerator.kt:382 */
   28     41   
    if let Some(var_3) = &input.false_boolean_value {
          42  +
        /* JsonSerializerGenerator.kt:424 */
   29     43   
        object.key("falseBooleanValue").boolean(*var_3);
          44  +
        /* JsonSerializerGenerator.kt:382 */
   30     45   
    }
          46  +
    /* JsonSerializerGenerator.kt:382 */
   31     47   
    if let Some(var_4) = &input.float_value {
          48  +
        /* JsonSerializerGenerator.kt:432 */
   32     49   
        object.key("floatValue").number(
   33     50   
            #[allow(clippy::useless_conversion)]
   34     51   
            ::aws_smithy_types::Number::Float((*var_4).into()),
   35     52   
        );
          53  +
        /* JsonSerializerGenerator.kt:382 */
   36     54   
    }
          55  +
    /* JsonSerializerGenerator.kt:382 */
   37     56   
    if let Some(var_5) = &input.integer_value {
          57  +
        /* JsonSerializerGenerator.kt:432 */
   38     58   
        object.key("integerValue").number(
   39     59   
            #[allow(clippy::useless_conversion)]
   40     60   
            ::aws_smithy_types::Number::NegInt((*var_5).into()),
   41     61   
        );
          62  +
        /* JsonSerializerGenerator.kt:382 */
   42     63   
    }
          64  +
    /* JsonSerializerGenerator.kt:382 */
   43     65   
    if let Some(var_6) = &input.long_value {
          66  +
        /* JsonSerializerGenerator.kt:432 */
   44     67   
        object.key("longValue").number(
   45     68   
            #[allow(clippy::useless_conversion)]
   46     69   
            ::aws_smithy_types::Number::NegInt((*var_6).into()),
   47     70   
        );
          71  +
        /* JsonSerializerGenerator.kt:382 */
   48     72   
    }
          73  +
    /* JsonSerializerGenerator.kt:382 */
   49     74   
    if let Some(var_7) = &input.short_value {
          75  +
        /* JsonSerializerGenerator.kt:432 */
   50     76   
        object.key("shortValue").number(
   51     77   
            #[allow(clippy::useless_conversion)]
   52     78   
            ::aws_smithy_types::Number::NegInt((*var_7).into()),
   53     79   
        );
          80  +
        /* JsonSerializerGenerator.kt:382 */
   54     81   
    }
          82  +
    /* JsonSerializerGenerator.kt:382 */
   55     83   
    if let Some(var_8) = &input.string_value {
          84  +
        /* JsonSerializerGenerator.kt:423 */
   56     85   
        object.key("stringValue").string(var_8.as_str());
          86  +
        /* JsonSerializerGenerator.kt:382 */
   57     87   
    }
          88  +
    /* JsonSerializerGenerator.kt:382 */
   58     89   
    if let Some(var_9) = &input.true_boolean_value {
          90  +
        /* JsonSerializerGenerator.kt:424 */
   59     91   
        object.key("trueBooleanValue").boolean(*var_9);
          92  +
        /* JsonSerializerGenerator.kt:382 */
   60     93   
    }
          94  +
    /* JsonSerializerGenerator.kt:372 */
   61     95   
    Ok(())
          96  +
    /* JsonSerializerGenerator.kt:358 */
   62     97   
}

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

@@ -1,1 +101,122 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:551 */
    2      3   
pub(crate) fn de_simple_union<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::SimpleUnion>,
    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:565 */
   16     18   
    let mut variant = None;
          19  +
    /* JsonParserGenerator.kt:567 */
   17     20   
    match tokens.next().transpose()? {
          21  +
        /* JsonParserGenerator.kt:568 */
   18     22   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   19         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          23  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          24  +
            /* JsonParserGenerator.kt:684 */
          25  +
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   20     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   21     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   22     30   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          31  +
                        /* JsonParserGenerator.kt:576 */
   23     32   
                        if let ::std::option::Option::Some(::std::result::Result::Ok(
   24     33   
                            ::aws_smithy_json::deserialize::Token::ValueNull { .. },
   25     34   
                        )) = tokens.peek()
   26     35   
                        {
   27     36   
                            let _ = tokens.next().expect("peek returned a token")?;
   28     37   
                            continue;
   29     38   
                        }
          39  +
                        /* JsonParserGenerator.kt:585 */
   30     40   
                        let key = key.to_unescaped()?;
   31     41   
                        if key == "__type" {
   32     42   
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   33     43   
                            continue;
   34     44   
                        }
   35     45   
                        if variant.is_some() {
   36     46   
                            return Err(
   37     47   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   38     48   
                                    "encountered mixed variants in union",
   39     49   
                                ),
   40     50   
                            );
   41     51   
                        }
          52  +
                        /* JsonParserGenerator.kt:598 */
   42     53   
                        variant = match key.as_ref() {
   43         -
                        "int" => Some(crate::model::SimpleUnion::Int(
   44         -
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
   45         -
                                tokens.next(),
   46         -
                            )?
          54  +
                            /* JsonParserGenerator.kt:601 */
          55  +
                            "int" => {
          56  +
                                /* JsonParserGenerator.kt:611 */
          57  +
                                Some(crate::model::SimpleUnion::Int(
          58  +
                                    /* JsonParserGenerator.kt:365 */::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   47     59   
                                                        .map(i32::try_from)
   48     60   
                                                        .transpose()?
   49         -
                            .ok_or_else(|| {
   50         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   51         -
                                    "value for 'int' cannot be null",
   52         -
                                )
   53         -
                            })?,
   54         -
                        )),
   55         -
                        "string" => Some(crate::model::SimpleUnion::String(
   56         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   57         -
                                tokens.next(),
   58         -
                            )?
   59         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   60         -
                            .transpose()?
   61         -
                            .ok_or_else(|| {
   62         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   63         -
                                    "value for 'string' cannot be null",
   64         -
                                )
   65         -
                            })?,
   66         -
                        )),
          61  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'int' cannot be null"))?
          62  +
                                /* JsonParserGenerator.kt:611 */))
          63  +
                                /* JsonParserGenerator.kt:601 */
          64  +
                            }
          65  +
                            /* JsonParserGenerator.kt:601 */
          66  +
                            "string" => {
          67  +
                                /* JsonParserGenerator.kt:611 */
          68  +
                                Some(crate::model::SimpleUnion::String(
          69  +
                                    /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          70  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          71  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          72  +
                                        /* JsonParserGenerator.kt:339 */)
          73  +
                                    /* JsonParserGenerator.kt:354 */).transpose()?
          74  +
                                    /* JsonParserGenerator.kt:670 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'string' cannot be null"))?
          75  +
                                /* JsonParserGenerator.kt:611 */))
          76  +
                                /* JsonParserGenerator.kt:601 */
          77  +
                            }
          78  +
                            /* JsonParserGenerator.kt:634 */
   67     79   
                            variant => {
   68     80   
                                return Err(
   69     81   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   70     82   
                                        format!("unexpected union variant: {variant}"),
   71     83   
                                    ),
   72     84   
                                )
   73         -
                        }
          85  +
                            } /* JsonParserGenerator.kt:598 */
   74     86   
                        };
          87  +
                        /* JsonParserGenerator.kt:686 */
   75     88   
                    }
          89  +
                    /* JsonParserGenerator.kt:695 */
   76     90   
                    other => {
   77     91   
                        return Err(
   78         -
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   79         -
                            "expected object key or end object, found: {other:?}"
   80         -
                        )),
          92  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          93  +
                                format!("expected object key or end object, found: {other:?}"),
          94  +
                            ),
   81     95   
                        )
          96  +
                    } /* JsonParserGenerator.kt:685 */
          97  +
                }
          98  +
                /* JsonParserGenerator.kt:684 */
   82     99   
            }
         100  +
            /* JsonParserGenerator.kt:568 */
   83    101   
        }
   84         -
        },
         102  +
        /* JsonParserGenerator.kt:642 */
   85    103   
        _ => {
   86    104   
            return Err(
   87    105   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   88    106   
                    "expected start object or null",
   89    107   
                ),
   90    108   
            )
         109  +
        } /* JsonParserGenerator.kt:567 */
   91    110   
    }
   92         -
    }
         111  +
    /* JsonParserGenerator.kt:649 */
   93    112   
    if variant.is_none() {
   94    113   
        return Err(
   95    114   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   96    115   
                "Union did not contain a valid variant.",
   97    116   
            ),
   98    117   
        );
   99    118   
    }
         119  +
    /* JsonParserGenerator.kt:657 */
  100    120   
    Ok(variant)
         121  +
    /* JsonParserGenerator.kt:551 */
  101    122   
}

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

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

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

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