Client Test

Client Test

rev. e063993ca0ab793f44c575dbe707d50a5e3e2406 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_primitive_int_header.rs

@@ -1,0 +74,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_primitive_int_header_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::primitive_int_header::PrimitiveIntHeaderOutput,
    9         -
    crate::operation::primitive_int_header::PrimitiveIntHeaderError,
   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::primitive_int_header::PrimitiveIntHeaderError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    let error_code = match generic.code() {
   16         -
        Some(code) => code,
   17         -
        None => return Err(crate::operation::primitive_int_header::PrimitiveIntHeaderError::unhandled(generic)),
   18         -
    };
   19         -
   20         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   21         -
    Err(match error_code {
   22         -
        "ValidationException" => crate::operation::primitive_int_header::PrimitiveIntHeaderError::ValidationError({
   23         -
            #[allow(unused_mut)]
   24         -
            let mut tmp = {
   25         -
                #[allow(unused_mut)]
   26         -
                let mut output = crate::types::error::builders::ValidationErrorBuilder::default();
   27         -
                output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
   28         -
                    .map_err(crate::operation::primitive_int_header::PrimitiveIntHeaderError::unhandled)?;
   29         -
                let output = output.meta(generic);
   30         -
                crate::serde_util::validation_exception_correct_errors(output)
   31         -
                    .build()
   32         -
                    .map_err(crate::operation::primitive_int_header::PrimitiveIntHeaderError::unhandled)?
   33         -
            };
   34         -
            tmp
   35         -
        }),
   36         -
        "ExtraError" => crate::operation::primitive_int_header::PrimitiveIntHeaderError::ExtraError({
   37         -
            #[allow(unused_mut)]
   38         -
            let mut tmp = {
   39         -
                #[allow(unused_mut)]
   40         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   41         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   42         -
                    .map_err(crate::operation::primitive_int_header::PrimitiveIntHeaderError::unhandled)?;
   43         -
                let output = output.meta(generic);
   44         -
                output.build()
   45         -
            };
   46         -
            if tmp.message.is_none() {
   47         -
                tmp.message = _error_message;
   48         -
            }
   49         -
            tmp
   50         -
        }),
   51         -
        _ => crate::operation::primitive_int_header::PrimitiveIntHeaderError::generic(generic),
   52         -
    })
   53         -
}
   54         -
   55         -
#[allow(clippy::unnecessary_wraps)]
   56         -
pub fn de_primitive_int_header_http_response(
   57         -
    _response_status: u16,
   58         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   59         -
    _response_body: &[u8],
   60         -
) -> std::result::Result<
   61         -
    crate::operation::primitive_int_header::PrimitiveIntHeaderOutput,
   62         -
    crate::operation::primitive_int_header::PrimitiveIntHeaderError,
   63         -
> {
   64         -
    Ok({
   65         -
        #[allow(unused_mut)]
   66         -
        let mut output = crate::operation::primitive_int_header::builders::PrimitiveIntHeaderOutputBuilder::default();
   67         -
        output = output.set_field(
   68         -
            crate::protocol_serde::shape_primitive_int_header_output::de_field_header(_response_headers).map_err(|_| {
   69         -
                crate::operation::primitive_int_header::PrimitiveIntHeaderError::unhandled("Failed to parse field from header `x-field")
   70         -
            })?,
   71         -
        );
   72         -
        crate::serde_util::primitive_int_header_output_output_correct_errors(output).build()
   73         -
    })
   74         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_primitive_int_header_output.rs

@@ -1,0 +16,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_field_header(
    3         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4         -
) -> ::std::result::Result<::std::option::Option<i32>, ::aws_smithy_http::header::ParseError> {
    5         -
    let headers = header_map.get_all("x-field");
    6         -
    let var_1 = ::aws_smithy_http::header::read_many_primitive::<i32>(headers)?;
    7         -
    if var_1.len() > 1 {
    8         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
    9         -
            "expected one item but found {}",
   10         -
            var_1.len()
   11         -
        )))
   12         -
    } else {
   13         -
        let mut var_1 = var_1;
   14         -
        Ok(var_1.pop())
   15         -
    }
   16         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_primitive_int_op.rs

@@ -1,0 +99,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_primitive_int_op_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::primitive_int_op::PrimitiveIntOpOutput, crate::operation::primitive_int_op::PrimitiveIntOpError> {
    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::primitive_int_op::PrimitiveIntOpError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    let error_code = match generic.code() {
   13         -
        Some(code) => code,
   14         -
        None => return Err(crate::operation::primitive_int_op::PrimitiveIntOpError::unhandled(generic)),
   15         -
    };
   16         -
   17         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   18         -
    Err(match error_code {
   19         -
        "ExtraError" => crate::operation::primitive_int_op::PrimitiveIntOpError::ExtraError({
   20         -
            #[allow(unused_mut)]
   21         -
            let mut tmp = {
   22         -
                #[allow(unused_mut)]
   23         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   24         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   25         -
                    .map_err(crate::operation::primitive_int_op::PrimitiveIntOpError::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::primitive_int_op::PrimitiveIntOpError::generic(generic),
   35         -
    })
   36         -
}
   37         -
   38         -
#[allow(clippy::unnecessary_wraps)]
   39         -
pub fn de_primitive_int_op_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::primitive_int_op::PrimitiveIntOpOutput, crate::operation::primitive_int_op::PrimitiveIntOpError> {
   44         -
    Ok({
   45         -
        #[allow(unused_mut)]
   46         -
        let mut output = crate::operation::primitive_int_op::builders::PrimitiveIntOpOutputBuilder::default();
   47         -
        output = crate::protocol_serde::shape_primitive_int_op::de_primitive_int_op(_response_body, output)
   48         -
            .map_err(crate::operation::primitive_int_op::PrimitiveIntOpError::unhandled)?;
   49         -
        output.build()
   50         -
    })
   51         -
}
   52         -
   53         -
pub fn ser_primitive_int_op_input(
   54         -
    input: &crate::operation::primitive_int_op::PrimitiveIntOpInput,
   55         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   56         -
    let mut out = String::new();
   57         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   58         -
    crate::protocol_serde::shape_primitive_int_op_input::ser_primitive_int_op_input_input(&mut object, input)?;
   59         -
    object.finish();
   60         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   61         -
}
   62         -
   63         -
pub(crate) fn de_primitive_int_op(
   64         -
    _value: &[u8],
   65         -
    mut builder: crate::operation::primitive_int_op::builders::PrimitiveIntOpOutputBuilder,
   66         -
) -> ::std::result::Result<
   67         -
    crate::operation::primitive_int_op::builders::PrimitiveIntOpOutputBuilder,
   68         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   69         -
> {
   70         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   71         -
    let tokens = &mut tokens_owned;
   72         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   73         -
    loop {
   74         -
        match tokens.next().transpose()? {
   75         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   76         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   77         -
                "value" => {
   78         -
                    builder = builder.set_value(
   79         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   80         -
                            .map(i32::try_from)
   81         -
                            .transpose()?,
   82         -
                    );
   83         -
                }
   84         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   85         -
            },
   86         -
            other => {
   87         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   88         -
                    "expected object key or end object, found: {other:?}"
   89         -
                )))
   90         -
            }
   91         -
        }
   92         -
    }
   93         -
    if tokens.next().is_some() {
   94         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   95         -
            "found more JSON tokens after completing parsing",
   96         -
        ));
   97         -
    }
   98         -
    Ok(builder)
   99         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_primitive_int_op_input.rs

@@ -1,0 +13,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_primitive_int_op_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::primitive_int_op::PrimitiveIntOpInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.value {
    7         -
        object.key("value").number(
    8         -
            #[allow(clippy::useless_conversion)]
    9         -
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   10         -
        );
   11         -
    }
   12         -
    Ok(())
   13         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_query_precedence.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_query_precedence_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::query_precedence::QueryPrecedenceOutput, crate::operation::query_precedence::QueryPrecedenceError> {
    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::query_precedence::QueryPrecedenceError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    let error_code = match generic.code() {
   13         -
        Some(code) => code,
   14         -
        None => return Err(crate::operation::query_precedence::QueryPrecedenceError::unhandled(generic)),
   15         -
    };
   16         -
   17         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   18         -
    Err(match error_code {
   19         -
        "ExtraError" => crate::operation::query_precedence::QueryPrecedenceError::ExtraError({
   20         -
            #[allow(unused_mut)]
   21         -
            let mut tmp = {
   22         -
                #[allow(unused_mut)]
   23         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   24         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   25         -
                    .map_err(crate::operation::query_precedence::QueryPrecedenceError::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::query_precedence::QueryPrecedenceError::generic(generic),
   35         -
    })
   36         -
}
   37         -
   38         -
#[allow(clippy::unnecessary_wraps)]
   39         -
pub fn de_query_precedence_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::query_precedence::QueryPrecedenceOutput, crate::operation::query_precedence::QueryPrecedenceError> {
   44         -
    Ok({
   45         -
        #[allow(unused_mut)]
   46         -
        let mut output = crate::operation::query_precedence::builders::QueryPrecedenceOutputBuilder::default();
   47         -
        output.build()
   48         -
    })
   49         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_single_element_union.rs

@@ -1,0 +64,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_single_element_union<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::SingleElementUnion>, ::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         -
    let mut variant = None;
   10         -
    match tokens.next().transpose()? {
   11         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   12         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
   13         -
            match tokens.next().transpose()? {
   14         -
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   15         -
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   16         -
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
   17         -
                        tokens.peek()
   18         -
                    {
   19         -
                        let _ = tokens.next().expect("peek returned a token")?;
   20         -
                        continue;
   21         -
                    }
   22         -
                    let key = key.to_unescaped()?;
   23         -
                    if key == "__type" {
   24         -
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   25         -
                        continue;
   26         -
                    }
   27         -
                    if variant.is_some() {
   28         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   29         -
                            "encountered mixed variants in union",
   30         -
                        ));
   31         -
                    }
   32         -
                    variant = match key.as_ref() {
   33         -
                        "a" => Some(crate::types::SingleElementUnion::A(
   34         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   35         -
                                .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   36         -
                                .transpose()?
   37         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'a' cannot be null"))?,
   38         -
                        )),
   39         -
                        _ => {
   40         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   41         -
                            Some(crate::types::SingleElementUnion::Unknown)
   42         -
                        }
   43         -
                    };
   44         -
                }
   45         -
                other => {
   46         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   47         -
                        "expected object key or end object, found: {other:?}"
   48         -
                    )))
   49         -
                }
   50         -
            }
   51         -
        },
   52         -
        _ => {
   53         -
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   54         -
                "expected start object or null",
   55         -
            ))
   56         -
        }
   57         -
    }
   58         -
    if variant.is_none() {
   59         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   60         -
            "Union did not contain a valid variant.",
   61         -
        ));
   62         -
    }
   63         -
    Ok(variant)
   64         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_status_response.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_status_response_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::status_response::StatusResponseOutput, crate::operation::status_response::StatusResponseError> {
    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::status_response::StatusResponseError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    let error_code = match generic.code() {
   13         -
        Some(code) => code,
   14         -
        None => return Err(crate::operation::status_response::StatusResponseError::unhandled(generic)),
   15         -
    };
   16         -
   17         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   18         -
    Err(match error_code {
   19         -
        "ExtraError" => crate::operation::status_response::StatusResponseError::ExtraError({
   20         -
            #[allow(unused_mut)]
   21         -
            let mut tmp = {
   22         -
                #[allow(unused_mut)]
   23         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   24         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   25         -
                    .map_err(crate::operation::status_response::StatusResponseError::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::status_response::StatusResponseError::generic(generic),
   35         -
    })
   36         -
}
   37         -
   38         -
#[allow(clippy::unnecessary_wraps)]
   39         -
pub fn de_status_response_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::status_response::StatusResponseOutput, crate::operation::status_response::StatusResponseError> {
   44         -
    Ok({
   45         -
        #[allow(unused_mut)]
   46         -
        let mut output = crate::operation::status_response::builders::StatusResponseOutputBuilder::default();
   47         -
        output = output.set_field(Some(_response_status as _));
   48         -
        output.build()
   49         -
    })
   50         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_string_payload.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_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::string_payload::StringPayloadOutput, crate::operation::string_payload::StringPayloadError> {
    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::string_payload::StringPayloadError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    let error_code = match generic.code() {
   13         -
        Some(code) => code,
   14         -
        None => return Err(crate::operation::string_payload::StringPayloadError::unhandled(generic)),
   15         -
    };
   16         -
   17         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   18         -
    Err(match error_code {
   19         -
        "ExtraError" => crate::operation::string_payload::StringPayloadError::ExtraError({
   20         -
            #[allow(unused_mut)]
   21         -
            let mut tmp = {
   22         -
                #[allow(unused_mut)]
   23         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   24         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   25         -
                    .map_err(crate::operation::string_payload::StringPayloadError::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::string_payload::StringPayloadError::generic(generic),
   35         -
    })
   36         -
}
   37         -
   38         -
#[allow(clippy::unnecessary_wraps)]
   39         -
pub fn de_string_payload_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::string_payload::StringPayloadOutput, crate::operation::string_payload::StringPayloadError> {
   44         -
    Ok({
   45         -
        #[allow(unused_mut)]
   46         -
        let mut output = crate::operation::string_payload::builders::StringPayloadOutputBuilder::default();
   47         -
        output = output.set_payload(crate::protocol_serde::shape_string_payload_output::de_payload_payload(_response_body)?);
   48         -
        output.build()
   49         -
    })
   50         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_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_extras/rust-client-codegen/src/protocol_serde/shape_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::string_payload::StringPayloadError> {
    5         -
    (!body.is_empty())
    6         -
        .then(|| {
    7         -
            let body_str = std::str::from_utf8(body).map_err(crate::operation::string_payload::StringPayloadError::unhandled)?;
    8         -
            Ok(body_str.to_string())
    9         -
        })
   10         -
        .transpose()
   11         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_validation_exception.rs

@@ -1,0 +40,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_validation_exception_json_err(
    3         -
    _value: &[u8],
    4         -
    mut builder: crate::types::error::builders::ValidationErrorBuilder,
    5         -
) -> ::std::result::Result<crate::types::error::builders::ValidationErrorBuilder, ::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         -
                "fieldList" => {
   21         -
                    builder = builder.set_field_list(
   22         -
                        crate::protocol_serde::shape_validation_exception_field_list::de_validation_exception_field_list(tokens, _value)?,
   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         -
    if tokens.next().is_some() {
   35         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   36         -
            "found more JSON tokens after completing parsing",
   37         -
        ));
   38         -
    }
   39         -
    Ok(builder)
   40         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_validation_exception_field.rs

@@ -1,0 +51,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_validation_exception_field<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::ValidationExceptionField>, ::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::ValidationExceptionFieldBuilder::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         -
                        "path" => {
   19         -
                            builder = builder.set_path(
   20         -
                                ::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         -
                            );
   24         -
                        }
   25         -
                        "message" => {
   26         -
                            builder = builder.set_message(
   27         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   28         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   29         -
                                    .transpose()?,
   30         -
                            );
   31         -
                        }
   32         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   33         -
                    },
   34         -
                    other => {
   35         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   36         -
                            "expected object key or end object, found: {other:?}"
   37         -
                        )))
   38         -
                    }
   39         -
                }
   40         -
            }
   41         -
            Ok(Some(
   42         -
                crate::serde_util::validation_exception_field_correct_errors(builder)
   43         -
                    .build()
   44         -
                    .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
   45         -
            ))
   46         -
        }
   47         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   48         -
            "expected start object or null",
   49         -
        )),
   50         -
    }
   51         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_validation_exception_field_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_validation_exception_field_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::ValidationExceptionField>>, ::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_validation_exception_field::de_validation_exception_field(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_extras/rust-client-codegen/src/serde_util.rs

@@ -1,0 +30,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn validation_exception_correct_errors(
    3         -
    mut builder: crate::types::error::builders::ValidationErrorBuilder,
    4         -
) -> crate::types::error::builders::ValidationErrorBuilder {
    5         -
    if builder.message.is_none() {
    6         -
        builder.message = Some(Default::default())
    7         -
    }
    8         -
    builder
    9         -
}
   10         -
   11         -
pub(crate) fn primitive_int_header_output_output_correct_errors(
   12         -
    mut builder: crate::operation::primitive_int_header::builders::PrimitiveIntHeaderOutputBuilder,
   13         -
) -> crate::operation::primitive_int_header::builders::PrimitiveIntHeaderOutputBuilder {
   14         -
    if builder.field.is_none() {
   15         -
        builder.field = Some(Default::default())
   16         -
    }
   17         -
    builder
   18         -
}
   19         -
   20         -
pub(crate) fn validation_exception_field_correct_errors(
   21         -
    mut builder: crate::types::builders::ValidationExceptionFieldBuilder,
   22         -
) -> crate::types::builders::ValidationExceptionFieldBuilder {
   23         -
    if builder.path.is_none() {
   24         -
        builder.path = Some(Default::default())
   25         -
    }
   26         -
    if builder.message.is_none() {
   27         -
        builder.message = Some(Default::default())
   28         -
    }
   29         -
    builder
   30         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/serialization_settings.rs

@@ -1,0 +89,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
/*
    3         -
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    4         -
 * SPDX-License-Identifier: Apache-2.0
    5         -
 */
    6         -
    7         -
#![allow(dead_code)]
    8         -
    9         -
use aws_smithy_http::header::set_request_header_if_absent;
   10         -
use aws_smithy_types::config_bag::{Storable, StoreReplace};
   11         -
use http_1x::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
   12         -
   13         -
/// Configuration for how default protocol headers are serialized
   14         -
#[derive(Clone, Debug, Default)]
   15         -
pub(crate) struct HeaderSerializationSettings {
   16         -
    omit_default_content_length: bool,
   17         -
    omit_default_content_type: bool,
   18         -
}
   19         -
   20         -
impl HeaderSerializationSettings {
   21         -
    /// Creates new [`HeaderSerializationSettings`]
   22         -
    pub(crate) fn new() -> Self {
   23         -
        Default::default()
   24         -
    }
   25         -
   26         -
    /// Omit the default `Content-Length` header during serialization
   27         -
    pub(crate) fn omit_default_content_length(self) -> Self {
   28         -
        Self {
   29         -
            omit_default_content_length: true,
   30         -
            ..self
   31         -
        }
   32         -
    }
   33         -
   34         -
    /// Omit the default `Content-Type` header during serialization
   35         -
    pub(crate) fn omit_default_content_type(self) -> Self {
   36         -
        Self {
   37         -
            omit_default_content_type: true,
   38         -
            ..self
   39         -
        }
   40         -
    }
   41         -
   42         -
    /// Returns true if the given default header name should be serialized
   43         -
    fn include_header(&self, header: &HeaderName) -> bool {
   44         -
        (!self.omit_default_content_length || header != CONTENT_LENGTH) && (!self.omit_default_content_type || header != CONTENT_TYPE)
   45         -
    }
   46         -
   47         -
    /// Sets a default header on the given request builder if it should be serialized
   48         -
    pub(crate) fn set_default_header(
   49         -
        &self,
   50         -
        mut request: http_1x::request::Builder,
   51         -
        header_name: HeaderName,
   52         -
        value: &str,
   53         -
    ) -> http_1x::request::Builder {
   54         -
        if self.include_header(&header_name) {
   55         -
            request = set_request_header_if_absent(request, header_name, value);
   56         -
        }
   57         -
        request
   58         -
    }
   59         -
}
   60         -
   61         -
impl Storable for HeaderSerializationSettings {
   62         -
    type Storer = StoreReplace<Self>;
   63         -
}
   64         -
   65         -
#[cfg(test)]
   66         -
mod tests {
   67         -
    use super::*;
   68         -
   69         -
    #[test]
   70         -
    fn test_include_header() {
   71         -
        let settings = HeaderSerializationSettings::default();
   72         -
        assert!(settings.include_header(&CONTENT_LENGTH));
   73         -
        assert!(settings.include_header(&CONTENT_TYPE));
   74         -
   75         -
        let settings = HeaderSerializationSettings::default().omit_default_content_length();
   76         -
        assert!(!settings.include_header(&CONTENT_LENGTH));
   77         -
        assert!(settings.include_header(&CONTENT_TYPE));
   78         -
   79         -
        let settings = HeaderSerializationSettings::default().omit_default_content_type();
   80         -
        assert!(settings.include_header(&CONTENT_LENGTH));
   81         -
        assert!(!settings.include_header(&CONTENT_TYPE));
   82         -
   83         -
        let settings = HeaderSerializationSettings::default()
   84         -
            .omit_default_content_type()
   85         -
            .omit_default_content_length();
   86         -
        assert!(!settings.include_header(&CONTENT_LENGTH));
   87         -
        assert!(!settings.include_header(&CONTENT_TYPE));
   88         -
    }
   89         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/types/_empty_struct.rs

@@ -1,1 +62,73 @@
   15     15   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   16     16   
    fn serialize_members(
   17     17   
        &self,
   18     18   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   19     19   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   20     20   
        Ok(())
   21     21   
    }
   22     22   
}
   23     23   
impl EmptyStruct {
   24     24   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   25         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   26         -
        deserializer: &mut D,
          25  +
    pub fn deserialize(
          26  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   27     27   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   28     28   
        #[allow(unused_variables, unused_mut)]
   29     29   
        let mut builder = Self::builder();
   30     30   
        #[allow(
   31     31   
            unused_variables,
   32     32   
            unreachable_code,
   33     33   
            clippy::single_match,
   34     34   
            clippy::match_single_binding,
   35     35   
            clippy::diverging_sub_expression
   36     36   
        )]
   37         -
        deserializer.read_struct(&EMPTYSTRUCT_SCHEMA, (), |_, member, deser| {
          37  +
        deserializer.read_struct(&EMPTYSTRUCT_SCHEMA, &mut |member, deser| {
   38     38   
            match member.member_index() {
   39     39   
                _ => {}
   40     40   
            }
   41     41   
            Ok(())
   42     42   
        })?;
   43     43   
        Ok(builder.build())
   44     44   
    }
   45     45   
}
          46  +
impl EmptyStruct {
          47  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          48  +
    pub fn deserialize_with_response(
          49  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          50  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          51  +
        _status: u16,
          52  +
        _body: &[u8],
          53  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          54  +
        Ok(Self::builder().build())
          55  +
    }
          56  +
}
   46     57   
impl EmptyStruct {
   47     58   
    /// Creates a new builder-style object to manufacture [`EmptyStruct`](crate::types::EmptyStruct).
   48     59   
    pub fn builder() -> crate::types::builders::EmptyStructBuilder {
   49     60   
        crate::types::builders::EmptyStructBuilder::default()
   50     61   
    }
   51     62   
}
   52     63   
   53     64   
/// A builder for [`EmptyStruct`](crate::types::EmptyStruct).
   54     65   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   55     66   
#[non_exhaustive]