Client Test

Client Test

rev. 32b1b3c3761061baed26023be3219639e42d7d12 (ignoring whitespace)

Files changed:

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

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

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

@@ -1,0 +51,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_test_get_no_payload_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<crate::operation::test_get_no_payload::TestGetNoPayloadOutput, crate::operation::test_get_no_payload::TestGetNoPayloadError>
    8         -
{
    9         -
    #[allow(unused_mut)]
   10         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   11         -
        .map_err(crate::operation::test_get_no_payload::TestGetNoPayloadError::unhandled)?;
   12         -
    let generic = generic_builder.build();
   13         -
    Err(crate::operation::test_get_no_payload::TestGetNoPayloadError::generic(generic))
   14         -
}
   15         -
   16         -
#[allow(clippy::unnecessary_wraps)]
   17         -
pub fn de_test_get_no_payload_http_response(
   18         -
    _response_status: u16,
   19         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   20         -
    _response_body: &[u8],
   21         -
) -> std::result::Result<crate::operation::test_get_no_payload::TestGetNoPayloadOutput, crate::operation::test_get_no_payload::TestGetNoPayloadError>
   22         -
{
   23         -
    Ok({
   24         -
        #[allow(unused_mut)]
   25         -
        let mut output = crate::operation::test_get_no_payload::builders::TestGetNoPayloadOutputBuilder::default();
   26         -
        output = output.set_test_id(
   27         -
            crate::protocol_serde::shape_test_get_no_payload_output::de_test_id_header(_response_headers).map_err(|_| {
   28         -
                crate::operation::test_get_no_payload::TestGetNoPayloadError::unhandled("Failed to parse testId from header `X-Amz-Test-Id")
   29         -
            })?,
   30         -
        );
   31         -
        output.build()
   32         -
    })
   33         -
}
   34         -
   35         -
pub fn ser_test_get_no_payload_headers(
   36         -
    input: &crate::operation::test_get_no_payload::TestGetNoPayloadInput,
   37         -
    mut builder: ::http_1x::request::Builder,
   38         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   39         -
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
   40         -
        let formatted_2 = inner_1.as_str();
   41         -
        let header_value = formatted_2;
   42         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   43         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   44         -
                "test_id",
   45         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   46         -
            )
   47         -
        })?;
   48         -
        builder = builder.header("X-Amz-Test-Id", header_value);
   49         -
    }
   50         -
    Ok(builder)
   51         -
}

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

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

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

@@ -1,0 +50,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_test_payload_blob_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<crate::operation::test_payload_blob::TestPayloadBlobOutput, crate::operation::test_payload_blob::TestPayloadBlobError> {
    8         -
    #[allow(unused_mut)]
    9         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   10         -
        .map_err(crate::operation::test_payload_blob::TestPayloadBlobError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::test_payload_blob::TestPayloadBlobError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_test_payload_blob_http_response(
   17         -
    _response_status: u16,
   18         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   19         -
    _response_body: &[u8],
   20         -
) -> std::result::Result<crate::operation::test_payload_blob::TestPayloadBlobOutput, crate::operation::test_payload_blob::TestPayloadBlobError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::test_payload_blob::builders::TestPayloadBlobOutputBuilder::default();
   24         -
        output = output.set_content_type(
   25         -
            crate::protocol_serde::shape_test_payload_blob_output::de_content_type_header(_response_headers).map_err(|_| {
   26         -
                crate::operation::test_payload_blob::TestPayloadBlobError::unhandled("Failed to parse contentType from header `Content-Type")
   27         -
            })?,
   28         -
        );
   29         -
        output = output.set_data(crate::protocol_serde::shape_test_payload_blob_output::de_data_payload(_response_body)?);
   30         -
        output.build()
   31         -
    })
   32         -
}
   33         -
   34         -
pub fn ser_test_payload_blob_headers(
   35         -
    input: &crate::operation::test_payload_blob::TestPayloadBlobInput,
   36         -
    mut builder: ::http_1x::request::Builder,
   37         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   38         -
    if let ::std::option::Option::Some(inner_1) = &input.content_type {
   39         -
        let formatted_2 = inner_1.as_str();
   40         -
        let header_value = formatted_2;
   41         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   42         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   43         -
                "content_type",
   44         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45         -
            )
   46         -
        })?;
   47         -
        builder = builder.header("Content-Type", header_value);
   48         -
    }
   49         -
    Ok(builder)
   50         -
}

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

@@ -1,0 +10,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_data_http_payload(
    3         -
    payload: ::std::option::Option<::aws_smithy_types::Blob>,
    4         -
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
    5         -
    let payload = match payload {
    6         -
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
    8         -
    };
    9         -
    Ok(payload.into_inner())
   10         -
}

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

@@ -1,0 +13,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_content_type_header(
    3         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4         -
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
    5         -
    let headers = header_map.get_all("Content-Type");
    6         -
    ::aws_smithy_http::header::one_or_none(headers)
    7         -
}
    8         -
    9         -
pub(crate) fn de_data_payload(
   10         -
    body: &[u8],
   11         -
) -> 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()
   13         -
}

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

@@ -1,0 +58,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_test_payload_structure_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<
    8         -
    crate::operation::test_payload_structure::TestPayloadStructureOutput,
    9         -
    crate::operation::test_payload_structure::TestPayloadStructureError,
   10         -
> {
   11         -
    #[allow(unused_mut)]
   12         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13         -
        .map_err(crate::operation::test_payload_structure::TestPayloadStructureError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::test_payload_structure::TestPayloadStructureError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_test_payload_structure_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::test_payload_structure::TestPayloadStructureOutput,
   25         -
    crate::operation::test_payload_structure::TestPayloadStructureError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        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         -
        )?);
   33         -
        output = output.set_test_id(
   34         -
            crate::protocol_serde::shape_test_payload_structure_output::de_test_id_header(_response_headers).map_err(|_| {
   35         -
                crate::operation::test_payload_structure::TestPayloadStructureError::unhandled("Failed to parse testId from header `x-amz-test-id")
   36         -
            })?,
   37         -
        );
   38         -
        output.build()
   39         -
    })
   40         -
}
   41         -
   42         -
pub fn ser_test_payload_structure_headers(
   43         -
    input: &crate::operation::test_payload_structure::TestPayloadStructureInput,
   44         -
    mut builder: ::http_1x::request::Builder,
   45         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   46         -
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
   47         -
        let formatted_2 = inner_1.as_str();
   48         -
        let header_value = formatted_2;
   49         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   50         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   51         -
                "test_id",
   52         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   53         -
            )
   54         -
        })?;
   55         -
        builder = builder.header("x-amz-test-id", header_value);
   56         -
    }
   57         -
    Ok(builder)
   58         -
}

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

@@ -1,0 +22,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_payload_config_http_payload(
    3         -
    payload: &::std::option::Option<crate::types::PayloadConfig>,
    4         -
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
    5         -
    let payload = match payload.as_ref() {
    6         -
        Some(t) => t,
    7         -
        None => return Ok(crate::protocol_serde::rest_json_unset_struct_payload()),
    8         -
    };
    9         -
    Ok(crate::protocol_serde::shape_test_payload_structure_input::ser_payload_config_payload(
   10         -
        payload,
   11         -
    )?)
   12         -
}
   13         -
   14         -
pub fn ser_payload_config_payload(
   15         -
    input: &crate::types::PayloadConfig,
   16         -
) -> std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::SerializationError> {
   17         -
    let mut out = String::new();
   18         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   19         -
    crate::protocol_serde::shape_payload_config::ser_payload_config(&mut object, input)?;
   20         -
    object.finish();
   21         -
    Ok(out.into_bytes())
   22         -
}

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

@@ -1,0 +18,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_payload_config_payload(
    3         -
    body: &[u8],
    4         -
) -> std::result::Result<::std::option::Option<crate::types::PayloadConfig>, crate::operation::test_payload_structure::TestPayloadStructureError> {
    5         -
    (!body.is_empty())
    6         -
        .then(|| {
    7         -
            crate::protocol_serde::shape_payload_config::de_payload_config_payload(body)
    8         -
                .map_err(crate::operation::test_payload_structure::TestPayloadStructureError::unhandled)
    9         -
        })
   10         -
        .transpose()
   11         -
}
   12         -
   13         -
pub(crate) fn de_test_id_header(
   14         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15         -
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   16         -
    let headers = header_map.get_all("x-amz-test-id");
   17         -
    ::aws_smithy_http::header::one_or_none(headers)
   18         -
}

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

@@ -1,0 +41,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_test_post_no_input_no_payload_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<
    8         -
    crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadOutput,
    9         -
    crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError,
   10         -
> {
   11         -
    #[allow(unused_mut)]
   12         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13         -
        .map_err(crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError::generic(
   16         -
        generic,
   17         -
    ))
   18         -
}
   19         -
   20         -
#[allow(clippy::unnecessary_wraps)]
   21         -
pub fn de_test_post_no_input_no_payload_http_response(
   22         -
    _response_status: u16,
   23         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24         -
    _response_body: &[u8],
   25         -
) -> std::result::Result<
   26         -
    crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadOutput,
   27         -
    crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError,
   28         -
> {
   29         -
    Ok({
   30         -
        #[allow(unused_mut)]
   31         -
        let mut output = crate::operation::test_post_no_input_no_payload::builders::TestPostNoInputNoPayloadOutputBuilder::default();
   32         -
        output = output.set_test_id(
   33         -
            crate::protocol_serde::shape_test_post_no_input_no_payload_output::de_test_id_header(_response_headers).map_err(|_| {
   34         -
                crate::operation::test_post_no_input_no_payload::TestPostNoInputNoPayloadError::unhandled(
   35         -
                    "Failed to parse testId from header `X-Amz-Test-Id",
   36         -
                )
   37         -
            })?,
   38         -
        );
   39         -
        output.build()
   40         -
    })
   41         -
}

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

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

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

@@ -1,0 +55,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_test_post_no_payload_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<
    8         -
    crate::operation::test_post_no_payload::TestPostNoPayloadOutput,
    9         -
    crate::operation::test_post_no_payload::TestPostNoPayloadError,
   10         -
> {
   11         -
    #[allow(unused_mut)]
   12         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13         -
        .map_err(crate::operation::test_post_no_payload::TestPostNoPayloadError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::test_post_no_payload::TestPostNoPayloadError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_test_post_no_payload_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::test_post_no_payload::TestPostNoPayloadOutput,
   25         -
    crate::operation::test_post_no_payload::TestPostNoPayloadError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::test_post_no_payload::builders::TestPostNoPayloadOutputBuilder::default();
   30         -
        output = output.set_test_id(
   31         -
            crate::protocol_serde::shape_test_post_no_payload_output::de_test_id_header(_response_headers).map_err(|_| {
   32         -
                crate::operation::test_post_no_payload::TestPostNoPayloadError::unhandled("Failed to parse testId from header `X-Amz-Test-Id")
   33         -
            })?,
   34         -
        );
   35         -
        output.build()
   36         -
    })
   37         -
}
   38         -
   39         -
pub fn ser_test_post_no_payload_headers(
   40         -
    input: &crate::operation::test_post_no_payload::TestPostNoPayloadInput,
   41         -
    mut builder: ::http_1x::request::Builder,
   42         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   43         -
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
   44         -
        let formatted_2 = inner_1.as_str();
   45         -
        let header_value = formatted_2;
   46         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   47         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   48         -
                "test_id",
   49         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   50         -
            )
   51         -
        })?;
   52         -
        builder = builder.header("X-Amz-Test-Id", header_value);
   53         -
    }
   54         -
    Ok(builder)
   55         -
}

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

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

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

@@ -1,0 +39,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_test_string_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   12         -
            let mut items = Vec::new();
   13         -
            loop {
   14         -
                match tokens.peek() {
   15         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   16         -
                        tokens.next().transpose().unwrap();
   17         -
                        break;
   18         -
                    }
   19         -
                    _ => {
   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()?;
   23         -
                        if let Some(value) = value {
   24         -
                            items.push(value);
   25         -
                        } else {
   26         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   27         -
                                "dense list cannot contain null values",
   28         -
                            ));
   29         -
                        }
   30         -
                    }
   31         -
                }
   32         -
            }
   33         -
            Ok(Some(items))
   34         -
        }
   35         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   36         -
            "expected start array or null",
   37         -
        )),
   38         -
    }
   39         -
}

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

@@ -1,0 +48,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_test_string_map<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<
    6         -
    Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    7         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
    8         -
>
    9         -
where
   10         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   11         -
{
   12         -
    match tokens.next().transpose()? {
   13         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   14         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   15         -
            let mut map = ::std::collections::HashMap::new();
   16         -
            loop {
   17         -
                match tokens.next().transpose()? {
   18         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   19         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   20         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   21         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   22         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   23         -
                            .transpose()?;
   24         -
                        match value {
   25         -
                            Some(value) => {
   26         -
                                map.insert(key, value);
   27         -
                            }
   28         -
                            None => {
   29         -
                                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   30         -
                                    "dense map cannot contain null values",
   31         -
                                ))
   32         -
                            }
   33         -
                        }
   34         -
                    }
   35         -
                    other => {
   36         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   37         -
                            "expected object key or end object, found: {other:?}"
   38         -
                        )))
   39         -
                    }
   40         -
                }
   41         -
            }
   42         -
            Ok(Some(map))
   43         -
        }
   44         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   45         -
            "expected start object or null",
   46         -
        )),
   47         -
    }
   48         -
}

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

@@ -1,0 +165,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_timestamp_format_headers_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<
    8         -
    crate::operation::timestamp_format_headers::TimestampFormatHeadersOutput,
    9         -
    crate::operation::timestamp_format_headers::TimestampFormatHeadersError,
   10         -
> {
   11         -
    #[allow(unused_mut)]
   12         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13         -
        .map_err(crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::timestamp_format_headers::TimestampFormatHeadersError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_timestamp_format_headers_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::timestamp_format_headers::TimestampFormatHeadersOutput,
   25         -
    crate::operation::timestamp_format_headers::TimestampFormatHeadersError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::timestamp_format_headers::builders::TimestampFormatHeadersOutputBuilder::default();
   30         -
        output = output.set_default_format(
   31         -
            crate::protocol_serde::shape_timestamp_format_headers_output::de_default_format_header(_response_headers).map_err(|_| {
   32         -
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   33         -
                    "Failed to parse defaultFormat from header `X-defaultFormat",
   34         -
                )
   35         -
            })?,
   36         -
        );
   37         -
        output = output.set_member_date_time(
   38         -
            crate::protocol_serde::shape_timestamp_format_headers_output::de_member_date_time_header(_response_headers).map_err(|_| {
   39         -
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   40         -
                    "Failed to parse memberDateTime from header `X-memberDateTime",
   41         -
                )
   42         -
            })?,
   43         -
        );
   44         -
        output = output.set_member_epoch_seconds(
   45         -
            crate::protocol_serde::shape_timestamp_format_headers_output::de_member_epoch_seconds_header(_response_headers).map_err(|_| {
   46         -
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   47         -
                    "Failed to parse memberEpochSeconds from header `X-memberEpochSeconds",
   48         -
                )
   49         -
            })?,
   50         -
        );
   51         -
        output = output.set_member_http_date(
   52         -
            crate::protocol_serde::shape_timestamp_format_headers_output::de_member_http_date_header(_response_headers).map_err(|_| {
   53         -
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   54         -
                    "Failed to parse memberHttpDate from header `X-memberHttpDate",
   55         -
                )
   56         -
            })?,
   57         -
        );
   58         -
        output = output.set_target_date_time(
   59         -
            crate::protocol_serde::shape_timestamp_format_headers_output::de_target_date_time_header(_response_headers).map_err(|_| {
   60         -
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   61         -
                    "Failed to parse targetDateTime from header `X-targetDateTime",
   62         -
                )
   63         -
            })?,
   64         -
        );
   65         -
        output = output.set_target_epoch_seconds(
   66         -
            crate::protocol_serde::shape_timestamp_format_headers_output::de_target_epoch_seconds_header(_response_headers).map_err(|_| {
   67         -
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   68         -
                    "Failed to parse targetEpochSeconds from header `X-targetEpochSeconds",
   69         -
                )
   70         -
            })?,
   71         -
        );
   72         -
        output = output.set_target_http_date(
   73         -
            crate::protocol_serde::shape_timestamp_format_headers_output::de_target_http_date_header(_response_headers).map_err(|_| {
   74         -
                crate::operation::timestamp_format_headers::TimestampFormatHeadersError::unhandled(
   75         -
                    "Failed to parse targetHttpDate from header `X-targetHttpDate",
   76         -
                )
   77         -
            })?,
   78         -
        );
   79         -
        output.build()
   80         -
    })
   81         -
}
   82         -
   83         -
pub fn ser_timestamp_format_headers_headers(
   84         -
    input: &crate::operation::timestamp_format_headers::TimestampFormatHeadersInput,
   85         -
    mut builder: ::http_1x::request::Builder,
   86         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   87         -
    if let ::std::option::Option::Some(inner_1) = &input.member_epoch_seconds {
   88         -
        let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
   89         -
        let header_value = formatted_2;
   90         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   91         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   92         -
                "member_epoch_seconds",
   93         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   94         -
            )
   95         -
        })?;
   96         -
        builder = builder.header("X-memberEpochSeconds", header_value);
   97         -
    }
   98         -
    if let ::std::option::Option::Some(inner_3) = &input.member_http_date {
   99         -
        let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
  100         -
        let header_value = formatted_4;
  101         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  102         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  103         -
                "member_http_date",
  104         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  105         -
            )
  106         -
        })?;
  107         -
        builder = builder.header("X-memberHttpDate", header_value);
  108         -
    }
  109         -
    if let ::std::option::Option::Some(inner_5) = &input.member_date_time {
  110         -
        let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
  111         -
        let header_value = formatted_6;
  112         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  113         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  114         -
                "member_date_time",
  115         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  116         -
            )
  117         -
        })?;
  118         -
        builder = builder.header("X-memberDateTime", header_value);
  119         -
    }
  120         -
    if let ::std::option::Option::Some(inner_7) = &input.default_format {
  121         -
        let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
  122         -
        let header_value = formatted_8;
  123         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  124         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  125         -
                "default_format",
  126         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  127         -
            )
  128         -
        })?;
  129         -
        builder = builder.header("X-defaultFormat", header_value);
  130         -
    }
  131         -
    if let ::std::option::Option::Some(inner_9) = &input.target_epoch_seconds {
  132         -
        let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
  133         -
        let header_value = formatted_10;
  134         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  135         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  136         -
                "target_epoch_seconds",
  137         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  138         -
            )
  139         -
        })?;
  140         -
        builder = builder.header("X-targetEpochSeconds", header_value);
  141         -
    }
  142         -
    if let ::std::option::Option::Some(inner_11) = &input.target_http_date {
  143         -
        let formatted_12 = inner_11.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
  144         -
        let header_value = formatted_12;
  145         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  146         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  147         -
                "target_http_date",
  148         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  149         -
            )
  150         -
        })?;
  151         -
        builder = builder.header("X-targetHttpDate", header_value);
  152         -
    }
  153         -
    if let ::std::option::Option::Some(inner_13) = &input.target_date_time {
  154         -
        let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
  155         -
        let header_value = formatted_14;
  156         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  157         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  158         -
                "target_date_time",
  159         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  160         -
            )
  161         -
        })?;
  162         -
        builder = builder.header("X-targetDateTime", header_value);
  163         -
    }
  164         -
    Ok(builder)
  165         -
}