Server Test Python

Server Test Python

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +152,216 @@
    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_http_checksum_required_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpChecksumRequiredInput,
    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::http_checksum_required_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_http_checksum_required::de_http_checksum_required(
   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_http_checksum_required_http_response(
   39     55   
    #[allow(unused_variables)] output: crate::output::HttpChecksumRequiredOutput,
   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);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   54     76   
        let payload =
   55         -
            crate::protocol_serde::shape_http_checksum_required_output::ser_http_checksum_required_output_output_output(&output)?
   56         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:237 */crate::protocol_serde::shape_http_checksum_required_output::ser_http_checksum_required_output_output_output(&output)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   57     80   
        let content_length = payload.len();
   58     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     82   
            builder,
   60     83   
            ::http::header::CONTENT_LENGTH,
   61     84   
            content_length,
   62     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   63     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   64     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   65     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   66     93   
}
   67     94   
          95  +
/* RustType.kt:516 */
   68     96   
#[allow(clippy::unnecessary_wraps)]
          97  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   69     98   
pub fn ser_http_checksum_required_http_error(
   70     99   
    error: &crate::error::HttpChecksumRequiredError,
   71    100   
) -> std::result::Result<
   72    101   
    ::aws_smithy_http_server::response::Response,
   73    102   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   74    103   
> {
         104  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   75    105   
    Ok({
         106  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   76    107   
        match error {
         108  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   77    109   
            crate::error::HttpChecksumRequiredError::InternalServerError(output) => {
         110  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   78    111   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         112  +
                /* RustType.kt:516 */
   79    113   
                #[allow(unused_mut)]
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   80    115   
                let mut builder = ::http::Response::builder();
         116  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   81    117   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   82    118   
                    builder,
   83    119   
                    ::http::header::CONTENT_TYPE,
   84    120   
                    "application/json",
   85    121   
                );
         122  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   86    123   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   87    124   
                    builder,
   88    125   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   89    126   
                    "InternalServerError",
   90    127   
                );
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   91    129   
                let content_length = payload.len();
   92    130   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93    131   
                    builder,
   94    132   
                    ::http::header::CONTENT_LENGTH,
   95    133   
                    content_length,
   96    134   
                );
         135  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   97    136   
                builder
   98    137   
                    .status(500)
   99    138   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         140  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  100    141   
        }
  101         -
        }
         142  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  102    143   
    })
         144  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  103    145   
}
  104    146   
         147  +
/* JsonParserGenerator.kt:148 */
  105    148   
pub(crate) fn de_http_checksum_required(
  106    149   
    value: &[u8],
  107    150   
    mut builder: crate::input::http_checksum_required_input_internal::Builder,
  108    151   
) -> ::std::result::Result<
  109    152   
    crate::input::http_checksum_required_input_internal::Builder,
  110    153   
    ::aws_smithy_json::deserialize::error::DeserializeError,
  111    154   
> {
         155  +
    /* JsonParserGenerator.kt:153 */
  112    156   
    let mut tokens_owned =
  113    157   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
  114    158   
            .peekable();
  115    159   
    let tokens = &mut tokens_owned;
  116    160   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         161  +
    /* JsonParserGenerator.kt:684 */
  117    162   
    loop {
         163  +
        /* JsonParserGenerator.kt:685 */
  118    164   
        match tokens.next().transpose()? {
         165  +
            /* JsonParserGenerator.kt:686 */
  119    166   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  120    167   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         168  +
                /* JsonParserGenerator.kt:260 */
  121    169   
                match key.to_unescaped()?.as_ref() {
         170  +
                    /* JsonParserGenerator.kt:262 */
  122    171   
                    "foo" => {
         172  +
                        /* JsonParserGenerator.kt:272 */
  123    173   
                        builder = builder.set_foo(
         174  +
                            /* JsonParserGenerator.kt:354 */
  124    175   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
  125    176   
                                tokens.next(),
  126    177   
                            )?
  127         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  128         -
                            .transpose()?,
         178  +
                            .map(|s|
         179  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         180  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         181  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         182  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
  129    183   
                        );
         184  +
                        /* JsonParserGenerator.kt:262 */
  130    185   
                    }
  131         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         186  +
                    /* JsonParserGenerator.kt:290 */
         187  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
  132    188   
                }
         189  +
                /* JsonParserGenerator.kt:686 */
  133    190   
            }
         191  +
            /* JsonParserGenerator.kt:695 */
  134    192   
            other => {
  135    193   
                return Err(
  136    194   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  137    195   
                        "expected object key or end object, found: {:?}",
  138    196   
                        other
  139    197   
                    )),
  140    198   
                )
         199  +
            } /* JsonParserGenerator.kt:685 */
  141    200   
        }
         201  +
        /* JsonParserGenerator.kt:684 */
  142    202   
    }
  143         -
    }
         203  +
    /* JsonParserGenerator.kt:250 */
  144    204   
    if tokens.next().is_some() {
         205  +
        /* JsonParserGenerator.kt:251 */
  145    206   
        return Err(
  146    207   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  147    208   
                "found more JSON tokens after completing parsing",
  148    209   
            ),
  149    210   
        );
         211  +
        /* JsonParserGenerator.kt:250 */
  150    212   
    }
         213  +
    /* JsonParserGenerator.kt:163 */
  151    214   
    Ok(builder)
         215  +
    /* JsonParserGenerator.kt:148 */
  152    216   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_http_checksum_required_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_http_checksum_required_output_output_output(
    3      4   
    value: &crate::output::HttpChecksumRequiredOutput,
    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_http_checksum_required_output::ser_http_checksum_required_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_http_checksum_required_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::HttpChecksumRequiredOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.foo {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("foo").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_http_enum_payload.rs

@@ -1,1 +129,176 @@
    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_http_enum_payload_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpEnumPayloadInput,
    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::http_enum_payload_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:794 */
   22     30   
        if let Some(value) = {
   23     31   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     32   
            if !bytes.is_empty() {
   25     33   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     34   
                    &headers,
   27     35   
                    Some("text/plain"),
   28     36   
                )?;
   29     37   
            }
   30     38   
            crate::protocol_serde::shape_http_enum_payload_input::de_payload_payload(&bytes)?
   31     39   
        } {
   32     40   
            input = input.set_payload(Some(value))
   33     41   
        }
          42  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     43   
        input.build()?
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     45   
    })
          46  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     47   
}
   37     48   
          49  +
/* RustType.kt:516 */
   38     50   
#[allow(clippy::unnecessary_wraps)]
          51  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     52   
pub fn ser_http_enum_payload_http_response(
   40     53   
    #[allow(unused_variables)] output: crate::output::HttpEnumPayloadOutput,
   41     54   
) -> std::result::Result<
   42     55   
    ::aws_smithy_http_server::response::Response,
   43     56   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     57   
> {
          58  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     59   
    Ok({
          60  +
        /* RustType.kt:516 */
   46     61   
        #[allow(unused_mut)]
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     63   
        let mut builder = ::http::Response::builder();
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   48     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     66   
            builder,
   50     67   
            ::http::header::CONTENT_TYPE,
   51     68   
            "text/plain",
   52     69   
        );
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   53     71   
        let http_status: u16 = 200;
   54     72   
        builder = builder.status(http_status);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   55     74   
        let payload =
   56         -
            crate::protocol_serde::shape_http_enum_payload_output::ser_payload_http_payload(
   57         -
                output.payload,
   58         -
            )?;
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_http_enum_payload_output::ser_payload_http_payload( output.payload)?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   59     78   
        let content_length = payload.len();
   60     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     80   
            builder,
   62     81   
            ::http::header::CONTENT_LENGTH,
   63     82   
            content_length,
   64     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   65     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   66     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   67     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   68     91   
}
   69     92   
          93  +
/* RustType.kt:516 */
   70     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   71     96   
pub fn ser_http_enum_payload_http_error(
   72     97   
    error: &crate::error::HttpEnumPayloadError,
   73     98   
) -> std::result::Result<
   74     99   
    ::aws_smithy_http_server::response::Response,
   75    100   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   76    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   77    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   78    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   79    107   
            crate::error::HttpEnumPayloadError::ValidationException(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   80    109   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         110  +
                /* RustType.kt:516 */
   81    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   82    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   83    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    116   
                    builder,
   85    117   
                    ::http::header::CONTENT_TYPE,
   86    118   
                    "text/plain",
   87    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   88    121   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    122   
                    builder,
   90    123   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   91    124   
                    "ValidationException",
   92    125   
                );
         126  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   93    127   
                let content_length = payload.len();
   94    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    129   
                    builder,
   96    130   
                    ::http::header::CONTENT_LENGTH,
   97    131   
                    content_length,
   98    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   99    134   
                builder
  100    135   
                    .status(400)
  101    136   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
  102    138   
            }
         139  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
  103    140   
            crate::error::HttpEnumPayloadError::InternalServerError(output) => {
         141  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
  104    142   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         143  +
                /* RustType.kt:516 */
  105    144   
                #[allow(unused_mut)]
         145  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
  106    146   
                let mut builder = ::http::Response::builder();
         147  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  107    148   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  108    149   
                    builder,
  109    150   
                    ::http::header::CONTENT_TYPE,
  110    151   
                    "text/plain",
  111    152   
                );
         153  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
  112    154   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  113    155   
                    builder,
  114    156   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  115    157   
                    "InternalServerError",
  116    158   
                );
         159  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  117    160   
                let content_length = payload.len();
  118    161   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  119    162   
                    builder,
  120    163   
                    ::http::header::CONTENT_LENGTH,
  121    164   
                    content_length,
  122    165   
                );
         166  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  123    167   
                builder
  124    168   
                    .status(500)
  125    169   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         170  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         171  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  126    172   
        }
  127         -
        }
         173  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  128    174   
    })
         175  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  129    176   
}

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

@@ -1,1 +14,20 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_payload_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9     11   
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:332 */
   10     13   
            let body_str = std::str::from_utf8(body)?;
          14  +
            /* HttpBindingGenerator.kt:339 */
   11     15   
            Ok(::std::string::String::from(body_str))
          16  +
            /* HttpBindingGenerator.kt:319 */
   12     17   
        })
   13     18   
        .transpose()
          19  +
    /* HttpBindingGenerator.kt:248 */
   14     20   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_http_enum_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<crate::model::StringEnum>,
    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.as_str().as_bytes().to_vec())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:363 */
          19  +
        payload.as_str().as_bytes().to_vec(), /* 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_http_payload_traits.rs

@@ -1,1 +123,170 @@
    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_http_payload_traits_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpPayloadTraitsInput,
    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::http_payload_traits_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:794 */
   22     30   
        if let Some(value) = {
   23     31   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     32   
   25     33   
            crate::protocol_serde::shape_http_payload_traits_input::de_blob_payload(&bytes)?
   26     34   
        } {
   27     35   
            input = input.set_blob(Some(value))
   28     36   
        }
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   29     38   
        if let Some(value) =
   30     39   
            crate::protocol_serde::shape_http_payload_traits_input::de_foo_header(&headers)?
   31     40   
        {
   32     41   
            input = input.set_foo(Some(value))
   33     42   
        }
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   34     44   
        input.build()
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   35     46   
    })
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   36     48   
}
   37     49   
          50  +
/* RustType.kt:516 */
   38     51   
#[allow(clippy::unnecessary_wraps)]
          52  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   39     53   
pub fn ser_http_payload_traits_http_response(
   40     54   
    #[allow(unused_variables)] output: crate::output::HttpPayloadTraitsOutput,
   41     55   
) -> std::result::Result<
   42     56   
    ::aws_smithy_http_server::response::Response,
   43     57   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     58   
> {
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   45     60   
    Ok({
          61  +
        /* RustType.kt:516 */
   46     62   
        #[allow(unused_mut)]
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   47     64   
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   48     66   
        builder =
   49     67   
            crate::protocol_serde::shape_http_payload_traits::ser_http_payload_traits_headers(
   50     68   
                &output, builder,
   51     69   
            )?;
          70  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     71   
        let http_status: u16 = 200;
   53     72   
        builder = builder.status(http_status);
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   54     74   
        let payload =
   55         -
            crate::protocol_serde::shape_http_payload_traits_output::ser_blob_http_payload(
   56         -
                output.blob,
   57         -
            )?;
          75  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_http_payload_traits_output::ser_blob_http_payload( output.blob)?
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   58     78   
        let content_length = payload.len();
   59     79   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     80   
            builder,
   61     81   
            ::http::header::CONTENT_LENGTH,
   62     82   
            content_length,
   63     83   
        );
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   64     85   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   65     87   
        builder.body(body)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   66     89   
    })
          90  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   67     91   
}
   68     92   
          93  +
/* RustType.kt:516 */
   69     94   
#[allow(clippy::unnecessary_wraps)]
          95  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   70     96   
pub fn ser_http_payload_traits_http_error(
   71     97   
    error: &crate::error::HttpPayloadTraitsError,
   72     98   
) -> std::result::Result<
   73     99   
    ::aws_smithy_http_server::response::Response,
   74    100   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   75    101   
> {
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   76    103   
    Ok({
         104  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   77    105   
        match error {
         106  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   78    107   
            crate::error::HttpPayloadTraitsError::InternalServerError(output) => {
         108  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   79    109   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         110  +
                /* RustType.kt:516 */
   80    111   
                #[allow(unused_mut)]
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   81    113   
                let mut builder = ::http::Response::builder();
         114  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   82    115   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    116   
                    builder,
   84    117   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   85    118   
                    "InternalServerError",
   86    119   
                );
         120  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   87    121   
                let content_length = payload.len();
   88    122   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    123   
                    builder,
   90    124   
                    ::http::header::CONTENT_LENGTH,
   91    125   
                    content_length,
   92    126   
                );
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   93    128   
                builder
   94    129   
                    .status(500)
   95    130   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         132  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   96    133   
        }
   97         -
        }
         134  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   98    135   
    })
         136  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   99    137   
}
  100    138   
         139  +
/* HttpBindingGenerator.kt:542 */
  101    140   
pub fn ser_http_payload_traits_headers(
  102    141   
    input: &crate::output::HttpPayloadTraitsOutput,
  103    142   
    mut builder: ::http::response::Builder,
  104    143   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  105    144   
{
         145  +
    /* HttpBindingGenerator.kt:592 */
  106    146   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         147  +
        /* HttpBindingGenerator.kt:704 */
  107    148   
        let formatted_2 = inner_1.as_str();
         149  +
        /* HttpBindingGenerator.kt:705 */
  108    150   
        if !formatted_2.is_empty() {
         151  +
            /* HttpBindingGenerator.kt:706 */
  109    152   
            let header_value = formatted_2;
  110    153   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  111    154   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  112    155   
                    "foo",
  113    156   
                    format!(
  114    157   
                        "`{}` cannot be used as a header value: {}",
  115    158   
                        &header_value, err
  116    159   
                    ),
  117    160   
                )
  118    161   
            })?;
  119    162   
            builder = builder.header("X-Foo", header_value);
         163  +
            /* HttpBindingGenerator.kt:705 */
  120    164   
        }
         165  +
        /* HttpBindingGenerator.kt:592 */
  121    166   
    }
         167  +
    /* HttpBindingGenerator.kt:555 */
  122    168   
    Ok(builder)
         169  +
    /* HttpBindingGenerator.kt:542 */
  123    170   
}

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

@@ -1,1 +21,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_blob_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| Ok(::aws_smithy_http_server_python::types::Blob::new(body)))
          11  +
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:349 */
          13  +
            Ok(::aws_smithy_http_server_python::types::Blob::new(body))
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
   11     18   
}
   12     19   
          20  +
/* HttpBindingGenerator.kt:153 */
   13     21   
pub(crate) fn de_foo_header(
   14     22   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     23   
) -> ::std::result::Result<
   16     24   
    ::std::option::Option<::std::string::String>,
   17     25   
    ::aws_smithy_http::header::ParseError,
   18     26   
> {
          27  +
    /* HttpBindingGenerator.kt:160 */
   19     28   
    let headers = header_map.get_all("X-Foo");
          29  +
    /* HttpBindingGenerator.kt:375 */
   20     30   
    ::aws_smithy_http::header::one_or_none(headers)
          31  +
    /* HttpBindingGenerator.kt:153 */
   21     32   
}

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

@@ -1,1 +139,189 @@
    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_http_payload_traits_with_media_type_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpPayloadTraitsWithMediaTypeInput,
    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::http_payload_traits_with_media_type_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:794 */
   23     31   
        if let Some(value) = {
   24     32   
            let bytes = ::hyper::body::to_bytes(body).await?;
   25     33   
            if !bytes.is_empty() {
   26     34   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   27     35   
                    &headers,
   28     36   
                    Some("text/plain"),
   29     37   
                )?;
   30     38   
            }
   31     39   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_input::de_blob_payload(
   32     40   
                &bytes,
   33     41   
            )?
   34     42   
        } {
   35     43   
            input = input.set_blob(Some(value))
   36     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   37     46   
        if let Some(value) =
   38     47   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_input::de_foo_header(
   39     48   
                &headers,
   40     49   
            )?
   41     50   
        {
   42     51   
            input = input.set_foo(Some(value))
   43     52   
        }
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   44     54   
        input.build()
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   45     56   
    })
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   46     58   
}
   47     59   
          60  +
/* RustType.kt:516 */
   48     61   
#[allow(clippy::unnecessary_wraps)]
          62  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   49     63   
pub fn ser_http_payload_traits_with_media_type_http_response(
   50     64   
    #[allow(unused_variables)] output: crate::output::HttpPayloadTraitsWithMediaTypeOutput,
   51     65   
) -> std::result::Result<
   52     66   
    ::aws_smithy_http_server::response::Response,
   53     67   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   54     68   
> {
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     70   
    Ok({
          71  +
        /* RustType.kt:516 */
   56     72   
        #[allow(unused_mut)]
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   57     74   
        let mut builder = ::http::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   58     76   
        builder = crate::protocol_serde::shape_http_payload_traits_with_media_type::ser_http_payload_traits_with_media_type_headers(&output, builder)?;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   59     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     79   
            builder,
   61     80   
            ::http::header::CONTENT_TYPE,
   62     81   
            "text/plain",
   63     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   64     84   
        let http_status: u16 = 200;
   65     85   
        builder = builder.status(http_status);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   66     87   
        let payload =
   67         -
            crate::protocol_serde::shape_http_payload_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
   68         -
        ;
          88  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_http_payload_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   69     91   
        let content_length = payload.len();
   70     92   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   71     93   
            builder,
   72     94   
            ::http::header::CONTENT_LENGTH,
   73     95   
            content_length,
   74     96   
        );
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   75     98   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   76    100   
        builder.body(body)?
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   77    102   
    })
         103  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   78    104   
}
   79    105   
         106  +
/* RustType.kt:516 */
   80    107   
#[allow(clippy::unnecessary_wraps)]
         108  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   81    109   
pub fn ser_http_payload_traits_with_media_type_http_error(
   82    110   
    error: &crate::error::HttpPayloadTraitsWithMediaTypeError,
   83    111   
) -> std::result::Result<
   84    112   
    ::aws_smithy_http_server::response::Response,
   85    113   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   86    114   
> {
         115  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   87    116   
    Ok({
         117  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   88    118   
        match error {
         119  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   89    120   
            crate::error::HttpPayloadTraitsWithMediaTypeError::InternalServerError(output) => {
         121  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   90    122   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
         123  +
                /* RustType.kt:516 */
   91    124   
                #[allow(unused_mut)]
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   92    126   
                let mut builder = ::http::Response::builder();
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   93    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   94    129   
                    builder,
   95    130   
                    ::http::header::CONTENT_TYPE,
   96    131   
                    "text/plain",
   97    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   98    134   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   99    135   
                    builder,
  100    136   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  101    137   
                    "InternalServerError",
  102    138   
                );
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  103    140   
                let content_length = payload.len();
  104    141   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  105    142   
                    builder,
  106    143   
                    ::http::header::CONTENT_LENGTH,
  107    144   
                    content_length,
  108    145   
                );
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  109    147   
                builder
  110    148   
                    .status(500)
  111    149   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         150  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         151  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  112    152   
        }
  113         -
        }
         153  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  114    154   
    })
         155  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  115    156   
}
  116    157   
         158  +
/* HttpBindingGenerator.kt:542 */
  117    159   
pub fn ser_http_payload_traits_with_media_type_headers(
  118    160   
    input: &crate::output::HttpPayloadTraitsWithMediaTypeOutput,
  119    161   
    mut builder: ::http::response::Builder,
  120    162   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  121    163   
{
         164  +
    /* HttpBindingGenerator.kt:592 */
  122    165   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         166  +
        /* HttpBindingGenerator.kt:704 */
  123    167   
        let formatted_2 = inner_1.as_str();
         168  +
        /* HttpBindingGenerator.kt:705 */
  124    169   
        if !formatted_2.is_empty() {
         170  +
            /* HttpBindingGenerator.kt:706 */
  125    171   
            let header_value = formatted_2;
  126    172   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  127    173   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  128    174   
                    "foo",
  129    175   
                    format!(
  130    176   
                        "`{}` cannot be used as a header value: {}",
  131    177   
                        &header_value, err
  132    178   
                    ),
  133    179   
                )
  134    180   
            })?;
  135    181   
            builder = builder.header("X-Foo", header_value);
         182  +
            /* HttpBindingGenerator.kt:705 */
  136    183   
        }
         184  +
        /* HttpBindingGenerator.kt:592 */
  137    185   
    }
         186  +
    /* HttpBindingGenerator.kt:555 */
  138    187   
    Ok(builder)
         188  +
    /* HttpBindingGenerator.kt:542 */
  139    189   
}

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

@@ -1,1 +21,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_blob_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| Ok(::aws_smithy_http_server_python::types::Blob::new(body)))
          11  +
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:349 */
          13  +
            Ok(::aws_smithy_http_server_python::types::Blob::new(body))
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
   11     18   
}
   12     19   
          20  +
/* HttpBindingGenerator.kt:153 */
   13     21   
pub(crate) fn de_foo_header(
   14     22   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     23   
) -> ::std::result::Result<
   16     24   
    ::std::option::Option<::std::string::String>,
   17     25   
    ::aws_smithy_http::header::ParseError,
   18     26   
> {
          27  +
    /* HttpBindingGenerator.kt:160 */
   19     28   
    let headers = header_map.get_all("X-Foo");
          29  +
    /* HttpBindingGenerator.kt:375 */
   20     30   
    ::aws_smithy_http::header::one_or_none(headers)
          31  +
    /* HttpBindingGenerator.kt:153 */
   21     32   
}

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

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

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

@@ -1,1 +11,18 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_nested_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<crate::model::NestedPayload>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| crate::protocol_serde::shape_nested_payload::de_nested_payload_payload(body))
          11  +
        .then(|| {
          12  +
            /* ServerHttpBoundProtocolGenerator.kt:850 */
          13  +
            crate::protocol_serde::shape_nested_payload::de_nested_payload_payload(body)
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
   11     18   
}

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

@@ -1,1 +27,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_nested_http_payload(
    3      4   
    payload: &::std::option::Option<crate::model::NestedPayload>,
    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.as_ref() {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(crate::protocol_serde::rest_json_unset_struct_payload()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:338 */
          12  +
                crate::protocol_serde::rest_json_unset_struct_payload(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          13  +
            )
          14  +
        }
    8     15   
    };
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
    9     17   
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:386 */
   10     19   
        crate::protocol_serde::shape_http_payload_with_structure_output::ser_nested_payload(
   11     20   
            payload,
   12         -
        )?,
          21  +
        )?, /* HttpBoundProtocolPayloadGenerator.kt:345 */
   13     22   
    )
          23  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   14     24   
}
   15     25   
          26  +
/* JsonSerializerGenerator.kt:240 */
   16     27   
pub fn ser_nested_payload(
   17     28   
    input: &crate::model::NestedPayload,
   18     29   
) -> std::result::Result<
   19     30   
    ::std::vec::Vec<u8>,
   20     31   
    ::aws_smithy_types::error::operation::SerializationError,
   21     32   
> {
          33  +
    /* JsonSerializerGenerator.kt:245 */
   22     34   
    let mut out = String::new();
          35  +
    /* JsonSerializerGenerator.kt:246 */
   23     36   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          37  +
    /* JsonSerializerGenerator.kt:375 */
   24     38   
    crate::protocol_serde::shape_nested_payload::ser_nested_payload(&mut object, input)?;
          39  +
    /* JsonSerializerGenerator.kt:252 */
   25     40   
    object.finish();
          41  +
    /* JsonSerializerGenerator.kt:253 */
   26     42   
    Ok(out.into_bytes())
          43  +
    /* JsonSerializerGenerator.kt:240 */
   27     44   
}

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

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

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

@@ -1,1 +11,18 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_nested_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<crate::model::UnionPayload>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:319 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| crate::protocol_serde::shape_union_payload::de_union_payload_payload(body))
          11  +
        .then(|| {
          12  +
            /* ServerHttpBoundProtocolGenerator.kt:850 */
          13  +
            crate::protocol_serde::shape_union_payload::de_union_payload_payload(body)
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
   11     18   
}