Server Test

Server Test

rev. 03e6e47f15dfd569240d570d98975ebba692c405 (ignoring whitespace)

Files changed:

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

@@ -1,1 +55,84 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_json_timestamps_output_output_output(
    3      4   
    value: &crate::output::JsonTimestampsOutput,
    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_json_timestamps_output::ser_json_timestamps_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_json_timestamps_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonTimestampsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.date_time {
          27  +
        /* JsonSerializerGenerator.kt:448 */
   20     28   
        object
   21     29   
            .key("dateTime")
   22     30   
            .date_time(var_1, ::aws_smithy_types::date_time::Format::DateTime)?;
          31  +
        /* JsonSerializerGenerator.kt:382 */
   23     32   
    }
          33  +
    /* JsonSerializerGenerator.kt:382 */
   24     34   
    if let Some(var_2) = &input.date_time_on_target {
          35  +
        /* JsonSerializerGenerator.kt:448 */
   25     36   
        object
   26     37   
            .key("dateTimeOnTarget")
   27     38   
            .date_time(var_2, ::aws_smithy_types::date_time::Format::DateTime)?;
          39  +
        /* JsonSerializerGenerator.kt:382 */
   28     40   
    }
          41  +
    /* JsonSerializerGenerator.kt:382 */
   29     42   
    if let Some(var_3) = &input.epoch_seconds {
          43  +
        /* JsonSerializerGenerator.kt:448 */
   30     44   
        object
   31     45   
            .key("epochSeconds")
   32     46   
            .date_time(var_3, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
          47  +
        /* JsonSerializerGenerator.kt:382 */
   33     48   
    }
          49  +
    /* JsonSerializerGenerator.kt:382 */
   34     50   
    if let Some(var_4) = &input.epoch_seconds_on_target {
          51  +
        /* JsonSerializerGenerator.kt:448 */
   35     52   
        object
   36     53   
            .key("epochSecondsOnTarget")
   37     54   
            .date_time(var_4, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
          55  +
        /* JsonSerializerGenerator.kt:382 */
   38     56   
    }
          57  +
    /* JsonSerializerGenerator.kt:382 */
   39     58   
    if let Some(var_5) = &input.http_date {
          59  +
        /* JsonSerializerGenerator.kt:448 */
   40     60   
        object
   41     61   
            .key("httpDate")
   42     62   
            .date_time(var_5, ::aws_smithy_types::date_time::Format::HttpDate)?;
          63  +
        /* JsonSerializerGenerator.kt:382 */
   43     64   
    }
          65  +
    /* JsonSerializerGenerator.kt:382 */
   44     66   
    if let Some(var_6) = &input.http_date_on_target {
          67  +
        /* JsonSerializerGenerator.kt:448 */
   45     68   
        object
   46     69   
            .key("httpDateOnTarget")
   47     70   
            .date_time(var_6, ::aws_smithy_types::date_time::Format::HttpDate)?;
          71  +
        /* JsonSerializerGenerator.kt:382 */
   48     72   
    }
          73  +
    /* JsonSerializerGenerator.kt:382 */
   49     74   
    if let Some(var_7) = &input.normal {
          75  +
        /* JsonSerializerGenerator.kt:448 */
   50     76   
        object
   51     77   
            .key("normal")
   52     78   
            .date_time(var_7, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
          79  +
        /* JsonSerializerGenerator.kt:382 */
   53     80   
    }
          81  +
    /* JsonSerializerGenerator.kt:372 */
   54     82   
    Ok(())
          83  +
    /* JsonSerializerGenerator.kt:358 */
   55     84   
}

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

@@ -1,1 +146,208 @@
    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_json_unions_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::JsonUnionsInput,
    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::json_unions_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input =
   29     42   
                crate::protocol_serde::shape_json_unions::de_json_unions(bytes.as_ref(), input)?;
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   30     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   31     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   32     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   33     50   
}
   34     51   
          52  +
/* RustType.kt:534 */
   35     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   36     55   
pub fn ser_json_unions_http_response(
   37     56   
    #[allow(unused_variables)] output: crate::output::JsonUnionsOutput,
   38     57   
) -> std::result::Result<
   39     58   
    ::aws_smithy_http_server::response::Response,
   40     59   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   41     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   42     62   
    Ok({
          63  +
        /* RustType.kt:534 */
   43     64   
        #[allow(unused_mut)]
   44         -
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          66  +
        let mut builder = ::http_1x::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   45     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     69   
            builder,
   47         -
            ::http::header::CONTENT_TYPE,
          70  +
            ::http_1x::header::CONTENT_TYPE,
   48     71   
            "application/json",
   49     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   50     74   
        let http_status: u16 = 200;
   51     75   
        builder = builder.status(http_status);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   52     77   
        let payload =
   53         -
            crate::protocol_serde::shape_json_unions_output::ser_json_unions_output_output_output(
   54         -
                &output,
   55         -
            )?;
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_json_unions_output::ser_json_unions_output_output_output(&output)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   56     81   
        let content_length = payload.len();
   57     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     83   
            builder,
   59         -
            ::http::header::CONTENT_LENGTH,
          84  +
            ::http_1x::header::CONTENT_LENGTH,
   60     85   
            content_length,
   61     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   62     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   63     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   64     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   65     94   
}
   66     95   
          96  +
/* RustType.kt:534 */
   67     97   
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   68     99   
pub fn ser_json_unions_http_error(
   69    100   
    error: &crate::error::JsonUnionsError,
   70    101   
) -> std::result::Result<
   71    102   
    ::aws_smithy_http_server::response::Response,
   72    103   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73    104   
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   74    106   
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   75    108   
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   76    110   
            crate::error::JsonUnionsError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   77    112   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:534 */
   78    114   
                #[allow(unused_mut)]
   79         -
                let mut builder = ::http::Response::builder();
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         116  +
                let mut builder = ::http_1x::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   80    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   81    119   
                    builder,
   82         -
                    ::http::header::CONTENT_TYPE,
         120  +
                    ::http_1x::header::CONTENT_TYPE,
   83    121   
                    "application/json",
   84    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   85    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   86    125   
                    builder,
   87         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         126  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   88    127   
                    "ValidationException",
   89    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   90    130   
                let content_length = payload.len();
   91    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    132   
                    builder,
   93         -
                    ::http::header::CONTENT_LENGTH,
         133  +
                    ::http_1x::header::CONTENT_LENGTH,
   94    134   
                    content_length,
   95    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   96    137   
                builder
   97    138   
                    .status(400)
   98    139   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
   99    142   
        }
  100         -
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  101    144   
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  102    146   
}
  103    147   
         148  +
/* JsonParserGenerator.kt:148 */
  104    149   
pub(crate) fn de_json_unions(
  105    150   
    value: &[u8],
  106    151   
    mut builder: crate::input::json_unions_input::Builder,
  107    152   
) -> ::std::result::Result<
  108    153   
    crate::input::json_unions_input::Builder,
  109    154   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  110    155   
> {
         156  +
    /* JsonParserGenerator.kt:153 */
  111    157   
    let mut tokens_owned =
  112    158   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  113    159   
            .peekable();
  114    160   
    let tokens = &mut tokens_owned;
  115    161   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         162  +
    /* JsonParserGenerator.kt:684 */
  116    163   
    loop {
         164  +
        /* JsonParserGenerator.kt:685 */
  117    165   
        match tokens.next().transpose()? {
         166  +
            /* JsonParserGenerator.kt:686 */
  118    167   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  119    168   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         169  +
                /* JsonParserGenerator.kt:260 */
  120    170   
                match key.to_unescaped()?.as_ref() {
         171  +
                    /* JsonParserGenerator.kt:262 */
  121    172   
                    "contents" => {
         173  +
                        /* JsonParserGenerator.kt:272 */
  122    174   
                        builder = builder.set_contents(
  123         -
                            crate::protocol_serde::shape_my_union::de_my_union(tokens)?,
  124         -
                        );
         175  +
                            /* JsonParserGenerator.kt:660 */crate::protocol_serde::shape_my_union::de_my_union(tokens)?
         176  +
                        /* JsonParserGenerator.kt:272 */);
         177  +
                        /* JsonParserGenerator.kt:262 */
  125    178   
                    }
  126         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         179  +
                    /* JsonParserGenerator.kt:290 */
         180  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  127    181   
                }
         182  +
                /* JsonParserGenerator.kt:686 */
  128    183   
            }
         184  +
            /* JsonParserGenerator.kt:695 */
  129    185   
            other => {
  130    186   
                return Err(
  131    187   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  132    188   
                        "expected object key or end object, found: {other:?}"
  133    189   
                    )),
  134    190   
                )
         191  +
            } /* JsonParserGenerator.kt:685 */
  135    192   
        }
         193  +
        /* JsonParserGenerator.kt:684 */
  136    194   
    }
  137         -
    }
         195  +
    /* JsonParserGenerator.kt:250 */
  138    196   
    if tokens.next().is_some() {
         197  +
        /* JsonParserGenerator.kt:251 */
  139    198   
        return Err(
  140    199   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  141    200   
                "found more JSON tokens after completing parsing",
  142    201   
            ),
  143    202   
        );
         203  +
        /* JsonParserGenerator.kt:250 */
  144    204   
    }
         205  +
    /* JsonParserGenerator.kt:163 */
  145    206   
    Ok(builder)
         207  +
    /* JsonParserGenerator.kt:148 */
  146    208   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_json_unions_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_json_unions_output_output_output(
    3      4   
    value: &crate::output::JsonUnionsOutput,
    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_json_unions_output::ser_json_unions_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_json_unions_output_output(
   16     22   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   17     23   
    input: &crate::output::JsonUnionsOutput,
   18     24   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          25  +
    /* JsonSerializerGenerator.kt:382 */
   19     26   
    if let Some(var_1) = &input.contents {
          27  +
        /* JsonSerializerGenerator.kt:495 */
   20     28   
        #[allow(unused_mut)]
          29  +
        /* JsonSerializerGenerator.kt:496 */
   21     30   
        let mut object_2 = object.key("contents").start_object();
          31  +
        /* JsonSerializerGenerator.kt:579 */
   22     32   
        crate::protocol_serde::shape_my_union::ser_my_union(&mut object_2, var_1)?;
          33  +
        /* JsonSerializerGenerator.kt:515 */
   23     34   
        object_2.finish();
          35  +
        /* JsonSerializerGenerator.kt:382 */
   24     36   
    }
          37  +
    /* JsonSerializerGenerator.kt:372 */
   25     38   
    Ok(())
          39  +
    /* JsonSerializerGenerator.kt:358 */
   26     40   
}

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

@@ -1,1 +56,80 @@
    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_malformed_accept_with_body_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::MalformedAcceptWithBodyInput,
    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::malformed_accept_with_body_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:873 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:534 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   28     41   
pub fn ser_malformed_accept_with_body_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::MalformedAcceptWithBodyOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:534 */
   35     50   
        #[allow(unused_mut)]
   36         -
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          52  +
        let mut builder = ::http_1x::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39         -
            ::http::header::CONTENT_TYPE,
          56  +
            ::http_1x::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     63   
        let payload =
   45         -
            crate::protocol_serde::shape_malformed_accept_with_body_output::ser_malformed_accept_with_body_output_output_output(&output)?
   46         -
        ;
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_malformed_accept_with_body_output::ser_malformed_accept_with_body_output_output_output(&output)?
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   47     67   
        let content_length = payload.len();
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50         -
            ::http::header::CONTENT_LENGTH,
          70  +
            ::http_1x::header::CONTENT_LENGTH,
   51     71   
            content_length,
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   53     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   54     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   55     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   56     80   
}

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

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_malformed_accept_with_body_output_output_output(
    3      4   
    value: &crate::output::MalformedAcceptWithBodyOutput,
    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_malformed_accept_with_body_output::ser_malformed_accept_with_body_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_malformed_accept_with_body_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::MalformedAcceptWithBodyOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.hi {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("hi").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}

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

@@ -1,1 +57,81 @@
    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_malformed_accept_with_generic_string_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::MalformedAcceptWithGenericStringInput,
    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 =
   18     23   
            crate::input::malformed_accept_with_generic_string_input::Builder::default();
          24  +
        /* RustType.kt:534 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:873 */
   23     31   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   24     33   
        input.build()
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   25     35   
    })
          36  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   26     37   
}
   27     38   
          39  +
/* RustType.kt:534 */
   28     40   
#[allow(clippy::unnecessary_wraps)]
          41  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   29     42   
pub fn ser_malformed_accept_with_generic_string_http_response(
   30     43   
    #[allow(unused_variables)] output: crate::output::MalformedAcceptWithGenericStringOutput,
   31     44   
) -> std::result::Result<
   32     45   
    ::aws_smithy_http_server::response::Response,
   33     46   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   34     47   
> {
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   35     49   
    Ok({
          50  +
        /* RustType.kt:534 */
   36     51   
        #[allow(unused_mut)]
   37         -
        let mut builder = ::http::Response::builder();
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          53  +
        let mut builder = ::http_1x::Response::builder();
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   38     55   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   39     56   
            builder,
   40         -
            ::http::header::CONTENT_TYPE,
          57  +
            ::http_1x::header::CONTENT_TYPE,
   41     58   
            "text/plain",
   42     59   
        );
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   43     61   
        let http_status: u16 = 200;
   44     62   
        builder = builder.status(http_status);
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     64   
        let payload =
   46         -
            crate::protocol_serde::shape_malformed_accept_with_generic_string_output::ser_payload_http_payload( output.payload)?
   47         -
        ;
          65  +
            /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_malformed_accept_with_generic_string_output::ser_payload_http_payload( output.payload)?
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   48     68   
        let content_length = payload.len();
   49     69   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     70   
            builder,
   51         -
            ::http::header::CONTENT_LENGTH,
          71  +
            ::http_1x::header::CONTENT_LENGTH,
   52     72   
            content_length,
   53     73   
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   54     75   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   55     77   
        builder.body(body)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   56     79   
    })
          80  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   57     81   
}

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

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<::std::string::String>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:318 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:330 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:318 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_bytes())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:364 */
          19  +
        payload.into_bytes(), /* HttpBoundProtocolPayloadGenerator.kt:343 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
   10     22   
}

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

@@ -1,1 +56,80 @@
    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_malformed_accept_with_payload_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::MalformedAcceptWithPayloadInput,
    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::malformed_accept_with_payload_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:873 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:534 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   28     41   
pub fn ser_malformed_accept_with_payload_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::MalformedAcceptWithPayloadOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:534 */
   35     50   
        #[allow(unused_mut)]
   36         -
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          52  +
        let mut builder = ::http_1x::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39         -
            ::http::header::CONTENT_TYPE,
          56  +
            ::http_1x::header::CONTENT_TYPE,
   40     57   
            "image/jpeg",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   44     63   
        let payload =
   45         -
            crate::protocol_serde::shape_malformed_accept_with_payload_output::ser_payload_http_payload( output.payload)?
   46         -
        ;
          64  +
            /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_malformed_accept_with_payload_output::ser_payload_http_payload( output.payload)?
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   47     67   
        let content_length = payload.len();
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50         -
            ::http::header::CONTENT_LENGTH,
          70  +
            ::http_1x::header::CONTENT_LENGTH,
   51     71   
            content_length,
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   53     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   54     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   55     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   56     80   
}

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

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<::aws_smithy_types::Blob>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:318 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:330 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:318 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_inner())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:375 */
          19  +
        payload.into_inner(), /* HttpBoundProtocolPayloadGenerator.kt:343 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
   10     22   
}

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

@@ -1,1 +110,161 @@
    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_malformed_blob_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::MalformedBlobInput,
    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::malformed_blob_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_malformed_blob::de_malformed_blob(
   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_malformed_blob_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::MalformedBlobOutput,
   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);
   54         -
        let payload = "";
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          79  +
        let payload =
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     83   
        let content_length = payload.len();
   56     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     85   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   59     87   
            content_length,
   60     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     96   
}
   65     97   
          98  +
/* JsonParserGenerator.kt:148 */
   66     99   
pub(crate) fn de_malformed_blob(
   67    100   
    value: &[u8],
   68    101   
    mut builder: crate::input::malformed_blob_input::Builder,
   69    102   
) -> ::std::result::Result<
   70    103   
    crate::input::malformed_blob_input::Builder,
   71    104   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   72    105   
> {
         106  +
    /* JsonParserGenerator.kt:153 */
   73    107   
    let mut tokens_owned =
   74    108   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   75    109   
            .peekable();
   76    110   
    let tokens = &mut tokens_owned;
   77    111   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         112  +
    /* JsonParserGenerator.kt:684 */
   78    113   
    loop {
         114  +
        /* JsonParserGenerator.kt:685 */
   79    115   
        match tokens.next().transpose()? {
         116  +
            /* JsonParserGenerator.kt:686 */
   80    117   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   81    118   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         119  +
                /* JsonParserGenerator.kt:260 */
   82    120   
                match key.to_unescaped()?.as_ref() {
         121  +
                    /* JsonParserGenerator.kt:262 */
   83    122   
                    "blob" => {
         123  +
                        /* JsonParserGenerator.kt:272 */
   84    124   
                        builder = builder.set_blob(
         125  +
                            /* JsonParserGenerator.kt:326 */
   85    126   
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(
   86    127   
                                tokens.next(),
   87         -
                            )?,
         128  +
                            )?, /* JsonParserGenerator.kt:272 */
   88    129   
                        );
         130  +
                        /* JsonParserGenerator.kt:262 */
   89    131   
                    }
   90         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         132  +
                    /* JsonParserGenerator.kt:290 */
         133  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   91    134   
                }
         135  +
                /* JsonParserGenerator.kt:686 */
   92    136   
            }
         137  +
            /* JsonParserGenerator.kt:695 */
   93    138   
            other => {
   94    139   
                return Err(
   95    140   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   96    141   
                        "expected object key or end object, found: {other:?}"
   97    142   
                    )),
   98    143   
                )
         144  +
            } /* JsonParserGenerator.kt:685 */
   99    145   
        }
         146  +
        /* JsonParserGenerator.kt:684 */
  100    147   
    }
  101         -
    }
         148  +
    /* JsonParserGenerator.kt:250 */
  102    149   
    if tokens.next().is_some() {
         150  +
        /* JsonParserGenerator.kt:251 */
  103    151   
        return Err(
  104    152   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  105    153   
                "found more JSON tokens after completing parsing",
  106    154   
            ),
  107    155   
        );
         156  +
        /* JsonParserGenerator.kt:250 */
  108    157   
    }
         158  +
    /* JsonParserGenerator.kt:163 */
  109    159   
    Ok(builder)
         160  +
    /* JsonParserGenerator.kt:148 */
  110    161   
}

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

@@ -1,1 +186,261 @@
    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_malformed_boolean_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::MalformedBooleanInput,
    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::malformed_boolean_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_malformed_boolean::de_malformed_boolean(
   29     42   
                bytes.as_ref(),
   30     43   
                input,
   31     44   
            )?;
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   32     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   33     48   
        if let Some(value) =
   34     49   
            crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_header_header(
   35     50   
                &headers,
   36     51   
            )?
   37     52   
        {
   38     53   
            input = input.set_boolean_in_header(Some(value))
   39     54   
        }
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
   40     56   
        let input_string = uri.path();
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
   41     58   
        let (input_string, (_, m1)) =
   42     59   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   43     60   
                ::nom::sequence::preceded(
   44     61   
                    ::nom::bytes::complete::tag("/"),
   45     62   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   46     63   
                        "MalformedBoolean",
   47     64   
                    ),
   48     65   
                ),
   49     66   
                ::nom::sequence::preceded(
   50     67   
                    ::nom::bytes::complete::tag("/"),
   51     68   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   52     69   
                        ::nom::bytes::complete::take_until("/"),
   53     70   
                        ::nom::combinator::rest,
   54     71   
                    )),
   55     72   
                ),
   56     73   
            ))(input_string)?;
   57     74   
        debug_assert_eq!("", input_string);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
   58     76   
        input = input.set_boolean_in_path(
   59     77   
            crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_path(m1)?,
   60     78   
        );
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:1221 */
   61     80   
        let query_string = uri.query().unwrap_or("");
   62     81   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   63     83   
        let mut boolean_in_query_seen = false;
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   64     85   
        for (k, v) in pairs {
          86  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   65     87   
            if !boolean_in_query_seen && k == "booleanInQuery" {
   66     88   
                input = input.set_boolean_in_query(
   67     89   
                    crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_query(&v)?,
   68     90   
                );
   69     91   
                boolean_in_query_seen = true;
   70     92   
            }
          93  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   71     94   
        }
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   72     96   
        input.build()?
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   73     98   
    })
          99  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   74    100   
}
   75    101   
         102  +
/* RustType.kt:534 */
   76    103   
#[allow(clippy::unnecessary_wraps)]
         104  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   77    105   
pub fn ser_malformed_boolean_http_response(
   78    106   
    #[allow(unused_variables)] output: crate::output::MalformedBooleanOutput,
   79    107   
) -> std::result::Result<
   80    108   
    ::aws_smithy_http_server::response::Response,
   81    109   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   82    110   
> {
         111  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   83    112   
    Ok({
         113  +
        /* RustType.kt:534 */
   84    114   
        #[allow(unused_mut)]
   85         -
        let mut builder = ::http::Response::builder();
         115  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
         116  +
        let mut builder = ::http_1x::Response::builder();
         117  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   86    118   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    119   
            builder,
   88         -
            ::http::header::CONTENT_TYPE,
         120  +
            ::http_1x::header::CONTENT_TYPE,
   89    121   
            "application/json",
   90    122   
        );
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   91    124   
        let http_status: u16 = 200;
   92    125   
        builder = builder.status(http_status);
   93         -
        let payload = "";
         126  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
         127  +
        let payload =
         128  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
         129  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
         130  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   94    131   
        let content_length = payload.len();
   95    132   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   96    133   
            builder,
   97         -
            ::http::header::CONTENT_LENGTH,
         134  +
            ::http_1x::header::CONTENT_LENGTH,
   98    135   
            content_length,
   99    136   
        );
         137  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
  100    138   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         139  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
  101    140   
        builder.body(body)?
         141  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
  102    142   
    })
         143  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
  103    144   
}
  104    145   
         146  +
/* RustType.kt:534 */
  105    147   
#[allow(clippy::unnecessary_wraps)]
         148  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
  106    149   
pub fn ser_malformed_boolean_http_error(
  107    150   
    error: &crate::error::MalformedBooleanError,
  108    151   
) -> std::result::Result<
  109    152   
    ::aws_smithy_http_server::response::Response,
  110    153   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  111    154   
> {
         155  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
  112    156   
    Ok({
         157  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
  113    158   
        match error {
         159  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
  114    160   
            crate::error::MalformedBooleanError::ValidationException(output) => {
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
  115    162   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         163  +
                /* RustType.kt:534 */
  116    164   
                #[allow(unused_mut)]
  117         -
                let mut builder = ::http::Response::builder();
         165  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         166  +
                let mut builder = ::http_1x::Response::builder();
         167  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
  118    168   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  119    169   
                    builder,
  120         -
                    ::http::header::CONTENT_TYPE,
         170  +
                    ::http_1x::header::CONTENT_TYPE,
  121    171   
                    "application/json",
  122    172   
                );
         173  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
  123    174   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  124    175   
                    builder,
  125         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         176  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
  126    177   
                    "ValidationException",
  127    178   
                );
         179  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
  128    180   
                let content_length = payload.len();
  129    181   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    182   
                    builder,
  131         -
                    ::http::header::CONTENT_LENGTH,
         183  +
                    ::http_1x::header::CONTENT_LENGTH,
  132    184   
                    content_length,
  133    185   
                );
         186  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
  134    187   
                builder
  135    188   
                    .status(400)
  136    189   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         190  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         191  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
  137    192   
        }
  138         -
        }
         193  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  139    194   
    })
         195  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  140    196   
}
  141    197   
         198  +
/* JsonParserGenerator.kt:148 */
  142    199   
pub(crate) fn de_malformed_boolean(
  143    200   
    value: &[u8],
  144    201   
    mut builder: crate::input::malformed_boolean_input::Builder,
  145    202   
) -> ::std::result::Result<
  146    203   
    crate::input::malformed_boolean_input::Builder,
  147    204   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  148    205   
> {
         206  +
    /* JsonParserGenerator.kt:153 */
  149    207   
    let mut tokens_owned =
  150    208   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  151    209   
            .peekable();
  152    210   
    let tokens = &mut tokens_owned;
  153    211   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         212  +
    /* JsonParserGenerator.kt:684 */
  154    213   
    loop {
         214  +
        /* JsonParserGenerator.kt:685 */
  155    215   
        match tokens.next().transpose()? {
         216  +
            /* JsonParserGenerator.kt:686 */
  156    217   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  157    218   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         219  +
                /* JsonParserGenerator.kt:260 */
  158    220   
                match key.to_unescaped()?.as_ref() {
         221  +
                    /* JsonParserGenerator.kt:262 */
  159    222   
                    "booleanInBody" => {
         223  +
                        /* JsonParserGenerator.kt:272 */
  160    224   
                        builder = builder.set_boolean_in_body(
         225  +
                            /* JsonParserGenerator.kt:298 */
  161    226   
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(
  162    227   
                                tokens.next(),
  163         -
                            )?,
         228  +
                            )?, /* JsonParserGenerator.kt:272 */
  164    229   
                        );
         230  +
                        /* JsonParserGenerator.kt:262 */
  165    231   
                    }
  166         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         232  +
                    /* JsonParserGenerator.kt:290 */
         233  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  167    234   
                }
         235  +
                /* JsonParserGenerator.kt:686 */
  168    236   
            }
         237  +
            /* JsonParserGenerator.kt:695 */
  169    238   
            other => {
  170    239   
                return Err(
  171    240   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  172    241   
                        "expected object key or end object, found: {other:?}"
  173    242   
                    )),
  174    243   
                )
         244  +
            } /* JsonParserGenerator.kt:685 */
  175    245   
        }
         246  +
        /* JsonParserGenerator.kt:684 */
  176    247   
    }
  177         -
    }
         248  +
    /* JsonParserGenerator.kt:250 */
  178    249   
    if tokens.next().is_some() {
         250  +
        /* JsonParserGenerator.kt:251 */
  179    251   
        return Err(
  180    252   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  181    253   
                "found more JSON tokens after completing parsing",
  182    254   
            ),
  183    255   
        );
         256  +
        /* JsonParserGenerator.kt:250 */
  184    257   
    }
         258  +
    /* JsonParserGenerator.kt:163 */
  185    259   
    Ok(builder)
         260  +
    /* JsonParserGenerator.kt:148 */
  186    261   
}

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

@@ -1,1 +36,49 @@
    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_boolean_in_header_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
           6  +
    /* HttpBindingGenerator.kt:166 */
    5      7   
    let headers = header_map.get_all("booleanInHeader");
           8  +
    /* HttpBindingGenerator.kt:427 */
    6      9   
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
          10  +
    /* HttpBindingGenerator.kt:491 */
    7     11   
    if var_1.len() > 1 {
    8     12   
        Err(::aws_smithy_http::header::ParseError::new(format!(
    9     13   
            "expected one item but found {}",
   10     14   
            var_1.len()
   11     15   
        )))
   12     16   
    } else {
   13     17   
        let mut var_1 = var_1;
   14     18   
        Ok(var_1.pop())
   15     19   
    }
          20  +
    /* HttpBindingGenerator.kt:159 */
   16     21   
}
   17     22   
          23  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
   18     24   
pub fn de_boolean_in_path(
   19     25   
    value: &str,
   20     26   
) -> std::result::Result<
   21     27   
    bool,
   22     28   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   23     29   
> {
          30  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
   24     31   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          32  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   25     33   
    Ok(value)
          34  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   26     35   
}
   27     36   
          37  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
   28     38   
pub fn de_boolean_in_query(
   29     39   
    value: &str,
   30     40   
) -> std::result::Result<
   31     41   
    ::std::option::Option<bool>,
   32     42   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   33     43   
> {
          44  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
   34     45   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   35     47   
    Ok(Some(value))
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   36     49   
}

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

@@ -1,1 +184,259 @@
    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_malformed_byte_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::MalformedByteInput,
    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::malformed_byte_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_malformed_byte::de_malformed_byte(
   29     42   
                bytes.as_ref(),
   30     43   
                input,
   31     44   
            )?;
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   32     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   33     48   
        if let Some(value) =
   34     49   
            crate::protocol_serde::shape_malformed_byte_input::de_byte_in_header_header(&headers)?
   35     50   
        {
   36     51   
            input = input.set_byte_in_header(Some(value))
   37     52   
        }
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:1134 */
   38     54   
        let input_string = uri.path();
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:1146 */
   39     56   
        let (input_string, (_, m1)) =
   40     57   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   41     58   
                ::nom::sequence::preceded(
   42     59   
                    ::nom::bytes::complete::tag("/"),
   43     60   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>("MalformedByte"),
   44     61   
                ),
   45     62   
                ::nom::sequence::preceded(
   46     63   
                    ::nom::bytes::complete::tag("/"),
   47     64   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   48     65   
                        ::nom::bytes::complete::take_until("/"),
   49     66   
                        ::nom::combinator::rest,
   50     67   
                    )),
   51     68   
                ),
   52     69   
            ))(input_string)?;
   53     70   
        debug_assert_eq!("", input_string);
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:1157 */
   54     72   
        input = input.set_byte_in_path(
   55     73   
            crate::protocol_serde::shape_malformed_byte_input::de_byte_in_path(m1)?,
   56     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:1221 */
   57     76   
        let query_string = uri.query().unwrap_or("");
   58     77   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:1247 */
   59     79   
        let mut byte_in_query_seen = false;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:1253 */
   60     81   
        for (k, v) in pairs {
          82  +
            /* ServerHttpBoundProtocolGenerator.kt:1257 */
   61     83   
            if !byte_in_query_seen && k == "byteInQuery" {
   62     84   
                input = input.set_byte_in_query(
   63     85   
                    crate::protocol_serde::shape_malformed_byte_input::de_byte_in_query(&v)?,
   64     86   
                );
   65     87   
                byte_in_query_seen = true;
   66     88   
            }
          89  +
            /* ServerHttpBoundProtocolGenerator.kt:1253 */
   67     90   
        }
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   68     92   
        input.build()?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   69     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   70     96   
}
   71     97   
          98  +
/* RustType.kt:534 */
   72     99   
#[allow(clippy::unnecessary_wraps)]
         100  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   73    101   
pub fn ser_malformed_byte_http_response(
   74    102   
    #[allow(unused_variables)] output: crate::output::MalformedByteOutput,
   75    103   
) -> std::result::Result<
   76    104   
    ::aws_smithy_http_server::response::Response,
   77    105   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   78    106   
> {
         107  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   79    108   
    Ok({
         109  +
        /* RustType.kt:534 */
   80    110   
        #[allow(unused_mut)]
   81         -
        let mut builder = ::http::Response::builder();
         111  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
         112  +
        let mut builder = ::http_1x::Response::builder();
         113  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   82    114   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    115   
            builder,
   84         -
            ::http::header::CONTENT_TYPE,
         116  +
            ::http_1x::header::CONTENT_TYPE,
   85    117   
            "application/json",
   86    118   
        );
         119  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   87    120   
        let http_status: u16 = 200;
   88    121   
        builder = builder.status(http_status);
   89         -
        let payload = "";
         122  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
         123  +
        let payload =
         124  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
         125  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
         126  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   90    127   
        let content_length = payload.len();
   91    128   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    129   
            builder,
   93         -
            ::http::header::CONTENT_LENGTH,
         130  +
            ::http_1x::header::CONTENT_LENGTH,
   94    131   
            content_length,
   95    132   
        );
         133  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   96    134   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         135  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   97    136   
        builder.body(body)?
         137  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   98    138   
    })
         139  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   99    140   
}
  100    141   
         142  +
/* RustType.kt:534 */
  101    143   
#[allow(clippy::unnecessary_wraps)]
         144  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
  102    145   
pub fn ser_malformed_byte_http_error(
  103    146   
    error: &crate::error::MalformedByteError,
  104    147   
) -> std::result::Result<
  105    148   
    ::aws_smithy_http_server::response::Response,
  106    149   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  107    150   
> {
         151  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
  108    152   
    Ok({
         153  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
  109    154   
        match error {
         155  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
  110    156   
            crate::error::MalformedByteError::ValidationException(output) => {
         157  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
  111    158   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         159  +
                /* RustType.kt:534 */
  112    160   
                #[allow(unused_mut)]
  113         -
                let mut builder = ::http::Response::builder();
         161  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         162  +
                let mut builder = ::http_1x::Response::builder();
         163  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
  114    164   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    165   
                    builder,
  116         -
                    ::http::header::CONTENT_TYPE,
         166  +
                    ::http_1x::header::CONTENT_TYPE,
  117    167   
                    "application/json",
  118    168   
                );
         169  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
  119    170   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  120    171   
                    builder,
  121         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         172  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
  122    173   
                    "ValidationException",
  123    174   
                );
         175  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
  124    176   
                let content_length = payload.len();
  125    177   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  126    178   
                    builder,
  127         -
                    ::http::header::CONTENT_LENGTH,
         179  +
                    ::http_1x::header::CONTENT_LENGTH,
  128    180   
                    content_length,
  129    181   
                );
         182  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
  130    183   
                builder
  131    184   
                    .status(400)
  132    185   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         186  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         187  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
  133    188   
        }
  134         -
        }
         189  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  135    190   
    })
         191  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  136    192   
}
  137    193   
         194  +
/* JsonParserGenerator.kt:148 */
  138    195   
pub(crate) fn de_malformed_byte(
  139    196   
    value: &[u8],
  140    197   
    mut builder: crate::input::malformed_byte_input::Builder,
  141    198   
) -> ::std::result::Result<
  142    199   
    crate::input::malformed_byte_input::Builder,
  143    200   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  144    201   
> {
         202  +
    /* JsonParserGenerator.kt:153 */
  145    203   
    let mut tokens_owned =
  146    204   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  147    205   
            .peekable();
  148    206   
    let tokens = &mut tokens_owned;
  149    207   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         208  +
    /* JsonParserGenerator.kt:684 */
  150    209   
    loop {
         210  +
        /* JsonParserGenerator.kt:685 */
  151    211   
        match tokens.next().transpose()? {
         212  +
            /* JsonParserGenerator.kt:686 */
  152    213   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  153    214   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         215  +
                /* JsonParserGenerator.kt:260 */
  154    216   
                match key.to_unescaped()?.as_ref() {
         217  +
                    /* JsonParserGenerator.kt:262 */
  155    218   
                    "byteInBody" => {
         219  +
                        /* JsonParserGenerator.kt:272 */
  156    220   
                        builder = builder.set_byte_in_body(
         221  +
                            /* JsonParserGenerator.kt:365 */
  157    222   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  158    223   
                                tokens.next(),
  159    224   
                            )?
  160    225   
                            .map(i8::try_from)
  161         -
                            .transpose()?,
         226  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  162    227   
                        );
         228  +
                        /* JsonParserGenerator.kt:262 */
  163    229   
                    }
  164         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         230  +
                    /* JsonParserGenerator.kt:290 */
         231  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  165    232   
                }
         233  +
                /* JsonParserGenerator.kt:686 */
  166    234   
            }
         235  +
            /* JsonParserGenerator.kt:695 */
  167    236   
            other => {
  168    237   
                return Err(
  169    238   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  170    239   
                        "expected object key or end object, found: {other:?}"
  171    240   
                    )),
  172    241   
                )
         242  +
            } /* JsonParserGenerator.kt:685 */
  173    243   
        }
         244  +
        /* JsonParserGenerator.kt:684 */
  174    245   
    }
  175         -
    }
         246  +
    /* JsonParserGenerator.kt:250 */
  176    247   
    if tokens.next().is_some() {
         248  +
        /* JsonParserGenerator.kt:251 */
  177    249   
        return Err(
  178    250   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  179    251   
                "found more JSON tokens after completing parsing",
  180    252   
            ),
  181    253   
        );
         254  +
        /* JsonParserGenerator.kt:250 */
  182    255   
    }
         256  +
    /* JsonParserGenerator.kt:163 */
  183    257   
    Ok(builder)
         258  +
    /* JsonParserGenerator.kt:148 */
  184    259   
}

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

@@ -1,1 +36,49 @@
    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_byte_in_header_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<::std::option::Option<i8>, ::aws_smithy_http::header::ParseError> {
           6  +
    /* HttpBindingGenerator.kt:166 */
    5      7   
    let headers = header_map.get_all("byteInHeader");
           8  +
    /* HttpBindingGenerator.kt:427 */
    6      9   
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<i8>(headers)?;
          10  +
    /* HttpBindingGenerator.kt:491 */
    7     11   
    if var_1.len() > 1 {
    8     12   
        Err(::aws_smithy_http::header::ParseError::new(format!(
    9     13   
            "expected one item but found {}",
   10     14   
            var_1.len()
   11     15   
        )))
   12     16   
    } else {
   13     17   
        let mut var_1 = var_1;
   14     18   
        Ok(var_1.pop())
   15     19   
    }
          20  +
    /* HttpBindingGenerator.kt:159 */
   16     21   
}
   17     22   
          23  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
   18     24   
pub fn de_byte_in_path(
   19     25   
    value: &str,
   20     26   
) -> std::result::Result<
   21     27   
    i8,
   22     28   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   23     29   
> {
          30  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
   24     31   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          32  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   25     33   
    Ok(value)
          34  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   26     35   
}
   27     36   
          37  +
/* ServerHttpBoundProtocolGenerator.kt:1453 */
   28     38   
pub fn de_byte_in_query(
   29     39   
    value: &str,
   30     40   
) -> std::result::Result<
   31     41   
    ::std::option::Option<i8>,
   32     42   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
   33     43   
> {
          44  +
    /* ServerHttpBoundProtocolGenerator.kt:1515 */
   34     45   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:1525 */
   35     47   
    Ok(Some(value))
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:1453 */
   36     49   
}

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

@@ -1,1 +109,163 @@
    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_malformed_content_type_with_body_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::MalformedContentTypeWithBodyInput,
    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::malformed_content_type_with_body_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_malformed_content_type_with_body::de_malformed_content_type_with_body(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_malformed_content_type_with_body_http_response(
   36     55   
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithBodyOutput,
   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);
   51         -
        let payload = "";
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   52     80   
        let content_length = payload.len();
   53     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     82   
            builder,
   55         -
            ::http::header::CONTENT_LENGTH,
          83  +
            ::http_1x::header::CONTENT_LENGTH,
   56     84   
            content_length,
   57     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   58     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   59     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   60     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   61     93   
}
   62     94   
          95  +
/* JsonParserGenerator.kt:148 */
   63     96   
pub(crate) fn de_malformed_content_type_with_body(
   64     97   
    value: &[u8],
   65     98   
    mut builder: crate::input::malformed_content_type_with_body_input::Builder,
   66     99   
) -> ::std::result::Result<
   67    100   
    crate::input::malformed_content_type_with_body_input::Builder,
   68    101   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   69    102   
> {
         103  +
    /* JsonParserGenerator.kt:153 */
   70    104   
    let mut tokens_owned =
   71    105   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   72    106   
            .peekable();
   73    107   
    let tokens = &mut tokens_owned;
   74    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   75    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   76    112   
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
   77    114   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   78    115   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
   79    117   
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
   80    119   
                    "hi" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
   81    121   
                        builder = builder.set_hi(
         122  +
                            /* JsonParserGenerator.kt:354 */
   82    123   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   83    124   
                                tokens.next(),
   84    125   
                            )?
   85         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   86         -
                            .transpose()?,
         126  +
                            .map(|s|
         127  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         128  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         129  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         130  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   87    131   
                        );
         132  +
                        /* JsonParserGenerator.kt:262 */
   88    133   
                    }
   89         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         134  +
                    /* JsonParserGenerator.kt:290 */
         135  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   90    136   
                }
         137  +
                /* JsonParserGenerator.kt:686 */
   91    138   
            }
         139  +
            /* JsonParserGenerator.kt:695 */
   92    140   
            other => {
   93    141   
                return Err(
   94    142   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   95    143   
                        "expected object key or end object, found: {other:?}"
   96    144   
                    )),
   97    145   
                )
         146  +
            } /* JsonParserGenerator.kt:685 */
   98    147   
        }
         148  +
        /* JsonParserGenerator.kt:684 */
   99    149   
    }
  100         -
    }
         150  +
    /* JsonParserGenerator.kt:250 */
  101    151   
    if tokens.next().is_some() {
         152  +
        /* JsonParserGenerator.kt:251 */
  102    153   
        return Err(
  103    154   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  104    155   
                "found more JSON tokens after completing parsing",
  105    156   
            ),
  106    157   
        );
         158  +
        /* JsonParserGenerator.kt:250 */
  107    159   
    }
         160  +
    /* JsonParserGenerator.kt:163 */
  108    161   
    Ok(builder)
         162  +
    /* JsonParserGenerator.kt:148 */
  109    163   
}

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

@@ -1,1 +66,95 @@
    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_malformed_content_type_with_generic_string_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::MalformedContentTypeWithGenericStringInput,
    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 =
   18     23   
            crate::input::malformed_content_type_with_generic_string_input::Builder::default();
          24  +
        /* RustType.kt:534 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   23     31   
        if let Some(value) = {
   24         -
            let bytes = ::hyper::body::to_bytes(body).await?;
          32  +
            let bytes = {
          33  +
                use ::http_body_util::BodyExt;
          34  +
                body.collect().await?.to_bytes()
          35  +
            };
   25     36   
            if !bytes.is_empty() {
   26     37   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   27     38   
                    &headers,
   28     39   
                    Some("text/plain"),
   29     40   
                )?;
   30     41   
            }
   31     42   
            crate::protocol_serde::shape_malformed_content_type_with_generic_string_input::de_payload_payload(&bytes)?
   32     43   
        } {
   33     44   
            input = input.set_payload(Some(value))
   34     45   
        }
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   35     47   
        input.build()
          48  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   36     49   
    })
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   37     51   
}
   38     52   
          53  +
/* RustType.kt:534 */
   39     54   
#[allow(clippy::unnecessary_wraps)]
          55  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   40     56   
pub fn ser_malformed_content_type_with_generic_string_http_response(
   41     57   
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithGenericStringOutput,
   42     58   
) -> std::result::Result<
   43     59   
    ::aws_smithy_http_server::response::Response,
   44     60   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   45     61   
> {
          62  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   46     63   
    Ok({
          64  +
        /* RustType.kt:534 */
   47     65   
        #[allow(unused_mut)]
   48         -
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          67  +
        let mut builder = ::http_1x::Response::builder();
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   49     69   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     70   
            builder,
   51         -
            ::http::header::CONTENT_TYPE,
          71  +
            ::http_1x::header::CONTENT_TYPE,
   52     72   
            "application/json",
   53     73   
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   54     75   
        let http_status: u16 = 200;
   55     76   
        builder = builder.status(http_status);
   56         -
        let payload = "";
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
          78  +
        let payload =
          79  +
            /* HttpBoundProtocolPayloadGenerator.kt:233 */""
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   57     82   
        let content_length = payload.len();
   58     83   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     84   
            builder,
   60         -
            ::http::header::CONTENT_LENGTH,
          85  +
            ::http_1x::header::CONTENT_LENGTH,
   61     86   
            content_length,
   62     87   
        );
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   63     89   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   64     91   
        builder.body(body)?
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   65     93   
    })
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   66     95   
}