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_streaming_traits.rs

@@ -1,1 +55,0 @@
   15     15   
        output = output.set_blob(Some(crate::protocol_serde::shape_streaming_traits_output::de_blob_payload(
   16     16   
            _response_body,
   17     17   
        )?));
   18     18   
        output = output.set_foo(
   19     19   
            crate::protocol_serde::shape_streaming_traits_output::de_foo_header(_response_headers)
   20     20   
                .map_err(|_| crate::operation::streaming_traits::StreamingTraitsError::unhandled("Failed to parse foo from header `X-Foo"))?,
   21     21   
        );
   22     22   
        output.build()
   23     23   
    })
   24     24   
}
   25         -
   26         -
#[allow(clippy::unnecessary_wraps)]
   27         -
pub fn de_streaming_traits_http_error(
   28         -
    _response_status: u16,
   29         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   30         -
    _response_body: &[u8],
   31         -
) -> std::result::Result<crate::operation::streaming_traits::StreamingTraitsOutput, crate::operation::streaming_traits::StreamingTraitsError> {
   32         -
    #[allow(unused_mut)]
   33         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   34         -
        .map_err(crate::operation::streaming_traits::StreamingTraitsError::unhandled)?;
   35         -
    let generic = generic_builder.build();
   36         -
    Err(crate::operation::streaming_traits::StreamingTraitsError::generic(generic))
   37         -
}
   38         -
   39         -
pub fn ser_streaming_traits_headers(
   40         -
    input: &crate::operation::streaming_traits::StreamingTraitsInput,
   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.foo {
   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         -
                "foo",
   49         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   50         -
            )
   51         -
        })?;
   52         -
        builder = builder.header("X-Foo", header_value);
   53         -
    }
   54         -
    Ok(builder)
   55         -
}

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

@@ -1,0 +6,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_blob_http_payload(
    3         -
    payload: ::aws_smithy_types::byte_stream::ByteStream,
    4         -
) -> ::std::result::Result<::aws_smithy_types::byte_stream::ByteStream, ::aws_smithy_types::error::operation::BuildError> {
    5         -
    Ok(payload)
    6         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_streaming_traits_require_length.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_streaming_traits_require_length_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::streaming_traits_require_length::StreamingTraitsRequireLengthOutput,
    9         -
    crate::operation::streaming_traits_require_length::StreamingTraitsRequireLengthError,
   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::streaming_traits_require_length::StreamingTraitsRequireLengthError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::streaming_traits_require_length::StreamingTraitsRequireLengthError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_streaming_traits_require_length_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::streaming_traits_require_length::StreamingTraitsRequireLengthOutput,
   25         -
    crate::operation::streaming_traits_require_length::StreamingTraitsRequireLengthError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::streaming_traits_require_length::builders::StreamingTraitsRequireLengthOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}
   33         -
   34         -
pub fn ser_streaming_traits_require_length_headers(
   35         -
    input: &crate::operation::streaming_traits_require_length::StreamingTraitsRequireLengthInput,
   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.foo {
   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         -
                "foo",
   44         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45         -
            )
   46         -
        })?;
   47         -
        builder = builder.header("X-Foo", header_value);
   48         -
    }
   49         -
    Ok(builder)
   50         -
}

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

@@ -1,0 +6,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_blob_http_payload(
    3         -
    payload: ::aws_smithy_types::byte_stream::ByteStream,
    4         -
) -> ::std::result::Result<::aws_smithy_types::byte_stream::ByteStream, ::aws_smithy_types::error::operation::BuildError> {
    5         -
    Ok(payload)
    6         -
}

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

@@ -1,1 +64,0 @@
   21     21   
        output = output.set_foo(
   22     22   
            crate::protocol_serde::shape_streaming_traits_with_media_type_output::de_foo_header(_response_headers).map_err(|_| {
   23     23   
                crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError::unhandled(
   24     24   
                    "Failed to parse foo from header `X-Foo",
   25     25   
                )
   26     26   
            })?,
   27     27   
        );
   28     28   
        output.build()
   29     29   
    })
   30     30   
}
   31         -
   32         -
#[allow(clippy::unnecessary_wraps)]
   33         -
pub fn de_streaming_traits_with_media_type_http_error(
   34         -
    _response_status: u16,
   35         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   36         -
    _response_body: &[u8],
   37         -
) -> std::result::Result<
   38         -
    crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeOutput,
   39         -
    crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError,
   40         -
> {
   41         -
    #[allow(unused_mut)]
   42         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   43         -
        .map_err(crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError::unhandled)?;
   44         -
    let generic = generic_builder.build();
   45         -
    Err(crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError::generic(generic))
   46         -
}
   47         -
   48         -
pub fn ser_streaming_traits_with_media_type_headers(
   49         -
    input: &crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeInput,
   50         -
    mut builder: ::http_1x::request::Builder,
   51         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   52         -
    if let ::std::option::Option::Some(inner_1) = &input.foo {
   53         -
        let formatted_2 = inner_1.as_str();
   54         -
        let header_value = formatted_2;
   55         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   56         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   57         -
                "foo",
   58         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   59         -
            )
   60         -
        })?;
   61         -
        builder = builder.header("X-Foo", header_value);
   62         -
    }
   63         -
    Ok(builder)
   64         -
}

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

@@ -1,0 +6,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_blob_http_payload(
    3         -
    payload: ::aws_smithy_types::byte_stream::ByteStream,
    4         -
) -> ::std::result::Result<::aws_smithy_types::byte_stream::ByteStream, ::aws_smithy_types::error::operation::BuildError> {
    5         -
    Ok(payload)
    6         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_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_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_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_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_string_set.rs

@@ -1,0 +39,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_string_set<'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_structure_list.rs

@@ -1,0 +37,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_structure_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::StructureListMember>>, ::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 = crate::protocol_serde::shape_structure_list_member::de_structure_list_member(tokens, _value)?;
   21         -
                        if let Some(value) = value {
   22         -
                            items.push(value);
   23         -
                        } else {
   24         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   25         -
                                "dense list cannot contain null values",
   26         -
                            ));
   27         -
                        }
   28         -
                    }
   29         -
                }
   30         -
            }
   31         -
            Ok(Some(items))
   32         -
        }
   33         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34         -
            "expected start array or null",
   35         -
        )),
   36         -
    }
   37         -
}

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

@@ -1,0 +60,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_structure_list_member(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::StructureListMember,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.a {
    7         -
        object.key("value").string(var_1.as_str());
    8         -
    }
    9         -
    if let Some(var_2) = &input.b {
   10         -
        object.key("other").string(var_2.as_str());
   11         -
    }
   12         -
    Ok(())
   13         -
}
   14         -
   15         -
pub(crate) fn de_structure_list_member<'a, I>(
   16         -
    tokens: &mut ::std::iter::Peekable<I>,
   17         -
    _value: &'a [u8],
   18         -
) -> ::std::result::Result<Option<crate::types::StructureListMember>, ::aws_smithy_json::deserialize::error::DeserializeError>
   19         -
where
   20         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   21         -
{
   22         -
    match tokens.next().transpose()? {
   23         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   24         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   25         -
            #[allow(unused_mut)]
   26         -
            let mut builder = crate::types::builders::StructureListMemberBuilder::default();
   27         -
            loop {
   28         -
                match tokens.next().transpose()? {
   29         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   30         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   31         -
                        "value" => {
   32         -
                            builder = builder.set_a(
   33         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   34         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   35         -
                                    .transpose()?,
   36         -
                            );
   37         -
                        }
   38         -
                        "other" => {
   39         -
                            builder = builder.set_b(
   40         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   41         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   42         -
                                    .transpose()?,
   43         -
                            );
   44         -
                        }
   45         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   46         -
                    },
   47         -
                    other => {
   48         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   49         -
                            "expected object key or end object, found: {other:?}"
   50         -
                        )))
   51         -
                    }
   52         -
                }
   53         -
            }
   54         -
            Ok(Some(builder.build()))
   55         -
        }
   56         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   57         -
            "expected start object or null",
   58         -
        )),
   59         -
    }
   60         -
}

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

@@ -1,0 +97,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_body_structure_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_body_structure::TestBodyStructureOutput, crate::operation::test_body_structure::TestBodyStructureError>
    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_body_structure::TestBodyStructureError::unhandled)?;
   12         -
    let generic = generic_builder.build();
   13         -
    Err(crate::operation::test_body_structure::TestBodyStructureError::generic(generic))
   14         -
}
   15         -
   16         -
#[allow(clippy::unnecessary_wraps)]
   17         -
pub fn de_test_body_structure_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_body_structure::TestBodyStructureOutput, crate::operation::test_body_structure::TestBodyStructureError>
   22         -
{
   23         -
    Ok({
   24         -
        #[allow(unused_mut)]
   25         -
        let mut output = crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder::default();
   26         -
        output = crate::protocol_serde::shape_test_body_structure::de_test_body_structure(_response_body, output)
   27         -
            .map_err(crate::operation::test_body_structure::TestBodyStructureError::unhandled)?;
   28         -
        output = output.set_test_id(
   29         -
            crate::protocol_serde::shape_test_body_structure_output::de_test_id_header(_response_headers).map_err(|_| {
   30         -
                crate::operation::test_body_structure::TestBodyStructureError::unhandled("Failed to parse testId from header `x-amz-test-id")
   31         -
            })?,
   32         -
        );
   33         -
        output.build()
   34         -
    })
   35         -
}
   36         -
   37         -
pub fn ser_test_body_structure_headers(
   38         -
    input: &crate::operation::test_body_structure::TestBodyStructureInput,
   39         -
    mut builder: ::http_1x::request::Builder,
   40         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   41         -
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
   42         -
        let formatted_2 = inner_1.as_str();
   43         -
        let header_value = formatted_2;
   44         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   45         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   46         -
                "test_id",
   47         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   48         -
            )
   49         -
        })?;
   50         -
        builder = builder.header("x-amz-test-id", header_value);
   51         -
    }
   52         -
    Ok(builder)
   53         -
}
   54         -
   55         -
pub fn ser_test_body_structure_input(
   56         -
    input: &crate::operation::test_body_structure::TestBodyStructureInput,
   57         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   58         -
    let mut out = String::new();
   59         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   60         -
    crate::protocol_serde::shape_test_body_structure_input::ser_test_body_structure_input_input(&mut object, input)?;
   61         -
    object.finish();
   62         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   63         -
}
   64         -
   65         -
pub(crate) fn de_test_body_structure(
   66         -
    _value: &[u8],
   67         -
    mut builder: crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder,
   68         -
) -> ::std::result::Result<
   69         -
    crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder,
   70         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   71         -
> {
   72         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   73         -
    let tokens = &mut tokens_owned;
   74         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   75         -
    loop {
   76         -
        match tokens.next().transpose()? {
   77         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   78         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   79         -
                "testConfig" => {
   80         -
                    builder = builder.set_test_config(crate::protocol_serde::shape_test_config::de_test_config(tokens, _value)?);
   81         -
                }
   82         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   83         -
            },
   84         -
            other => {
   85         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   86         -
                    "expected object key or end object, found: {other:?}"
   87         -
                )))
   88         -
            }
   89         -
        }
   90         -
    }
   91         -
    if tokens.next().is_some() {
   92         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   93         -
            "found more JSON tokens after completing parsing",
   94         -
        ));
   95         -
    }
   96         -
    Ok(builder)
   97         -
}

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

@@ -1,0 +13,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_test_body_structure_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::test_body_structure::TestBodyStructureInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.test_config {
    7         -
        #[allow(unused_mut)]
    8         -
        let mut object_2 = object.key("testConfig").start_object();
    9         -
        crate::protocol_serde::shape_test_config::ser_test_config(&mut object_2, var_1)?;
   10         -
        object_2.finish();
   11         -
    }
   12         -
    Ok(())
   13         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_body_structure_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_config.rs

@@ -1,0 +53,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_test_config<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::TestConfig>, ::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::StartObject { .. }) => {
   12         -
            #[allow(unused_mut)]
   13         -
            let mut builder = crate::types::builders::TestConfigBuilder::default();
   14         -
            loop {
   15         -
                match tokens.next().transpose()? {
   16         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   17         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   18         -
                        "timeout" => {
   19         -
                            builder = builder.set_timeout(
   20         -
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   21         -
                                    .map(i32::try_from)
   22         -
                                    .transpose()?,
   23         -
                            );
   24         -
                        }
   25         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   26         -
                    },
   27         -
                    other => {
   28         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   29         -
                            "expected object key or end object, found: {other:?}"
   30         -
                        )))
   31         -
                    }
   32         -
                }
   33         -
            }
   34         -
            Ok(Some(builder.build()))
   35         -
        }
   36         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37         -
            "expected start object or null",
   38         -
        )),
   39         -
    }
   40         -
}
   41         -
   42         -
pub fn ser_test_config(
   43         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   44         -
    input: &crate::types::TestConfig,
   45         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
   46         -
    if let Some(var_1) = &input.timeout {
   47         -
        object.key("timeout").number(
   48         -
            #[allow(clippy::useless_conversion)]
   49         -
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   50         -
        );
   51         -
    }
   52         -
    Ok(())
   53         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_get_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_get_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_get_no_input_no_payload::TestGetNoInputNoPayloadOutput,
    9         -
    crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError,
   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_get_no_input_no_payload::TestGetNoInputNoPayloadError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError::generic(
   16         -
        generic,
   17         -
    ))
   18         -
}
   19         -
   20         -
#[allow(clippy::unnecessary_wraps)]
   21         -
pub fn de_test_get_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_get_no_input_no_payload::TestGetNoInputNoPayloadOutput,
   27         -
    crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError,
   28         -
> {
   29         -
    Ok({
   30         -
        #[allow(unused_mut)]
   31         -
        let mut output = crate::operation::test_get_no_input_no_payload::builders::TestGetNoInputNoPayloadOutputBuilder::default();
   32         -
        output = output.set_test_id(
   33         -
            crate::protocol_serde::shape_test_get_no_input_no_payload_output::de_test_id_header(_response_headers).map_err(|_| {
   34         -
                crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError::unhandled(
   35         -
                    "Failed to parse testId from header `X-Amz-Test-Id",
   36         -
                )
   37         -
            })?,
   38         -
        );
   39         -
        output.build()
   40         -
    })
   41         -
}