Client Test

Client Test

rev. ec7b2441254af868911fccffe8d8dca83aff0045

Files changed:

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

@@ -1,0 +70,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_case_insensitive_error_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::case_insensitive_error_operation::CaseInsensitiveErrorOperationOutput,
    9         -
    crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationError,
   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::case_insensitive_error_operation::CaseInsensitiveErrorOperationError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    let error_code = match generic.code() {
   16         -
        Some(code) => code,
   17         -
        None => return Err(crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationError::unhandled(generic)),
   18         -
    };
   19         -
   20         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   21         -
    Err(match error_code {
   22         -
        "CaseInsensitiveError" => crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationError::CaseInsensitiveError({
   23         -
            #[allow(unused_mut)]
   24         -
            let mut tmp = {
   25         -
                #[allow(unused_mut)]
   26         -
                let mut output = crate::types::error::builders::CaseInsensitiveErrorBuilder::default();
   27         -
                output = crate::protocol_serde::shape_case_insensitive_error::de_case_insensitive_error_json_err(_response_body, output)
   28         -
                    .map_err(crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationError::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         -
        "ExtraError" => crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationError::ExtraError({
   38         -
            #[allow(unused_mut)]
   39         -
            let mut tmp = {
   40         -
                #[allow(unused_mut)]
   41         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   42         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   43         -
                    .map_err(crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationError::unhandled)?;
   44         -
                let output = output.meta(generic);
   45         -
                output.build()
   46         -
            };
   47         -
            if tmp.message.is_none() {
   48         -
                tmp.message = _error_message;
   49         -
            }
   50         -
            tmp
   51         -
        }),
   52         -
        _ => crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationError::generic(generic),
   53         -
    })
   54         -
}
   55         -
   56         -
#[allow(clippy::unnecessary_wraps)]
   57         -
pub fn de_case_insensitive_error_operation_http_response(
   58         -
    _response_status: u16,
   59         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   60         -
    _response_body: &[u8],
   61         -
) -> std::result::Result<
   62         -
    crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationOutput,
   63         -
    crate::operation::case_insensitive_error_operation::CaseInsensitiveErrorOperationError,
   64         -
> {
   65         -
    Ok({
   66         -
        #[allow(unused_mut)]
   67         -
        let mut output = crate::operation::case_insensitive_error_operation::builders::CaseInsensitiveErrorOperationOutputBuilder::default();
   68         -
        output.build()
   69         -
    })
   70         -
}

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

@@ -1,0 +21,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_empty_struct<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::EmptyStruct>, ::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::EmptyStructBuilder::default();
   14         -
            ::aws_smithy_json::deserialize::token::skip_to_end(tokens)?;
   15         -
            Ok(Some(builder.build()))
   16         -
        }
   17         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   18         -
            "expected start object or null",
   19         -
        )),
   20         -
    }
   21         -
}

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

@@ -1,0 +91,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_empty_struct_with_content_on_wire_op_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::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpOutput,
    9         -
    crate::operation::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpError,
   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::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    let error_code = match generic.code() {
   16         -
        Some(code) => code,
   17         -
        None => return Err(crate::operation::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpError::unhandled(generic)),
   18         -
    };
   19         -
   20         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   21         -
    Err(match error_code {
   22         -
        "ExtraError" => crate::operation::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpError::ExtraError({
   23         -
            #[allow(unused_mut)]
   24         -
            let mut tmp = {
   25         -
                #[allow(unused_mut)]
   26         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   27         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   28         -
                    .map_err(crate::operation::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpError::unhandled)?;
   29         -
                let output = output.meta(generic);
   30         -
                output.build()
   31         -
            };
   32         -
            if tmp.message.is_none() {
   33         -
                tmp.message = _error_message;
   34         -
            }
   35         -
            tmp
   36         -
        }),
   37         -
        _ => crate::operation::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpError::generic(generic),
   38         -
    })
   39         -
}
   40         -
   41         -
#[allow(clippy::unnecessary_wraps)]
   42         -
pub fn de_empty_struct_with_content_on_wire_op_http_response(
   43         -
    _response_status: u16,
   44         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   45         -
    _response_body: &[u8],
   46         -
) -> std::result::Result<
   47         -
    crate::operation::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpOutput,
   48         -
    crate::operation::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpError,
   49         -
> {
   50         -
    Ok({
   51         -
        #[allow(unused_mut)]
   52         -
        let mut output = crate::operation::empty_struct_with_content_on_wire_op::builders::EmptyStructWithContentOnWireOpOutputBuilder::default();
   53         -
        output = crate::protocol_serde::shape_empty_struct_with_content_on_wire_op::de_empty_struct_with_content_on_wire_op(_response_body, output)
   54         -
            .map_err(crate::operation::empty_struct_with_content_on_wire_op::EmptyStructWithContentOnWireOpError::unhandled)?;
   55         -
        output.build()
   56         -
    })
   57         -
}
   58         -
   59         -
pub(crate) fn de_empty_struct_with_content_on_wire_op(
   60         -
    _value: &[u8],
   61         -
    mut builder: crate::operation::empty_struct_with_content_on_wire_op::builders::EmptyStructWithContentOnWireOpOutputBuilder,
   62         -
) -> ::std::result::Result<
   63         -
    crate::operation::empty_struct_with_content_on_wire_op::builders::EmptyStructWithContentOnWireOpOutputBuilder,
   64         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   65         -
> {
   66         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   67         -
    let tokens = &mut tokens_owned;
   68         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   69         -
    loop {
   70         -
        match tokens.next().transpose()? {
   71         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   72         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   73         -
                "empty" => {
   74         -
                    builder = builder.set_empty(crate::protocol_serde::shape_empty_struct::de_empty_struct(tokens, _value)?);
   75         -
                }
   76         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   77         -
            },
   78         -
            other => {
   79         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   80         -
                    "expected object key or end object, found: {other:?}"
   81         -
                )))
   82         -
            }
   83         -
        }
   84         -
    }
   85         -
    if tokens.next().is_some() {
   86         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   87         -
            "found more JSON tokens after completing parsing",
   88         -
        ));
   89         -
    }
   90         -
    Ok(builder)
   91         -
}

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

@@ -1,0 +63,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_enum_query_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::enum_query::EnumQueryOutput, crate::operation::enum_query::EnumQueryError> {
    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::enum_query::EnumQueryError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    let error_code = match generic.code() {
   13         -
        Some(code) => code,
   14         -
        None => return Err(crate::operation::enum_query::EnumQueryError::unhandled(generic)),
   15         -
    };
   16         -
   17         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   18         -
    Err(match error_code {
   19         -
        "ValidationException" => crate::operation::enum_query::EnumQueryError::ValidationError({
   20         -
            #[allow(unused_mut)]
   21         -
            let mut tmp = {
   22         -
                #[allow(unused_mut)]
   23         -
                let mut output = crate::types::error::builders::ValidationErrorBuilder::default();
   24         -
                output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
   25         -
                    .map_err(crate::operation::enum_query::EnumQueryError::unhandled)?;
   26         -
                let output = output.meta(generic);
   27         -
                crate::serde_util::validation_exception_correct_errors(output)
   28         -
                    .build()
   29         -
                    .map_err(crate::operation::enum_query::EnumQueryError::unhandled)?
   30         -
            };
   31         -
            tmp
   32         -
        }),
   33         -
        "ExtraError" => crate::operation::enum_query::EnumQueryError::ExtraError({
   34         -
            #[allow(unused_mut)]
   35         -
            let mut tmp = {
   36         -
                #[allow(unused_mut)]
   37         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   38         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   39         -
                    .map_err(crate::operation::enum_query::EnumQueryError::unhandled)?;
   40         -
                let output = output.meta(generic);
   41         -
                output.build()
   42         -
            };
   43         -
            if tmp.message.is_none() {
   44         -
                tmp.message = _error_message;
   45         -
            }
   46         -
            tmp
   47         -
        }),
   48         -
        _ => crate::operation::enum_query::EnumQueryError::generic(generic),
   49         -
    })
   50         -
}
   51         -
   52         -
#[allow(clippy::unnecessary_wraps)]
   53         -
pub fn de_enum_query_http_response(
   54         -
    _response_status: u16,
   55         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   56         -
    _response_body: &[u8],
   57         -
) -> std::result::Result<crate::operation::enum_query::EnumQueryOutput, crate::operation::enum_query::EnumQueryError> {
   58         -
    Ok({
   59         -
        #[allow(unused_mut)]
   60         -
        let mut output = crate::operation::enum_query::builders::EnumQueryOutputBuilder::default();
   61         -
        output.build()
   62         -
    })
   63         -
}

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

@@ -1,0 +126,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_escaped_string_values_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::escaped_string_values::EscapedStringValuesOutput,
    9         -
    crate::operation::escaped_string_values::EscapedStringValuesError,
   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::escaped_string_values::EscapedStringValuesError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    let error_code = match generic.code() {
   16         -
        Some(code) => code,
   17         -
        None => return Err(crate::operation::escaped_string_values::EscapedStringValuesError::unhandled(generic)),
   18         -
    };
   19         -
   20         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   21         -
    Err(match error_code {
   22         -
        "ValidationException" => crate::operation::escaped_string_values::EscapedStringValuesError::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::escaped_string_values::EscapedStringValuesError::unhandled)?;
   29         -
                let output = output.meta(generic);
   30         -
                crate::serde_util::validation_exception_correct_errors(output)
   31         -
                    .build()
   32         -
                    .map_err(crate::operation::escaped_string_values::EscapedStringValuesError::unhandled)?
   33         -
            };
   34         -
            tmp
   35         -
        }),
   36         -
        "ExtraError" => crate::operation::escaped_string_values::EscapedStringValuesError::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::escaped_string_values::EscapedStringValuesError::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::escaped_string_values::EscapedStringValuesError::generic(generic),
   52         -
    })
   53         -
}
   54         -
   55         -
#[allow(clippy::unnecessary_wraps)]
   56         -
pub fn de_escaped_string_values_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::escaped_string_values::EscapedStringValuesOutput,
   62         -
    crate::operation::escaped_string_values::EscapedStringValuesError,
   63         -
> {
   64         -
    Ok({
   65         -
        #[allow(unused_mut)]
   66         -
        let mut output = crate::operation::escaped_string_values::builders::EscapedStringValuesOutputBuilder::default();
   67         -
        output = crate::protocol_serde::shape_escaped_string_values::de_escaped_string_values(_response_body, output)
   68         -
            .map_err(crate::operation::escaped_string_values::EscapedStringValuesError::unhandled)?;
   69         -
        output.build()
   70         -
    })
   71         -
}
   72         -
   73         -
pub fn ser_escaped_string_values_input(
   74         -
    input: &crate::operation::escaped_string_values::EscapedStringValuesInput,
   75         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   76         -
    let mut out = String::new();
   77         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   78         -
    crate::protocol_serde::shape_escaped_string_values_input::ser_escaped_string_values_input_input(&mut object, input)?;
   79         -
    object.finish();
   80         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   81         -
}
   82         -
   83         -
pub(crate) fn de_escaped_string_values(
   84         -
    _value: &[u8],
   85         -
    mut builder: crate::operation::escaped_string_values::builders::EscapedStringValuesOutputBuilder,
   86         -
) -> ::std::result::Result<
   87         -
    crate::operation::escaped_string_values::builders::EscapedStringValuesOutputBuilder,
   88         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   89         -
> {
   90         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   91         -
    let tokens = &mut tokens_owned;
   92         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   93         -
    loop {
   94         -
        match tokens.next().transpose()? {
   95         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   96         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   97         -
                "enum" => {
   98         -
                    builder = builder.set_enum(
   99         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  100         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::EnumWithEscapedChars::from(u.as_ref())))
  101         -
                            .transpose()?,
  102         -
                    );
  103         -
                }
  104         -
                "also\"has\"quotes" => {
  105         -
                    builder = builder.set_some_string(
  106         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  107         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  108         -
                            .transpose()?,
  109         -
                    );
  110         -
                }
  111         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  112         -
            },
  113         -
            other => {
  114         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  115         -
                    "expected object key or end object, found: {other:?}"
  116         -
                )))
  117         -
            }
  118         -
        }
  119         -
    }
  120         -
    if tokens.next().is_some() {
  121         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  122         -
            "found more JSON tokens after completing parsing",
  123         -
        ));
  124         -
    }
  125         -
    Ok(builder)
  126         -
}

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

@@ -1,0 +13,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_escaped_string_values_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::escaped_string_values::EscapedStringValuesInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.r#enum {
    7         -
        object.key("enum").string(var_1.as_str());
    8         -
    }
    9         -
    if let Some(var_2) = &input.some_string {
   10         -
        object.key("also\"has\"quotes").string(var_2.as_str());
   11         -
    }
   12         -
    Ok(())
   13         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_extra_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_extra_error_json_err(
    3         -
    _value: &[u8],
    4         -
    mut builder: crate::types::error::builders::ExtraErrorBuilder,
    5         -
) -> ::std::result::Result<crate::types::error::builders::ExtraErrorBuilder, ::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_extras/rust-client-codegen/src/protocol_serde/shape_map_with_enum_key.rs

@@ -1,0 +48,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_map_with_enum_key<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<
    6         -
    Option<::std::collections::HashMap<crate::types::StringEnum, ::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| crate::types::StringEnum::from(u.as_ref()))?;
   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_extras/rust-client-codegen/src/protocol_serde/shape_map_with_enum_key_op.rs

@@ -1,0 +111,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_map_with_enum_key_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::map_with_enum_key_op::MapWithEnumKeyOpOutput, crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError>
    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::map_with_enum_key_op::MapWithEnumKeyOpError::unhandled)?;
   12         -
    let generic = generic_builder.build();
   13         -
    let error_code = match generic.code() {
   14         -
        Some(code) => code,
   15         -
        None => return Err(crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError::unhandled(generic)),
   16         -
    };
   17         -
   18         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   19         -
    Err(match error_code {
   20         -
        "ValidationException" => crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError::ValidationError({
   21         -
            #[allow(unused_mut)]
   22         -
            let mut tmp = {
   23         -
                #[allow(unused_mut)]
   24         -
                let mut output = crate::types::error::builders::ValidationErrorBuilder::default();
   25         -
                output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
   26         -
                    .map_err(crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError::unhandled)?;
   27         -
                let output = output.meta(generic);
   28         -
                crate::serde_util::validation_exception_correct_errors(output)
   29         -
                    .build()
   30         -
                    .map_err(crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError::unhandled)?
   31         -
            };
   32         -
            tmp
   33         -
        }),
   34         -
        "ExtraError" => crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError::ExtraError({
   35         -
            #[allow(unused_mut)]
   36         -
            let mut tmp = {
   37         -
                #[allow(unused_mut)]
   38         -
                let mut output = crate::types::error::builders::ExtraErrorBuilder::default();
   39         -
                output = crate::protocol_serde::shape_extra_error::de_extra_error_json_err(_response_body, output)
   40         -
                    .map_err(crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError::unhandled)?;
   41         -
                let output = output.meta(generic);
   42         -
                output.build()
   43         -
            };
   44         -
            if tmp.message.is_none() {
   45         -
                tmp.message = _error_message;
   46         -
            }
   47         -
            tmp
   48         -
        }),
   49         -
        _ => crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError::generic(generic),
   50         -
    })
   51         -
}
   52         -
   53         -
#[allow(clippy::unnecessary_wraps)]
   54         -
pub fn de_map_with_enum_key_op_http_response(
   55         -
    _response_status: u16,
   56         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   57         -
    _response_body: &[u8],
   58         -
) -> std::result::Result<crate::operation::map_with_enum_key_op::MapWithEnumKeyOpOutput, crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError>
   59         -
{
   60         -
    Ok({
   61         -
        #[allow(unused_mut)]
   62         -
        let mut output = crate::operation::map_with_enum_key_op::builders::MapWithEnumKeyOpOutputBuilder::default();
   63         -
        output = crate::protocol_serde::shape_map_with_enum_key_op::de_map_with_enum_key_op(_response_body, output)
   64         -
            .map_err(crate::operation::map_with_enum_key_op::MapWithEnumKeyOpError::unhandled)?;
   65         -
        output.build()
   66         -
    })
   67         -
}
   68         -
   69         -
pub fn ser_map_with_enum_key_op_input(
   70         -
    input: &crate::operation::map_with_enum_key_op::MapWithEnumKeyOpInput,
   71         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   72         -
    let mut out = String::new();
   73         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   74         -
    crate::protocol_serde::shape_map_with_enum_key_op_input::ser_map_with_enum_key_op_input_input(&mut object, input)?;
   75         -
    object.finish();
   76         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   77         -
}
   78         -
   79         -
pub(crate) fn de_map_with_enum_key_op(
   80         -
    _value: &[u8],
   81         -
    mut builder: crate::operation::map_with_enum_key_op::builders::MapWithEnumKeyOpOutputBuilder,
   82         -
) -> ::std::result::Result<
   83         -
    crate::operation::map_with_enum_key_op::builders::MapWithEnumKeyOpOutputBuilder,
   84         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   85         -
> {
   86         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   87         -
    let tokens = &mut tokens_owned;
   88         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   89         -
    loop {
   90         -
        match tokens.next().transpose()? {
   91         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   92         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   93         -
                "map" => {
   94         -
                    builder = builder.set_map(crate::protocol_serde::shape_map_with_enum_key::de_map_with_enum_key(tokens, _value)?);
   95         -
                }
   96         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   97         -
            },
   98         -
            other => {
   99         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  100         -
                    "expected object key or end object, found: {other:?}"
  101         -
                )))
  102         -
            }
  103         -
        }
  104         -
    }
  105         -
    if tokens.next().is_some() {
  106         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  107         -
            "found more JSON tokens after completing parsing",
  108         -
        ));
  109         -
    }
  110         -
    Ok(builder)
  111         -
}

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

@@ -1,0 +17,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_map_with_enum_key_op_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::map_with_enum_key_op::MapWithEnumKeyOpInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.map {
    7         -
        #[allow(unused_mut)]
    8         -
        let mut object_2 = object.key("map").start_object();
    9         -
        for (key_3, value_4) in var_1 {
   10         -
            {
   11         -
                object_2.key(key_3.as_str()).string(value_4.as_str());
   12         -
            }
   13         -
        }
   14         -
        object_2.finish();
   15         -
    }
   16         -
    Ok(())
   17         -
}

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_non_sparse_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_non_sparse_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_extras/rust-client-codegen/src/protocol_serde/shape_non_sparse_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_non_sparse_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_extras/rust-client-codegen/src/protocol_serde/shape_null_in_non_sparse.rs

@@ -1,0 +93,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_null_in_non_sparse_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::null_in_non_sparse::NullInNonSparseOutput, crate::operation::null_in_non_sparse::NullInNonSparseError> {
    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::null_in_non_sparse::NullInNonSparseError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    let error_code = match generic.code() {
   13         -
        Some(code) => code,
   14         -
        None => return Err(crate::operation::null_in_non_sparse::NullInNonSparseError::unhandled(generic)),
   15         -
    };
   16         -
   17         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   18         -
    Err(match error_code {
   19         -
        "ExtraError" => crate::operation::null_in_non_sparse::NullInNonSparseError::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::null_in_non_sparse::NullInNonSparseError::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::null_in_non_sparse::NullInNonSparseError::generic(generic),
   35         -
    })
   36         -
}
   37         -
   38         -
#[allow(clippy::unnecessary_wraps)]
   39         -
pub fn de_null_in_non_sparse_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::null_in_non_sparse::NullInNonSparseOutput, crate::operation::null_in_non_sparse::NullInNonSparseError> {
   44         -
    Ok({
   45         -
        #[allow(unused_mut)]
   46         -
        let mut output = crate::operation::null_in_non_sparse::builders::NullInNonSparseOutputBuilder::default();
   47         -
        output = crate::protocol_serde::shape_null_in_non_sparse::de_null_in_non_sparse(_response_body, output)
   48         -
            .map_err(crate::operation::null_in_non_sparse::NullInNonSparseError::unhandled)?;
   49         -
        output.build()
   50         -
    })
   51         -
}
   52         -
   53         -
pub(crate) fn de_null_in_non_sparse(
   54         -
    _value: &[u8],
   55         -
    mut builder: crate::operation::null_in_non_sparse::builders::NullInNonSparseOutputBuilder,
   56         -
) -> ::std::result::Result<
   57         -
    crate::operation::null_in_non_sparse::builders::NullInNonSparseOutputBuilder,
   58         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   59         -
> {
   60         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   61         -
    let tokens = &mut tokens_owned;
   62         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   63         -
    loop {
   64         -
        match tokens.next().transpose()? {
   65         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   66         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   67         -
                "list" => {
   68         -
                    builder = builder.set_list(crate::protocol_serde::shape_non_sparse_list::de_non_sparse_list(tokens, _value)?);
   69         -
                }
   70         -
                "map" => {
   71         -
                    builder = builder.set_map(crate::protocol_serde::shape_non_sparse_map::de_non_sparse_map(tokens, _value)?);
   72         -
                }
   73         -
                "union" => {
   74         -
                    builder = builder.set_union(crate::protocol_serde::shape_single_element_union::de_single_element_union(
   75         -
                        tokens, _value,
   76         -
                    )?);
   77         -
                }
   78         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   79         -
            },
   80         -
            other => {
   81         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   82         -
                    "expected object key or end object, found: {other:?}"
   83         -
                )))
   84         -
            }
   85         -
        }
   86         -
    }
   87         -
    if tokens.next().is_some() {
   88         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   89         -
            "found more JSON tokens after completing parsing",
   90         -
        ));
   91         -
    }
   92         -
    Ok(builder)
   93         -
}

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         -
}