Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

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

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

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

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

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

@@ -1,1 +99,139 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_test_payload_structure_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPayloadStructureInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::test_payload_structure_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) = {
   23         -
            let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
            let bytes = {
          32  +
                use ::http_body_util::BodyExt;
          33  +
                body.collect().await?.to_bytes()
          34  +
            };
   24     35   
            if !bytes.is_empty() {
   25     36   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     37   
                    &headers,
   27     38   
                    Some("application/json"),
   28     39   
                )?;
   29     40   
            }
   30     41   
            crate::protocol_serde::shape_test_payload_structure_input::de_payload_config_payload(
   31     42   
                &bytes,
   32     43   
            )?
   33     44   
        } {
   34     45   
            input = input.set_payload_config(Some(value))
   35     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   36     48   
        if let Some(value) =
   37     49   
            crate::protocol_serde::shape_test_payload_structure_input::de_test_id_header(&headers)?
   38     50   
        {
   39     51   
            input = input.set_test_id(Some(value))
   40     52   
        }
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   41     54   
        input.build()
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   42     56   
    })
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   43     58   
}
   44     59   
          60  +
/* RustType.kt:534 */
   45     61   
#[allow(clippy::unnecessary_wraps)]
          62  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   46     63   
pub fn ser_test_payload_structure_http_response(
   47     64   
    #[allow(unused_variables)] output: crate::output::TestPayloadStructureOutput,
   48     65   
) -> std::result::Result<
   49     66   
    ::aws_smithy_http_server::response::Response,
   50     67   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   51     68   
> {
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   52     70   
    Ok({
          71  +
        /* RustType.kt:534 */
   53     72   
        #[allow(unused_mut)]
   54         -
        let mut builder = ::http::Response::builder();
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          74  +
        let mut builder = ::http_1x::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   55     76   
        builder = crate::protocol_serde::shape_test_payload_structure::ser_test_payload_structure_headers(&output, builder)?;
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   56     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     79   
            builder,
   58         -
            ::http::header::CONTENT_TYPE,
          80  +
            ::http_1x::header::CONTENT_TYPE,
   59     81   
            "application/json",
   60     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   61     84   
        let http_status: u16 = 200;
   62     85   
        builder = builder.status(http_status);
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   63     87   
        let payload =
   64         -
            crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_http_payload(& output.payload_config)?
   65         -
        ;
          88  +
            /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_http_payload(& output.payload_config)?
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   66     91   
        let content_length = payload.len();
   67     92   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   68     93   
            builder,
   69         -
            ::http::header::CONTENT_LENGTH,
          94  +
            ::http_1x::header::CONTENT_LENGTH,
   70     95   
            content_length,
   71     96   
        );
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   72     98   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   73    100   
        builder.body(body)?
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   74    102   
    })
         103  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   75    104   
}
   76    105   
         106  +
/* HttpBindingGenerator.kt:565 */
   77    107   
pub fn ser_test_payload_structure_headers(
   78    108   
    input: &crate::output::TestPayloadStructureOutput,
   79         -
    mut builder: ::http::response::Builder,
   80         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   81         -
{
         109  +
    mut builder: ::http_1x::response::Builder,
         110  +
) -> std::result::Result<
         111  +
    ::http_1x::response::Builder,
         112  +
    ::aws_smithy_types::error::operation::BuildError,
         113  +
> {
         114  +
    /* HttpBindingGenerator.kt:615 */
   82    115   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
         116  +
        /* HttpBindingGenerator.kt:727 */
   83    117   
        let formatted_2 = inner_1.as_str();
         118  +
        /* HttpBindingGenerator.kt:728 */
   84    119   
        if !formatted_2.is_empty() {
         120  +
            /* HttpBindingGenerator.kt:729 */
   85    121   
            let header_value = formatted_2;
   86         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         122  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   87    123   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   88    124   
                    "test_id",
   89    125   
                    format!(
   90    126   
                        "`{}` cannot be used as a header value: {}",
   91    127   
                        &header_value, err
   92    128   
                    ),
   93    129   
                )
   94    130   
            })?;
   95    131   
            builder = builder.header("x-amz-test-id", header_value);
         132  +
            /* HttpBindingGenerator.kt:728 */
   96    133   
        }
         134  +
        /* HttpBindingGenerator.kt:615 */
   97    135   
    }
         136  +
    /* HttpBindingGenerator.kt:578 */
   98    137   
    Ok(builder)
         138  +
    /* HttpBindingGenerator.kt:565 */
   99    139   
}

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

@@ -1,1 +21,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:254 */
    2      3   
pub(crate) fn de_payload_config_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<crate::model::PayloadConfig>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:342 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| crate::protocol_serde::shape_payload_config::de_payload_config_payload(body))
          11  +
        .then(|| {
          12  +
            /* ServerHttpBoundProtocolGenerator.kt:914 */
          13  +
            crate::protocol_serde::shape_payload_config::de_payload_config_payload(body)
          14  +
            /* HttpBindingGenerator.kt:342 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:254 */
   11     18   
}
   12     19   
          20  +
/* HttpBindingGenerator.kt:159 */
   13     21   
pub(crate) fn de_test_id_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:166 */
   19     28   
    let headers = header_map.get_all("x-amz-test-id");
          29  +
    /* HttpBindingGenerator.kt:398 */
   20     30   
    ::aws_smithy_http::header::one_or_none(headers)
          31  +
    /* HttpBindingGenerator.kt:159 */
   21     32   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_test_payload_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:309 */
    2      3   
pub fn ser_payload_config_http_payload(
    3      4   
    payload: &::std::option::Option<crate::model::PayloadConfig>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:318 */
    5      7   
    let payload = match payload.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:336 */
          12  +
                crate::protocol_serde::rest_json_unset_struct_payload(), /* HttpBoundProtocolPayloadGenerator.kt:318 */
          13  +
            )
          14  +
        }
    8     15   
    };
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
    9     17   
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:384 */
   10     19   
        crate::protocol_serde::shape_test_payload_structure_output::ser_payload_config_payload(
   11     20   
            payload,
   12         -
        )?,
          21  +
        )?, /* HttpBoundProtocolPayloadGenerator.kt:343 */
   13     22   
    )
          23  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
   14     24   
}
   15     25   
          26  +
/* JsonSerializerGenerator.kt:240 */
   16     27   
pub fn ser_payload_config_payload(
   17     28   
    input: &crate::model::PayloadConfig,
   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_payload_config::ser_payload_config(&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_test_post_no_input_no_payload.rs

@@ -1,1 +81,117 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_test_post_no_input_no_payload_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPostNoInputNoPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::test_post_no_input_no_payload_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:873 */
   22     30   
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   23     32   
        input.build()
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   24     34   
    })
          35  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   25     36   
}
   26     37   
          38  +
/* RustType.kt:534 */
   27     39   
#[allow(clippy::unnecessary_wraps)]
          40  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   28     41   
pub fn ser_test_post_no_input_no_payload_http_response(
   29     42   
    #[allow(unused_variables)] output: crate::output::TestPostNoInputNoPayloadOutput,
   30     43   
) -> std::result::Result<
   31     44   
    ::aws_smithy_http_server::response::Response,
   32     45   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     46   
> {
          47  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   34     48   
    Ok({
          49  +
        /* RustType.kt:534 */
   35     50   
        #[allow(unused_mut)]
   36         -
        let mut builder = ::http::Response::builder();
          51  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          52  +
        let mut builder = ::http_1x::Response::builder();
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   37     54   
        builder = crate::protocol_serde::shape_test_post_no_input_no_payload::ser_test_post_no_input_no_payload_headers(&output, builder)?;
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   38     56   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   39     57   
            builder,
   40         -
            ::http::header::CONTENT_TYPE,
          58  +
            ::http_1x::header::CONTENT_TYPE,
   41     59   
            "application/json",
   42     60   
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   43     62   
        let http_status: u16 = 200;
   44     63   
        builder = builder.status(http_status);
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   45     65   
        let payload =
   46         -
            crate::protocol_serde::shape_test_post_no_input_no_payload_output::ser_test_post_no_input_no_payload_output_output_output(&output)?
   47         -
        ;
          66  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_test_post_no_input_no_payload_output::ser_test_post_no_input_no_payload_output_output_output(&output)?
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   48     69   
        let content_length = payload.len();
   49     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     71   
            builder,
   51         -
            ::http::header::CONTENT_LENGTH,
          72  +
            ::http_1x::header::CONTENT_LENGTH,
   52     73   
            content_length,
   53     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   54     76   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   55     78   
        builder.body(body)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   56     80   
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   57     82   
}
   58     83   
          84  +
/* HttpBindingGenerator.kt:565 */
   59     85   
pub fn ser_test_post_no_input_no_payload_headers(
   60     86   
    input: &crate::output::TestPostNoInputNoPayloadOutput,
   61         -
    mut builder: ::http::response::Builder,
   62         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   63         -
{
          87  +
    mut builder: ::http_1x::response::Builder,
          88  +
) -> std::result::Result<
          89  +
    ::http_1x::response::Builder,
          90  +
    ::aws_smithy_types::error::operation::BuildError,
          91  +
> {
          92  +
    /* HttpBindingGenerator.kt:615 */
   64     93   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          94  +
        /* HttpBindingGenerator.kt:727 */
   65     95   
        let formatted_2 = inner_1.as_str();
          96  +
        /* HttpBindingGenerator.kt:728 */
   66     97   
        if !formatted_2.is_empty() {
          98  +
            /* HttpBindingGenerator.kt:729 */
   67     99   
            let header_value = formatted_2;
   68         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         100  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   69    101   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   70    102   
                    "test_id",
   71    103   
                    format!(
   72    104   
                        "`{}` cannot be used as a header value: {}",
   73    105   
                        &header_value, err
   74    106   
                    ),
   75    107   
                )
   76    108   
            })?;
   77    109   
            builder = builder.header("X-Amz-Test-Id", header_value);
         110  +
            /* HttpBindingGenerator.kt:728 */
   78    111   
        }
         112  +
        /* HttpBindingGenerator.kt:615 */
   79    113   
    }
         114  +
    /* HttpBindingGenerator.kt:578 */
   80    115   
    Ok(builder)
         116  +
    /* HttpBindingGenerator.kt:565 */
   81    117   
}

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

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_test_post_no_input_no_payload_output_output_output(
    3      4   
    value: &crate::output::TestPostNoInputNoPayloadOutput,
    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_test_post_no_input_no_payload_output::ser_test_post_no_input_no_payload_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_test_post_no_input_no_payload_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::TestPostNoInputNoPayloadOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

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

@@ -1,1 +88,124 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_test_post_no_payload_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TestPostNoPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::test_post_no_payload_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_test_post_no_payload_input::de_test_id_header(&headers)?
   24     32   
        {
   25     33   
            input = input.set_test_id(Some(value))
   26     34   
        }
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   27     36   
        input.build()
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   28     38   
    })
          39  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   29     40   
}
   30     41   
          42  +
/* RustType.kt:534 */
   31     43   
#[allow(clippy::unnecessary_wraps)]
          44  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   32     45   
pub fn ser_test_post_no_payload_http_response(
   33     46   
    #[allow(unused_variables)] output: crate::output::TestPostNoPayloadOutput,
   34     47   
) -> std::result::Result<
   35     48   
    ::aws_smithy_http_server::response::Response,
   36     49   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   37     50   
> {
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   38     52   
    Ok({
          53  +
        /* RustType.kt:534 */
   39     54   
        #[allow(unused_mut)]
   40         -
        let mut builder = ::http::Response::builder();
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          56  +
        let mut builder = ::http_1x::Response::builder();
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   41     58   
        builder =
   42     59   
            crate::protocol_serde::shape_test_post_no_payload::ser_test_post_no_payload_headers(
   43     60   
                &output, builder,
   44     61   
            )?;
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   45     63   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   46     64   
            builder,
   47         -
            ::http::header::CONTENT_TYPE,
          65  +
            ::http_1x::header::CONTENT_TYPE,
   48     66   
            "application/json",
   49     67   
        );
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   50     69   
        let http_status: u16 = 200;
   51     70   
        builder = builder.status(http_status);
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   52     72   
        let payload =
   53         -
            crate::protocol_serde::shape_test_post_no_payload_output::ser_test_post_no_payload_output_output_output(&output)?
   54         -
        ;
          73  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_test_post_no_payload_output::ser_test_post_no_payload_output_output_output(&output)?
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   55     76   
        let content_length = payload.len();
   56     77   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     78   
            builder,
   58         -
            ::http::header::CONTENT_LENGTH,
          79  +
            ::http_1x::header::CONTENT_LENGTH,
   59     80   
            content_length,
   60     81   
        );
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   61     83   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   62     85   
        builder.body(body)?
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   63     87   
    })
          88  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   64     89   
}
   65     90   
          91  +
/* HttpBindingGenerator.kt:565 */
   66     92   
pub fn ser_test_post_no_payload_headers(
   67     93   
    input: &crate::output::TestPostNoPayloadOutput,
   68         -
    mut builder: ::http::response::Builder,
   69         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   70         -
{
          94  +
    mut builder: ::http_1x::response::Builder,
          95  +
) -> std::result::Result<
          96  +
    ::http_1x::response::Builder,
          97  +
    ::aws_smithy_types::error::operation::BuildError,
          98  +
> {
          99  +
    /* HttpBindingGenerator.kt:615 */
   71    100   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
         101  +
        /* HttpBindingGenerator.kt:727 */
   72    102   
        let formatted_2 = inner_1.as_str();
         103  +
        /* HttpBindingGenerator.kt:728 */
   73    104   
        if !formatted_2.is_empty() {
         105  +
            /* HttpBindingGenerator.kt:729 */
   74    106   
            let header_value = formatted_2;
   75         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         107  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   76    108   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   77    109   
                    "test_id",
   78    110   
                    format!(
   79    111   
                        "`{}` cannot be used as a header value: {}",
   80    112   
                        &header_value, err
   81    113   
                    ),
   82    114   
                )
   83    115   
            })?;
   84    116   
            builder = builder.header("X-Amz-Test-Id", header_value);
         117  +
            /* HttpBindingGenerator.kt:728 */
   85    118   
        }
         119  +
        /* HttpBindingGenerator.kt:615 */
   86    120   
    }
         121  +
    /* HttpBindingGenerator.kt:578 */
   87    122   
    Ok(builder)
         123  +
    /* HttpBindingGenerator.kt:565 */
   88    124   
}

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

@@ -1,1 +10,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
    2      3   
pub(crate) fn de_test_id_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:166 */
    8     10   
    let headers = header_map.get_all("X-Amz-Test-Id");
          11  +
    /* HttpBindingGenerator.kt:398 */
    9     12   
    ::aws_smithy_http::header::one_or_none(headers)
          13  +
    /* HttpBindingGenerator.kt:159 */
   10     14   
}

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

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_test_post_no_payload_output_output_output(
    3      4   
    value: &crate::output::TestPostNoPayloadOutput,
    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_test_post_no_payload_output::ser_test_post_no_payload_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_test_post_no_payload_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::TestPostNoPayloadOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

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

@@ -1,1 +52,78 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_test_string_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<::std::string::String>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
   27         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
   28         -
                            tokens.next(),
   29         -
                        )?
   30         -
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   31         -
                        .transpose()?;
          37  +
                        /* JsonParserGenerator.kt:419 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:419 */;
          45  +
                        /* JsonParserGenerator.kt:422 */
   32     46   
                        if let Some(value) = value {
   33     47   
                            items.push(value);
   34         -
                        } else {
          48  +
                        }
          49  +
                        /* JsonParserGenerator.kt:430 */
          50  +
                        else {
   35     51   
                            return Err(
   36     52   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                    "dense list cannot contain null values",
   38     54   
                                ),
   39     55   
                            );
   40     56   
                        }
   41         -
                    }
          57  +
                        /* JsonParserGenerator.kt:413 */
          58  +
                    } /* JsonParserGenerator.kt:409 */
   42     59   
                }
          60  +
                /* JsonParserGenerator.kt:408 */
   43     61   
            }
          62  +
            /* JsonParserGenerator.kt:446 */
   44     63   
            Ok(Some(items))
          64  +
            /* JsonParserGenerator.kt:713 */
   45     65   
        }
   46         -
        _ => Err(
   47         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48         -
                "expected start array or null",
   49         -
            ),
   50         -
        ),
          66  +
        /* JsonParserGenerator.kt:722 */
          67  +
        _ => {
          68  +
            /* JsonParserGenerator.kt:723 */
          69  +
            Err(
          70  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          71  +
                    "expected start array or null",
          72  +
                ),
          73  +
            )
          74  +
            /* JsonParserGenerator.kt:722 */
          75  +
        } /* JsonParserGenerator.kt:712 */
   51     76   
    }
          77  +
    /* JsonParserGenerator.kt:398 */
   52     78   
}

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

@@ -1,1 +60,87 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_test_string_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          22  +
            /* JsonParserGenerator.kt:469 */
   19     23   
            let mut map = ::std::collections::HashMap::new();
          24  +
            /* JsonParserGenerator.kt:684 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:685 */
   21     27   
                match tokens.next().transpose()? {
          28  +
                    /* JsonParserGenerator.kt:686 */
   22     29   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   23     30   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   24         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   25         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(
   26         -
                            tokens.next(),
   27         -
                        )?
   28         -
                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   29         -
                        .transpose()?;
          31  +
                        /* JsonParserGenerator.kt:471 */
          32  +
                        let key =
          33  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          34  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                            /* JsonParserGenerator.kt:339 */)
          36  +
                        /* JsonParserGenerator.kt:471 */?;
          37  +
                        /* JsonParserGenerator.kt:474 */
          38  +
                        let value =
          39  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          40  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          41  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          42  +
                                /* JsonParserGenerator.kt:339 */)
          43  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          44  +
                        /* JsonParserGenerator.kt:474 */;
          45  +
                        /* JsonParserGenerator.kt:481 */
   30     46   
                        match value {
   31     47   
                            Some(value) => {
   32     48   
                                map.insert(key, value);
   33     49   
                            }
   34     50   
                            None => {
   35     51   
                                return Err(
   36     52   
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     53   
                                        "dense map cannot contain null values",
   38     54   
                                    ),
   39     55   
                                )
   40     56   
                            }
   41     57   
                        }
          58  +
                        /* JsonParserGenerator.kt:686 */
   42     59   
                    }
          60  +
                    /* JsonParserGenerator.kt:695 */
   43     61   
                    other => {
   44     62   
                        return Err(
   45     63   
                            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46     64   
                                format!("expected object key or end object, found: {other:?}"),
   47     65   
                            ),
   48     66   
                        )
   49         -
                    }
          67  +
                    } /* JsonParserGenerator.kt:685 */
   50     68   
                }
          69  +
                /* JsonParserGenerator.kt:684 */
   51     70   
            }
          71  +
            /* JsonParserGenerator.kt:504 */
   52     72   
            Ok(Some(map))
          73  +
            /* JsonParserGenerator.kt:713 */
   53     74   
        }
   54         -
        _ => Err(
   55         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   56         -
                "expected start object or null",
   57         -
            ),
   58         -
        ),
          75  +
        /* JsonParserGenerator.kt:722 */
          76  +
        _ => {
          77  +
            /* JsonParserGenerator.kt:723 */
          78  +
            Err(
          79  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          80  +
                    "expected start object or null",
          81  +
                ),
          82  +
            )
          83  +
            /* JsonParserGenerator.kt:722 */
          84  +
        } /* JsonParserGenerator.kt:712 */
   59     85   
    }
          86  +
    /* JsonParserGenerator.kt:460 */
   60     87   
}

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

@@ -1,1 +217,295 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_timestamp_format_headers_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::TimestampFormatHeadersInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::timestamp_format_headers_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) =
   23     31   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_default_format_header(
   24     32   
                &headers,
   25     33   
            )?
   26     34   
        {
   27     35   
            input = input.set_default_format(Some(value))
   28     36   
        }
          37  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   29     38   
        if let Some(value) =
   30     39   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_member_date_time_header(
   31     40   
                &headers,
   32     41   
            )?
   33     42   
        {
   34     43   
            input = input.set_member_date_time(Some(value))
   35     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   36     46   
        if let Some(value) = crate::protocol_serde::shape_timestamp_format_headers_input::de_member_epoch_seconds_header(&headers)? {
   37     47   
                                input = input.set_member_epoch_seconds(Some(value))
   38     48   
                            }
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   39     50   
        if let Some(value) =
   40     51   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_member_http_date_header(
   41     52   
                &headers,
   42     53   
            )?
   43     54   
        {
   44     55   
            input = input.set_member_http_date(Some(value))
   45     56   
        }
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   46     58   
        if let Some(value) =
   47     59   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_target_date_time_header(
   48     60   
                &headers,
   49     61   
            )?
   50     62   
        {
   51     63   
            input = input.set_target_date_time(Some(value))
   52     64   
        }
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   53     66   
        if let Some(value) = crate::protocol_serde::shape_timestamp_format_headers_input::de_target_epoch_seconds_header(&headers)? {
   54     67   
                                input = input.set_target_epoch_seconds(Some(value))
   55     68   
                            }
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   56     70   
        if let Some(value) =
   57     71   
            crate::protocol_serde::shape_timestamp_format_headers_input::de_target_http_date_header(
   58     72   
                &headers,
   59     73   
            )?
   60     74   
        {
   61     75   
            input = input.set_target_http_date(Some(value))
   62     76   
        }
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   63     78   
        input.build()
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   64     80   
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   65     82   
}
   66     83   
          84  +
/* RustType.kt:534 */
   67     85   
#[allow(clippy::unnecessary_wraps)]
          86  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   68     87   
pub fn ser_timestamp_format_headers_http_response(
   69     88   
    #[allow(unused_variables)] output: crate::output::TimestampFormatHeadersOutput,
   70     89   
) -> std::result::Result<
   71     90   
    ::aws_smithy_http_server::response::Response,
   72     91   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73     92   
> {
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   74     94   
    Ok({
          95  +
        /* RustType.kt:534 */
   75     96   
        #[allow(unused_mut)]
   76         -
        let mut builder = ::http::Response::builder();
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          98  +
        let mut builder = ::http_1x::Response::builder();
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   77    100   
        builder = crate::protocol_serde::shape_timestamp_format_headers::ser_timestamp_format_headers_headers(&output, builder)?;
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   78    102   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   79    103   
            builder,
   80         -
            ::http::header::CONTENT_TYPE,
         104  +
            ::http_1x::header::CONTENT_TYPE,
   81    105   
            "application/json",
   82    106   
        );
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   83    108   
        let http_status: u16 = 200;
   84    109   
        builder = builder.status(http_status);
         110  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   85    111   
        let payload =
   86         -
            crate::protocol_serde::shape_timestamp_format_headers_output::ser_timestamp_format_headers_output_output_output(&output)?
   87         -
        ;
         112  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_timestamp_format_headers_output::ser_timestamp_format_headers_output_output_output(&output)?
         113  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
         114  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   88    115   
        let content_length = payload.len();
   89    116   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    117   
            builder,
   91         -
            ::http::header::CONTENT_LENGTH,
         118  +
            ::http_1x::header::CONTENT_LENGTH,
   92    119   
            content_length,
   93    120   
        );
         121  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   94    122   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         123  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   95    124   
        builder.body(body)?
         125  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   96    126   
    })
         127  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   97    128   
}
   98    129   
         130  +
/* HttpBindingGenerator.kt:565 */
   99    131   
pub fn ser_timestamp_format_headers_headers(
  100    132   
    input: &crate::output::TimestampFormatHeadersOutput,
  101         -
    mut builder: ::http::response::Builder,
  102         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  103         -
{
         133  +
    mut builder: ::http_1x::response::Builder,
         134  +
) -> std::result::Result<
         135  +
    ::http_1x::response::Builder,
         136  +
    ::aws_smithy_types::error::operation::BuildError,
         137  +
> {
         138  +
    /* HttpBindingGenerator.kt:615 */
  104    139   
    if let ::std::option::Option::Some(inner_1) = &input.member_epoch_seconds {
         140  +
        /* HttpBindingGenerator.kt:727 */
  105    141   
        let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
         142  +
        /* HttpBindingGenerator.kt:728 */
  106    143   
        if !formatted_2.is_empty() {
         144  +
            /* HttpBindingGenerator.kt:729 */
  107    145   
            let header_value = formatted_2;
  108         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         146  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  109    147   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  110    148   
                    "member_epoch_seconds",
  111    149   
                    format!(
  112    150   
                        "`{}` cannot be used as a header value: {}",
  113    151   
                        &header_value, err
  114    152   
                    ),
  115    153   
                )
  116    154   
            })?;
  117    155   
            builder = builder.header("X-memberEpochSeconds", header_value);
         156  +
            /* HttpBindingGenerator.kt:728 */
  118    157   
        }
         158  +
        /* HttpBindingGenerator.kt:615 */
  119    159   
    }
         160  +
    /* HttpBindingGenerator.kt:615 */
  120    161   
    if let ::std::option::Option::Some(inner_3) = &input.member_http_date {
         162  +
        /* HttpBindingGenerator.kt:727 */
  121    163   
        let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         164  +
        /* HttpBindingGenerator.kt:728 */
  122    165   
        if !formatted_4.is_empty() {
         166  +
            /* HttpBindingGenerator.kt:729 */
  123    167   
            let header_value = formatted_4;
  124         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         168  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  125    169   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  126    170   
                    "member_http_date",
  127    171   
                    format!(
  128    172   
                        "`{}` cannot be used as a header value: {}",
  129    173   
                        &header_value, err
  130    174   
                    ),
  131    175   
                )
  132    176   
            })?;
  133    177   
            builder = builder.header("X-memberHttpDate", header_value);
         178  +
            /* HttpBindingGenerator.kt:728 */
  134    179   
        }
         180  +
        /* HttpBindingGenerator.kt:615 */
  135    181   
    }
         182  +
    /* HttpBindingGenerator.kt:615 */
  136    183   
    if let ::std::option::Option::Some(inner_5) = &input.member_date_time {
         184  +
        /* HttpBindingGenerator.kt:727 */
  137    185   
        let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
         186  +
        /* HttpBindingGenerator.kt:728 */
  138    187   
        if !formatted_6.is_empty() {
         188  +
            /* HttpBindingGenerator.kt:729 */
  139    189   
            let header_value = formatted_6;
  140         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         190  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  141    191   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  142    192   
                    "member_date_time",
  143    193   
                    format!(
  144    194   
                        "`{}` cannot be used as a header value: {}",
  145    195   
                        &header_value, err
  146    196   
                    ),
  147    197   
                )
  148    198   
            })?;
  149    199   
            builder = builder.header("X-memberDateTime", header_value);
         200  +
            /* HttpBindingGenerator.kt:728 */
  150    201   
        }
         202  +
        /* HttpBindingGenerator.kt:615 */
  151    203   
    }
         204  +
    /* HttpBindingGenerator.kt:615 */
  152    205   
    if let ::std::option::Option::Some(inner_7) = &input.default_format {
         206  +
        /* HttpBindingGenerator.kt:727 */
  153    207   
        let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         208  +
        /* HttpBindingGenerator.kt:728 */
  154    209   
        if !formatted_8.is_empty() {
         210  +
            /* HttpBindingGenerator.kt:729 */
  155    211   
            let header_value = formatted_8;
  156         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         212  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  157    213   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  158    214   
                    "default_format",
  159    215   
                    format!(
  160    216   
                        "`{}` cannot be used as a header value: {}",
  161    217   
                        &header_value, err
  162    218   
                    ),
  163    219   
                )
  164    220   
            })?;
  165    221   
            builder = builder.header("X-defaultFormat", header_value);
         222  +
            /* HttpBindingGenerator.kt:728 */
  166    223   
        }
         224  +
        /* HttpBindingGenerator.kt:615 */
  167    225   
    }
         226  +
    /* HttpBindingGenerator.kt:615 */
  168    227   
    if let ::std::option::Option::Some(inner_9) = &input.target_epoch_seconds {
         228  +
        /* HttpBindingGenerator.kt:727 */
  169    229   
        let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
         230  +
        /* HttpBindingGenerator.kt:728 */
  170    231   
        if !formatted_10.is_empty() {
         232  +
            /* HttpBindingGenerator.kt:729 */
  171    233   
            let header_value = formatted_10;
  172         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         234  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  173    235   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  174    236   
                    "target_epoch_seconds",
  175    237   
                    format!(
  176    238   
                        "`{}` cannot be used as a header value: {}",
  177    239   
                        &header_value, err
  178    240   
                    ),
  179    241   
                )
  180    242   
            })?;
  181    243   
            builder = builder.header("X-targetEpochSeconds", header_value);
         244  +
            /* HttpBindingGenerator.kt:728 */
  182    245   
        }
         246  +
        /* HttpBindingGenerator.kt:615 */
  183    247   
    }
         248  +
    /* HttpBindingGenerator.kt:615 */
  184    249   
    if let ::std::option::Option::Some(inner_11) = &input.target_http_date {
         250  +
        /* HttpBindingGenerator.kt:727 */
  185    251   
        let formatted_12 = inner_11.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         252  +
        /* HttpBindingGenerator.kt:728 */
  186    253   
        if !formatted_12.is_empty() {
         254  +
            /* HttpBindingGenerator.kt:729 */
  187    255   
            let header_value = formatted_12;
  188         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         256  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  189    257   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  190    258   
                    "target_http_date",
  191    259   
                    format!(
  192    260   
                        "`{}` cannot be used as a header value: {}",
  193    261   
                        &header_value, err
  194    262   
                    ),
  195    263   
                )
  196    264   
            })?;
  197    265   
            builder = builder.header("X-targetHttpDate", header_value);
         266  +
            /* HttpBindingGenerator.kt:728 */
  198    267   
        }
         268  +
        /* HttpBindingGenerator.kt:615 */
  199    269   
    }
         270  +
    /* HttpBindingGenerator.kt:615 */
  200    271   
    if let ::std::option::Option::Some(inner_13) = &input.target_date_time {
         272  +
        /* HttpBindingGenerator.kt:727 */
  201    273   
        let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
         274  +
        /* HttpBindingGenerator.kt:728 */
  202    275   
        if !formatted_14.is_empty() {
         276  +
            /* HttpBindingGenerator.kt:729 */
  203    277   
            let header_value = formatted_14;
  204         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         278  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  205    279   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  206    280   
                    "target_date_time",
  207    281   
                    format!(
  208    282   
                        "`{}` cannot be used as a header value: {}",
  209    283   
                        &header_value, err
  210    284   
                    ),
  211    285   
                )
  212    286   
            })?;
  213    287   
            builder = builder.header("X-targetDateTime", header_value);
         288  +
            /* HttpBindingGenerator.kt:728 */
  214    289   
        }
         290  +
        /* HttpBindingGenerator.kt:615 */
  215    291   
    }
         292  +
    /* HttpBindingGenerator.kt:578 */
  216    293   
    Ok(builder)
         294  +
    /* HttpBindingGenerator.kt:565 */
  217    295   
}

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

@@ -1,1 +154,175 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:159 */
    2      3   
pub(crate) fn de_default_format_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::DateTime>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:166 */
    8     10   
    let headers = header_map.get_all("X-defaultFormat");
    9         -
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
   10         -
        headers,
   11         -
        ::aws_smithy_types::date_time::Format::HttpDate,
   12         -
    )?;
          11  +
    /* HttpBindingGenerator.kt:417 */
          12  +
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
          13  +
    /* HttpBindingGenerator.kt:425 */;
          14  +
    /* HttpBindingGenerator.kt:491 */
   13     15   
    if var_1.len() > 1 {
   14     16   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   15     17   
            "expected one item but found {}",
   16     18   
            var_1.len()
   17     19   
        )))
   18     20   
    } else {
   19     21   
        let mut var_1 = var_1;
   20     22   
        Ok(var_1.pop())
   21     23   
    }
          24  +
    /* HttpBindingGenerator.kt:159 */
   22     25   
}
   23     26   
          27  +
/* HttpBindingGenerator.kt:159 */
   24     28   
pub(crate) fn de_member_date_time_header(
   25     29   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   26     30   
) -> ::std::result::Result<
   27     31   
    ::std::option::Option<::aws_smithy_types::DateTime>,
   28     32   
    ::aws_smithy_http::header::ParseError,
   29     33   
> {
          34  +
    /* HttpBindingGenerator.kt:166 */
   30     35   
    let headers = header_map.get_all("X-memberDateTime");
   31         -
    let var_2: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
   32         -
        headers,
   33         -
        ::aws_smithy_types::date_time::Format::DateTime,
   34         -
    )?;
          36  +
    /* HttpBindingGenerator.kt:417 */
          37  +
    let var_2: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::DateTime)?
          38  +
    /* HttpBindingGenerator.kt:425 */;
          39  +
    /* HttpBindingGenerator.kt:491 */
   35     40   
    if var_2.len() > 1 {
   36     41   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   37     42   
            "expected one item but found {}",
   38     43   
            var_2.len()
   39     44   
        )))
   40     45   
    } else {
   41     46   
        let mut var_2 = var_2;
   42     47   
        Ok(var_2.pop())
   43     48   
    }
          49  +
    /* HttpBindingGenerator.kt:159 */
   44     50   
}
   45     51   
          52  +
/* HttpBindingGenerator.kt:159 */
   46     53   
pub(crate) fn de_member_epoch_seconds_header(
   47     54   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   48     55   
) -> ::std::result::Result<
   49     56   
    ::std::option::Option<::aws_smithy_types::DateTime>,
   50     57   
    ::aws_smithy_http::header::ParseError,
   51     58   
> {
          59  +
    /* HttpBindingGenerator.kt:166 */
   52     60   
    let headers = header_map.get_all("X-memberEpochSeconds");
   53         -
    let var_3: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
   54         -
        headers,
   55         -
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   56         -
    )?;
          61  +
    /* HttpBindingGenerator.kt:417 */
          62  +
    let var_3: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::EpochSeconds)?
          63  +
    /* HttpBindingGenerator.kt:425 */;
          64  +
    /* HttpBindingGenerator.kt:491 */
   57     65   
    if var_3.len() > 1 {
   58     66   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   59     67   
            "expected one item but found {}",
   60     68   
            var_3.len()
   61     69   
        )))
   62     70   
    } else {
   63     71   
        let mut var_3 = var_3;
   64     72   
        Ok(var_3.pop())
   65     73   
    }
          74  +
    /* HttpBindingGenerator.kt:159 */
   66     75   
}
   67     76   
          77  +
/* HttpBindingGenerator.kt:159 */
   68     78   
pub(crate) fn de_member_http_date_header(
   69     79   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   70     80   
) -> ::std::result::Result<
   71     81   
    ::std::option::Option<::aws_smithy_types::DateTime>,
   72     82   
    ::aws_smithy_http::header::ParseError,
   73     83   
> {
          84  +
    /* HttpBindingGenerator.kt:166 */
   74     85   
    let headers = header_map.get_all("X-memberHttpDate");
   75         -
    let var_4: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
   76         -
        headers,
   77         -
        ::aws_smithy_types::date_time::Format::HttpDate,
   78         -
    )?;
          86  +
    /* HttpBindingGenerator.kt:417 */
          87  +
    let var_4: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
          88  +
    /* HttpBindingGenerator.kt:425 */;
          89  +
    /* HttpBindingGenerator.kt:491 */
   79     90   
    if var_4.len() > 1 {
   80     91   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   81     92   
            "expected one item but found {}",
   82     93   
            var_4.len()
   83     94   
        )))
   84     95   
    } else {
   85     96   
        let mut var_4 = var_4;
   86     97   
        Ok(var_4.pop())
   87     98   
    }
          99  +
    /* HttpBindingGenerator.kt:159 */
   88    100   
}
   89    101   
         102  +
/* HttpBindingGenerator.kt:159 */
   90    103   
pub(crate) fn de_target_date_time_header(
   91    104   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   92    105   
) -> ::std::result::Result<
   93    106   
    ::std::option::Option<::aws_smithy_types::DateTime>,
   94    107   
    ::aws_smithy_http::header::ParseError,
   95    108   
> {
         109  +
    /* HttpBindingGenerator.kt:166 */
   96    110   
    let headers = header_map.get_all("X-targetDateTime");
   97         -
    let var_5: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
   98         -
        headers,
   99         -
        ::aws_smithy_types::date_time::Format::DateTime,
  100         -
    )?;
         111  +
    /* HttpBindingGenerator.kt:417 */
         112  +
    let var_5: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::DateTime)?
         113  +
    /* HttpBindingGenerator.kt:425 */;
         114  +
    /* HttpBindingGenerator.kt:491 */
  101    115   
    if var_5.len() > 1 {
  102    116   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  103    117   
            "expected one item but found {}",
  104    118   
            var_5.len()
  105    119   
        )))
  106    120   
    } else {
  107    121   
        let mut var_5 = var_5;
  108    122   
        Ok(var_5.pop())
  109    123   
    }
         124  +
    /* HttpBindingGenerator.kt:159 */
  110    125   
}
  111    126   
         127  +
/* HttpBindingGenerator.kt:159 */
  112    128   
pub(crate) fn de_target_epoch_seconds_header(
  113    129   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  114    130   
) -> ::std::result::Result<
  115    131   
    ::std::option::Option<::aws_smithy_types::DateTime>,
  116    132   
    ::aws_smithy_http::header::ParseError,
  117    133   
> {
         134  +
    /* HttpBindingGenerator.kt:166 */
  118    135   
    let headers = header_map.get_all("X-targetEpochSeconds");
  119         -
    let var_6: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
  120         -
        headers,
  121         -
        ::aws_smithy_types::date_time::Format::EpochSeconds,
  122         -
    )?;
         136  +
    /* HttpBindingGenerator.kt:417 */
         137  +
    let var_6: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::EpochSeconds)?
         138  +
    /* HttpBindingGenerator.kt:425 */;
         139  +
    /* HttpBindingGenerator.kt:491 */
  123    140   
    if var_6.len() > 1 {
  124    141   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  125    142   
            "expected one item but found {}",
  126    143   
            var_6.len()
  127    144   
        )))
  128    145   
    } else {
  129    146   
        let mut var_6 = var_6;
  130    147   
        Ok(var_6.pop())
  131    148   
    }
         149  +
    /* HttpBindingGenerator.kt:159 */
  132    150   
}
  133    151   
         152  +
/* HttpBindingGenerator.kt:159 */
  134    153   
pub(crate) fn de_target_http_date_header(
  135    154   
    header_map: &::aws_smithy_runtime_api::http::Headers,
  136    155   
) -> ::std::result::Result<
  137    156   
    ::std::option::Option<::aws_smithy_types::DateTime>,
  138    157   
    ::aws_smithy_http::header::ParseError,
  139    158   
> {
         159  +
    /* HttpBindingGenerator.kt:166 */
  140    160   
    let headers = header_map.get_all("X-targetHttpDate");
  141         -
    let var_7: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
  142         -
        headers,
  143         -
        ::aws_smithy_types::date_time::Format::HttpDate,
  144         -
    )?;
         161  +
    /* HttpBindingGenerator.kt:417 */
         162  +
    let var_7: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
         163  +
    /* HttpBindingGenerator.kt:425 */;
         164  +
    /* HttpBindingGenerator.kt:491 */
  145    165   
    if var_7.len() > 1 {
  146    166   
        Err(::aws_smithy_http::header::ParseError::new(format!(
  147    167   
            "expected one item but found {}",
  148    168   
            var_7.len()
  149    169   
        )))
  150    170   
    } else {
  151    171   
        let mut var_7 = var_7;
  152    172   
        Ok(var_7.pop())
  153    173   
    }
         174  +
    /* HttpBindingGenerator.kt:159 */
  154    175   
}

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

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_timestamp_format_headers_output_output_output(
    3      4   
    value: &crate::output::TimestampFormatHeadersOutput,
    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_timestamp_format_headers_output::ser_timestamp_format_headers_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_timestamp_format_headers_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::TimestampFormatHeadersOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

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

@@ -1,1 +52,74 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_timestamp_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::vec::Vec<::aws_smithy_types::DateTime>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<
   10     11   
        Item = Result<
   11     12   
            ::aws_smithy_json::deserialize::Token<'a>,
   12     13   
            ::aws_smithy_json::deserialize::error::DeserializeError,
   13     14   
        >,
   14     15   
    >,
   15     16   
{
          17  +
    /* JsonParserGenerator.kt:712 */
   16     18   
    match tokens.next().transpose()? {
          19  +
        /* JsonParserGenerator.kt:713 */
   17     20   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   18     21   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          22  +
            /* JsonParserGenerator.kt:407 */
   19     23   
            let mut items = Vec::new();
          24  +
            /* JsonParserGenerator.kt:408 */
   20     25   
            loop {
          26  +
                /* JsonParserGenerator.kt:409 */
   21     27   
                match tokens.peek() {
          28  +
                    /* JsonParserGenerator.kt:410 */
   22     29   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          30  +
                        /* JsonParserGenerator.kt:411 */
   23     31   
                        tokens.next().transpose().unwrap();
   24     32   
                        break;
          33  +
                        /* JsonParserGenerator.kt:410 */
   25     34   
                    }
          35  +
                    /* JsonParserGenerator.kt:413 */
   26     36   
                    _ => {
          37  +
                        /* JsonParserGenerator.kt:419 */
   27     38   
                        let value =
   28         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   29         -
                                tokens.next(),
   30         -
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
   31         -
                            )?;
          39  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          40  +
                        /* JsonParserGenerator.kt:419 */;
          41  +
                        /* JsonParserGenerator.kt:422 */
   32     42   
                        if let Some(value) = value {
   33     43   
                            items.push(value);
   34         -
                        } else {
          44  +
                        }
          45  +
                        /* JsonParserGenerator.kt:430 */
          46  +
                        else {
   35     47   
                            return Err(
   36     48   
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     49   
                                    "dense list cannot contain null values",
   38     50   
                                ),
   39     51   
                            );
   40     52   
                        }
   41         -
                    }
          53  +
                        /* JsonParserGenerator.kt:413 */
          54  +
                    } /* JsonParserGenerator.kt:409 */
   42     55   
                }
          56  +
                /* JsonParserGenerator.kt:408 */
   43     57   
            }
          58  +
            /* JsonParserGenerator.kt:446 */
   44     59   
            Ok(Some(items))
          60  +
            /* JsonParserGenerator.kt:713 */
   45     61   
        }
   46         -
        _ => Err(
   47         -
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48         -
                "expected start array or null",
   49         -
            ),
   50         -
        ),
          62  +
        /* JsonParserGenerator.kt:722 */
          63  +
        _ => {
          64  +
            /* JsonParserGenerator.kt:723 */
          65  +
            Err(
          66  +
                ::aws_smithy_json::deserialize::error::DeserializeError::custom(
          67  +
                    "expected start array or null",
          68  +
                ),
          69  +
            )
          70  +
            /* JsonParserGenerator.kt:722 */
          71  +
        } /* JsonParserGenerator.kt:712 */
   51     72   
    }
          73  +
    /* JsonParserGenerator.kt:398 */
   52     74   
}