Server Test

Server Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9 (ignoring whitespace)

Files changed:

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

@@ -1,1 +48,87 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_operation_with_nested_structure_output_output_output(
    3      4   
    value: &crate::output::OperationWithNestedStructureOutput,
    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_operation_with_nested_structure_output::ser_operation_with_nested_structure_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_operation_with_nested_structure_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::OperationWithNestedStructureOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* SerializerUtil.kt:42 */
   16     23   
    {
          24  +
        /* JsonSerializerGenerator.kt:495 */
   17     25   
        #[allow(unused_mut)]
          26  +
        /* JsonSerializerGenerator.kt:496 */
   18     27   
        let mut object_1 = object.key("dialog").start_object();
          28  +
        /* JsonSerializerGenerator.kt:375 */
   19     29   
        crate::protocol_serde::shape_dialog::ser_dialog(&mut object_1, &input.dialog)?;
          30  +
        /* JsonSerializerGenerator.kt:515 */
   20     31   
        object_1.finish();
          32  +
        /* SerializerUtil.kt:42 */
   21     33   
    }
          34  +
    /* SerializerUtil.kt:46 */
   22     35   
    {
          36  +
        /* JsonSerializerGenerator.kt:484 */
   23     37   
        let mut array_2 = object.key("dialogList").start_array();
          38  +
        /* JsonSerializerGenerator.kt:524 */
   24     39   
        for item_3 in &input.dialog_list {
          40  +
            /* SerializerUtil.kt:42 */
   25     41   
            {
          42  +
                /* JsonSerializerGenerator.kt:495 */
   26     43   
                #[allow(unused_mut)]
          44  +
                /* JsonSerializerGenerator.kt:496 */
   27     45   
                let mut object_4 = array_2.value().start_object();
          46  +
                /* JsonSerializerGenerator.kt:375 */
   28     47   
                crate::protocol_serde::shape_dialog::ser_dialog(&mut object_4, item_3)?;
          48  +
                /* JsonSerializerGenerator.kt:515 */
   29     49   
                object_4.finish();
          50  +
                /* SerializerUtil.kt:42 */
   30     51   
            }
          52  +
            /* JsonSerializerGenerator.kt:524 */
   31     53   
        }
          54  +
        /* JsonSerializerGenerator.kt:486 */
   32     55   
        array_2.finish();
          56  +
        /* SerializerUtil.kt:46 */
   33     57   
    }
          58  +
    /* SerializerUtil.kt:46 */
   34     59   
    {
          60  +
        /* JsonSerializerGenerator.kt:495 */
   35     61   
        #[allow(unused_mut)]
          62  +
        /* JsonSerializerGenerator.kt:496 */
   36     63   
        let mut object_5 = object.key("dialogMap").start_object();
          64  +
        /* JsonSerializerGenerator.kt:537 */
   37     65   
        for (key_6, value_7) in &input.dialog_map {
          66  +
            /* SerializerUtil.kt:42 */
   38     67   
            {
          68  +
                /* JsonSerializerGenerator.kt:495 */
   39     69   
                #[allow(unused_mut)]
          70  +
                /* JsonSerializerGenerator.kt:496 */
   40     71   
                let mut object_8 = object_5.key(key_6.as_str()).start_object();
          72  +
                /* JsonSerializerGenerator.kt:375 */
   41     73   
                crate::protocol_serde::shape_dialog::ser_dialog(&mut object_8, value_7)?;
          74  +
                /* JsonSerializerGenerator.kt:515 */
   42     75   
                object_8.finish();
          76  +
                /* SerializerUtil.kt:42 */
   43     77   
            }
          78  +
            /* JsonSerializerGenerator.kt:537 */
   44     79   
        }
          80  +
        /* JsonSerializerGenerator.kt:515 */
   45     81   
        object_5.finish();
          82  +
        /* SerializerUtil.kt:46 */
   46     83   
    }
          84  +
    /* JsonSerializerGenerator.kt:372 */
   47     85   
    Ok(())
          86  +
    /* JsonSerializerGenerator.kt:358 */
   48     87   
}

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

@@ -1,1 +94,130 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:175 */
    2      3   
pub(crate) fn de_payload_config_payload(
    3      4   
    input: &[u8],
    4      5   
) -> ::std::result::Result<
    5      6   
    crate::model::PayloadConfig,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* JsonParserGenerator.kt:187 */
    8     10   
    let mut tokens_owned =
    9     11   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(input))
   10     12   
            .peekable();
   11     13   
    let tokens = &mut tokens_owned;
   12         -
    let result = crate::protocol_serde::shape_payload_config::de_payload_config(tokens)?
   13         -
        .ok_or_else(|| {
   14         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   15         -
                "expected payload member value",
   16         -
            )
   17         -
        });
          14  +
    /* JsonParserGenerator.kt:194 */
          15  +
    let result =
          16  +
    /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_payload_config::de_payload_config(tokens)?
          17  +
    /* JsonParserGenerator.kt:196 */.ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          18  +
    /* JsonParserGenerator.kt:250 */
   18     19   
    if tokens.next().is_some() {
          20  +
        /* JsonParserGenerator.kt:251 */
   19     21   
        return Err(
   20     22   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   21     23   
                "found more JSON tokens after completing parsing",
   22     24   
            ),
   23     25   
        );
          26  +
        /* JsonParserGenerator.kt:250 */
   24     27   
    }
          28  +
    /* JsonParserGenerator.kt:198 */
   25     29   
    result
          30  +
    /* JsonParserGenerator.kt:175 */
   26     31   
}
   27     32   
          33  +
/* JsonParserGenerator.kt:516 */
   28     34   
pub(crate) fn de_payload_config<'a, I>(
   29     35   
    tokens: &mut ::std::iter::Peekable<I>,
   30     36   
) -> ::std::result::Result<
   31     37   
    Option<crate::model::PayloadConfig>,
   32     38   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   33     39   
>
   34     40   
where
   35     41   
    I: Iterator<
   36     42   
        Item = Result<
   37     43   
            ::aws_smithy_json::deserialize::Token<'a>,
   38     44   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   39     45   
        >,
   40     46   
    >,
   41     47   
{
          48  +
    /* JsonParserGenerator.kt:712 */
   42     49   
    match tokens.next().transpose()? {
          50  +
        /* JsonParserGenerator.kt:713 */
   43     51   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   44     52   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          53  +
            /* RustType.kt:534 */
   45     54   
            #[allow(unused_mut)]
          55  +
            /* JsonParserGenerator.kt:526 */
   46     56   
            let mut builder = crate::model::payload_config::Builder::default();
          57  +
            /* JsonParserGenerator.kt:684 */
   47     58   
            loop {
          59  +
                /* JsonParserGenerator.kt:685 */
   48     60   
                match tokens.next().transpose()? {
          61  +
                    /* JsonParserGenerator.kt:686 */
   49     62   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   50     63   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          64  +
                        /* JsonParserGenerator.kt:260 */
   51     65   
                        match key.to_unescaped()?.as_ref() {
          66  +
                            /* JsonParserGenerator.kt:262 */
   52     67   
                            "data" => {
          68  +
                                /* JsonParserGenerator.kt:272 */
   53     69   
                                builder = builder.set_data(
          70  +
                                    /* JsonParserGenerator.kt:365 */
   54     71   
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(
   55     72   
                                        tokens.next(),
   56     73   
                                    )?
   57     74   
                                    .map(i32::try_from)
   58         -
                                    .transpose()?,
          75  +
                                    .transpose()?, /* JsonParserGenerator.kt:272 */
   59     76   
                                );
          77  +
                                /* JsonParserGenerator.kt:262 */
   60     78   
                            }
   61         -
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          79  +
                            /* JsonParserGenerator.kt:290 */
          80  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   62     81   
                        }
          82  +
                        /* JsonParserGenerator.kt:686 */
   63     83   
                    }
          84  +
                    /* JsonParserGenerator.kt:695 */
   64     85   
                    other => {
   65     86   
                        return Err(
   66     87   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   67     88   
                                format!("expected object key or end object, found: {other:?}"),
   68     89   
                            ),
   69     90   
                        )
          91  +
                    } /* JsonParserGenerator.kt:685 */
   70     92   
                }
          93  +
                /* JsonParserGenerator.kt:684 */
   71     94   
            }
   72         -
            }
          95  +
            /* JsonParserGenerator.kt:540 */
   73     96   
            Ok(Some(builder.build()))
          97  +
            /* JsonParserGenerator.kt:713 */
   74     98   
        }
   75         -
        _ => Err(
          99  +
        /* JsonParserGenerator.kt:722 */
         100  +
        _ => {
         101  +
            /* JsonParserGenerator.kt:723 */
         102  +
            Err(
   76    103   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   77    104   
                    "expected start object or null",
   78    105   
                ),
   79         -
        ),
         106  +
            )
         107  +
            /* JsonParserGenerator.kt:722 */
         108  +
        } /* JsonParserGenerator.kt:712 */
   80    109   
    }
         110  +
    /* JsonParserGenerator.kt:516 */
   81    111   
}
   82    112   
         113  +
/* JsonSerializerGenerator.kt:358 */
   83    114   
pub fn ser_payload_config(
   84    115   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   85    116   
    input: &crate::model::PayloadConfig,
   86    117   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         118  +
    /* JsonSerializerGenerator.kt:382 */
   87    119   
    if let Some(var_1) = &input.data {
         120  +
        /* JsonSerializerGenerator.kt:432 */
   88    121   
        object.key("data").number(
   89    122   
            #[allow(clippy::useless_conversion)]
   90    123   
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   91    124   
        );
         125  +
        /* JsonSerializerGenerator.kt:382 */
   92    126   
    }
         127  +
    /* JsonSerializerGenerator.kt:372 */
   93    128   
    Ok(())
         129  +
    /* JsonSerializerGenerator.kt:358 */
   94    130   
}

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

@@ -1,1 +95,132 @@
    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_player_action<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<crate::model::PlayerAction>,
    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   
                        }
   42         -
                    variant = match key.as_ref() {
          52  +
                        /* JsonParserGenerator.kt:598 */
          53  +
                        variant =
          54  +
                            match key.as_ref() {
          55  +
                                /* JsonParserGenerator.kt:601 */
   43     56   
                                "quit" => {
          57  +
                                    /* JsonParserGenerator.kt:603 */
   44     58   
                                    ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   45     59   
                                    Some(crate::model::PlayerAction::Quit)
          60  +
                                    /* JsonParserGenerator.kt:601 */
   46     61   
                                }
   47         -
                        variant => {
   48         -
                            return Err(
          62  +
                                /* JsonParserGenerator.kt:634 */
          63  +
                                variant => return Err(
   49     64   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   50     65   
                                        format!("unexpected union variant: {variant}"),
   51     66   
                                    ),
   52         -
                            )
   53         -
                        }
          67  +
                                ), /* JsonParserGenerator.kt:598 */
   54     68   
                            };
          69  +
                        /* JsonParserGenerator.kt:686 */
   55     70   
                    }
          71  +
                    /* JsonParserGenerator.kt:695 */
   56     72   
                    other => {
   57     73   
                        return Err(
   58         -
                        ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   59         -
                            "expected object key or end object, found: {other:?}"
   60         -
                        )),
          74  +
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          75  +
                                format!("expected object key or end object, found: {other:?}"),
          76  +
                            ),
   61     77   
                        )
          78  +
                    } /* JsonParserGenerator.kt:685 */
   62     79   
                }
          80  +
                /* JsonParserGenerator.kt:684 */
   63     81   
            }
   64         -
        },
          82  +
            /* JsonParserGenerator.kt:568 */
          83  +
        }
          84  +
        /* JsonParserGenerator.kt:642 */
   65     85   
        _ => {
   66     86   
            return Err(
   67     87   
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   68     88   
                    "expected start object or null",
   69     89   
                ),
   70     90   
            )
          91  +
        } /* JsonParserGenerator.kt:567 */
   71     92   
    }
   72         -
    }
          93  +
    /* JsonParserGenerator.kt:649 */
   73     94   
    if variant.is_none() {
   74     95   
        return Err(
   75     96   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   76     97   
                "Union did not contain a valid variant.",
   77     98   
            ),
   78     99   
        );
   79    100   
    }
         101  +
    /* JsonParserGenerator.kt:657 */
   80    102   
    Ok(variant)
         103  +
    /* JsonParserGenerator.kt:551 */
   81    104   
}
   82    105   
         106  +
/* JsonSerializerGenerator.kt:547 */
   83    107   
pub fn ser_player_action(
   84    108   
    object_1: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   85    109   
    input: &crate::model::PlayerAction,
   86    110   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         111  +
    /* JsonSerializerGenerator.kt:556 */
   87    112   
    match input {
         113  +
        /* JsonSerializerGenerator.kt:564 */
   88    114   
        crate::model::PlayerAction::Quit => {
         115  +
            /* SerializerUtil.kt:42 */
         116  +
            {
         117  +
                /* JsonSerializerGenerator.kt:495 */
   89    118   
                #[allow(unused_mut)]
         119  +
                /* JsonSerializerGenerator.kt:496 */
   90    120   
                let mut object_1 = object_1.key("quit").start_object();
         121  +
                /* JsonSerializerGenerator.kt:515 */
   91    122   
                object_1.finish();
         123  +
                /* SerializerUtil.kt:42 */
         124  +
            }
         125  +
            /* JsonSerializerGenerator.kt:564 */
   92    126   
        }
         127  +
        /* JsonSerializerGenerator.kt:556 */
   93    128   
    }
         129  +
    /* JsonSerializerGenerator.kt:576 */
   94    130   
    Ok(())
         131  +
    /* JsonSerializerGenerator.kt:547 */
   95    132   
}

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

@@ -1,1 +110,162 @@
    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_post_player_action_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::PostPlayerActionInput,
    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::post_player_action_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_post_player_action::de_post_player_action(
   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_post_player_action_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::PostPlayerActionOutput,
   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_post_player_action_output::ser_post_player_action_output_output_output(&output)?
   56         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_post_player_action_output::ser_post_player_action_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_post_player_action(
   69    100   
    value: &[u8],
   70    101   
    mut builder: crate::input::post_player_action_input::Builder,
   71    102   
) -> ::std::result::Result<
   72    103   
    crate::input::post_player_action_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   
                    "action" => {
   86         -
                        builder = builder.set_action(
   87         -
                            crate::protocol_serde::shape_player_action::de_player_action(tokens)?,
         123  +
                        /* JsonParserGenerator.kt:272 */
         124  +
                        builder =
         125  +
                            builder.set_action(
         126  +
                                /* JsonParserGenerator.kt:660 */
         127  +
                                crate::protocol_serde::shape_player_action::de_player_action(
         128  +
                                    tokens,
         129  +
                                )?, /* JsonParserGenerator.kt:272 */
   88    130   
                            );
         131  +
                        /* JsonParserGenerator.kt:262 */
   89    132   
                    }
   90         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         133  +
                    /* JsonParserGenerator.kt:290 */
         134  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   91    135   
                }
         136  +
                /* JsonParserGenerator.kt:686 */
   92    137   
            }
         138  +
            /* JsonParserGenerator.kt:695 */
   93    139   
            other => {
   94    140   
                return Err(
   95    141   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   96    142   
                        "expected object key or end object, found: {other:?}"
   97    143   
                    )),
   98    144   
                )
         145  +
            } /* JsonParserGenerator.kt:685 */
   99    146   
        }
         147  +
        /* JsonParserGenerator.kt:684 */
  100    148   
    }
  101         -
    }
         149  +
    /* JsonParserGenerator.kt:250 */
  102    150   
    if tokens.next().is_some() {
         151  +
        /* JsonParserGenerator.kt:251 */
  103    152   
        return Err(
  104    153   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  105    154   
                "found more JSON tokens after completing parsing",
  106    155   
            ),
  107    156   
        );
         157  +
        /* JsonParserGenerator.kt:250 */
  108    158   
    }
         159  +
    /* JsonParserGenerator.kt:163 */
  109    160   
    Ok(builder)
         161  +
    /* JsonParserGenerator.kt:148 */
  110    162   
}

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

@@ -1,1 +29,43 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_post_player_action_output_output_output(
    3      4   
    value: &crate::output::PostPlayerActionOutput,
    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_post_player_action_output::ser_post_player_action_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_post_player_action_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::PostPlayerActionOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* SerializerUtil.kt:42 */
   19     26   
    {
          27  +
        /* JsonSerializerGenerator.kt:495 */
   20     28   
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
   21     30   
        let mut object_1 = object.key("action").start_object();
          31  +
        /* JsonSerializerGenerator.kt:579 */
   22     32   
        crate::protocol_serde::shape_player_action::ser_player_action(
   23     33   
            &mut object_1,
   24     34   
            &input.action,
   25     35   
        )?;
          36  +
        /* JsonSerializerGenerator.kt:515 */
   26     37   
        object_1.finish();
          38  +
        /* SerializerUtil.kt:42 */
   27     39   
    }
          40  +
    /* JsonSerializerGenerator.kt:372 */
   28     41   
    Ok(())
          42  +
    /* JsonSerializerGenerator.kt:358 */
   29     43   
}

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

@@ -1,1 +107,155 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_post_union_with_json_name_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::PostUnionWithJsonNameInput,
    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::post_union_with_json_name_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_post_union_with_json_name::de_post_union_with_json_name(bytes.as_ref(), input)?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   29     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   30     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   31     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   32     49   
}
   33     50   
          51  +
/* RustType.kt:534 */
   34     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   35     54   
pub fn ser_post_union_with_json_name_http_response(
   36     55   
    #[allow(unused_variables)] output: crate::output::PostUnionWithJsonNameOutput,
   37     56   
) -> std::result::Result<
   38     57   
    ::aws_smithy_http_server::response::Response,
   39     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   40     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   41     61   
    Ok({
          62  +
        /* RustType.kt:534 */
   42     63   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          65  +
        let mut builder = ::http_1x::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   44     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     68   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          69  +
            ::http_1x::header::CONTENT_TYPE,
   47     70   
            "application/json",
   48     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   49     73   
        let http_status: u16 = 200;
   50     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   51     76   
        let payload =
   52         -
            crate::protocol_serde::shape_post_union_with_json_name_output::ser_post_union_with_json_name_output_output_output(&output)?
   53         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_post_union_with_json_name_output::ser_post_union_with_json_name_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   54     80   
        let content_length = payload.len();
   55     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     82   
            builder,
   57         -
            ::http::header::CONTENT_LENGTH,
          83  +
            ::http_1x::header::CONTENT_LENGTH,
   58     84   
            content_length,
   59     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   60     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   61     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   62     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   63     93   
}
   64     94   
          95  +
/* JsonParserGenerator.kt:148 */
   65     96   
pub(crate) fn de_post_union_with_json_name(
   66     97   
    value: &[u8],
   67     98   
    mut builder: crate::input::post_union_with_json_name_input::Builder,
   68     99   
) -> ::std::result::Result<
   69    100   
    crate::input::post_union_with_json_name_input::Builder,
   70    101   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   71    102   
> {
         103  +
    /* JsonParserGenerator.kt:153 */
   72    104   
    let mut tokens_owned =
   73    105   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   74    106   
            .peekable();
   75    107   
    let tokens = &mut tokens_owned;
   76    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   77    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   78    112   
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
   79    114   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   80    115   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
   81    117   
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
   82    119   
                    "value" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
   83    121   
                        builder = builder.set_value(
   84         -
                            crate::protocol_serde::shape_union_with_json_name::de_union_with_json_name(tokens)?
   85         -
                        );
         122  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_union_with_json_name::de_union_with_json_name(tokens)?
         123  +
                        /* JsonParserGenerator.kt:272 */);
         124  +
                        /* JsonParserGenerator.kt:262 */
   86    125   
                    }
   87         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         126  +
                    /* JsonParserGenerator.kt:290 */
         127  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   88    128   
                }
         129  +
                /* JsonParserGenerator.kt:686 */
   89    130   
            }
         131  +
            /* JsonParserGenerator.kt:695 */
   90    132   
            other => {
   91    133   
                return Err(
   92    134   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   93    135   
                        "expected object key or end object, found: {other:?}"
   94    136   
                    )),
   95    137   
                )
         138  +
            } /* JsonParserGenerator.kt:685 */
   96    139   
        }
         140  +
        /* JsonParserGenerator.kt:684 */
   97    141   
    }
   98         -
    }
         142  +
    /* JsonParserGenerator.kt:250 */
   99    143   
    if tokens.next().is_some() {
         144  +
        /* JsonParserGenerator.kt:251 */
  100    145   
        return Err(
  101    146   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  102    147   
                "found more JSON tokens after completing parsing",
  103    148   
            ),
  104    149   
        );
         150  +
        /* JsonParserGenerator.kt:250 */
  105    151   
    }
         152  +
    /* JsonParserGenerator.kt:163 */
  106    153   
    Ok(builder)
         154  +
    /* JsonParserGenerator.kt:148 */
  107    155   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_post_union_with_json_name_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_post_union_with_json_name_output_output_output(
    3      4   
    value: &crate::output::PostUnionWithJsonNameOutput,
    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_post_union_with_json_name_output::ser_post_union_with_json_name_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_post_union_with_json_name_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::PostUnionWithJsonNameOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* SerializerUtil.kt:42 */
   16     23   
    {
          24  +
        /* JsonSerializerGenerator.kt:495 */
   17     25   
        #[allow(unused_mut)]
          26  +
        /* JsonSerializerGenerator.kt:496 */
   18     27   
        let mut object_1 = object.key("value").start_object();
          28  +
        /* JsonSerializerGenerator.kt:579 */
   19     29   
        crate::protocol_serde::shape_union_with_json_name::ser_union_with_json_name(
   20     30   
            &mut object_1,
   21     31   
            &input.value,
   22     32   
        )?;
          33  +
        /* JsonSerializerGenerator.kt:515 */
   23     34   
        object_1.finish();
          35  +
        /* SerializerUtil.kt:42 */
   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_put_with_content_encoding.rs

@@ -1,1 +116,171 @@
    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_put_with_content_encoding_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::PutWithContentEncodingInput,
    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::put_with_content_encoding_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_put_with_content_encoding::de_put_with_content_encoding(bytes.as_ref(), input)?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   29     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   30     45   
        if let Some(value) =
   31     46   
            crate::protocol_serde::shape_put_with_content_encoding_input::de_encoding_header(
   32     47   
                &headers,
   33     48   
            )?
   34     49   
        {
   35     50   
            input = input.set_encoding(Some(value))
   36     51   
        }
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   37     53   
        input.build()
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   38     55   
    })
          56  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   39     57   
}
   40     58   
          59  +
/* RustType.kt:534 */
   41     60   
#[allow(clippy::unnecessary_wraps)]
          61  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   42     62   
pub fn ser_put_with_content_encoding_http_response(
   43     63   
    #[allow(unused_variables)] output: crate::output::PutWithContentEncodingOutput,
   44     64   
) -> std::result::Result<
   45     65   
    ::aws_smithy_http_server::response::Response,
   46     66   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   47     67   
> {
          68  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   48     69   
    Ok({
          70  +
        /* RustType.kt:534 */
   49     71   
        #[allow(unused_mut)]
   50         -
        let mut builder = ::http::Response::builder();
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          73  +
        let mut builder = ::http_1x::Response::builder();
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   51     75   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   52     76   
            builder,
   53         -
            ::http::header::CONTENT_TYPE,
          77  +
            ::http_1x::header::CONTENT_TYPE,
   54     78   
            "application/json",
   55     79   
        );
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   56     81   
        let http_status: u16 = 200;
   57     82   
        builder = builder.status(http_status);
   58         -
        let payload = "";
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          84  +
        let payload =
          85  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   59     88   
        let content_length = payload.len();
   60     89   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     90   
            builder,
   62         -
            ::http::header::CONTENT_LENGTH,
          91  +
            ::http_1x::header::CONTENT_LENGTH,
   63     92   
            content_length,
   64     93   
        );
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   65     95   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   66     97   
        builder.body(body)?
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   67     99   
    })
         100  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   68    101   
}
   69    102   
         103  +
/* JsonParserGenerator.kt:148 */
   70    104   
pub(crate) fn de_put_with_content_encoding(
   71    105   
    value: &[u8],
   72    106   
    mut builder: crate::input::put_with_content_encoding_input::Builder,
   73    107   
) -> ::std::result::Result<
   74    108   
    crate::input::put_with_content_encoding_input::Builder,
   75    109   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   76    110   
> {
         111  +
    /* JsonParserGenerator.kt:153 */
   77    112   
    let mut tokens_owned =
   78    113   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   79    114   
            .peekable();
   80    115   
    let tokens = &mut tokens_owned;
   81    116   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         117  +
    /* JsonParserGenerator.kt:684 */
   82    118   
    loop {
         119  +
        /* JsonParserGenerator.kt:685 */
   83    120   
        match tokens.next().transpose()? {
         121  +
            /* JsonParserGenerator.kt:686 */
   84    122   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   85    123   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         124  +
                /* JsonParserGenerator.kt:260 */
   86    125   
                match key.to_unescaped()?.as_ref() {
         126  +
                    /* JsonParserGenerator.kt:262 */
   87    127   
                    "data" => {
         128  +
                        /* JsonParserGenerator.kt:272 */
   88    129   
                        builder = builder.set_data(
         130  +
                            /* JsonParserGenerator.kt:354 */
   89    131   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   90    132   
                                tokens.next(),
   91    133   
                            )?
   92         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   93         -
                            .transpose()?,
         134  +
                            .map(|s|
         135  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         136  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         137  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         138  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   94    139   
                        );
         140  +
                        /* JsonParserGenerator.kt:262 */
   95    141   
                    }
   96         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         142  +
                    /* JsonParserGenerator.kt:290 */
         143  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   97    144   
                }
         145  +
                /* JsonParserGenerator.kt:686 */
   98    146   
            }
         147  +
            /* JsonParserGenerator.kt:695 */
   99    148   
            other => {
  100    149   
                return Err(
  101    150   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  102    151   
                        "expected object key or end object, found: {other:?}"
  103    152   
                    )),
  104    153   
                )
         154  +
            } /* JsonParserGenerator.kt:685 */
  105    155   
        }
         156  +
        /* JsonParserGenerator.kt:684 */
  106    157   
    }
  107         -
    }
         158  +
    /* JsonParserGenerator.kt:250 */
  108    159   
    if tokens.next().is_some() {
         160  +
        /* JsonParserGenerator.kt:251 */
  109    161   
        return Err(
  110    162   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  111    163   
                "found more JSON tokens after completing parsing",
  112    164   
            ),
  113    165   
        );
         166  +
        /* JsonParserGenerator.kt:250 */
  114    167   
    }
         168  +
    /* JsonParserGenerator.kt:163 */
  115    169   
    Ok(builder)
         170  +
    /* JsonParserGenerator.kt:148 */
  116    171   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_put_with_content_encoding_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_encoding_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("Content-Encoding");
          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_query_idempotency_token_auto_fill.rs

@@ -1,1 +66,96 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_query_idempotency_token_auto_fill_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::QueryIdempotencyTokenAutoFillInput,
    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::query_idempotency_token_auto_fill_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:1221 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   24     33   
        let mut token_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   25     35   
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   26     37   
            if !token_seen && k == "token" {
   27     38   
                input = input.set_token(
   28     39   
                    crate::protocol_serde::shape_query_idempotency_token_auto_fill_input::de_token(
   29     40   
                        &v,
   30     41   
                    )?,
   31     42   
                );
   32     43   
                token_seen = true;
   33     44   
            }
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   34     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   35     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   36     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   37     52   
}
   38     53   
          54  +
/* RustType.kt:534 */
   39     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   40     57   
pub fn ser_query_idempotency_token_auto_fill_http_response(
   41     58   
    #[allow(unused_variables)] output: crate::output::QueryIdempotencyTokenAutoFillOutput,
   42     59   
) -> std::result::Result<
   43     60   
    ::aws_smithy_http_server::response::Response,
   44     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   45     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   46     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   47     66   
        #[allow(unused_mut)]
   48         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   49     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     71   
            builder,
   51         -
            ::http::header::CONTENT_TYPE,
          72  +
            ::http_1x::header::CONTENT_TYPE,
   52     73   
            "application/json",
   53     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   54     76   
        let http_status: u16 = 200;
   55     77   
        builder = builder.status(http_status);
   56         -
        let payload = "";
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          79  +
        let payload =
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          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   
}

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

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

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

@@ -1,1 +71,109 @@
    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_query_params_as_string_list_map_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::QueryParamsAsStringListMapInput,
    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::query_params_as_string_list_map_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:1221 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   24         -
        let mut query_params: ::std::collections::HashMap<
   25         -
            ::std::string::String,
   26         -
            ::std::vec::Vec<::std::string::String>,
   27         -
        > = ::std::collections::HashMap::new();
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1236 */
          33  +
        let mut query_params: ::std::collections::HashMap::<::std::string::String, ::std::vec::Vec::<::std::string::String>> =
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:1238 */::std::collections::HashMap::new()
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1236 */;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   28     37   
        let mut qux_seen = false;
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   29     39   
        for (k, v) in pairs {
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   30     41   
            if !qux_seen && k == "corge" {
   31     42   
                input = input.set_qux(
   32     43   
                    crate::protocol_serde::shape_query_params_as_string_list_map_input::de_qux(&v)?,
   33     44   
                );
   34     45   
                qux_seen = true;
   35     46   
            }
          47  +
            /* ServerHttpBoundProtocolGenerator.kt:1358 */
   36     48   
            let entry = query_params.entry(String::from(k)).or_default();
   37     49   
            entry.push(String::from(v));
          50  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   38     51   
        }
   39         -
        input = input.set_foo(Some(query_params));
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:1374 */
          53  +
        input = input.set_foo(
          54  +
            /* ServerHttpBoundProtocolGenerator.kt:1375 */
          55  +
            Some(
          56  +
                /* ServerHttpBoundProtocolGenerator.kt:1376 */
          57  +
                query_params, /* ServerHttpBoundProtocolGenerator.kt:1375 */
          58  +
            ), /* ServerHttpBoundProtocolGenerator.kt:1374 */
          59  +
        );
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   40     61   
        input.build()
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   41     63   
    })
          64  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   42     65   
}
   43     66   
          67  +
/* RustType.kt:534 */
   44     68   
#[allow(clippy::unnecessary_wraps)]
          69  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   45     70   
pub fn ser_query_params_as_string_list_map_http_response(
   46     71   
    #[allow(unused_variables)] output: crate::output::QueryParamsAsStringListMapOutput,
   47     72   
) -> std::result::Result<
   48     73   
    ::aws_smithy_http_server::response::Response,
   49     74   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   50     75   
> {
          76  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   51     77   
    Ok({
          78  +
        /* RustType.kt:534 */
   52     79   
        #[allow(unused_mut)]
   53         -
        let mut builder = ::http::Response::builder();
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          81  +
        let mut builder = ::http_1x::Response::builder();
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   54     83   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     84   
            builder,
   56         -
            ::http::header::CONTENT_TYPE,
          85  +
            ::http_1x::header::CONTENT_TYPE,
   57     86   
            "application/json",
   58     87   
        );
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   59     89   
        let http_status: u16 = 200;
   60     90   
        builder = builder.status(http_status);
   61         -
        let payload = "";
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          92  +
        let payload =
          93  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   62     96   
        let content_length = payload.len();
   63     97   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   64     98   
            builder,
   65         -
            ::http::header::CONTENT_LENGTH,
          99  +
            ::http_1x::header::CONTENT_LENGTH,
   66    100   
            content_length,
   67    101   
        );
         102  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   68    103   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   69    105   
        builder.body(body)?
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   70    107   
    })
         108  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   71    109   
}

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

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

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

@@ -1,1 +72,110 @@
    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_query_precedence_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::QueryPrecedenceInput,
    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::query_precedence_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:1221 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   24         -
        let mut query_params: ::std::collections::HashMap<
   25         -
            ::std::string::String,
   26         -
            ::std::string::String,
   27         -
        > = ::std::collections::HashMap::new();
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1236 */
          33  +
        let mut query_params: ::std::collections::HashMap::<::std::string::String, ::std::string::String> =
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:1238 */::std::collections::HashMap::new()
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:1236 */;
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   28     37   
        let mut foo_seen = false;
          38  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   29     39   
        for (k, v) in pairs {
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   30     41   
            if !foo_seen && k == "bar" {
   31     42   
                input = input.set_foo(crate::protocol_serde::shape_query_precedence_input::de_foo(
   32     43   
                    &v,
   33     44   
                )?);
   34     45   
                foo_seen = true;
   35     46   
            }
          47  +
            /* ServerHttpBoundProtocolGenerator.kt:1339 */
   36     48   
            query_params
   37     49   
                .entry(String::from(k))
   38     50   
                .or_insert_with(|| String::from(v));
          51  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   39     52   
        }
   40         -
        input = input.set_baz(Some(query_params));
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:1374 */
          54  +
        input = input.set_baz(
          55  +
            /* ServerHttpBoundProtocolGenerator.kt:1375 */
          56  +
            Some(
          57  +
                /* ServerHttpBoundProtocolGenerator.kt:1376 */
          58  +
                query_params, /* ServerHttpBoundProtocolGenerator.kt:1375 */
          59  +
            ), /* ServerHttpBoundProtocolGenerator.kt:1374 */
          60  +
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   41     62   
        input.build()
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   42     64   
    })
          65  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   43     66   
}
   44     67   
          68  +
/* RustType.kt:534 */
   45     69   
#[allow(clippy::unnecessary_wraps)]
          70  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   46     71   
pub fn ser_query_precedence_http_response(
   47     72   
    #[allow(unused_variables)] output: crate::output::QueryPrecedenceOutput,
   48     73   
) -> std::result::Result<
   49     74   
    ::aws_smithy_http_server::response::Response,
   50     75   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   51     76   
> {
          77  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   52     78   
    Ok({
          79  +
        /* RustType.kt:534 */
   53     80   
        #[allow(unused_mut)]
   54         -
        let mut builder = ::http::Response::builder();
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          82  +
        let mut builder = ::http_1x::Response::builder();
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   55     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     85   
            builder,
   57         -
            ::http::header::CONTENT_TYPE,
          86  +
            ::http_1x::header::CONTENT_TYPE,
   58     87   
            "application/json",
   59     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   60     90   
        let http_status: u16 = 200;
   61     91   
        builder = builder.status(http_status);
   62         -
        let payload = "";
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          93  +
        let payload =
          94  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   63     97   
        let content_length = payload.len();
   64     98   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   65     99   
            builder,
   66         -
            ::http::header::CONTENT_LENGTH,
         100  +
            ::http_1x::header::CONTENT_LENGTH,
   67    101   
            content_length,
   68    102   
        );
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   69    104   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         105  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   70    106   
        builder.body(body)?
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   71    108   
    })
         109  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   72    110   
}

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

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

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

@@ -1,1 +110,158 @@
    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_recursive_shapes_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::RecursiveShapesInput,
    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::recursive_shapes_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_recursive_shapes::de_recursive_shapes(
   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_recursive_shapes_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::RecursiveShapesOutput,
   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_recursive_shapes_output::ser_recursive_shapes_output_output_output(&output)?
   56         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_recursive_shapes_output::ser_recursive_shapes_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_recursive_shapes(
   69    100   
    value: &[u8],
   70    101   
    mut builder: crate::input::recursive_shapes_input::Builder,
   71    102   
) -> ::std::result::Result<
   72    103   
    crate::input::recursive_shapes_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   
                    "nested" => {
         123  +
                        /* JsonParserGenerator.kt:272 */
   86    124   
                        builder = builder.set_nested(
   87         -
                            crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
   88         -
                        );
         125  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_recursive_shapes_input_output_nested1::de_recursive_shapes_input_output_nested1(tokens)?
         126  +
                        /* JsonParserGenerator.kt:272 */);
         127  +
                        /* JsonParserGenerator.kt:262 */
   89    128   
                    }
   90         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         129  +
                    /* JsonParserGenerator.kt:290 */
         130  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   91    131   
                }
         132  +
                /* JsonParserGenerator.kt:686 */
   92    133   
            }
         134  +
            /* JsonParserGenerator.kt:695 */
   93    135   
            other => {
   94    136   
                return Err(
   95    137   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   96    138   
                        "expected object key or end object, found: {other:?}"
   97    139   
                    )),
   98    140   
                )
         141  +
            } /* JsonParserGenerator.kt:685 */
   99    142   
        }
         143  +
        /* JsonParserGenerator.kt:684 */
  100    144   
    }
  101         -
    }
         145  +
    /* JsonParserGenerator.kt:250 */
  102    146   
    if tokens.next().is_some() {
         147  +
        /* JsonParserGenerator.kt:251 */
  103    148   
        return Err(
  104    149   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  105    150   
                "found more JSON tokens after completing parsing",
  106    151   
            ),
  107    152   
        );
         153  +
        /* JsonParserGenerator.kt:250 */
  108    154   
    }
         155  +
    /* JsonParserGenerator.kt:163 */
  109    156   
    Ok(builder)
         157  +
    /* JsonParserGenerator.kt:148 */
  110    158   
}