Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_get_no_payload_output.rs

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_payload_blob.rs

@@ -1,1 +50,78 @@
    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  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_test_payload_blob_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<crate::operation::test_payload_blob::TestPayloadBlobOutput, crate::operation::test_payload_blob::TestPayloadBlobError> {
          10  +
    /* RustType.kt:516 */
    8     11   
    #[allow(unused_mut)]
          12  +
    /* ProtocolParserGenerator.kt:106 */
    9     13   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   10     14   
        .map_err(crate::operation::test_payload_blob::TestPayloadBlobError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::test_payload_blob::TestPayloadBlobError::generic(generic))
          19  +
    /* ProtocolParserGenerator.kt:99 */
   13     20   
}
   14     21   
          22  +
/* RustType.kt:516 */
   15     23   
#[allow(clippy::unnecessary_wraps)]
          24  +
/* ProtocolParserGenerator.kt:71 */
   16     25   
pub fn de_test_payload_blob_http_response(
   17     26   
    _response_status: u16,
   18     27   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   19     28   
    _response_body: &[u8],
   20     29   
) -> std::result::Result<crate::operation::test_payload_blob::TestPayloadBlobOutput, crate::operation::test_payload_blob::TestPayloadBlobError> {
          30  +
    /* ProtocolParserGenerator.kt:77 */
   21     31   
    Ok({
          32  +
        /* RustType.kt:516 */
   22     33   
        #[allow(unused_mut)]
          34  +
        /* ProtocolParserGenerator.kt:240 */
   23     35   
        let mut output = crate::operation::test_payload_blob::builders::TestPayloadBlobOutputBuilder::default();
          36  +
        /* ProtocolParserGenerator.kt:267 */
   24     37   
        output = output.set_content_type(
          38  +
            /* ProtocolParserGenerator.kt:302 */
   25     39   
            crate::protocol_serde::shape_test_payload_blob_output::de_content_type_header(_response_headers).map_err(|_| {
   26     40   
                crate::operation::test_payload_blob::TestPayloadBlobError::unhandled("Failed to parse contentType from header `Content-Type")
   27         -
            })?,
          41  +
            })?, /* ProtocolParserGenerator.kt:267 */
   28     42   
        );
   29         -
        output = output.set_data(crate::protocol_serde::shape_test_payload_blob_output::de_data_payload(_response_body)?);
          43  +
        /* ProtocolParserGenerator.kt:267 */
          44  +
        output = output.set_data(
          45  +
            /* ProtocolParserGenerator.kt:327 */
          46  +
            crate::protocol_serde::shape_test_payload_blob_output::de_data_payload(_response_body)?, /* ProtocolParserGenerator.kt:267 */
          47  +
        );
          48  +
        /* ClientBuilderInstantiator.kt:56 */
   30     49   
        output.build()
          50  +
        /* ProtocolParserGenerator.kt:77 */
   31     51   
    })
          52  +
    /* ProtocolParserGenerator.kt:71 */
   32     53   
}
   33     54   
          55  +
/* HttpBindingGenerator.kt:542 */
   34     56   
pub fn ser_test_payload_blob_headers(
   35     57   
    input: &crate::operation::test_payload_blob::TestPayloadBlobInput,
   36     58   
    mut builder: ::http::request::Builder,
   37     59   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          60  +
    /* HttpBindingGenerator.kt:592 */
   38     61   
    if let ::std::option::Option::Some(inner_1) = &input.content_type {
          62  +
        /* HttpBindingGenerator.kt:704 */
   39     63   
        let formatted_2 = inner_1.as_str();
          64  +
        /* HttpBindingGenerator.kt:706 */
   40     65   
        let header_value = formatted_2;
   41     66   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   42     67   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   43     68   
                "content_type",
   44     69   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45     70   
            )
   46     71   
        })?;
   47     72   
        builder = builder.header("Content-Type", header_value);
          73  +
        /* HttpBindingGenerator.kt:592 */
   48     74   
    }
          75  +
    /* HttpBindingGenerator.kt:555 */
   49     76   
    Ok(builder)
          77  +
    /* HttpBindingGenerator.kt:542 */
   50     78   
}

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

@@ -1,1 +10,20 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    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: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 */ Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          12  +
            )
          13  +
        }
    8     14   
    };
    9         -
    Ok(payload.into_inner())
          15  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          16  +
    Ok(
          17  +
        /* HttpBoundProtocolPayloadGenerator.kt:377 */ payload.into_inner(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          18  +
    )
          19  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     20   
}

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

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

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

@@ -1,1 +58,83 @@
    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  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_test_payload_structure_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::test_payload_structure::TestPayloadStructureOutput,
    9     11   
    crate::operation::test_payload_structure::TestPayloadStructureError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::test_payload_structure::TestPayloadStructureError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::test_payload_structure::TestPayloadStructureError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_test_payload_structure_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::test_payload_structure::TestPayloadStructureOutput,
   25     34   
    crate::operation::test_payload_structure::TestPayloadStructureError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::test_payload_structure::builders::TestPayloadStructureOutputBuilder::default();
   30         -
        output = output.set_payload_config(crate::protocol_serde::shape_test_payload_structure_output::de_payload_config_payload(
   31         -
            _response_body,
   32         -
        )?);
          42  +
        /* ProtocolParserGenerator.kt:267 */
          43  +
        output = output.set_payload_config(
          44  +
            /* ProtocolParserGenerator.kt:327 */crate::protocol_serde::shape_test_payload_structure_output::de_payload_config_payload(_response_body)?
          45  +
        /* ProtocolParserGenerator.kt:267 */);
          46  +
        /* ProtocolParserGenerator.kt:267 */
   33     47   
        output = output.set_test_id(
          48  +
            /* ProtocolParserGenerator.kt:302 */
   34     49   
            crate::protocol_serde::shape_test_payload_structure_output::de_test_id_header(_response_headers).map_err(|_| {
   35     50   
                crate::operation::test_payload_structure::TestPayloadStructureError::unhandled("Failed to parse testId from header `x-amz-test-id")
   36         -
            })?,
          51  +
            })?, /* ProtocolParserGenerator.kt:267 */
   37     52   
        );
          53  +
        /* ClientBuilderInstantiator.kt:56 */
   38     54   
        output.build()
          55  +
        /* ProtocolParserGenerator.kt:77 */
   39     56   
    })
          57  +
    /* ProtocolParserGenerator.kt:71 */
   40     58   
}
   41     59   
          60  +
/* HttpBindingGenerator.kt:542 */
   42     61   
pub fn ser_test_payload_structure_headers(
   43     62   
    input: &crate::operation::test_payload_structure::TestPayloadStructureInput,
   44     63   
    mut builder: ::http::request::Builder,
   45     64   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          65  +
    /* HttpBindingGenerator.kt:592 */
   46     66   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          67  +
        /* HttpBindingGenerator.kt:704 */
   47     68   
        let formatted_2 = inner_1.as_str();
          69  +
        /* HttpBindingGenerator.kt:706 */
   48     70   
        let header_value = formatted_2;
   49     71   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   50     72   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   51     73   
                "test_id",
   52     74   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   53     75   
            )
   54     76   
        })?;
   55     77   
        builder = builder.header("x-amz-test-id", header_value);
          78  +
        /* HttpBindingGenerator.kt:592 */
   56     79   
    }
          80  +
    /* HttpBindingGenerator.kt:555 */
   57     81   
    Ok(builder)
          82  +
    /* HttpBindingGenerator.kt:542 */
   58     83   
}

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

@@ -1,1 +22,39 @@
    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_config_http_payload(
    3      4   
    payload: &::std::option::Option<crate::types::PayloadConfig>,
    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   
    };
    9         -
    Ok(crate::protocol_serde::shape_test_payload_structure_input::ser_payload_config_payload(
   10         -
        payload,
   11         -
    )?)
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:386 */
          19  +
        crate::protocol_serde::shape_test_payload_structure_input::ser_payload_config_payload(payload)?, /* HttpBoundProtocolPayloadGenerator.kt:345 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   12     22   
}
   13     23   
          24  +
/* JsonSerializerGenerator.kt:240 */
   14     25   
pub fn ser_payload_config_payload(
   15     26   
    input: &crate::types::PayloadConfig,
   16     27   
) -> std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::SerializationError> {
          28  +
    /* JsonSerializerGenerator.kt:245 */
   17     29   
    let mut out = String::new();
          30  +
    /* JsonSerializerGenerator.kt:246 */
   18     31   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          32  +
    /* JsonSerializerGenerator.kt:375 */
   19     33   
    crate::protocol_serde::shape_payload_config::ser_payload_config(&mut object, input)?;
          34  +
    /* JsonSerializerGenerator.kt:252 */
   20     35   
    object.finish();
          36  +
    /* JsonSerializerGenerator.kt:253 */
   21     37   
    Ok(out.into_bytes())
          38  +
    /* JsonSerializerGenerator.kt:240 */
   22     39   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_payload_structure_output.rs

@@ -1,1 +18,27 @@
    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_config_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<::std::option::Option<crate::types::PayloadConfig>, crate::operation::test_payload_structure::TestPayloadStructureError> {
           6  +
    /* HttpBindingGenerator.kt:319 */
    5      7   
    (!body.is_empty())
    6      8   
        .then(|| {
           9  +
            /* ProtocolParserGenerator.kt:316 */
    7     10   
            crate::protocol_serde::shape_payload_config::de_payload_config_payload(body)
    8     11   
                .map_err(crate::operation::test_payload_structure::TestPayloadStructureError::unhandled)
          12  +
            /* HttpBindingGenerator.kt:319 */
    9     13   
        })
   10     14   
        .transpose()
          15  +
    /* HttpBindingGenerator.kt:248 */
   11     16   
}
   12     17   
          18  +
/* HttpBindingGenerator.kt:153 */
   13     19   
pub(crate) fn de_test_id_header(
   14     20   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     21   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
          22  +
    /* HttpBindingGenerator.kt:160 */
   16     23   
    let headers = header_map.get_all("x-amz-test-id");
          24  +
    /* HttpBindingGenerator.kt:375 */
   17     25   
    ::aws_smithy_http::header::one_or_none(headers)
          26  +
    /* HttpBindingGenerator.kt:153 */
   18     27   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_post_no_input_no_payload.rs

@@ -1,1 +41,58 @@
    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  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_test_post_no_input_no_payload_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadOutput,
    9     11   
    crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError::generic(
   16     22   
        generic,
   17     23   
    ))
          24  +
    /* ProtocolParserGenerator.kt:99 */
   18     25   
}
   19     26   
          27  +
/* RustType.kt:516 */
   20     28   
#[allow(clippy::unnecessary_wraps)]
          29  +
/* ProtocolParserGenerator.kt:71 */
   21     30   
pub fn de_test_post_no_input_no_payload_http_response(
   22     31   
    _response_status: u16,
   23     32   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24     33   
    _response_body: &[u8],
   25     34   
) -> std::result::Result<
   26     35   
    crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadOutput,
   27     36   
    crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError,
   28     37   
> {
          38  +
    /* ProtocolParserGenerator.kt:77 */
   29     39   
    Ok({
          40  +
        /* RustType.kt:516 */
   30     41   
        #[allow(unused_mut)]
          42  +
        /* ProtocolParserGenerator.kt:240 */
   31     43   
        let mut output = crate::operation::test_post_no_input_no_payload::builders::TestPostNoInputNoPayloadOutputBuilder::default();
          44  +
        /* ProtocolParserGenerator.kt:267 */
   32     45   
        output = output.set_test_id(
          46  +
            /* ProtocolParserGenerator.kt:302 */
   33     47   
            crate::protocol_serde::shape_test_post_no_input_no_payload_output::de_test_id_header(_response_headers).map_err(|_| {
   34     48   
                crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError::unhandled(
   35     49   
                    "Failed to parse testId from header `X-Amz-Test-Id",
   36     50   
                )
   37         -
            })?,
          51  +
            })?, /* ProtocolParserGenerator.kt:267 */
   38     52   
        );
          53  +
        /* ClientBuilderInstantiator.kt:56 */
   39     54   
        output.build()
          55  +
        /* ProtocolParserGenerator.kt:77 */
   40     56   
    })
          57  +
    /* ProtocolParserGenerator.kt:71 */
   41     58   
}

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

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

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

@@ -1,1 +55,79 @@
    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  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_test_post_no_payload_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::test_post_no_payload::TestPostNoPayloadOutput,
    9     11   
    crate::operation::test_post_no_payload::TestPostNoPayloadError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::test_post_no_payload::TestPostNoPayloadError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::test_post_no_payload::TestPostNoPayloadError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_test_post_no_payload_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::test_post_no_payload::TestPostNoPayloadOutput,
   25     34   
    crate::operation::test_post_no_payload::TestPostNoPayloadError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::test_post_no_payload::builders::TestPostNoPayloadOutputBuilder::default();
          42  +
        /* ProtocolParserGenerator.kt:267 */
   30     43   
        output = output.set_test_id(
          44  +
            /* ProtocolParserGenerator.kt:302 */
   31     45   
            crate::protocol_serde::shape_test_post_no_payload_output::de_test_id_header(_response_headers).map_err(|_| {
   32     46   
                crate::operation::test_post_no_payload::TestPostNoPayloadError::unhandled("Failed to parse testId from header `X-Amz-Test-Id")
   33         -
            })?,
          47  +
            })?, /* ProtocolParserGenerator.kt:267 */
   34     48   
        );
          49  +
        /* ClientBuilderInstantiator.kt:56 */
   35     50   
        output.build()
          51  +
        /* ProtocolParserGenerator.kt:77 */
   36     52   
    })
          53  +
    /* ProtocolParserGenerator.kt:71 */
   37     54   
}
   38     55   
          56  +
/* HttpBindingGenerator.kt:542 */
   39     57   
pub fn ser_test_post_no_payload_headers(
   40     58   
    input: &crate::operation::test_post_no_payload::TestPostNoPayloadInput,
   41     59   
    mut builder: ::http::request::Builder,
   42     60   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          61  +
    /* HttpBindingGenerator.kt:592 */
   43     62   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          63  +
        /* HttpBindingGenerator.kt:704 */
   44     64   
        let formatted_2 = inner_1.as_str();
          65  +
        /* HttpBindingGenerator.kt:706 */
   45     66   
        let header_value = formatted_2;
   46     67   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   47     68   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   48     69   
                "test_id",
   49     70   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   50     71   
            )
   51     72   
        })?;
   52     73   
        builder = builder.header("X-Amz-Test-Id", header_value);
          74  +
        /* HttpBindingGenerator.kt:592 */
   53     75   
    }
          76  +
    /* HttpBindingGenerator.kt:555 */
   54     77   
    Ok(builder)
          78  +
    /* HttpBindingGenerator.kt:542 */
   55     79   
}

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

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

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

@@ -1,1 +34,59 @@
    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<Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5      6   
where
    6      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7      8   
{
           9  +
    /* JsonParserGenerator.kt:712 */
    8     10   
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          11  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10     12   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          13  +
            /* JsonParserGenerator.kt:407 */
   11     14   
            let mut items = Vec::new();
          15  +
            /* JsonParserGenerator.kt:408 */
   12     16   
            loop {
          17  +
                /* JsonParserGenerator.kt:409 */
   13     18   
                match tokens.peek() {
          19  +
                    /* JsonParserGenerator.kt:410 */
   14     20   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          21  +
                        /* JsonParserGenerator.kt:411 */
   15     22   
                        tokens.next().transpose().unwrap();
   16     23   
                        break;
          24  +
                        /* JsonParserGenerator.kt:410 */
   17     25   
                    }
          26  +
                    /* JsonParserGenerator.kt:413 */
   18     27   
                    _ => {
   19         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   20         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   21         -
                            .transpose()?;
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          31  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          32  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          33  +
                                /* JsonParserGenerator.kt:339 */)
          34  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          35  +
                        /* JsonParserGenerator.kt:419 */;
          36  +
                        /* JsonParserGenerator.kt:422 */
   22     37   
                        if let Some(value) = value {
   23     38   
                            items.push(value);
   24     39   
                        }
          40  +
                        /* JsonParserGenerator.kt:413 */
          41  +
                    } /* JsonParserGenerator.kt:409 */
   25     42   
                }
          43  +
                /* JsonParserGenerator.kt:408 */
   26     44   
            }
   27         -
            }
          45  +
            /* JsonParserGenerator.kt:446 */
   28     46   
            Ok(Some(items))
          47  +
            /* JsonParserGenerator.kt:713 */
   29     48   
        }
   30         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          49  +
        /* JsonParserGenerator.kt:722 */
          50  +
        _ => {
          51  +
            /* JsonParserGenerator.kt:723 */
          52  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31     53   
                "expected start array or null",
   32         -
        )),
          54  +
            ))
          55  +
            /* JsonParserGenerator.kt:722 */
          56  +
        } /* JsonParserGenerator.kt:712 */
   33     57   
    }
          58  +
    /* JsonParserGenerator.kt:398 */
   34     59   
}

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

@@ -1,1 +41,68 @@
    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<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   10     11   
{
          12  +
    /* JsonParserGenerator.kt:712 */
   11     13   
    match tokens.next().transpose()? {
   12         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          14  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   13     15   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          16  +
            /* JsonParserGenerator.kt:469 */
   14     17   
            let mut map = ::std::collections::HashMap::new();
          18  +
            /* JsonParserGenerator.kt:684 */
   15     19   
            loop {
          20  +
                /* JsonParserGenerator.kt:685 */
   16     21   
                match tokens.next().transpose()? {
   17         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   18     23   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   19         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   20         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   21         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   22         -
                            .transpose()?;
          24  +
                        /* JsonParserGenerator.kt:471 */
          25  +
                        let key =
          26  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          27  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          28  +
                            /* JsonParserGenerator.kt:339 */)
          29  +
                        /* JsonParserGenerator.kt:471 */?;
          30  +
                        /* JsonParserGenerator.kt:474 */
          31  +
                        let value =
          32  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          33  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          34  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                                /* JsonParserGenerator.kt:339 */)
          36  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          37  +
                        /* JsonParserGenerator.kt:474 */;
          38  +
                        /* JsonParserGenerator.kt:491 */
   23     39   
                        if let Some(value) = value {
   24     40   
                            map.insert(key, value);
   25     41   
                        }
          42  +
                        /* JsonParserGenerator.kt:686 */
   26     43   
                    }
          44  +
                    /* JsonParserGenerator.kt:695 */
   27     45   
                    other => {
   28     46   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   29     47   
                            "expected object key or end object, found: {:?}",
   30     48   
                            other
   31     49   
                        )))
          50  +
                    } /* JsonParserGenerator.kt:685 */
   32     51   
                }
          52  +
                /* JsonParserGenerator.kt:684 */
   33     53   
            }
   34         -
            }
          54  +
            /* JsonParserGenerator.kt:504 */
   35     55   
            Ok(Some(map))
          56  +
            /* JsonParserGenerator.kt:713 */
   36     57   
        }
   37         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          58  +
        /* JsonParserGenerator.kt:722 */
          59  +
        _ => {
          60  +
            /* JsonParserGenerator.kt:723 */
          61  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   38     62   
                "expected start object or null",
   39         -
        )),
          63  +
            ))
          64  +
            /* JsonParserGenerator.kt:722 */
          65  +
        } /* JsonParserGenerator.kt:712 */
   40     66   
    }
          67  +
    /* JsonParserGenerator.kt:460 */
   41     68   
}

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

@@ -1,1 +165,225 @@
    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  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_timestamp_format_headers_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::timestamp_format_headers::TimestampFormatHeadersOutput,
    9     11   
    crate::operation::timestamp_format_headers::TimestampFormatHeadersError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::timestamp_format_headers::TimestampFormatHeadersError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_timestamp_format_headers_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::timestamp_format_headers::TimestampFormatHeadersOutput,
   25     34   
    crate::operation::timestamp_format_headers::TimestampFormatHeadersError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::timestamp_format_headers::builders::TimestampFormatHeadersOutputBuilder::default();
          42  +
        /* ProtocolParserGenerator.kt:267 */
   30     43   
        output = output.set_default_format(
          44  +
            /* ProtocolParserGenerator.kt:302 */
   31     45   
            crate::protocol_serde::shape_timestamp_format_headers_output::de_default_format_header(_response_headers).map_err(|_| {
   32     46   
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   33     47   
                    "Failed to parse defaultFormat from header `X-defaultFormat",
   34     48   
                )
   35         -
            })?,
          49  +
            })?, /* ProtocolParserGenerator.kt:267 */
   36     50   
        );
          51  +
        /* ProtocolParserGenerator.kt:267 */
   37     52   
        output = output.set_member_date_time(
          53  +
            /* ProtocolParserGenerator.kt:302 */
   38     54   
            crate::protocol_serde::shape_timestamp_format_headers_output::de_member_date_time_header(_response_headers).map_err(|_| {
   39     55   
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   40     56   
                    "Failed to parse memberDateTime from header `X-memberDateTime",
   41     57   
                )
   42         -
            })?,
          58  +
            })?, /* ProtocolParserGenerator.kt:267 */
   43     59   
        );
          60  +
        /* ProtocolParserGenerator.kt:267 */
   44     61   
        output = output.set_member_epoch_seconds(
          62  +
            /* ProtocolParserGenerator.kt:302 */
   45     63   
            crate::protocol_serde::shape_timestamp_format_headers_output::de_member_epoch_seconds_header(_response_headers).map_err(|_| {
   46     64   
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   47     65   
                    "Failed to parse memberEpochSeconds from header `X-memberEpochSeconds",
   48     66   
                )
   49         -
            })?,
          67  +
            })?, /* ProtocolParserGenerator.kt:267 */
   50     68   
        );
          69  +
        /* ProtocolParserGenerator.kt:267 */
   51     70   
        output = output.set_member_http_date(
          71  +
            /* ProtocolParserGenerator.kt:302 */
   52     72   
            crate::protocol_serde::shape_timestamp_format_headers_output::de_member_http_date_header(_response_headers).map_err(|_| {
   53     73   
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   54     74   
                    "Failed to parse memberHttpDate from header `X-memberHttpDate",
   55     75   
                )
   56         -
            })?,
          76  +
            })?, /* ProtocolParserGenerator.kt:267 */
   57     77   
        );
          78  +
        /* ProtocolParserGenerator.kt:267 */
   58     79   
        output = output.set_target_date_time(
          80  +
            /* ProtocolParserGenerator.kt:302 */
   59     81   
            crate::protocol_serde::shape_timestamp_format_headers_output::de_target_date_time_header(_response_headers).map_err(|_| {
   60     82   
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   61     83   
                    "Failed to parse targetDateTime from header `X-targetDateTime",
   62     84   
                )
   63         -
            })?,
          85  +
            })?, /* ProtocolParserGenerator.kt:267 */
   64     86   
        );
          87  +
        /* ProtocolParserGenerator.kt:267 */
   65     88   
        output = output.set_target_epoch_seconds(
          89  +
            /* ProtocolParserGenerator.kt:302 */
   66     90   
            crate::protocol_serde::shape_timestamp_format_headers_output::de_target_epoch_seconds_header(_response_headers).map_err(|_| {
   67     91   
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   68     92   
                    "Failed to parse targetEpochSeconds from header `X-targetEpochSeconds",
   69     93   
                )
   70         -
            })?,
          94  +
            })?, /* ProtocolParserGenerator.kt:267 */
   71     95   
        );
          96  +
        /* ProtocolParserGenerator.kt:267 */
   72     97   
        output = output.set_target_http_date(
          98  +
            /* ProtocolParserGenerator.kt:302 */
   73     99   
            crate::protocol_serde::shape_timestamp_format_headers_output::de_target_http_date_header(_response_headers).map_err(|_| {
   74    100   
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   75    101   
                    "Failed to parse targetHttpDate from header `X-targetHttpDate",
   76    102   
                )
   77         -
            })?,
         103  +
            })?, /* ProtocolParserGenerator.kt:267 */
   78    104   
        );
         105  +
        /* ClientBuilderInstantiator.kt:56 */
   79    106   
        output.build()
         107  +
        /* ProtocolParserGenerator.kt:77 */
   80    108   
    })
         109  +
    /* ProtocolParserGenerator.kt:71 */
   81    110   
}
   82    111   
         112  +
/* HttpBindingGenerator.kt:542 */
   83    113   
pub fn ser_timestamp_format_headers_headers(
   84    114   
    input: &crate::operation::timestamp_format_headers::TimestampFormatHeadersInput,
   85    115   
    mut builder: ::http::request::Builder,
   86    116   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
         117  +
    /* HttpBindingGenerator.kt:592 */
   87    118   
    if let ::std::option::Option::Some(inner_1) = &input.member_epoch_seconds {
         119  +
        /* HttpBindingGenerator.kt:704 */
   88    120   
        let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
         121  +
        /* HttpBindingGenerator.kt:706 */
   89    122   
        let header_value = formatted_2;
   90    123   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   91    124   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   92    125   
                "member_epoch_seconds",
   93    126   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   94    127   
            )
   95    128   
        })?;
   96    129   
        builder = builder.header("X-memberEpochSeconds", header_value);
         130  +
        /* HttpBindingGenerator.kt:592 */
   97    131   
    }
         132  +
    /* HttpBindingGenerator.kt:592 */
   98    133   
    if let ::std::option::Option::Some(inner_3) = &input.member_http_date {
         134  +
        /* HttpBindingGenerator.kt:704 */
   99    135   
        let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         136  +
        /* HttpBindingGenerator.kt:706 */
  100    137   
        let header_value = formatted_4;
  101    138   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  102    139   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  103    140   
                "member_http_date",
  104    141   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  105    142   
            )
  106    143   
        })?;
  107    144   
        builder = builder.header("X-memberHttpDate", header_value);
         145  +
        /* HttpBindingGenerator.kt:592 */
  108    146   
    }
         147  +
    /* HttpBindingGenerator.kt:592 */
  109    148   
    if let ::std::option::Option::Some(inner_5) = &input.member_date_time {
         149  +
        /* HttpBindingGenerator.kt:704 */
  110    150   
        let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
         151  +
        /* HttpBindingGenerator.kt:706 */
  111    152   
        let header_value = formatted_6;
  112    153   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  113    154   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  114    155   
                "member_date_time",
  115    156   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  116    157   
            )
  117    158   
        })?;
  118    159   
        builder = builder.header("X-memberDateTime", header_value);
         160  +
        /* HttpBindingGenerator.kt:592 */
  119    161   
    }
         162  +
    /* HttpBindingGenerator.kt:592 */
  120    163   
    if let ::std::option::Option::Some(inner_7) = &input.default_format {
         164  +
        /* HttpBindingGenerator.kt:704 */
  121    165   
        let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         166  +
        /* HttpBindingGenerator.kt:706 */
  122    167   
        let header_value = formatted_8;
  123    168   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  124    169   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  125    170   
                "default_format",
  126    171   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  127    172   
            )
  128    173   
        })?;
  129    174   
        builder = builder.header("X-defaultFormat", header_value);
         175  +
        /* HttpBindingGenerator.kt:592 */
  130    176   
    }
         177  +
    /* HttpBindingGenerator.kt:592 */
  131    178   
    if let ::std::option::Option::Some(inner_9) = &input.target_epoch_seconds {
         179  +
        /* HttpBindingGenerator.kt:704 */
  132    180   
        let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
         181  +
        /* HttpBindingGenerator.kt:706 */
  133    182   
        let header_value = formatted_10;
  134    183   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  135    184   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  136    185   
                "target_epoch_seconds",
  137    186   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  138    187   
            )
  139    188   
        })?;
  140    189   
        builder = builder.header("X-targetEpochSeconds", header_value);
         190  +
        /* HttpBindingGenerator.kt:592 */
  141    191   
    }
         192  +
    /* HttpBindingGenerator.kt:592 */
  142    193   
    if let ::std::option::Option::Some(inner_11) = &input.target_http_date {
         194  +
        /* HttpBindingGenerator.kt:704 */
  143    195   
        let formatted_12 = inner_11.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         196  +
        /* HttpBindingGenerator.kt:706 */
  144    197   
        let header_value = formatted_12;
  145    198   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  146    199   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  147    200   
                "target_http_date",
  148    201   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  149    202   
            )
  150    203   
        })?;
  151    204   
        builder = builder.header("X-targetHttpDate", header_value);
         205  +
        /* HttpBindingGenerator.kt:592 */
  152    206   
    }
         207  +
    /* HttpBindingGenerator.kt:592 */
  153    208   
    if let ::std::option::Option::Some(inner_13) = &input.target_date_time {
         209  +
        /* HttpBindingGenerator.kt:704 */
  154    210   
        let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
         211  +
        /* HttpBindingGenerator.kt:706 */
  155    212   
        let header_value = formatted_14;
  156    213   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  157    214   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  158    215   
                "target_date_time",
  159    216   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  160    217   
            )
  161    218   
        })?;
  162    219   
        builder = builder.header("X-targetDateTime", header_value);
         220  +
        /* HttpBindingGenerator.kt:592 */
  163    221   
    }
         222  +
    /* HttpBindingGenerator.kt:555 */
  164    223   
    Ok(builder)
         224  +
    /* HttpBindingGenerator.kt:542 */
  165    225   
}

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

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

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

@@ -1,1 +35,55 @@
    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<Option<::std::vec::Vec<::aws_smithy_types::DateTime>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5      6   
where
    6      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7      8   
{
           9  +
    /* JsonParserGenerator.kt:712 */
    8     10   
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          11  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10     12   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          13  +
            /* JsonParserGenerator.kt:407 */
   11     14   
            let mut items = Vec::new();
          15  +
            /* JsonParserGenerator.kt:408 */
   12     16   
            loop {
          17  +
                /* JsonParserGenerator.kt:409 */
   13     18   
                match tokens.peek() {
          19  +
                    /* JsonParserGenerator.kt:410 */
   14     20   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          21  +
                        /* JsonParserGenerator.kt:411 */
   15     22   
                        tokens.next().transpose().unwrap();
   16     23   
                        break;
          24  +
                        /* JsonParserGenerator.kt:410 */
   17     25   
                    }
          26  +
                    /* JsonParserGenerator.kt:413 */
   18     27   
                    _ => {
   19         -
                        let value = ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   20         -
                            tokens.next(),
   21         -
                            ::aws_smithy_types::date_time::Format::EpochSeconds,
   22         -
                        )?;
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:384 */::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          31  +
                        /* JsonParserGenerator.kt:419 */;
          32  +
                        /* JsonParserGenerator.kt:422 */
   23     33   
                        if let Some(value) = value {
   24     34   
                            items.push(value);
   25     35   
                        }
          36  +
                        /* JsonParserGenerator.kt:413 */
          37  +
                    } /* JsonParserGenerator.kt:409 */
   26     38   
                }
          39  +
                /* JsonParserGenerator.kt:408 */
   27     40   
            }
   28         -
            }
          41  +
            /* JsonParserGenerator.kt:446 */
   29     42   
            Ok(Some(items))
          43  +
            /* JsonParserGenerator.kt:713 */
   30     44   
        }
   31         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          45  +
        /* JsonParserGenerator.kt:722 */
          46  +
        _ => {
          47  +
            /* JsonParserGenerator.kt:723 */
          48  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   32     49   
                "expected start array or null",
   33         -
        )),
          50  +
            ))
          51  +
            /* JsonParserGenerator.kt:722 */
          52  +
        } /* JsonParserGenerator.kt:712 */
   34     53   
    }
          54  +
    /* JsonParserGenerator.kt:398 */
   35     55   
}