Client Test

Client Test

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_foo_enum_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_foo_enum_set<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::FooEnum>>, ::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| crate::types::FooEnum::from(u.as_ref())))
   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_foo_error.rs

@@ -1,0 +35,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_foo_error_json_err(
    3         -
    _value: &[u8],
    4         -
    mut builder: crate::types::error::builders::FooErrorBuilder,
    5         -
) -> ::std::result::Result<crate::types::error::builders::FooErrorBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
    6         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
    7         -
    let tokens = &mut tokens_owned;
    8         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
    9         -
    loop {
   10         -
        match tokens.next().transpose()? {
   11         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   12         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   13         -
                "Message" => {
   14         -
                    builder = builder.set_message(
   15         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   16         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   17         -
                            .transpose()?,
   18         -
                    );
   19         -
                }
   20         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   21         -
            },
   22         -
            other => {
   23         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   24         -
                    "expected object key or end object, found: {other:?}"
   25         -
                )))
   26         -
            }
   27         -
        }
   28         -
    }
   29         -
    if tokens.next().is_some() {
   30         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31         -
            "found more JSON tokens after completing parsing",
   32         -
        ));
   33         -
    }
   34         -
    Ok(builder)
   35         -
}

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

@@ -1,0 +67,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_fractional_seconds_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::fractional_seconds::FractionalSecondsOutput, crate::operation::fractional_seconds::FractionalSecondsError>
    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::fractional_seconds::FractionalSecondsError::unhandled)?;
   12         -
    let generic = generic_builder.build();
   13         -
    Err(crate::operation::fractional_seconds::FractionalSecondsError::generic(generic))
   14         -
}
   15         -
   16         -
#[allow(clippy::unnecessary_wraps)]
   17         -
pub fn de_fractional_seconds_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::fractional_seconds::FractionalSecondsOutput, crate::operation::fractional_seconds::FractionalSecondsError>
   22         -
{
   23         -
    Ok({
   24         -
        #[allow(unused_mut)]
   25         -
        let mut output = crate::operation::fractional_seconds::builders::FractionalSecondsOutputBuilder::default();
   26         -
        output = crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds(_response_body, output)
   27         -
            .map_err(crate::operation::fractional_seconds::FractionalSecondsError::unhandled)?;
   28         -
        output.build()
   29         -
    })
   30         -
}
   31         -
   32         -
pub(crate) fn de_fractional_seconds(
   33         -
    _value: &[u8],
   34         -
    mut builder: crate::operation::fractional_seconds::builders::FractionalSecondsOutputBuilder,
   35         -
) -> ::std::result::Result<
   36         -
    crate::operation::fractional_seconds::builders::FractionalSecondsOutputBuilder,
   37         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   38         -
> {
   39         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   40         -
    let tokens = &mut tokens_owned;
   41         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   42         -
    loop {
   43         -
        match tokens.next().transpose()? {
   44         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   45         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   46         -
                "datetime" => {
   47         -
                    builder = builder.set_datetime(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   48         -
                        tokens.next(),
   49         -
                        ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
   50         -
                    )?);
   51         -
                }
   52         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   53         -
            },
   54         -
            other => {
   55         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   56         -
                    "expected object key or end object, found: {other:?}"
   57         -
                )))
   58         -
            }
   59         -
        }
   60         -
    }
   61         -
    if tokens.next().is_some() {
   62         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   63         -
            "found more JSON tokens after completing parsing",
   64         -
        ));
   65         -
    }
   66         -
    Ok(builder)
   67         -
}

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

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

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

@@ -1,0 +95,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_greeting_with_errors_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::greeting_with_errors::GreetingWithErrorsOutput,
    9         -
    crate::operation::greeting_with_errors::GreetingWithErrorsError,
   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::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    let error_code = match generic.code() {
   16         -
        Some(code) => code,
   17         -
        None => return Err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled(generic)),
   18         -
    };
   19         -
   20         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   21         -
    Err(match error_code {
   22         -
        "InvalidGreeting" => crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting({
   23         -
            #[allow(unused_mut)]
   24         -
            let mut tmp = {
   25         -
                #[allow(unused_mut)]
   26         -
                let mut output = crate::types::error::builders::InvalidGreetingBuilder::default();
   27         -
                output = crate::protocol_serde::shape_invalid_greeting::de_invalid_greeting_json_err(_response_body, output)
   28         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::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         -
        "ComplexError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError({
   38         -
            #[allow(unused_mut)]
   39         -
            let mut tmp = {
   40         -
                #[allow(unused_mut)]
   41         -
                let mut output = crate::types::error::builders::ComplexErrorBuilder::default();
   42         -
                output = crate::protocol_serde::shape_complex_error::de_complex_error_json_err(_response_body, output)
   43         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   44         -
                output = output.set_header(
   45         -
                    crate::protocol_serde::shape_complex_error::de_header_header(_response_headers).map_err(|_| {
   46         -
                        crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled("Failed to parse Header from header `X-Header")
   47         -
                    })?,
   48         -
                );
   49         -
                let output = output.meta(generic);
   50         -
                output.build()
   51         -
            };
   52         -
            if tmp.message.is_none() {
   53         -
                tmp.message = _error_message;
   54         -
            }
   55         -
            tmp
   56         -
        }),
   57         -
        "FooError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError({
   58         -
            #[allow(unused_mut)]
   59         -
            let mut tmp = {
   60         -
                #[allow(unused_mut)]
   61         -
                let mut output = crate::types::error::builders::FooErrorBuilder::default();
   62         -
                output = crate::protocol_serde::shape_foo_error::de_foo_error_json_err(_response_body, output)
   63         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   64         -
                let output = output.meta(generic);
   65         -
                output.build()
   66         -
            };
   67         -
            if tmp.message.is_none() {
   68         -
                tmp.message = _error_message;
   69         -
            }
   70         -
            tmp
   71         -
        }),
   72         -
        _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic),
   73         -
    })
   74         -
}
   75         -
   76         -
#[allow(clippy::unnecessary_wraps)]
   77         -
pub fn de_greeting_with_errors_http_response(
   78         -
    _response_status: u16,
   79         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   80         -
    _response_body: &[u8],
   81         -
) -> std::result::Result<
   82         -
    crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
   83         -
    crate::operation::greeting_with_errors::GreetingWithErrorsError,
   84         -
> {
   85         -
    Ok({
   86         -
        #[allow(unused_mut)]
   87         -
        let mut output = crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder::default();
   88         -
        output = output.set_greeting(
   89         -
            crate::protocol_serde::shape_greeting_with_errors_output::de_greeting_header(_response_headers).map_err(|_| {
   90         -
                crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled("Failed to parse greeting from header `X-Greeting")
   91         -
            })?,
   92         -
        );
   93         -
        output.build()
   94         -
    })
   95         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_greeting_with_errors_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_greeting_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-Greeting");
    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_host_with_path_operation.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_host_with_path_operation_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::host_with_path_operation::HostWithPathOperationOutput,
    9         -
    crate::operation::host_with_path_operation::HostWithPathOperationError,
   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::host_with_path_operation::HostWithPathOperationError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::host_with_path_operation::HostWithPathOperationError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_host_with_path_operation_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::host_with_path_operation::HostWithPathOperationOutput,
   25         -
    crate::operation::host_with_path_operation::HostWithPathOperationError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::host_with_path_operation::builders::HostWithPathOperationOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

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

@@ -1,0 +82,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_checksum_required_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_checksum_required::HttpChecksumRequiredOutput,
    9         -
    crate::operation::http_checksum_required::HttpChecksumRequiredError,
   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_checksum_required::HttpChecksumRequiredError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::http_checksum_required::HttpChecksumRequiredError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_http_checksum_required_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_checksum_required::HttpChecksumRequiredOutput,
   25         -
    crate::operation::http_checksum_required::HttpChecksumRequiredError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::http_checksum_required::builders::HttpChecksumRequiredOutputBuilder::default();
   30         -
        output = crate::protocol_serde::shape_http_checksum_required::de_http_checksum_required(_response_body, output)
   31         -
            .map_err(crate::operation::http_checksum_required::HttpChecksumRequiredError::unhandled)?;
   32         -
        output.build()
   33         -
    })
   34         -
}
   35         -
   36         -
pub fn ser_http_checksum_required_input(
   37         -
    input: &crate::operation::http_checksum_required::HttpChecksumRequiredInput,
   38         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   39         -
    let mut out = String::new();
   40         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   41         -
    crate::protocol_serde::shape_http_checksum_required_input::ser_http_checksum_required_input_input(&mut object, input)?;
   42         -
    object.finish();
   43         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   44         -
}
   45         -
   46         -
pub(crate) fn de_http_checksum_required(
   47         -
    _value: &[u8],
   48         -
    mut builder: crate::operation::http_checksum_required::builders::HttpChecksumRequiredOutputBuilder,
   49         -
) -> ::std::result::Result<
   50         -
    crate::operation::http_checksum_required::builders::HttpChecksumRequiredOutputBuilder,
   51         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   52         -
> {
   53         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   54         -
    let tokens = &mut tokens_owned;
   55         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   56         -
    loop {
   57         -
        match tokens.next().transpose()? {
   58         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   59         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   60         -
                "foo" => {
   61         -
                    builder = builder.set_foo(
   62         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   63         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   64         -
                            .transpose()?,
   65         -
                    );
   66         -
                }
   67         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   68         -
            },
   69         -
            other => {
   70         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   71         -
                    "expected object key or end object, found: {other:?}"
   72         -
                )))
   73         -
            }
   74         -
        }
   75         -
    }
   76         -
    if tokens.next().is_some() {
   77         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   78         -
            "found more JSON tokens after completing parsing",
   79         -
        ));
   80         -
    }
   81         -
    Ok(builder)
   82         -
}

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

@@ -1,0 +10,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_http_checksum_required_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::http_checksum_required::HttpChecksumRequiredInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.foo {
    7         -
        object.key("foo").string(var_1.as_str());
    8         -
    }
    9         -
    Ok(())
   10         -
}

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

@@ -1,0 +85,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_empty_prefix_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::http_empty_prefix_headers::HttpEmptyPrefixHeadersOutput,
    9         -
    crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersError,
   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_empty_prefix_headers::HttpEmptyPrefixHeadersError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_http_empty_prefix_headers_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersOutput,
   25         -
    crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::http_empty_prefix_headers::builders::HttpEmptyPrefixHeadersOutputBuilder::default();
   30         -
        output = output.set_prefix_headers(
   31         -
            crate::protocol_serde::shape_http_empty_prefix_headers_output::de_prefix_headers_prefix_header(_response_headers).map_err(|_| {
   32         -
                crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersError::unhandled(
   33         -
                    "Failed to parse prefixHeaders from prefix header `",
   34         -
                )
   35         -
            })?,
   36         -
        );
   37         -
        output = output.set_specific_header(
   38         -
            crate::protocol_serde::shape_http_empty_prefix_headers_output::de_specific_header_header(_response_headers).map_err(|_| {
   39         -
                crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersError::unhandled(
   40         -
                    "Failed to parse specificHeader from header `hello",
   41         -
                )
   42         -
            })?,
   43         -
        );
   44         -
        output.build()
   45         -
    })
   46         -
}
   47         -
   48         -
pub fn ser_http_empty_prefix_headers_headers(
   49         -
    input: &crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersInput,
   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.specific_header {
   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         -
                "specific_header",
   58         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   59         -
            )
   60         -
        })?;
   61         -
        builder = builder.header("hello", header_value);
   62         -
    }
   63         -
    if let ::std::option::Option::Some(inner_3) = &input.prefix_headers {
   64         -
        {
   65         -
            for (k, v) in inner_3 {
   66         -
                use std::str::FromStr;
   67         -
                let header_name = ::http_1x::HeaderName::from_str(&format!("{}{}", "", &k)).map_err(|err| {
   68         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   69         -
                        "prefix_headers",
   70         -
                        format!("`{k}` cannot be used as a header name: {err}"),
   71         -
                    )
   72         -
                })?;
   73         -
                let header_value = v.as_str();
   74         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   75         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   76         -
                        "prefix_headers",
   77         -
                        format!("`{v}` cannot be used as a header value: {err}"),
   78         -
                    )
   79         -
                })?;
   80         -
                builder = builder.header(header_name, header_value);
   81         -
            }
   82         -
        }
   83         -
    }
   84         -
    Ok(builder)
   85         -
}

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

@@ -1,0 +29,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_prefix_headers_prefix_header(
    3         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4         -
) -> std::result::Result<
    5         -
    ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    6         -
    ::aws_smithy_http::header::ParseError,
    7         -
> {
    8         -
    let headers = ::aws_smithy_http::header::headers_for_prefix(header_map.iter().map(|(k, _)| k), "");
    9         -
    let out: std::result::Result<_, _> = headers.map(|(key, header_name)| {
   10         -
                            let values = header_map.get_all(header_name);
   11         -
                            crate::protocol_serde::shape_http_empty_prefix_headers_output::de_prefix_headers_inner(values).map(|v| (key.to_string(), v.expect(
   12         -
                                "we have checked there is at least one value for this header name; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues"
   13         -
                            )))
   14         -
                        }).collect();
   15         -
    out.map(Some)
   16         -
}
   17         -
   18         -
pub(crate) fn de_specific_header_header(
   19         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   20         -
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   21         -
    let headers = header_map.get_all("hello");
   22         -
    ::aws_smithy_http::header::one_or_none(headers)
   23         -
}
   24         -
   25         -
pub fn de_prefix_headers_inner<'a>(
   26         -
    headers: impl ::std::iter::Iterator<Item = &'a str>,
   27         -
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   28         -
    ::aws_smithy_http::header::one_or_none(headers)
   29         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_http_enum_payload.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_enum_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_enum_payload::HttpEnumPayloadOutput, crate::operation::http_enum_payload::HttpEnumPayloadError> {
    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_enum_payload::HttpEnumPayloadError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::http_enum_payload::HttpEnumPayloadError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_http_enum_payload_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_enum_payload::HttpEnumPayloadOutput, crate::operation::http_enum_payload::HttpEnumPayloadError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::http_enum_payload::builders::HttpEnumPayloadOutputBuilder::default();
   24         -
        output = output.set_payload(crate::protocol_serde::shape_http_enum_payload_output::de_payload_payload(_response_body)?);
   25         -
        output.build()
   26         -
    })
   27         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_http_enum_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<crate::types::StringEnum>,
    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.as_str().as_bytes().to_vec())
   10         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_http_enum_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<crate::types::StringEnum>, crate::operation::http_enum_payload::HttpEnumPayloadError> {
    5         -
    (!body.is_empty())
    6         -
        .then(|| {
    7         -
            let body_str = std::str::from_utf8(body).map_err(crate::operation::http_enum_payload::HttpEnumPayloadError::unhandled)?;
    8         -
            Ok(crate::types::StringEnum::from(body_str))
    9         -
        })
   10         -
        .transpose()
   11         -
}

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

@@ -1,0 +51,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_http_payload_traits_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_payload_traits::HttpPayloadTraitsOutput, crate::operation::http_payload_traits::HttpPayloadTraitsError>
    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_payload_traits::HttpPayloadTraitsError::unhandled)?;
   12         -
    let generic = generic_builder.build();
   13         -
    Err(crate::operation::http_payload_traits::HttpPayloadTraitsError::generic(generic))
   14         -
}
   15         -
   16         -
#[allow(clippy::unnecessary_wraps)]
   17         -
pub fn de_http_payload_traits_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_payload_traits::HttpPayloadTraitsOutput, crate::operation::http_payload_traits::HttpPayloadTraitsError>
   22         -
{
   23         -
    Ok({
   24         -
        #[allow(unused_mut)]
   25         -
        let mut output = crate::operation::http_payload_traits::builders::HttpPayloadTraitsOutputBuilder::default();
   26         -
        output = output.set_blob(crate::protocol_serde::shape_http_payload_traits_output::de_blob_payload(_response_body)?);
   27         -
        output = output.set_foo(
   28         -
            crate::protocol_serde::shape_http_payload_traits_output::de_foo_header(_response_headers)
   29         -
                .map_err(|_| crate::operation::http_payload_traits::HttpPayloadTraitsError::unhandled("Failed to parse foo from header `X-Foo"))?,
   30         -
        );
   31         -
        output.build()
   32         -
    })
   33         -
}
   34         -
   35         -
pub fn ser_http_payload_traits_headers(
   36         -
    input: &crate::operation::http_payload_traits::HttpPayloadTraitsInput,
   37         -
    mut builder: ::http_1x::request::Builder,
   38         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   39         -
    if let ::std::option::Option::Some(inner_1) = &input.foo {
   40         -
        let formatted_2 = inner_1.as_str();
   41         -
        let header_value = formatted_2;
   42         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   43         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   44         -
                "foo",
   45         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   46         -
            )
   47         -
        })?;
   48         -
        builder = builder.header("X-Foo", header_value);
   49         -
    }
   50         -
    Ok(builder)
   51         -
}

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

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