Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

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

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

@@ -1,1 +93,132 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_accept_with_body_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_accept_with_body_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:811 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:516 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   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:433 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:516 */
   35     50   
        #[allow(unused_mut)]
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   36     52   
        let mut builder = ::http::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   37     54   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   38     55   
            builder,
   39     56   
            ::http::header::CONTENT_TYPE,
   40     57   
            "application/json",
   41     58   
        );
          59  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   42     60   
        let http_status: u16 = 200;
   43     61   
        builder = builder.status(http_status);
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   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:237 */crate::protocol_serde::shape_malformed_accept_with_body_output::ser_malformed_accept_with_body_output_output_output(&output)?
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   47     67   
        let content_length = payload.len();
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50     70   
            ::http::header::CONTENT_LENGTH,
   51     71   
            content_length,
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   53     74   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   54     76   
        builder.body(body)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     78   
    })
          79  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   56     80   
}
   57     81   
          82  +
/* RustType.kt:516 */
   58     83   
#[allow(clippy::unnecessary_wraps)]
          84  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   59     85   
pub fn ser_malformed_accept_with_body_http_error(
   60     86   
    error: &crate::error::MalformedAcceptWithBodyError,
   61     87   
) -> std::result::Result<
   62     88   
    ::aws_smithy_http_server::response::Response,
   63     89   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   64     90   
> {
          91  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   65     92   
    Ok({
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   66     94   
        match error {
          95  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   67     96   
            crate::error::MalformedAcceptWithBodyError::InternalServerError(output) => {
          97  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   68     98   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
          99  +
                /* RustType.kt:516 */
   69    100   
                #[allow(unused_mut)]
         101  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   70    102   
                let mut builder = ::http::Response::builder();
         103  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   71    104   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   72    105   
                    builder,
   73    106   
                    ::http::header::CONTENT_TYPE,
   74    107   
                    "application/json",
   75    108   
                );
         109  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   76    110   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   77    111   
                    builder,
   78    112   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   79    113   
                    "InternalServerError",
   80    114   
                );
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   81    116   
                let content_length = payload.len();
   82    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    118   
                    builder,
   84    119   
                    ::http::header::CONTENT_LENGTH,
   85    120   
                    content_length,
   86    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   87    123   
                builder
   88    124   
                    .status(500)
   89    125   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   90         -
            }
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         127  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   91    128   
        }
         129  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   92    130   
    })
         131  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   93    132   
}

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

@@ -1,1 +94,133 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_accept_with_generic_string_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_accept_with_generic_string_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   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:811 */
   23     31   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   24     33   
        input.build()
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   25     35   
    })
          36  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   26     37   
}
   27     38   
          39  +
/* RustType.kt:516 */
   28     40   
#[allow(clippy::unnecessary_wraps)]
          41  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   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:433 */
   35     49   
    Ok({
          50  +
        /* RustType.kt:516 */
   36     51   
        #[allow(unused_mut)]
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   37     53   
        let mut builder = ::http::Response::builder();
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   38     55   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   39     56   
            builder,
   40     57   
            ::http::header::CONTENT_TYPE,
   41     58   
            "text/plain",
   42     59   
        );
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   43     61   
        let http_status: u16 = 200;
   44     62   
        builder = builder.status(http_status);
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   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:350 */crate::protocol_serde::shape_malformed_accept_with_generic_string_output::ser_payload_http_payload( output.payload)?
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     68   
        let content_length = payload.len();
   49     69   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     70   
            builder,
   51     71   
            ::http::header::CONTENT_LENGTH,
   52     72   
            content_length,
   53     73   
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     75   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     77   
        builder.body(body)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     79   
    })
          80  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     81   
}
   58     82   
          83  +
/* RustType.kt:516 */
   59     84   
#[allow(clippy::unnecessary_wraps)]
          85  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     86   
pub fn ser_malformed_accept_with_generic_string_http_error(
   61     87   
    error: &crate::error::MalformedAcceptWithGenericStringError,
   62     88   
) -> std::result::Result<
   63     89   
    ::aws_smithy_http_server::response::Response,
   64     90   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     91   
> {
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     93   
    Ok({
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     95   
        match error {
          96  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68     97   
            crate::error::MalformedAcceptWithGenericStringError::InternalServerError(output) => {
          98  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69     99   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         100  +
                /* RustType.kt:516 */
   70    101   
                #[allow(unused_mut)]
         102  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    103   
                let mut builder = ::http::Response::builder();
         104  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    105   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    106   
                    builder,
   74    107   
                    ::http::header::CONTENT_TYPE,
   75    108   
                    "text/plain",
   76    109   
                );
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    111   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    112   
                    builder,
   79    113   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    114   
                    "InternalServerError",
   81    115   
                );
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    117   
                let content_length = payload.len();
   83    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    119   
                    builder,
   85    120   
                    ::http::header::CONTENT_LENGTH,
   86    121   
                    content_length,
   87    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    124   
                builder
   89    125   
                    .status(500)
   90    126   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   91         -
            }
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         128  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   92    129   
        }
         130  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   93    131   
    })
         132  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   94    133   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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:311 */
    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:320 */
    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:332 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_bytes())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:366 */
          19  +
        payload.into_bytes(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     22   
}

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

@@ -1,1 +94,133 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_accept_with_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_accept_with_payload_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   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:811 */
   23     31   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   24     33   
        input.build()
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   25     35   
    })
          36  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   26     37   
}
   27     38   
          39  +
/* RustType.kt:516 */
   28     40   
#[allow(clippy::unnecessary_wraps)]
          41  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   29     42   
pub fn ser_malformed_accept_with_payload_http_response(
   30     43   
    #[allow(unused_variables)] output: crate::output::MalformedAcceptWithPayloadOutput,
   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:433 */
   35     49   
    Ok({
          50  +
        /* RustType.kt:516 */
   36     51   
        #[allow(unused_mut)]
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   37     53   
        let mut builder = ::http::Response::builder();
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   38     55   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   39     56   
            builder,
   40     57   
            ::http::header::CONTENT_TYPE,
   41     58   
            "image/jpeg",
   42     59   
        );
          60  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   43     61   
        let http_status: u16 = 200;
   44     62   
        builder = builder.status(http_status);
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   45     64   
        let payload =
   46         -
            crate::protocol_serde::shape_malformed_accept_with_payload_output::ser_payload_http_payload( output.payload)?
   47         -
        ;
          65  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_malformed_accept_with_payload_output::ser_payload_http_payload( output.payload)?
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     68   
        let content_length = payload.len();
   49     69   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     70   
            builder,
   51     71   
            ::http::header::CONTENT_LENGTH,
   52     72   
            content_length,
   53     73   
        );
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     75   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     77   
        builder.body(body)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     79   
    })
          80  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     81   
}
   58     82   
          83  +
/* RustType.kt:516 */
   59     84   
#[allow(clippy::unnecessary_wraps)]
          85  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     86   
pub fn ser_malformed_accept_with_payload_http_error(
   61     87   
    error: &crate::error::MalformedAcceptWithPayloadError,
   62     88   
) -> std::result::Result<
   63     89   
    ::aws_smithy_http_server::response::Response,
   64     90   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     91   
> {
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     93   
    Ok({
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     95   
        match error {
          96  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68     97   
            crate::error::MalformedAcceptWithPayloadError::InternalServerError(output) => {
          98  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69     99   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         100  +
                /* RustType.kt:516 */
   70    101   
                #[allow(unused_mut)]
         102  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    103   
                let mut builder = ::http::Response::builder();
         104  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    105   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    106   
                    builder,
   74    107   
                    ::http::header::CONTENT_TYPE,
   75    108   
                    "image/jpeg",
   76    109   
                );
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    111   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    112   
                    builder,
   79    113   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    114   
                    "InternalServerError",
   81    115   
                );
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    117   
                let content_length = payload.len();
   83    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    119   
                    builder,
   85    120   
                    ::http::header::CONTENT_LENGTH,
   86    121   
                    content_length,
   87    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    124   
                builder
   89    125   
                    .status(500)
   90    126   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   91         -
            }
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         128  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   92    129   
        }
         130  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   93    131   
    })
         132  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   94    133   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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:311 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_inner())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:377 */
          19  +
        payload.into_inner(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     22   
}

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

@@ -1,1 +149,209 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_blob_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_blob_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_blob::de_malformed_blob(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     49   
}
   36     50   
          51  +
/* RustType.kt:516 */
   37     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     54   
pub fn ser_malformed_blob_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::MalformedBlobOutput,
   40     56   
) -> std::result::Result<
   41     57   
    ::aws_smithy_http_server::response::Response,
   42     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   45     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     68   
            builder,
   49     69   
            ::http::header::CONTENT_TYPE,
   50     70   
            "application/json",
   51     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     73   
        let http_status: u16 = 200;
   53     74   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          76  +
        let payload =
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     80   
        let content_length = payload.len();
   56     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     82   
            builder,
   58     83   
            ::http::header::CONTENT_LENGTH,
   59     84   
            content_length,
   60     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     93   
}
   65     94   
          95  +
/* RustType.kt:516 */
   66     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     98   
pub fn ser_malformed_blob_http_error(
   68     99   
    error: &crate::error::MalformedBlobError,
   69    100   
) -> std::result::Result<
   70    101   
    ::aws_smithy_http_server::response::Response,
   71    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    109   
            crate::error::MalformedBlobError::InternalServerError(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    111   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         112  +
                /* RustType.kt:516 */
   77    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    118   
                    builder,
   81    119   
                    ::http::header::CONTENT_TYPE,
   82    120   
                    "application/json",
   83    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    124   
                    builder,
   86    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    126   
                    "InternalServerError",
   88    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    129   
                let content_length = payload.len();
   90    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    131   
                    builder,
   92    132   
                    ::http::header::CONTENT_LENGTH,
   93    133   
                    content_length,
   94    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    136   
                builder
   96    137   
                    .status(500)
   97    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   98         -
            }
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   99    141   
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  100    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  101    145   
}
  102    146   
         147  +
/* JsonParserGenerator.kt:148 */
  103    148   
pub(crate) fn de_malformed_blob(
  104    149   
    value: &[u8],
  105    150   
    mut builder: crate::input::malformed_blob_input_internal::Builder,
  106    151   
) -> ::std::result::Result<
  107    152   
    crate::input::malformed_blob_input_internal::Builder,
  108    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  109    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  110    156   
    let mut tokens_owned =
  111    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  112    158   
            .peekable();
  113    159   
    let tokens = &mut tokens_owned;
  114    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  115    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  116    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  117    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  118    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  119    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  120    171   
                    "blob" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  121    173   
                        builder = builder.set_blob(
  122         -
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(
  123         -
                                tokens.next(),
  124         -
                            )?
  125         -
                            .map(::aws_smithy_http_server_python::types::Blob::from),
  126         -
                        );
         174  +
                            /* JsonParserGenerator.kt:326 */::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
         175  +
                            /* PythonServerProtocolLoader.kt:48 */.map(::aws_smithy_http_server_python::types::Blob::from)
         176  +
                        /* JsonParserGenerator.kt:272 */);
         177  +
                        /* JsonParserGenerator.kt:262 */
  127    178   
                    }
  128         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         179  +
                    /* JsonParserGenerator.kt:290 */
         180  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  129    181   
                }
         182  +
                /* JsonParserGenerator.kt:686 */
  130    183   
            }
         184  +
            /* JsonParserGenerator.kt:695 */
  131    185   
            other => {
  132    186   
                return Err(
  133    187   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  134    188   
                        "expected object key or end object, found: {:?}",
  135    189   
                        other
  136    190   
                    )),
  137    191   
                )
  138         -
            }
         192  +
            } /* JsonParserGenerator.kt:685 */
  139    193   
        }
         194  +
        /* JsonParserGenerator.kt:684 */
  140    195   
    }
         196  +
    /* JsonParserGenerator.kt:250 */
  141    197   
    if tokens.next().is_some() {
         198  +
        /* JsonParserGenerator.kt:251 */
  142    199   
        return Err(
  143    200   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  144    201   
                "found more JSON tokens after completing parsing",
  145    202   
            ),
  146    203   
        );
         204  +
        /* JsonParserGenerator.kt:250 */
  147    205   
    }
         206  +
    /* JsonParserGenerator.kt:163 */
  148    207   
    Ok(builder)
         208  +
    /* JsonParserGenerator.kt:148 */
  149    209   
}

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

@@ -1,1 +211,292 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_boolean_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_boolean_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_boolean::de_malformed_boolean(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   33     45   
        if let Some(value) =
   34     46   
            crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_header_header(
   35     47   
                &headers,
   36     48   
            )?
   37     49   
        {
   38     50   
            input = input.set_boolean_in_header(Some(value))
   39     51   
        }
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   40     53   
        let input_string = uri.path();
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   41     55   
        let (input_string, (_, m1)) =
   42     56   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   43     57   
                ::nom::sequence::preceded(
   44     58   
                    ::nom::bytes::complete::tag("/"),
   45     59   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   46     60   
                        "MalformedBoolean",
   47     61   
                    ),
   48     62   
                ),
   49     63   
                ::nom::sequence::preceded(
   50     64   
                    ::nom::bytes::complete::tag("/"),
   51     65   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   52     66   
                        ::nom::bytes::complete::take_until("/"),
   53     67   
                        ::nom::combinator::rest,
   54     68   
                    )),
   55     69   
                ),
   56     70   
            ))(input_string)?;
   57     71   
        debug_assert_eq!("", input_string);
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   58     73   
        input = input.set_boolean_in_path(
   59     74   
            crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_path(m1)?,
   60     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   61     77   
        let query_string = uri.query().unwrap_or("");
   62     78   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   63     80   
        let mut boolean_in_query_seen = false;
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   64     82   
        for (k, v) in pairs {
          83  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   65     84   
            if !boolean_in_query_seen && k == "booleanInQuery" {
   66     85   
                input = input.set_boolean_in_query(
   67     86   
                    crate::protocol_serde::shape_malformed_boolean_input::de_boolean_in_query(&v)?,
   68     87   
                );
   69     88   
                boolean_in_query_seen = true;
   70     89   
            }
          90  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   71     91   
        }
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   72     93   
        input.build()?
          94  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   73     95   
    })
          96  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   74     97   
}
   75     98   
          99  +
/* RustType.kt:516 */
   76    100   
#[allow(clippy::unnecessary_wraps)]
         101  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   77    102   
pub fn ser_malformed_boolean_http_response(
   78    103   
    #[allow(unused_variables)] output: crate::output::MalformedBooleanOutput,
   79    104   
) -> std::result::Result<
   80    105   
    ::aws_smithy_http_server::response::Response,
   81    106   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   82    107   
> {
         108  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   83    109   
    Ok({
         110  +
        /* RustType.kt:516 */
   84    111   
        #[allow(unused_mut)]
         112  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   85    113   
        let mut builder = ::http::Response::builder();
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    115   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    116   
            builder,
   88    117   
            ::http::header::CONTENT_TYPE,
   89    118   
            "application/json",
   90    119   
        );
         120  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   91    121   
        let http_status: u16 = 200;
   92    122   
        builder = builder.status(http_status);
   93         -
        let payload = "";
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         124  +
        let payload =
         125  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         126  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         127  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   94    128   
        let content_length = payload.len();
   95    129   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   96    130   
            builder,
   97    131   
            ::http::header::CONTENT_LENGTH,
   98    132   
            content_length,
   99    133   
        );
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
  100    135   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         136  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
  101    137   
        builder.body(body)?
         138  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
  102    139   
    })
         140  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
  103    141   
}
  104    142   
         143  +
/* RustType.kt:516 */
  105    144   
#[allow(clippy::unnecessary_wraps)]
         145  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  106    146   
pub fn ser_malformed_boolean_http_error(
  107    147   
    error: &crate::error::MalformedBooleanError,
  108    148   
) -> std::result::Result<
  109    149   
    ::aws_smithy_http_server::response::Response,
  110    150   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  111    151   
> {
         152  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  112    153   
    Ok({
         154  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  113    155   
        match error {
         156  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  114    157   
            crate::error::MalformedBooleanError::ValidationException(output) => {
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  115    159   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         160  +
                /* RustType.kt:516 */
  116    161   
                #[allow(unused_mut)]
         162  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  117    163   
                let mut builder = ::http::Response::builder();
         164  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  118    165   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  119    166   
                    builder,
  120    167   
                    ::http::header::CONTENT_TYPE,
  121    168   
                    "application/json",
  122    169   
                );
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  123    171   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  124    172   
                    builder,
  125    173   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  126    174   
                    "ValidationException",
  127    175   
                );
         176  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  128    177   
                let content_length = payload.len();
  129    178   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  130    179   
                    builder,
  131    180   
                    ::http::header::CONTENT_LENGTH,
  132    181   
                    content_length,
  133    182   
                );
         183  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  134    184   
                builder
  135    185   
                    .status(400)
  136    186   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         187  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  137    188   
            }
         189  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  138    190   
            crate::error::MalformedBooleanError::InternalServerError(output) => {
         191  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  139    192   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         193  +
                /* RustType.kt:516 */
  140    194   
                #[allow(unused_mut)]
         195  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  141    196   
                let mut builder = ::http::Response::builder();
         197  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  142    198   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  143    199   
                    builder,
  144    200   
                    ::http::header::CONTENT_TYPE,
  145    201   
                    "application/json",
  146    202   
                );
         203  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  147    204   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  148    205   
                    builder,
  149    206   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  150    207   
                    "InternalServerError",
  151    208   
                );
         209  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  152    210   
                let content_length = payload.len();
  153    211   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  154    212   
                    builder,
  155    213   
                    ::http::header::CONTENT_LENGTH,
  156    214   
                    content_length,
  157    215   
                );
         216  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  158    217   
                builder
  159    218   
                    .status(500)
  160    219   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  161         -
            }
         220  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         221  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  162    222   
        }
         223  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  163    224   
    })
         225  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  164    226   
}
  165    227   
         228  +
/* JsonParserGenerator.kt:148 */
  166    229   
pub(crate) fn de_malformed_boolean(
  167    230   
    value: &[u8],
  168    231   
    mut builder: crate::input::malformed_boolean_input_internal::Builder,
  169    232   
) -> ::std::result::Result<
  170    233   
    crate::input::malformed_boolean_input_internal::Builder,
  171    234   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  172    235   
> {
         236  +
    /* JsonParserGenerator.kt:153 */
  173    237   
    let mut tokens_owned =
  174    238   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  175    239   
            .peekable();
  176    240   
    let tokens = &mut tokens_owned;
  177    241   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         242  +
    /* JsonParserGenerator.kt:684 */
  178    243   
    loop {
         244  +
        /* JsonParserGenerator.kt:685 */
  179    245   
        match tokens.next().transpose()? {
         246  +
            /* JsonParserGenerator.kt:686 */
  180    247   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  181    248   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         249  +
                /* JsonParserGenerator.kt:260 */
  182    250   
                match key.to_unescaped()?.as_ref() {
         251  +
                    /* JsonParserGenerator.kt:262 */
  183    252   
                    "booleanInBody" => {
         253  +
                        /* JsonParserGenerator.kt:272 */
  184    254   
                        builder = builder.set_boolean_in_body(
         255  +
                            /* JsonParserGenerator.kt:298 */
  185    256   
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(
  186    257   
                                tokens.next(),
  187         -
                            )?,
         258  +
                            )?, /* JsonParserGenerator.kt:272 */
  188    259   
                        );
         260  +
                        /* JsonParserGenerator.kt:262 */
  189    261   
                    }
  190         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         262  +
                    /* JsonParserGenerator.kt:290 */
         263  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  191    264   
                }
         265  +
                /* JsonParserGenerator.kt:686 */
  192    266   
            }
         267  +
            /* JsonParserGenerator.kt:695 */
  193    268   
            other => {
  194    269   
                return Err(
  195    270   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  196    271   
                        "expected object key or end object, found: {:?}",
  197    272   
                        other
  198    273   
                    )),
  199    274   
                )
  200         -
            }
         275  +
            } /* JsonParserGenerator.kt:685 */
  201    276   
        }
         277  +
        /* JsonParserGenerator.kt:684 */
  202    278   
    }
         279  +
    /* JsonParserGenerator.kt:250 */
  203    280   
    if tokens.next().is_some() {
         281  +
        /* JsonParserGenerator.kt:251 */
  204    282   
        return Err(
  205    283   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  206    284   
                "found more JSON tokens after completing parsing",
  207    285   
            ),
  208    286   
        );
         287  +
        /* JsonParserGenerator.kt:250 */
  209    288   
    }
         289  +
    /* JsonParserGenerator.kt:163 */
  210    290   
    Ok(builder)
         291  +
    /* JsonParserGenerator.kt:148 */
  211    292   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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:153 */
    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:160 */
    5      7   
    let headers = header_map.get_all("booleanInHeader");
           8  +
    /* HttpBindingGenerator.kt:404 */
    6      9   
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
          10  +
    /* HttpBindingGenerator.kt:468 */
    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:153 */
   16     21   
}
   17     22   
          23  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   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:1347 */
   24     31   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          32  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   25     33   
    Ok(value)
          34  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   26     35   
}
   27     36   
          37  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   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:1347 */
   34     45   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   35     47   
    Ok(Some(value))
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   36     49   
}

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

@@ -1,1 +209,290 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_byte_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_byte_input_internal::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:745 */
   22     30   
        let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   23     32   
        if !bytes.is_empty() {
          33  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   24     34   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     35   
                &headers,
   26     36   
                Some("application/json"),
   27     37   
            )?;
   28     38   
            input = crate::protocol_serde::shape_malformed_byte::de_malformed_byte(
   29     39   
                bytes.as_ref(),
   30     40   
                input,
   31     41   
            )?;
          42  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   32     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   33     45   
        if let Some(value) =
   34     46   
            crate::protocol_serde::shape_malformed_byte_input::de_byte_in_header_header(&headers)?
   35     47   
        {
   36     48   
            input = input.set_byte_in_header(Some(value))
   37     49   
        }
          50  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   38     51   
        let input_string = uri.path();
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   39     53   
        let (input_string, (_, m1)) =
   40     54   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   41     55   
                ::nom::sequence::preceded(
   42     56   
                    ::nom::bytes::complete::tag("/"),
   43     57   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>("MalformedByte"),
   44     58   
                ),
   45     59   
                ::nom::sequence::preceded(
   46     60   
                    ::nom::bytes::complete::tag("/"),
   47     61   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   48     62   
                        ::nom::bytes::complete::take_until("/"),
   49     63   
                        ::nom::combinator::rest,
   50     64   
                    )),
   51     65   
                ),
   52     66   
            ))(input_string)?;
   53     67   
        debug_assert_eq!("", input_string);
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   54     69   
        input = input.set_byte_in_path(
   55     70   
            crate::protocol_serde::shape_malformed_byte_input::de_byte_in_path(m1)?,
   56     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   57     73   
        let query_string = uri.query().unwrap_or("");
   58     74   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   59     76   
        let mut byte_in_query_seen = false;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   60     78   
        for (k, v) in pairs {
          79  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   61     80   
            if !byte_in_query_seen && k == "byteInQuery" {
   62     81   
                input = input.set_byte_in_query(
   63     82   
                    crate::protocol_serde::shape_malformed_byte_input::de_byte_in_query(&v)?,
   64     83   
                );
   65     84   
                byte_in_query_seen = true;
   66     85   
            }
          86  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   67     87   
        }
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   68     89   
        input.build()?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   69     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   70     93   
}
   71     94   
          95  +
/* RustType.kt:516 */
   72     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   73     98   
pub fn ser_malformed_byte_http_response(
   74     99   
    #[allow(unused_variables)] output: crate::output::MalformedByteOutput,
   75    100   
) -> std::result::Result<
   76    101   
    ::aws_smithy_http_server::response::Response,
   77    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   78    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   79    105   
    Ok({
         106  +
        /* RustType.kt:516 */
   80    107   
        #[allow(unused_mut)]
         108  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   81    109   
        let mut builder = ::http::Response::builder();
         110  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    111   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    112   
            builder,
   84    113   
            ::http::header::CONTENT_TYPE,
   85    114   
            "application/json",
   86    115   
        );
         116  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   87    117   
        let http_status: u16 = 200;
   88    118   
        builder = builder.status(http_status);
   89         -
        let payload = "";
         119  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
         120  +
        let payload =
         121  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
         122  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   90    124   
        let content_length = payload.len();
   91    125   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    126   
            builder,
   93    127   
            ::http::header::CONTENT_LENGTH,
   94    128   
            content_length,
   95    129   
        );
         130  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   96    131   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         132  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   97    133   
        builder.body(body)?
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   98    135   
    })
         136  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   99    137   
}
  100    138   
         139  +
/* RustType.kt:516 */
  101    140   
#[allow(clippy::unnecessary_wraps)]
         141  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
  102    142   
pub fn ser_malformed_byte_http_error(
  103    143   
    error: &crate::error::MalformedByteError,
  104    144   
) -> std::result::Result<
  105    145   
    ::aws_smithy_http_server::response::Response,
  106    146   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
  107    147   
> {
         148  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
  108    149   
    Ok({
         150  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
  109    151   
        match error {
         152  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  110    153   
            crate::error::MalformedByteError::ValidationException(output) => {
         154  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  111    155   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         156  +
                /* RustType.kt:516 */
  112    157   
                #[allow(unused_mut)]
         158  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  113    159   
                let mut builder = ::http::Response::builder();
         160  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  114    161   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  115    162   
                    builder,
  116    163   
                    ::http::header::CONTENT_TYPE,
  117    164   
                    "application/json",
  118    165   
                );
         166  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  119    167   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  120    168   
                    builder,
  121    169   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  122    170   
                    "ValidationException",
  123    171   
                );
         172  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  124    173   
                let content_length = payload.len();
  125    174   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  126    175   
                    builder,
  127    176   
                    ::http::header::CONTENT_LENGTH,
  128    177   
                    content_length,
  129    178   
                );
         179  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  130    180   
                builder
  131    181   
                    .status(400)
  132    182   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         183  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  133    184   
            }
         185  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  134    186   
            crate::error::MalformedByteError::InternalServerError(output) => {
         187  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  135    188   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         189  +
                /* RustType.kt:516 */
  136    190   
                #[allow(unused_mut)]
         191  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  137    192   
                let mut builder = ::http::Response::builder();
         193  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  138    194   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  139    195   
                    builder,
  140    196   
                    ::http::header::CONTENT_TYPE,
  141    197   
                    "application/json",
  142    198   
                );
         199  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  143    200   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  144    201   
                    builder,
  145    202   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  146    203   
                    "InternalServerError",
  147    204   
                );
         205  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  148    206   
                let content_length = payload.len();
  149    207   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  150    208   
                    builder,
  151    209   
                    ::http::header::CONTENT_LENGTH,
  152    210   
                    content_length,
  153    211   
                );
         212  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  154    213   
                builder
  155    214   
                    .status(500)
  156    215   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  157         -
            }
         216  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         217  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  158    218   
        }
         219  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  159    220   
    })
         221  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  160    222   
}
  161    223   
         224  +
/* JsonParserGenerator.kt:148 */
  162    225   
pub(crate) fn de_malformed_byte(
  163    226   
    value: &[u8],
  164    227   
    mut builder: crate::input::malformed_byte_input_internal::Builder,
  165    228   
) -> ::std::result::Result<
  166    229   
    crate::input::malformed_byte_input_internal::Builder,
  167    230   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  168    231   
> {
         232  +
    /* JsonParserGenerator.kt:153 */
  169    233   
    let mut tokens_owned =
  170    234   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  171    235   
            .peekable();
  172    236   
    let tokens = &mut tokens_owned;
  173    237   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         238  +
    /* JsonParserGenerator.kt:684 */
  174    239   
    loop {
         240  +
        /* JsonParserGenerator.kt:685 */
  175    241   
        match tokens.next().transpose()? {
         242  +
            /* JsonParserGenerator.kt:686 */
  176    243   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  177    244   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         245  +
                /* JsonParserGenerator.kt:260 */
  178    246   
                match key.to_unescaped()?.as_ref() {
         247  +
                    /* JsonParserGenerator.kt:262 */
  179    248   
                    "byteInBody" => {
         249  +
                        /* JsonParserGenerator.kt:272 */
  180    250   
                        builder = builder.set_byte_in_body(
         251  +
                            /* JsonParserGenerator.kt:365 */
  181    252   
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
  182    253   
                                tokens.next(),
  183    254   
                            )?
  184    255   
                            .map(i8::try_from)
  185         -
                            .transpose()?,
         256  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  186    257   
                        );
         258  +
                        /* JsonParserGenerator.kt:262 */
  187    259   
                    }
  188         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         260  +
                    /* JsonParserGenerator.kt:290 */
         261  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  189    262   
                }
         263  +
                /* JsonParserGenerator.kt:686 */
  190    264   
            }
         265  +
            /* JsonParserGenerator.kt:695 */
  191    266   
            other => {
  192    267   
                return Err(
  193    268   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  194    269   
                        "expected object key or end object, found: {:?}",
  195    270   
                        other
  196    271   
                    )),
  197    272   
                )
  198         -
            }
         273  +
            } /* JsonParserGenerator.kt:685 */
  199    274   
        }
         275  +
        /* JsonParserGenerator.kt:684 */
  200    276   
    }
         277  +
    /* JsonParserGenerator.kt:250 */
  201    278   
    if tokens.next().is_some() {
         279  +
        /* JsonParserGenerator.kt:251 */
  202    280   
        return Err(
  203    281   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  204    282   
                "found more JSON tokens after completing parsing",
  205    283   
            ),
  206    284   
        );
         285  +
        /* JsonParserGenerator.kt:250 */
  207    286   
    }
         287  +
    /* JsonParserGenerator.kt:163 */
  208    288   
    Ok(builder)
         289  +
    /* JsonParserGenerator.kt:148 */
  209    290   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/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:153 */
    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:160 */
    5      7   
    let headers = header_map.get_all("byteInHeader");
           8  +
    /* HttpBindingGenerator.kt:404 */
    6      9   
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<i8>(headers)?;
          10  +
    /* HttpBindingGenerator.kt:468 */
    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:153 */
   16     21   
}
   17     22   
          23  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   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:1347 */
   24     31   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          32  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   25     33   
    Ok(value)
          34  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   26     35   
}
   27     36   
          37  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
   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:1347 */
   34     45   
    let value = <_ as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(value)?;
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   35     47   
    Ok(Some(value))
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   36     49   
}

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

@@ -1,1 +148,214 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_content_type_with_body_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_content_type_with_body_input_internal::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   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:745 */
   23     31   
        let bytes = ::hyper::body::to_bytes(body).await?;
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:768 */
   24     33   
        if !bytes.is_empty() {
          34  +
            /* ServerHttpBoundProtocolGenerator.kt:769 */
   25     35   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     36   
                &headers,
   27     37   
                Some("application/json"),
   28     38   
            )?;
   29     39   
            input = crate::protocol_serde::shape_malformed_content_type_with_body::de_malformed_content_type_with_body(bytes.as_ref(), input)?;
          40  +
            /* ServerHttpBoundProtocolGenerator.kt:768 */
   30     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   31     43   
        input.build()
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   32     45   
    })
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   33     47   
}
   34     48   
          49  +
/* RustType.kt:516 */
   35     50   
#[allow(clippy::unnecessary_wraps)]
          51  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   36     52   
pub fn ser_malformed_content_type_with_body_http_response(
   37     53   
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithBodyOutput,
   38     54   
) -> std::result::Result<
   39     55   
    ::aws_smithy_http_server::response::Response,
   40     56   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   41     57   
> {
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   42     59   
    Ok({
          60  +
        /* RustType.kt:516 */
   43     61   
        #[allow(unused_mut)]
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   44     63   
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     66   
            builder,
   47     67   
            ::http::header::CONTENT_TYPE,
   48     68   
            "application/json",
   49     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   50     71   
        let http_status: u16 = 200;
   51     72   
        builder = builder.status(http_status);
   52         -
        let payload = "";
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          74  +
        let payload =
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   53     78   
        let content_length = payload.len();
   54     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   55     80   
            builder,
   56     81   
            ::http::header::CONTENT_LENGTH,
   57     82   
            content_length,
   58     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   59     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   60     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   61     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   62     91   
}
   63     92   
          93  +
/* RustType.kt:516 */
   64     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   65     96   
pub fn ser_malformed_content_type_with_body_http_error(
   66     97   
    error: &crate::error::MalformedContentTypeWithBodyError,
   67     98   
) -> std::result::Result<
   68     99   
    ::aws_smithy_http_server::response::Response,
   69    100   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   70    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   71    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   72    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   73    107   
            crate::error::MalformedContentTypeWithBodyError::InternalServerError(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   74    109   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         110  +
                /* RustType.kt:516 */
   75    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   76    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    116   
                    builder,
   79    117   
                    ::http::header::CONTENT_TYPE,
   80    118   
                    "application/json",
   81    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    122   
                    builder,
   84    123   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   85    124   
                    "InternalServerError",
   86    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   87    127   
                let content_length = payload.len();
   88    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    129   
                    builder,
   90    130   
                    ::http::header::CONTENT_LENGTH,
   91    131   
                    content_length,
   92    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   93    134   
                builder
   94    135   
                    .status(500)
   95    136   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
   96         -
            }
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         138  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   97    139   
        }
         140  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   98    141   
    })
         142  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   99    143   
}
  100    144   
         145  +
/* JsonParserGenerator.kt:148 */
  101    146   
pub(crate) fn de_malformed_content_type_with_body(
  102    147   
    value: &[u8],
  103    148   
    mut builder: crate::input::malformed_content_type_with_body_input_internal::Builder,
  104    149   
) -> ::std::result::Result<
  105    150   
    crate::input::malformed_content_type_with_body_input_internal::Builder,
  106    151   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  107    152   
> {
         153  +
    /* JsonParserGenerator.kt:153 */
  108    154   
    let mut tokens_owned =
  109    155   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  110    156   
            .peekable();
  111    157   
    let tokens = &mut tokens_owned;
  112    158   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         159  +
    /* JsonParserGenerator.kt:684 */
  113    160   
    loop {
         161  +
        /* JsonParserGenerator.kt:685 */
  114    162   
        match tokens.next().transpose()? {
         163  +
            /* JsonParserGenerator.kt:686 */
  115    164   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  116    165   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         166  +
                /* JsonParserGenerator.kt:260 */
  117    167   
                match key.to_unescaped()?.as_ref() {
         168  +
                    /* JsonParserGenerator.kt:262 */
  118    169   
                    "hi" => {
         170  +
                        /* JsonParserGenerator.kt:272 */
  119    171   
                        builder = builder.set_hi(
         172  +
                            /* JsonParserGenerator.kt:354 */
  120    173   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  121    174   
                                tokens.next(),
  122    175   
                            )?
  123         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  124         -
                            .transpose()?,
         176  +
                            .map(|s|
         177  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         178  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         179  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         180  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  125    181   
                        );
         182  +
                        /* JsonParserGenerator.kt:262 */
  126    183   
                    }
  127         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         184  +
                    /* JsonParserGenerator.kt:290 */
         185  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  128    186   
                }
         187  +
                /* JsonParserGenerator.kt:686 */
  129    188   
            }
         189  +
            /* JsonParserGenerator.kt:695 */
  130    190   
            other => {
  131    191   
                return Err(
  132    192   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  133    193   
                        "expected object key or end object, found: {:?}",
  134    194   
                        other
  135    195   
                    )),
  136    196   
                )
  137         -
            }
         197  +
            } /* JsonParserGenerator.kt:685 */
  138    198   
        }
         199  +
        /* JsonParserGenerator.kt:684 */
  139    200   
    }
         201  +
    /* JsonParserGenerator.kt:250 */
  140    202   
    if tokens.next().is_some() {
         203  +
        /* JsonParserGenerator.kt:251 */
  141    204   
        return Err(
  142    205   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  143    206   
                "found more JSON tokens after completing parsing",
  144    207   
            ),
  145    208   
        );
         209  +
        /* JsonParserGenerator.kt:250 */
  146    210   
    }
         211  +
    /* JsonParserGenerator.kt:163 */
  147    212   
    Ok(builder)
         213  +
    /* JsonParserGenerator.kt:148 */
  148    214   
}

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

@@ -1,1 +104,144 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_content_type_with_generic_string_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::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:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
   17         -
        let mut input = crate::input::malformed_content_type_with_generic_string_input_internal::Builder::default();
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */let mut input = crate::input::malformed_content_type_with_generic_string_input_internal::Builder::default();
          22  +
        /* RustType.kt:516 */
   18     23   
        #[allow(unused_variables)]
          24  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     25   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     26   
            uri, headers, body, ..
   21     27   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          28  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     29   
        if let Some(value) = {
   23     30   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     31   
            if !bytes.is_empty() {
   25     32   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     33   
                    &headers,
   27     34   
                    Some("text/plain"),
   28     35   
                )?;
   29     36   
            }
   30     37   
            crate::protocol_serde::shape_malformed_content_type_with_generic_string_input::de_payload_payload(&bytes)?
   31     38   
        } {
   32     39   
            input = input.set_payload(Some(value))
   33     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     42   
        input.build()
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     46   
}
   37     47   
          48  +
/* RustType.kt:516 */
   38     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     51   
pub fn ser_malformed_content_type_with_generic_string_http_response(
   40     52   
    #[allow(unused_variables)] output: crate::output::MalformedContentTypeWithGenericStringOutput,
   41     53   
) -> std::result::Result<
   42     54   
    ::aws_smithy_http_server::response::Response,
   43     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     58   
    Ok({
          59  +
        /* RustType.kt:516 */
   46     60   
        #[allow(unused_mut)]
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     62   
        let mut builder = ::http::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     64   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     65   
            builder,
   50     66   
            ::http::header::CONTENT_TYPE,
   51     67   
            "application/json",
   52     68   
        );
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     70   
        let http_status: u16 = 200;
   54     71   
        builder = builder.status(http_status);
   55         -
        let payload = "";
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          73  +
        let payload =
          74  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   56     77   
        let content_length = payload.len();
   57     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     79   
            builder,
   59     80   
            ::http::header::CONTENT_LENGTH,
   60     81   
            content_length,
   61     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   62     84   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   63     86   
        builder.body(body)?
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   64     88   
    })
          89  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   65     90   
}
   66     91   
          92  +
/* RustType.kt:516 */
   67     93   
#[allow(clippy::unnecessary_wraps)]
          94  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   68     95   
pub fn ser_malformed_content_type_with_generic_string_http_error(
   69     96   
    error: &crate::error::MalformedContentTypeWithGenericStringError,
   70     97   
) -> std::result::Result<
   71     98   
    ::aws_smithy_http_server::response::Response,
   72     99   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73    100   
> {
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   74    102   
    Ok({
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   75    104   
        match error {
         105  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   76    106   
            crate::error::MalformedContentTypeWithGenericStringError::InternalServerError(
   77    107   
                output,
   78    108   
            ) => {
         109  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   79    110   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         111  +
                /* RustType.kt:516 */
   80    112   
                #[allow(unused_mut)]
         113  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   81    114   
                let mut builder = ::http::Response::builder();
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    116   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    117   
                    builder,
   84    118   
                    ::http::header::CONTENT_TYPE,
   85    119   
                    "application/json",
   86    120   
                );
         121  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   87    122   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88    123   
                    builder,
   89    124   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   90    125   
                    "InternalServerError",
   91    126   
                );
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   92    128   
                let content_length = payload.len();
   93    129   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   94    130   
                    builder,
   95    131   
                    ::http::header::CONTENT_LENGTH,
   96    132   
                    content_length,
   97    133   
                );
         134  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   98    135   
                builder
   99    136   
                    .status(500)
  100    137   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  101         -
            }
         138  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         139  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  102    140   
        }
         141  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  103    142   
    })
         143  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  104    144   
}