Client Test

Client Test

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c

Files changed:

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

@@ -1,0 +32,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_http_request_with_greedy_label_in_path_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::http_request_with_greedy_label_in_path::HttpRequestWithGreedyLabelInPathOutput,
    9         -
    crate::operation::http_request_with_greedy_label_in_path::HttpRequestWithGreedyLabelInPathError,
   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::http_request_with_greedy_label_in_path::HttpRequestWithGreedyLabelInPathError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::http_request_with_greedy_label_in_path::HttpRequestWithGreedyLabelInPathError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_http_request_with_greedy_label_in_path_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::http_request_with_greedy_label_in_path::HttpRequestWithGreedyLabelInPathOutput,
   25         -
    crate::operation::http_request_with_greedy_label_in_path::HttpRequestWithGreedyLabelInPathError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::http_request_with_greedy_label_in_path::builders::HttpRequestWithGreedyLabelInPathOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

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

@@ -1,0 +32,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_http_request_with_labels_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::http_request_with_labels::HttpRequestWithLabelsOutput,
    9         -
    crate::operation::http_request_with_labels::HttpRequestWithLabelsError,
   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::http_request_with_labels::HttpRequestWithLabelsError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::http_request_with_labels::HttpRequestWithLabelsError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_http_request_with_labels_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::http_request_with_labels::HttpRequestWithLabelsOutput,
   25         -
    crate::operation::http_request_with_labels::HttpRequestWithLabelsError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::http_request_with_labels::builders::HttpRequestWithLabelsOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

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

@@ -1,0 +34,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_http_request_with_labels_and_timestamp_format_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::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatOutput,
    9         -
    crate::operation::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatError,
   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::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_http_request_with_labels_and_timestamp_format_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::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatOutput,
   25         -
    crate::operation::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output =
   30         -
            crate::operation::http_request_with_labels_and_timestamp_format::builders::HttpRequestWithLabelsAndTimestampFormatOutputBuilder::default(
   31         -
            );
   32         -
        output.build()
   33         -
    })
   34         -
}

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

@@ -1,0 +32,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_http_request_with_regex_literal_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::http_request_with_regex_literal::HttpRequestWithRegexLiteralOutput,
    9         -
    crate::operation::http_request_with_regex_literal::HttpRequestWithRegexLiteralError,
   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::http_request_with_regex_literal::HttpRequestWithRegexLiteralError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::http_request_with_regex_literal::HttpRequestWithRegexLiteralError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_http_request_with_regex_literal_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::http_request_with_regex_literal::HttpRequestWithRegexLiteralOutput,
   25         -
    crate::operation::http_request_with_regex_literal::HttpRequestWithRegexLiteralError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::http_request_with_regex_literal::builders::HttpRequestWithRegexLiteralOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

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

@@ -1,0 +27,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_http_response_code_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::http_response_code::HttpResponseCodeOutput, crate::operation::http_response_code::HttpResponseCodeError> {
    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::http_response_code::HttpResponseCodeError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::http_response_code::HttpResponseCodeError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_http_response_code_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::http_response_code::HttpResponseCodeOutput, crate::operation::http_response_code::HttpResponseCodeError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::http_response_code::builders::HttpResponseCodeOutputBuilder::default();
   24         -
        output = output.set_status(Some(_response_status as _));
   25         -
        output.build()
   26         -
    })
   27         -
}

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

@@ -1,0 +31,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_http_string_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::http_string_payload::HttpStringPayloadOutput, crate::operation::http_string_payload::HttpStringPayloadError>
    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::http_string_payload::HttpStringPayloadError::unhandled)?;
   12         -
    let generic = generic_builder.build();
   13         -
    Err(crate::operation::http_string_payload::HttpStringPayloadError::generic(generic))
   14         -
}
   15         -
   16         -
#[allow(clippy::unnecessary_wraps)]
   17         -
pub fn de_http_string_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::http_string_payload::HttpStringPayloadOutput, crate::operation::http_string_payload::HttpStringPayloadError>
   22         -
{
   23         -
    Ok({
   24         -
        #[allow(unused_mut)]
   25         -
        let mut output = crate::operation::http_string_payload::builders::HttpStringPayloadOutputBuilder::default();
   26         -
        output = output.set_payload(crate::protocol_serde::shape_http_string_payload_output::de_payload_payload(
   27         -
            _response_body,
   28         -
        )?);
   29         -
        output.build()
   30         -
    })
   31         -
}

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

@@ -1,0 +10,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_payload_http_payload(
    3         -
    payload: ::std::option::Option<::std::string::String>,
    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_bytes())
   10         -
}

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

@@ -1,0 +11,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_payload_payload(
    3         -
    body: &[u8],
    4         -
) -> std::result::Result<::std::option::Option<::std::string::String>, crate::operation::http_string_payload::HttpStringPayloadError> {
    5         -
    (!body.is_empty())
    6         -
        .then(|| {
    7         -
            let body_str = std::str::from_utf8(body).map_err(crate::operation::http_string_payload::HttpStringPayloadError::unhandled)?;
    8         -
            Ok(body_str.to_string())
    9         -
        })
   10         -
        .transpose()
   11         -
}

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

@@ -1,0 +72,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_ignore_query_params_in_response_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::ignore_query_params_in_response::IgnoreQueryParamsInResponseOutput,
    9         -
    crate::operation::ignore_query_params_in_response::IgnoreQueryParamsInResponseError,
   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::ignore_query_params_in_response::IgnoreQueryParamsInResponseError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::ignore_query_params_in_response::IgnoreQueryParamsInResponseError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_ignore_query_params_in_response_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::ignore_query_params_in_response::IgnoreQueryParamsInResponseOutput,
   25         -
    crate::operation::ignore_query_params_in_response::IgnoreQueryParamsInResponseError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::ignore_query_params_in_response::builders::IgnoreQueryParamsInResponseOutputBuilder::default();
   30         -
        output = crate::protocol_serde::shape_ignore_query_params_in_response::de_ignore_query_params_in_response(_response_body, output)
   31         -
            .map_err(crate::operation::ignore_query_params_in_response::IgnoreQueryParamsInResponseError::unhandled)?;
   32         -
        output.build()
   33         -
    })
   34         -
}
   35         -
   36         -
pub(crate) fn de_ignore_query_params_in_response(
   37         -
    _value: &[u8],
   38         -
    mut builder: crate::operation::ignore_query_params_in_response::builders::IgnoreQueryParamsInResponseOutputBuilder,
   39         -
) -> ::std::result::Result<
   40         -
    crate::operation::ignore_query_params_in_response::builders::IgnoreQueryParamsInResponseOutputBuilder,
   41         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   42         -
> {
   43         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   44         -
    let tokens = &mut tokens_owned;
   45         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   46         -
    loop {
   47         -
        match tokens.next().transpose()? {
   48         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   49         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   50         -
                "baz" => {
   51         -
                    builder = builder.set_baz(
   52         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   53         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   54         -
                            .transpose()?,
   55         -
                    );
   56         -
                }
   57         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   58         -
            },
   59         -
            other => {
   60         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   61         -
                    "expected object key or end object, found: {other:?}"
   62         -
                )))
   63         -
            }
   64         -
        }
   65         -
    }
   66         -
    if tokens.next().is_some() {
   67         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   68         -
            "found more JSON tokens after completing parsing",
   69         -
        ));
   70         -
    }
   71         -
    Ok(builder)
   72         -
}

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

@@ -1,0 +428,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_input_and_output_with_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::input_and_output_with_headers::InputAndOutputWithHeadersOutput,
    9         -
    crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError,
   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::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::generic(
   16         -
        generic,
   17         -
    ))
   18         -
}
   19         -
   20         -
#[allow(clippy::unnecessary_wraps)]
   21         -
pub fn de_input_and_output_with_headers_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::input_and_output_with_headers::InputAndOutputWithHeadersOutput,
   27         -
    crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError,
   28         -
> {
   29         -
    Ok({
   30         -
        #[allow(unused_mut)]
   31         -
        let mut output = crate::operation::input_and_output_with_headers::builders::InputAndOutputWithHeadersOutputBuilder::default();
   32         -
        output = output.set_header_boolean_list(
   33         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_boolean_list_header(_response_headers).map_err(|_| {
   34         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   35         -
                    "Failed to parse headerBooleanList from header `X-BooleanList",
   36         -
                )
   37         -
            })?,
   38         -
        );
   39         -
        output = output.set_header_byte(
   40         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_byte_header(_response_headers).map_err(|_| {
   41         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   42         -
                    "Failed to parse headerByte from header `X-Byte",
   43         -
                )
   44         -
            })?,
   45         -
        );
   46         -
        output = output.set_header_double(
   47         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_double_header(_response_headers).map_err(|_| {
   48         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   49         -
                    "Failed to parse headerDouble from header `X-Double",
   50         -
                )
   51         -
            })?,
   52         -
        );
   53         -
        output = output.set_header_enum(
   54         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_enum_header(_response_headers).map_err(|_| {
   55         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   56         -
                    "Failed to parse headerEnum from header `X-Enum",
   57         -
                )
   58         -
            })?,
   59         -
        );
   60         -
        output = output.set_header_enum_list(
   61         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_enum_list_header(_response_headers).map_err(|_| {
   62         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   63         -
                    "Failed to parse headerEnumList from header `X-EnumList",
   64         -
                )
   65         -
            })?,
   66         -
        );
   67         -
        output = output.set_header_false_bool(
   68         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_false_bool_header(_response_headers).map_err(|_| {
   69         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   70         -
                    "Failed to parse headerFalseBool from header `X-Boolean2",
   71         -
                )
   72         -
            })?,
   73         -
        );
   74         -
        output = output.set_header_float(
   75         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_float_header(_response_headers).map_err(|_| {
   76         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   77         -
                    "Failed to parse headerFloat from header `X-Float",
   78         -
                )
   79         -
            })?,
   80         -
        );
   81         -
        output = output.set_header_integer(
   82         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_header(_response_headers).map_err(|_| {
   83         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   84         -
                    "Failed to parse headerInteger from header `X-Integer",
   85         -
                )
   86         -
            })?,
   87         -
        );
   88         -
        output = output.set_header_integer_enum(
   89         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_enum_header(_response_headers).map_err(|_| {
   90         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   91         -
                    "Failed to parse headerIntegerEnum from header `X-IntegerEnum",
   92         -
                )
   93         -
            })?,
   94         -
        );
   95         -
        output = output.set_header_integer_enum_list(
   96         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_enum_list_header(_response_headers).map_err(
   97         -
                |_| {
   98         -
                    crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
   99         -
                        "Failed to parse headerIntegerEnumList from header `X-IntegerEnumList",
  100         -
                    )
  101         -
                },
  102         -
            )?,
  103         -
        );
  104         -
        output = output.set_header_integer_list(
  105         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_integer_list_header(_response_headers).map_err(|_| {
  106         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  107         -
                    "Failed to parse headerIntegerList from header `X-IntegerList",
  108         -
                )
  109         -
            })?,
  110         -
        );
  111         -
        output = output.set_header_long(
  112         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_long_header(_response_headers).map_err(|_| {
  113         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  114         -
                    "Failed to parse headerLong from header `X-Long",
  115         -
                )
  116         -
            })?,
  117         -
        );
  118         -
        output = output.set_header_short(
  119         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_short_header(_response_headers).map_err(|_| {
  120         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  121         -
                    "Failed to parse headerShort from header `X-Short",
  122         -
                )
  123         -
            })?,
  124         -
        );
  125         -
        output = output.set_header_string(
  126         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_header(_response_headers).map_err(|_| {
  127         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  128         -
                    "Failed to parse headerString from header `X-String",
  129         -
                )
  130         -
            })?,
  131         -
        );
  132         -
        output = output.set_header_string_list(
  133         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_list_header(_response_headers).map_err(|_| {
  134         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  135         -
                    "Failed to parse headerStringList from header `X-StringList",
  136         -
                )
  137         -
            })?,
  138         -
        );
  139         -
        output = output.set_header_string_set(
  140         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_string_set_header(_response_headers).map_err(|_| {
  141         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  142         -
                    "Failed to parse headerStringSet from header `X-StringSet",
  143         -
                )
  144         -
            })?,
  145         -
        );
  146         -
        output = output.set_header_timestamp_list(
  147         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_timestamp_list_header(_response_headers).map_err(|_| {
  148         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  149         -
                    "Failed to parse headerTimestampList from header `X-TimestampList",
  150         -
                )
  151         -
            })?,
  152         -
        );
  153         -
        output = output.set_header_true_bool(
  154         -
            crate::protocol_serde::shape_input_and_output_with_headers_output::de_header_true_bool_header(_response_headers).map_err(|_| {
  155         -
                crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersError::unhandled(
  156         -
                    "Failed to parse headerTrueBool from header `X-Boolean1",
  157         -
                )
  158         -
            })?,
  159         -
        );
  160         -
        output.build()
  161         -
    })
  162         -
}
  163         -
  164         -
pub fn ser_input_and_output_with_headers_headers(
  165         -
    input: &crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersInput,
  166         -
    mut builder: ::http_1x::request::Builder,
  167         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  168         -
    if let ::std::option::Option::Some(inner_1) = &input.header_string {
  169         -
        let formatted_2 = inner_1.as_str();
  170         -
        let header_value = formatted_2;
  171         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  172         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  173         -
                "header_string",
  174         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  175         -
            )
  176         -
        })?;
  177         -
        builder = builder.header("X-String", header_value);
  178         -
    }
  179         -
    if let ::std::option::Option::Some(inner_3) = &input.header_byte {
  180         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
  181         -
        let formatted_4 = encoder.encode();
  182         -
        let header_value = formatted_4;
  183         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  184         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  185         -
                "header_byte",
  186         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  187         -
            )
  188         -
        })?;
  189         -
        builder = builder.header("X-Byte", header_value);
  190         -
    }
  191         -
    if let ::std::option::Option::Some(inner_5) = &input.header_short {
  192         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_5);
  193         -
        let formatted_6 = encoder.encode();
  194         -
        let header_value = formatted_6;
  195         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  196         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  197         -
                "header_short",
  198         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  199         -
            )
  200         -
        })?;
  201         -
        builder = builder.header("X-Short", header_value);
  202         -
    }
  203         -
    if let ::std::option::Option::Some(inner_7) = &input.header_integer {
  204         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_7);
  205         -
        let formatted_8 = encoder.encode();
  206         -
        let header_value = formatted_8;
  207         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  208         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  209         -
                "header_integer",
  210         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  211         -
            )
  212         -
        })?;
  213         -
        builder = builder.header("X-Integer", header_value);
  214         -
    }
  215         -
    if let ::std::option::Option::Some(inner_9) = &input.header_long {
  216         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_9);
  217         -
        let formatted_10 = encoder.encode();
  218         -
        let header_value = formatted_10;
  219         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  220         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  221         -
                "header_long",
  222         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  223         -
            )
  224         -
        })?;
  225         -
        builder = builder.header("X-Long", header_value);
  226         -
    }
  227         -
    if let ::std::option::Option::Some(inner_11) = &input.header_float {
  228         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_11);
  229         -
        let formatted_12 = encoder.encode();
  230         -
        let header_value = formatted_12;
  231         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  232         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  233         -
                "header_float",
  234         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  235         -
            )
  236         -
        })?;
  237         -
        builder = builder.header("X-Float", header_value);
  238         -
    }
  239         -
    if let ::std::option::Option::Some(inner_13) = &input.header_double {
  240         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_13);
  241         -
        let formatted_14 = encoder.encode();
  242         -
        let header_value = formatted_14;
  243         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  244         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  245         -
                "header_double",
  246         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  247         -
            )
  248         -
        })?;
  249         -
        builder = builder.header("X-Double", header_value);
  250         -
    }
  251         -
    if let ::std::option::Option::Some(inner_15) = &input.header_true_bool {
  252         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_15);
  253         -
        let formatted_16 = encoder.encode();
  254         -
        let header_value = formatted_16;
  255         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  256         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  257         -
                "header_true_bool",
  258         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  259         -
            )
  260         -
        })?;
  261         -
        builder = builder.header("X-Boolean1", header_value);
  262         -
    }
  263         -
    if let ::std::option::Option::Some(inner_17) = &input.header_false_bool {
  264         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
  265         -
        let formatted_18 = encoder.encode();
  266         -
        let header_value = formatted_18;
  267         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  268         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  269         -
                "header_false_bool",
  270         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  271         -
            )
  272         -
        })?;
  273         -
        builder = builder.header("X-Boolean2", header_value);
  274         -
    }
  275         -
    if let ::std::option::Option::Some(inner_19) = &input.header_string_list {
  276         -
        // Empty vec in header is serialized as an empty string
  277         -
        if inner_19.is_empty() {
  278         -
            builder = builder.header("X-StringList", "");
  279         -
        } else {
  280         -
            for inner_20 in inner_19 {
  281         -
                let formatted_21 = ::aws_smithy_http::header::quote_header_value(inner_20.as_str());
  282         -
                let header_value = formatted_21;
  283         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  284         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  285         -
                        "header_string_list",
  286         -
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  287         -
                    )
  288         -
                })?;
  289         -
                builder = builder.header("X-StringList", header_value);
  290         -
            }
  291         -
        }
  292         -
    }
  293         -
    if let ::std::option::Option::Some(inner_22) = &input.header_string_set {
  294         -
        // Empty vec in header is serialized as an empty string
  295         -
        if inner_22.is_empty() {
  296         -
            builder = builder.header("X-StringSet", "");
  297         -
        } else {
  298         -
            for inner_23 in inner_22 {
  299         -
                let formatted_24 = ::aws_smithy_http::header::quote_header_value(inner_23.as_str());
  300         -
                let header_value = formatted_24;
  301         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  302         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  303         -
                        "header_string_set",
  304         -
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  305         -
                    )
  306         -
                })?;
  307         -
                builder = builder.header("X-StringSet", header_value);
  308         -
            }
  309         -
        }
  310         -
    }
  311         -
    if let ::std::option::Option::Some(inner_25) = &input.header_integer_list {
  312         -
        // Empty vec in header is serialized as an empty string
  313         -
        if inner_25.is_empty() {
  314         -
            builder = builder.header("X-IntegerList", "");
  315         -
        } else {
  316         -
            for inner_26 in inner_25 {
  317         -
                let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
  318         -
                let formatted_27 = encoder.encode();
  319         -
                let header_value = formatted_27;
  320         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  321         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  322         -
                        "header_integer_list",
  323         -
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  324         -
                    )
  325         -
                })?;
  326         -
                builder = builder.header("X-IntegerList", header_value);
  327         -
            }
  328         -
        }
  329         -
    }
  330         -
    if let ::std::option::Option::Some(inner_28) = &input.header_boolean_list {
  331         -
        // Empty vec in header is serialized as an empty string
  332         -
        if inner_28.is_empty() {
  333         -
            builder = builder.header("X-BooleanList", "");
  334         -
        } else {
  335         -
            for inner_29 in inner_28 {
  336         -
                let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
  337         -
                let formatted_30 = encoder.encode();
  338         -
                let header_value = formatted_30;
  339         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  340         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  341         -
                        "header_boolean_list",
  342         -
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  343         -
                    )
  344         -
                })?;
  345         -
                builder = builder.header("X-BooleanList", header_value);
  346         -
            }
  347         -
        }
  348         -
    }
  349         -
    if let ::std::option::Option::Some(inner_31) = &input.header_timestamp_list {
  350         -
        // Empty vec in header is serialized as an empty string
  351         -
        if inner_31.is_empty() {
  352         -
            builder = builder.header("X-TimestampList", "");
  353         -
        } else {
  354         -
            for inner_32 in inner_31 {
  355         -
                let formatted_33 = inner_32.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
  356         -
                let header_value = formatted_33;
  357         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  358         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  359         -
                        "header_timestamp_list",
  360         -
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  361         -
                    )
  362         -
                })?;
  363         -
                builder = builder.header("X-TimestampList", header_value);
  364         -
            }
  365         -
        }
  366         -
    }
  367         -
    if let ::std::option::Option::Some(inner_34) = &input.header_enum {
  368         -
        let formatted_35 = inner_34.as_str();
  369         -
        let header_value = formatted_35;
  370         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  371         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  372         -
                "header_enum",
  373         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  374         -
            )
  375         -
        })?;
  376         -
        builder = builder.header("X-Enum", header_value);
  377         -
    }
  378         -
    if let ::std::option::Option::Some(inner_36) = &input.header_enum_list {
  379         -
        // Empty vec in header is serialized as an empty string
  380         -
        if inner_36.is_empty() {
  381         -
            builder = builder.header("X-EnumList", "");
  382         -
        } else {
  383         -
            for inner_37 in inner_36 {
  384         -
                let formatted_38 = ::aws_smithy_http::header::quote_header_value(inner_37.as_str());
  385         -
                let header_value = formatted_38;
  386         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  387         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  388         -
                        "header_enum_list",
  389         -
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  390         -
                    )
  391         -
                })?;
  392         -
                builder = builder.header("X-EnumList", header_value);
  393         -
            }
  394         -
        }
  395         -
    }
  396         -
    if let ::std::option::Option::Some(inner_39) = &input.header_integer_enum {
  397         -
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
  398         -
        let formatted_40 = encoder.encode();
  399         -
        let header_value = formatted_40;
  400         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  401         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
  402         -
                "header_integer_enum",
  403         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
  404         -
            )
  405         -
        })?;
  406         -
        builder = builder.header("X-IntegerEnum", header_value);
  407         -
    }
  408         -
    if let ::std::option::Option::Some(inner_41) = &input.header_integer_enum_list {
  409         -
        // Empty vec in header is serialized as an empty string
  410         -
        if inner_41.is_empty() {
  411         -
            builder = builder.header("X-IntegerEnumList", "");
  412         -
        } else {
  413         -
            for inner_42 in inner_41 {
  414         -
                let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
  415         -
                let formatted_43 = encoder.encode();
  416         -
                let header_value = formatted_43;
  417         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  418         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  419         -
                        "header_integer_enum_list",
  420         -
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  421         -
                    )
  422         -
                })?;
  423         -
                builder = builder.header("X-IntegerEnumList", header_value);
  424         -
            }
  425         -
        }
  426         -
    }
  427         -
    Ok(builder)
  428         -
}

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

@@ -1,0 +214,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_header_boolean_list_header(
    3         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<bool>>, ::aws_smithy_http::header::ParseError> {
    5         -
    let headers = header_map.get_all("X-BooleanList");
    6         -
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
    7         -
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
    8         -
}
    9         -
   10         -
pub(crate) fn de_header_byte_header(
   11         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   12         -
) -> ::std::result::Result<::std::option::Option<i8>, ::aws_smithy_http::header::ParseError> {
   13         -
    let headers = header_map.get_all("X-Byte");
   14         -
    let var_2 = ::aws_smithy_http::header::read_many_primitive::<i8>(headers)?;
   15         -
    if var_2.len() > 1 {
   16         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
   17         -
            "expected one item but found {}",
   18         -
            var_2.len()
   19         -
        )))
   20         -
    } else {
   21         -
        let mut var_2 = var_2;
   22         -
        Ok(var_2.pop())
   23         -
    }
   24         -
}
   25         -
   26         -
pub(crate) fn de_header_double_header(
   27         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   28         -
) -> ::std::result::Result<::std::option::Option<f64>, ::aws_smithy_http::header::ParseError> {
   29         -
    let headers = header_map.get_all("X-Double");
   30         -
    let var_3 = ::aws_smithy_http::header::read_many_primitive::<f64>(headers)?;
   31         -
    if var_3.len() > 1 {
   32         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
   33         -
            "expected one item but found {}",
   34         -
            var_3.len()
   35         -
        )))
   36         -
    } else {
   37         -
        let mut var_3 = var_3;
   38         -
        Ok(var_3.pop())
   39         -
    }
   40         -
}
   41         -
   42         -
pub(crate) fn de_header_enum_header(
   43         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   44         -
) -> ::std::result::Result<::std::option::Option<crate::types::FooEnum>, ::aws_smithy_http::header::ParseError> {
   45         -
    let headers = header_map.get_all("X-Enum");
   46         -
    ::aws_smithy_http::header::one_or_none(headers)
   47         -
}
   48         -
   49         -
pub(crate) fn de_header_enum_list_header(
   50         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   51         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<crate::types::FooEnum>>, ::aws_smithy_http::header::ParseError> {
   52         -
    let headers = header_map.get_all("X-EnumList");
   53         -
    let var_4: Vec<crate::types::FooEnum> = ::aws_smithy_http::header::read_many_from_str(headers)?;
   54         -
    Ok(if !var_4.is_empty() { Some(var_4) } else { None })
   55         -
}
   56         -
   57         -
pub(crate) fn de_header_false_bool_header(
   58         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   59         -
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
   60         -
    let headers = header_map.get_all("X-Boolean2");
   61         -
    let var_5 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
   62         -
    if var_5.len() > 1 {
   63         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
   64         -
            "expected one item but found {}",
   65         -
            var_5.len()
   66         -
        )))
   67         -
    } else {
   68         -
        let mut var_5 = var_5;
   69         -
        Ok(var_5.pop())
   70         -
    }
   71         -
}
   72         -
   73         -
pub(crate) fn de_header_float_header(
   74         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   75         -
) -> ::std::result::Result<::std::option::Option<f32>, ::aws_smithy_http::header::ParseError> {
   76         -
    let headers = header_map.get_all("X-Float");
   77         -
    let var_6 = ::aws_smithy_http::header::read_many_primitive::<f32>(headers)?;
   78         -
    if var_6.len() > 1 {
   79         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
   80         -
            "expected one item but found {}",
   81         -
            var_6.len()
   82         -
        )))
   83         -
    } else {
   84         -
        let mut var_6 = var_6;
   85         -
        Ok(var_6.pop())
   86         -
    }
   87         -
}
   88         -
   89         -
pub(crate) fn de_header_integer_header(
   90         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   91         -
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
   92         -
    let headers = header_map.get_all("X-Integer");
   93         -
    let var_7 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
   94         -
    if var_7.len() > 1 {
   95         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
   96         -
            "expected one item but found {}",
   97         -
            var_7.len()
   98         -
        )))
   99         -
    } else {
  100         -
        let mut var_7 = var_7;
  101         -
        Ok(var_7.pop())
  102         -
    }
  103         -
}
  104         -
  105         -
pub(crate) fn de_header_integer_enum_header(
  106         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  107         -
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
  108         -
    let headers = header_map.get_all("X-IntegerEnum");
  109         -
    let var_8 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
  110         -
    if var_8.len() > 1 {
  111         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
  112         -
            "expected one item but found {}",
  113         -
            var_8.len()
  114         -
        )))
  115         -
    } else {
  116         -
        let mut var_8 = var_8;
  117         -
        Ok(var_8.pop())
  118         -
    }
  119         -
}
  120         -
  121         -
pub(crate) fn de_header_integer_enum_list_header(
  122         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  123         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<i32>>, ::aws_smithy_http::header::ParseError> {
  124         -
    let headers = header_map.get_all("X-IntegerEnumList");
  125         -
    let var_9 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
  126         -
    Ok(if !var_9.is_empty() { Some(var_9) } else { None })
  127         -
}
  128         -
  129         -
pub(crate) fn de_header_integer_list_header(
  130         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  131         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<i32>>, ::aws_smithy_http::header::ParseError> {
  132         -
    let headers = header_map.get_all("X-IntegerList");
  133         -
    let var_10 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
  134         -
    Ok(if !var_10.is_empty() { Some(var_10) } else { None })
  135         -
}
  136         -
  137         -
pub(crate) fn de_header_long_header(
  138         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  139         -
) -> ::std::result::Result<::std::option::Option<i64>, ::aws_smithy_http::header::ParseError> {
  140         -
    let headers = header_map.get_all("X-Long");
  141         -
    let var_11 = ::aws_smithy_http::header::read_many_primitive::<i64>(headers)?;
  142         -
    if var_11.len() > 1 {
  143         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
  144         -
            "expected one item but found {}",
  145         -
            var_11.len()
  146         -
        )))
  147         -
    } else {
  148         -
        let mut var_11 = var_11;
  149         -
        Ok(var_11.pop())
  150         -
    }
  151         -
}
  152         -
  153         -
pub(crate) fn de_header_short_header(
  154         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  155         -
) -> ::std::result::Result<::std::option::Option<i16>, ::aws_smithy_http::header::ParseError> {
  156         -
    let headers = header_map.get_all("X-Short");
  157         -
    let var_12 = ::aws_smithy_http::header::read_many_primitive::<i16>(headers)?;
  158         -
    if var_12.len() > 1 {
  159         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
  160         -
            "expected one item but found {}",
  161         -
            var_12.len()
  162         -
        )))
  163         -
    } else {
  164         -
        let mut var_12 = var_12;
  165         -
        Ok(var_12.pop())
  166         -
    }
  167         -
}
  168         -
  169         -
pub(crate) fn de_header_string_header(
  170         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  171         -
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
  172         -
    let headers = header_map.get_all("X-String");
  173         -
    ::aws_smithy_http::header::one_or_none(headers)
  174         -
}
  175         -
  176         -
pub(crate) fn de_header_string_list_header(
  177         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  178         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_http::header::ParseError> {
  179         -
    let headers = header_map.get_all("X-StringList");
  180         -
    let var_13: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
  181         -
    Ok(if !var_13.is_empty() { Some(var_13) } else { None })
  182         -
}
  183         -
  184         -
pub(crate) fn de_header_string_set_header(
  185         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  186         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_http::header::ParseError> {
  187         -
    let headers = header_map.get_all("X-StringSet");
  188         -
    let var_14: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
  189         -
    Ok(if !var_14.is_empty() { Some(var_14) } else { None })
  190         -
}
  191         -
  192         -
pub(crate) fn de_header_timestamp_list_header(
  193         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  194         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::aws_smithy_types::DateTime>>, ::aws_smithy_http::header::ParseError> {
  195         -
    let headers = header_map.get_all("X-TimestampList");
  196         -
    let var_15: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?;
  197         -
    Ok(if !var_15.is_empty() { Some(var_15) } else { None })
  198         -
}
  199         -
  200         -
pub(crate) fn de_header_true_bool_header(
  201         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
  202         -
) -> ::std::result::Result<::std::option::Option<bool>, ::aws_smithy_http::header::ParseError> {
  203         -
    let headers = header_map.get_all("X-Boolean1");
  204         -
    let var_16 = ::aws_smithy_http::header::read_many_primitive::<bool>(headers)?;
  205         -
    if var_16.len() > 1 {
  206         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
  207         -
            "expected one item but found {}",
  208         -
            var_16.len()
  209         -
        )))
  210         -
    } else {
  211         -
        let mut var_16 = var_16;
  212         -
        Ok(var_16.pop())
  213         -
    }
  214         -
}

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

@@ -1,0 +49,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_input_stream_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::input_stream::InputStreamOutput, crate::operation::input_stream::InputStreamError> {
    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::input_stream::InputStreamError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    let error_code = match generic.code() {
   13         -
        Some(code) => code,
   14         -
        None => return Err(crate::operation::input_stream::InputStreamError::unhandled(generic)),
   15         -
    };
   16         -
   17         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   18         -
    Err(match error_code {
   19         -
        "ErrorEvent" => crate::operation::input_stream::InputStreamError::ErrorEvent({
   20         -
            #[allow(unused_mut)]
   21         -
            let mut tmp = {
   22         -
                #[allow(unused_mut)]
   23         -
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
   24         -
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
   25         -
                    .map_err(crate::operation::input_stream::InputStreamError::unhandled)?;
   26         -
                let output = output.meta(generic);
   27         -
                output.build()
   28         -
            };
   29         -
            if tmp.message.is_none() {
   30         -
                tmp.message = _error_message;
   31         -
            }
   32         -
            tmp
   33         -
        }),
   34         -
        _ => crate::operation::input_stream::InputStreamError::generic(generic),
   35         -
    })
   36         -
}
   37         -
   38         -
#[allow(clippy::unnecessary_wraps)]
   39         -
pub fn de_input_stream_http_response(
   40         -
    _response_status: u16,
   41         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   42         -
    _response_body: &[u8],
   43         -
) -> std::result::Result<crate::operation::input_stream::InputStreamOutput, crate::operation::input_stream::InputStreamError> {
   44         -
    Ok({
   45         -
        #[allow(unused_mut)]
   46         -
        let mut output = crate::operation::input_stream::builders::InputStreamOutputBuilder::default();
   47         -
        output.build()
   48         -
    })
   49         -
}

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

@@ -1,0 +73,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_input_stream_with_initial_request_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::input_stream_with_initial_request::InputStreamWithInitialRequestOutput,
    9         -
    crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError,
   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::input_stream_with_initial_request::InputStreamWithInitialRequestError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    let error_code = match generic.code() {
   16         -
        Some(code) => code,
   17         -
        None => return Err(crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::unhandled(generic)),
   18         -
    };
   19         -
   20         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   21         -
    Err(match error_code {
   22         -
        "ErrorEvent" => crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::ErrorEvent({
   23         -
            #[allow(unused_mut)]
   24         -
            let mut tmp = {
   25         -
                #[allow(unused_mut)]
   26         -
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
   27         -
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
   28         -
                    .map_err(crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::unhandled)?;
   29         -
                let output = output.meta(generic);
   30         -
                output.build()
   31         -
            };
   32         -
            if tmp.message.is_none() {
   33         -
                tmp.message = _error_message;
   34         -
            }
   35         -
            tmp
   36         -
        }),
   37         -
        _ => crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::generic(generic),
   38         -
    })
   39         -
}
   40         -
   41         -
#[allow(clippy::unnecessary_wraps)]
   42         -
pub fn de_input_stream_with_initial_request_http_response(
   43         -
    _response_status: u16,
   44         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   45         -
    _response_body: &[u8],
   46         -
) -> std::result::Result<
   47         -
    crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput,
   48         -
    crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError,
   49         -
> {
   50         -
    Ok({
   51         -
        #[allow(unused_mut)]
   52         -
        let mut output = crate::operation::input_stream_with_initial_request::builders::InputStreamWithInitialRequestOutputBuilder::default();
   53         -
        output.build()
   54         -
    })
   55         -
}
   56         -
   57         -
pub fn ser_input_stream_with_initial_request_headers(
   58         -
    input: &crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
   59         -
    mut builder: ::http_1x::request::Builder,
   60         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   61         -
    if let ::std::option::Option::Some(inner_1) = &input.initial_request_member {
   62         -
        let formatted_2 = inner_1.as_str();
   63         -
        let header_value = formatted_2;
   64         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   65         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   66         -
                "initial_request_member",
   67         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   68         -
            )
   69         -
        })?;
   70         -
        builder = builder.header("initial-request-member", header_value);
   71         -
    }
   72         -
    Ok(builder)
   73         -
}