Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +115,164 @@
    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::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  +
/* JsonParserGenerator.kt:148 */
   68     96   
pub(crate) fn de_http_checksum_required(
   69     97   
    value: &[u8],
   70     98   
    mut builder: crate::input::http_checksum_required_input::Builder,
   71     99   
) -> ::std::result::Result<
   72    100   
    crate::input::http_checksum_required_input::Builder,
   73    101   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   74    102   
> {
         103  +
    /* JsonParserGenerator.kt:153 */
   75    104   
    let mut tokens_owned =
   76    105   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   77    106   
            .peekable();
   78    107   
    let tokens = &mut tokens_owned;
   79    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   80    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   81    112   
        match tokens.next().transpose()? {
         113  +
            /* JsonParserGenerator.kt:686 */
   82    114   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   83    115   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         116  +
                /* JsonParserGenerator.kt:260 */
   84    117   
                match key.to_unescaped()?.as_ref() {
         118  +
                    /* JsonParserGenerator.kt:262 */
   85    119   
                    "foo" => {
         120  +
                        /* JsonParserGenerator.kt:272 */
   86    121   
                        builder = builder.set_foo(
         122  +
                            /* JsonParserGenerator.kt:354 */
   87    123   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   88    124   
                                tokens.next(),
   89    125   
                            )?
   90         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   91         -
                            .transpose()?,
         126  +
                            .map(|s|
         127  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         128  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         129  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         130  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   92    131   
                        );
         132  +
                        /* JsonParserGenerator.kt:262 */
   93    133   
                    }
   94         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         134  +
                    /* JsonParserGenerator.kt:290 */
         135  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   95    136   
                }
         137  +
                /* JsonParserGenerator.kt:686 */
   96    138   
            }
         139  +
            /* JsonParserGenerator.kt:695 */
   97    140   
            other => {
   98    141   
                return Err(
   99    142   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  100    143   
                        "expected object key or end object, found: {:?}",
  101    144   
                        other
  102    145   
                    )),
  103    146   
                )
         147  +
            } /* JsonParserGenerator.kt:685 */
  104    148   
        }
         149  +
        /* JsonParserGenerator.kt:684 */
  105    150   
    }
  106         -
    }
         151  +
    /* JsonParserGenerator.kt:250 */
  107    152   
    if tokens.next().is_some() {
         153  +
        /* JsonParserGenerator.kt:251 */
  108    154   
        return Err(
  109    155   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  110    156   
                "found more JSON tokens after completing parsing",
  111    157   
            ),
  112    158   
        );
         159  +
        /* JsonParserGenerator.kt:250 */
  113    160   
    }
         161  +
    /* JsonParserGenerator.kt:163 */
  114    162   
    Ok(builder)
         163  +
    /* JsonParserGenerator.kt:148 */
  115    164   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/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/rest_json/rust-server-codegen/src/protocol_serde/shape_http_enum_payload.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_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::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 */
         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/rest_json/rust-server-codegen/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/rest_json/rust-server-codegen/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/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_traits.rs

@@ -1,1 +91,124 @@
    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::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  +
/* HttpBindingGenerator.kt:542 */
   69     94   
pub fn ser_http_payload_traits_headers(
   70     95   
    input: &crate::output::HttpPayloadTraitsOutput,
   71     96   
    mut builder: ::http::response::Builder,
   72     97   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   73     98   
{
          99  +
    /* HttpBindingGenerator.kt:592 */
   74    100   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         101  +
        /* HttpBindingGenerator.kt:704 */
   75    102   
        let formatted_2 = inner_1.as_str();
         103  +
        /* HttpBindingGenerator.kt:705 */
   76    104   
        if !formatted_2.is_empty() {
         105  +
            /* HttpBindingGenerator.kt:706 */
   77    106   
            let header_value = formatted_2;
   78    107   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   79    108   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   80    109   
                    "foo",
   81    110   
                    format!(
   82    111   
                        "`{}` cannot be used as a header value: {}",
   83    112   
                        &header_value, err
   84    113   
                    ),
   85    114   
                )
   86    115   
            })?;
   87    116   
            builder = builder.header("X-Foo", header_value);
         117  +
            /* HttpBindingGenerator.kt:705 */
   88    118   
        }
         119  +
        /* HttpBindingGenerator.kt:592 */
   89    120   
    }
         121  +
    /* HttpBindingGenerator.kt:555 */
   90    122   
    Ok(builder)
         123  +
    /* HttpBindingGenerator.kt:542 */
   91    124   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/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_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_types::Blob::new(body)))
          11  +
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:349 */
          13  +
            Ok(::aws_smithy_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/rest_json/rust-server-codegen/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_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/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_traits_with_media_type.rs

@@ -1,1 +101,136 @@
    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 = crate::input::http_payload_traits_with_media_type_input::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_payload_traits_with_media_type_input::de_blob_payload(
   31     39   
                &bytes,
   32     40   
            )?
   33     41   
        } {
   34     42   
            input = input.set_blob(Some(value))
   35     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   36     45   
        if let Some(value) =
   37     46   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_input::de_foo_header(
   38     47   
                &headers,
   39     48   
            )?
   40     49   
        {
   41     50   
            input = input.set_foo(Some(value))
   42     51   
        }
          52  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   43     53   
        input.build()
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   44     55   
    })
          56  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   45     57   
}
   46     58   
          59  +
/* RustType.kt:516 */
   47     60   
#[allow(clippy::unnecessary_wraps)]
          61  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   48     62   
pub fn ser_http_payload_traits_with_media_type_http_response(
   49     63   
    #[allow(unused_variables)] output: crate::output::HttpPayloadTraitsWithMediaTypeOutput,
   50     64   
) -> std::result::Result<
   51     65   
    ::aws_smithy_http_server::response::Response,
   52     66   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   53     67   
> {
          68  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   54     69   
    Ok({
          70  +
        /* RustType.kt:516 */
   55     71   
        #[allow(unused_mut)]
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   56     73   
        let mut builder = ::http::Response::builder();
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:629 */
   57     75   
        builder = crate::protocol_serde::shape_http_payload_traits_with_media_type::ser_http_payload_traits_with_media_type_headers(&output, builder)?;
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   58     77   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     78   
            builder,
   60     79   
            ::http::header::CONTENT_TYPE,
   61     80   
            "text/plain",
   62     81   
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   63     83   
        let http_status: u16 = 200;
   64     84   
        builder = builder.status(http_status);
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   65     86   
        let payload =
   66         -
            crate::protocol_serde::shape_http_payload_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
   67         -
        ;
          87  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_http_payload_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   68     90   
        let content_length = payload.len();
   69     91   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   70     92   
            builder,
   71     93   
            ::http::header::CONTENT_LENGTH,
   72     94   
            content_length,
   73     95   
        );
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   74     97   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          98  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   75     99   
        builder.body(body)?
         100  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   76    101   
    })
         102  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   77    103   
}
   78    104   
         105  +
/* HttpBindingGenerator.kt:542 */
   79    106   
pub fn ser_http_payload_traits_with_media_type_headers(
   80    107   
    input: &crate::output::HttpPayloadTraitsWithMediaTypeOutput,
   81    108   
    mut builder: ::http::response::Builder,
   82    109   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   83    110   
{
         111  +
    /* HttpBindingGenerator.kt:592 */
   84    112   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         113  +
        /* HttpBindingGenerator.kt:704 */
   85    114   
        let formatted_2 = inner_1.as_str();
         115  +
        /* HttpBindingGenerator.kt:705 */
   86    116   
        if !formatted_2.is_empty() {
         117  +
            /* HttpBindingGenerator.kt:706 */
   87    118   
            let header_value = formatted_2;
   88    119   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   89    120   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   90    121   
                    "foo",
   91    122   
                    format!(
   92    123   
                        "`{}` cannot be used as a header value: {}",
   93    124   
                        &header_value, err
   94    125   
                    ),
   95    126   
                )
   96    127   
            })?;
   97    128   
            builder = builder.header("X-Foo", header_value);
         129  +
            /* HttpBindingGenerator.kt:705 */
   98    130   
        }
         131  +
        /* HttpBindingGenerator.kt:592 */
   99    132   
    }
         133  +
    /* HttpBindingGenerator.kt:555 */
  100    134   
    Ok(builder)
         135  +
    /* HttpBindingGenerator.kt:542 */
  101    136   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/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_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_types::Blob::new(body)))
          11  +
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:349 */
          13  +
            Ok(::aws_smithy_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/rest_json/rust-server-codegen/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_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/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_with_structure.rs

@@ -1,1 +69,93 @@
    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 = crate::input::http_payload_with_structure_input::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_structure_input::de_nested_payload(
   31     39   
                &bytes,
   32     40   
            )?
   33     41   
        } {
   34     42   
            input = input.set_nested(Some(value))
   35     43   
        }
          44  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   36     45   
        input.build()
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   37     47   
    })
          48  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   38     49   
}
   39     50   
          51  +
/* RustType.kt:516 */
   40     52   
#[allow(clippy::unnecessary_wraps)]
          53  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   41     54   
pub fn ser_http_payload_with_structure_http_response(
   42     55   
    #[allow(unused_variables)] output: crate::output::HttpPayloadWithStructureOutput,
   43     56   
) -> std::result::Result<
   44     57   
    ::aws_smithy_http_server::response::Response,
   45     58   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   46     59   
> {
          60  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   47     61   
    Ok({
          62  +
        /* RustType.kt:516 */
   48     63   
        #[allow(unused_mut)]
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   49     65   
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   50     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   51     68   
            builder,
   52     69   
            ::http::header::CONTENT_TYPE,
   53     70   
            "application/json",
   54     71   
        );
          72  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   55     73   
        let http_status: u16 = 200;
   56     74   
        builder = builder.status(http_status);
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
   57     76   
        let payload =
   58         -
            crate::protocol_serde::shape_http_payload_with_structure_output::ser_nested_http_payload(& output.nested)?
   59         -
        ;
          77  +
            /* HttpBoundProtocolPayloadGenerator.kt:350 */crate::protocol_serde::shape_http_payload_with_structure_output::ser_nested_http_payload(& output.nested)?
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   60     80   
        let content_length = payload.len();
   61     81   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   62     82   
            builder,
   63     83   
            ::http::header::CONTENT_LENGTH,
   64     84   
            content_length,
   65     85   
        );
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   66     87   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   67     89   
        builder.body(body)?
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   68     91   
    })
          92  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   69     93   
}

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

@@ -1,1 +68,91 @@
    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::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   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/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   
}