Client Test

Client Test

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c (ignoring whitespace)

Files changed:

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

@@ -1,0 +22,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_a_header(
    3         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4         -
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
    5         -
    let headers = header_map.get_all("X-A");
    6         -
    ::aws_smithy_http::header::one_or_none(headers)
    7         -
}
    8         -
    9         -
pub(crate) fn de_b_header(
   10         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   11         -
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   12         -
    let headers = header_map.get_all("X-B");
   13         -
    ::aws_smithy_http::header::one_or_none(headers)
   14         -
}
   15         -
   16         -
pub(crate) fn de_c_header(
   17         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   18         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_http::header::ParseError> {
   19         -
    let headers = header_map.get_all("X-C");
   20         -
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
   21         -
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
   22         -
}

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

@@ -1,0 +96,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_and_empty_headers_server_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::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput,
    9         -
    crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError,
   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::null_and_empty_headers_server::NullAndEmptyHeadersServerError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::generic(
   16         -
        generic,
   17         -
    ))
   18         -
}
   19         -
   20         -
#[allow(clippy::unnecessary_wraps)]
   21         -
pub fn de_null_and_empty_headers_server_http_response(
   22         -
    _response_status: u16,
   23         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24         -
    _response_body: &[u8],
   25         -
) -> std::result::Result<
   26         -
    crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput,
   27         -
    crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError,
   28         -
> {
   29         -
    Ok({
   30         -
        #[allow(unused_mut)]
   31         -
        let mut output = crate::operation::null_and_empty_headers_server::builders::NullAndEmptyHeadersServerOutputBuilder::default();
   32         -
        output = output.set_a(
   33         -
            crate::protocol_serde::shape_null_and_empty_headers_server_output::de_a_header(_response_headers).map_err(|_| {
   34         -
                crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::unhandled("Failed to parse a from header `X-A")
   35         -
            })?,
   36         -
        );
   37         -
        output = output.set_b(
   38         -
            crate::protocol_serde::shape_null_and_empty_headers_server_output::de_b_header(_response_headers).map_err(|_| {
   39         -
                crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::unhandled("Failed to parse b from header `X-B")
   40         -
            })?,
   41         -
        );
   42         -
        output = output.set_c(
   43         -
            crate::protocol_serde::shape_null_and_empty_headers_server_output::de_c_header(_response_headers).map_err(|_| {
   44         -
                crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::unhandled("Failed to parse c from header `X-C")
   45         -
            })?,
   46         -
        );
   47         -
        output.build()
   48         -
    })
   49         -
}
   50         -
   51         -
pub fn ser_null_and_empty_headers_server_headers(
   52         -
    input: &crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerInput,
   53         -
    mut builder: ::http_1x::request::Builder,
   54         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   55         -
    if let ::std::option::Option::Some(inner_1) = &input.a {
   56         -
        let formatted_2 = inner_1.as_str();
   57         -
        let header_value = formatted_2;
   58         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   59         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   60         -
                "a",
   61         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   62         -
            )
   63         -
        })?;
   64         -
        builder = builder.header("X-A", header_value);
   65         -
    }
   66         -
    if let ::std::option::Option::Some(inner_3) = &input.b {
   67         -
        let formatted_4 = inner_3.as_str();
   68         -
        let header_value = formatted_4;
   69         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   70         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   71         -
                "b",
   72         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   73         -
            )
   74         -
        })?;
   75         -
        builder = builder.header("X-B", header_value);
   76         -
    }
   77         -
    if let ::std::option::Option::Some(inner_5) = &input.c {
   78         -
        // Empty vec in header is serialized as an empty string
   79         -
        if inner_5.is_empty() {
   80         -
            builder = builder.header("X-C", "");
   81         -
        } else {
   82         -
            for inner_6 in inner_5 {
   83         -
                let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
   84         -
                let header_value = formatted_7;
   85         -
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   86         -
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   87         -
                        "c",
   88         -
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
   89         -
                    )
   90         -
                })?;
   91         -
                builder = builder.header("X-C", header_value);
   92         -
            }
   93         -
        }
   94         -
    }
   95         -
    Ok(builder)
   96         -
}

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

@@ -1,0 +22,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_a_header(
    3         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4         -
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
    5         -
    let headers = header_map.get_all("X-A");
    6         -
    ::aws_smithy_http::header::one_or_none(headers)
    7         -
}
    8         -
    9         -
pub(crate) fn de_b_header(
   10         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   11         -
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   12         -
    let headers = header_map.get_all("X-B");
   13         -
    ::aws_smithy_http::header::one_or_none(headers)
   14         -
}
   15         -
   16         -
pub(crate) fn de_c_header(
   17         -
    header_map: &::aws_smithy_runtime_api::http::Headers,
   18         -
) -> ::std::result::Result<::std::option::Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_http::header::ParseError> {
   19         -
    let headers = header_map.get_all("X-C");
   20         -
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
   21         -
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
   22         -
}

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

@@ -1,0 +32,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_omits_null_serializes_empty_string_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::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringOutput,
    9         -
    crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError,
   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::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_omits_null_serializes_empty_string_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringOutput,
   25         -
    crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::omits_null_serializes_empty_string::builders::OmitsNullSerializesEmptyStringOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

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

@@ -1,0 +34,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_omits_serializing_empty_lists_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::omits_serializing_empty_lists::OmitsSerializingEmptyListsOutput,
    9         -
    crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError,
   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::omits_serializing_empty_lists::OmitsSerializingEmptyListsError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError::generic(
   16         -
        generic,
   17         -
    ))
   18         -
}
   19         -
   20         -
#[allow(clippy::unnecessary_wraps)]
   21         -
pub fn de_omits_serializing_empty_lists_http_response(
   22         -
    _response_status: u16,
   23         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24         -
    _response_body: &[u8],
   25         -
) -> std::result::Result<
   26         -
    crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsOutput,
   27         -
    crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError,
   28         -
> {
   29         -
    Ok({
   30         -
        #[allow(unused_mut)]
   31         -
        let mut output = crate::operation::omits_serializing_empty_lists::builders::OmitsSerializingEmptyListsOutputBuilder::default();
   32         -
        output.build()
   33         -
    })
   34         -
}

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

@@ -1,0 +214,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_operation_with_defaults_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::operation_with_defaults::OperationWithDefaultsOutput,
    9         -
    crate::operation::operation_with_defaults::OperationWithDefaultsError,
   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::operation_with_defaults::OperationWithDefaultsError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::operation_with_defaults::OperationWithDefaultsError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_operation_with_defaults_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::operation_with_defaults::OperationWithDefaultsOutput,
   25         -
    crate::operation::operation_with_defaults::OperationWithDefaultsError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder::default();
   30         -
        output = crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults(_response_body, output)
   31         -
            .map_err(crate::operation::operation_with_defaults::OperationWithDefaultsError::unhandled)?;
   32         -
        output.build()
   33         -
    })
   34         -
}
   35         -
   36         -
pub fn ser_operation_with_defaults_input(
   37         -
    input: &crate::operation::operation_with_defaults::OperationWithDefaultsInput,
   38         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   39         -
    let mut out = String::new();
   40         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   41         -
    crate::protocol_serde::shape_operation_with_defaults_input::ser_operation_with_defaults_input_input(&mut object, input)?;
   42         -
    object.finish();
   43         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   44         -
}
   45         -
   46         -
pub(crate) fn de_operation_with_defaults(
   47         -
    _value: &[u8],
   48         -
    mut builder: crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder,
   49         -
) -> ::std::result::Result<
   50         -
    crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder,
   51         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   52         -
> {
   53         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   54         -
    let tokens = &mut tokens_owned;
   55         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   56         -
    loop {
   57         -
        match tokens.next().transpose()? {
   58         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   59         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   60         -
                "defaultBlob" => {
   61         -
                    builder = builder.set_default_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
   62         -
                }
   63         -
                "defaultBoolean" => {
   64         -
                    builder = builder.set_default_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
   65         -
                }
   66         -
                "defaultByte" => {
   67         -
                    builder = builder.set_default_byte(
   68         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   69         -
                            .map(i8::try_from)
   70         -
                            .transpose()?,
   71         -
                    );
   72         -
                }
   73         -
                "defaultDocumentBoolean" => {
   74         -
                    builder = builder.set_default_document_boolean(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   75         -
                }
   76         -
                "defaultDocumentList" => {
   77         -
                    builder = builder.set_default_document_list(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   78         -
                }
   79         -
                "defaultDocumentMap" => {
   80         -
                    builder = builder.set_default_document_map(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   81         -
                }
   82         -
                "defaultDocumentString" => {
   83         -
                    builder = builder.set_default_document_string(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   84         -
                }
   85         -
                "defaultDouble" => {
   86         -
                    builder = builder
   87         -
                        .set_default_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
   88         -
                }
   89         -
                "defaultEnum" => {
   90         -
                    builder = builder.set_default_enum(
   91         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   92         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::TestEnum::from(u.as_ref())))
   93         -
                            .transpose()?,
   94         -
                    );
   95         -
                }
   96         -
                "defaultFloat" => {
   97         -
                    builder = builder
   98         -
                        .set_default_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
   99         -
                }
  100         -
                "defaultIntEnum" => {
  101         -
                    builder = builder.set_default_int_enum(
  102         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  103         -
                            .map(i32::try_from)
  104         -
                            .transpose()?,
  105         -
                    );
  106         -
                }
  107         -
                "defaultInteger" => {
  108         -
                    builder = builder.set_default_integer(
  109         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  110         -
                            .map(i32::try_from)
  111         -
                            .transpose()?,
  112         -
                    );
  113         -
                }
  114         -
                "defaultList" => {
  115         -
                    builder = builder.set_default_list(crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens, _value)?);
  116         -
                }
  117         -
                "defaultLong" => {
  118         -
                    builder = builder.set_default_long(
  119         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  120         -
                            .map(i64::try_from)
  121         -
                            .transpose()?,
  122         -
                    );
  123         -
                }
  124         -
                "defaultMap" => {
  125         -
                    builder = builder.set_default_map(crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens, _value)?);
  126         -
                }
  127         -
                "defaultNullDocument" => {
  128         -
                    builder = builder.set_default_null_document(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
  129         -
                }
  130         -
                "defaultShort" => {
  131         -
                    builder = builder.set_default_short(
  132         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  133         -
                            .map(i16::try_from)
  134         -
                            .transpose()?,
  135         -
                    );
  136         -
                }
  137         -
                "defaultString" => {
  138         -
                    builder = builder.set_default_string(
  139         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  140         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  141         -
                            .transpose()?,
  142         -
                    );
  143         -
                }
  144         -
                "defaultTimestamp" => {
  145         -
                    builder = builder.set_default_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  146         -
                        tokens.next(),
  147         -
                        ::aws_smithy_types::date_time::Format::EpochSeconds,
  148         -
                    )?);
  149         -
                }
  150         -
                "emptyBlob" => {
  151         -
                    builder = builder.set_empty_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
  152         -
                }
  153         -
                "emptyString" => {
  154         -
                    builder = builder.set_empty_string(
  155         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  156         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  157         -
                            .transpose()?,
  158         -
                    );
  159         -
                }
  160         -
                "falseBoolean" => {
  161         -
                    builder = builder.set_false_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
  162         -
                }
  163         -
                "zeroByte" => {
  164         -
                    builder = builder.set_zero_byte(
  165         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  166         -
                            .map(i8::try_from)
  167         -
                            .transpose()?,
  168         -
                    );
  169         -
                }
  170         -
                "zeroDouble" => {
  171         -
                    builder = builder
  172         -
                        .set_zero_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
  173         -
                }
  174         -
                "zeroFloat" => {
  175         -
                    builder = builder
  176         -
                        .set_zero_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
  177         -
                }
  178         -
                "zeroInteger" => {
  179         -
                    builder = builder.set_zero_integer(
  180         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  181         -
                            .map(i32::try_from)
  182         -
                            .transpose()?,
  183         -
                    );
  184         -
                }
  185         -
                "zeroLong" => {
  186         -
                    builder = builder.set_zero_long(
  187         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  188         -
                            .map(i64::try_from)
  189         -
                            .transpose()?,
  190         -
                    );
  191         -
                }
  192         -
                "zeroShort" => {
  193         -
                    builder = builder.set_zero_short(
  194         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  195         -
                            .map(i16::try_from)
  196         -
                            .transpose()?,
  197         -
                    );
  198         -
                }
  199         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  200         -
            },
  201         -
            other => {
  202         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  203         -
                    "expected object key or end object, found: {other:?}"
  204         -
                )))
  205         -
            }
  206         -
        }
  207         -
    }
  208         -
    if tokens.next().is_some() {
  209         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  210         -
            "found more JSON tokens after completing parsing",
  211         -
        ));
  212         -
    }
  213         -
    Ok(builder)
  214         -
}

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

@@ -1,0 +28,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_operation_with_defaults_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::operation_with_defaults::OperationWithDefaultsInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.client_optional_defaults {
    7         -
        #[allow(unused_mut)]
    8         -
        let mut object_2 = object.key("clientOptionalDefaults").start_object();
    9         -
        crate::protocol_serde::shape_client_optional_defaults::ser_client_optional_defaults(&mut object_2, var_1)?;
   10         -
        object_2.finish();
   11         -
    }
   12         -
    if let Some(var_3) = &input.defaults {
   13         -
        #[allow(unused_mut)]
   14         -
        let mut object_4 = object.key("defaults").start_object();
   15         -
        crate::protocol_serde::shape_defaults::ser_defaults(&mut object_4, var_3)?;
   16         -
        object_4.finish();
   17         -
    }
   18         -
    if let Some(var_5) = &input.other_top_level_default {
   19         -
        object.key("otherTopLevelDefault").number(
   20         -
            #[allow(clippy::useless_conversion)]
   21         -
            ::aws_smithy_types::Number::NegInt((*var_5).into()),
   22         -
        );
   23         -
    }
   24         -
    if let Some(var_6) = &input.top_level_default {
   25         -
        object.key("topLevelDefault").string(var_6.as_str());
   26         -
    }
   27         -
    Ok(())
   28         -
}

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

@@ -1,0 +86,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_operation_with_nested_structure_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::operation_with_nested_structure::OperationWithNestedStructureOutput,
    9         -
    crate::operation::operation_with_nested_structure::OperationWithNestedStructureError,
   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::operation_with_nested_structure::OperationWithNestedStructureError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::operation_with_nested_structure::OperationWithNestedStructureError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_operation_with_nested_structure_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::operation_with_nested_structure::OperationWithNestedStructureOutput,
   25         -
    crate::operation::operation_with_nested_structure::OperationWithNestedStructureError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder::default();
   30         -
        output = crate::protocol_serde::shape_operation_with_nested_structure::de_operation_with_nested_structure(_response_body, output)
   31         -
            .map_err(crate::operation::operation_with_nested_structure::OperationWithNestedStructureError::unhandled)?;
   32         -
        crate::serde_util::operation_with_nested_structure_output_output_correct_errors(output)
   33         -
            .build()
   34         -
            .map_err(crate::operation::operation_with_nested_structure::OperationWithNestedStructureError::unhandled)?
   35         -
    })
   36         -
}
   37         -
   38         -
pub fn ser_operation_with_nested_structure_input(
   39         -
    input: &crate::operation::operation_with_nested_structure::OperationWithNestedStructureInput,
   40         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   41         -
    let mut out = String::new();
   42         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   43         -
    crate::protocol_serde::shape_operation_with_nested_structure_input::ser_operation_with_nested_structure_input_input(&mut object, input)?;
   44         -
    object.finish();
   45         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   46         -
}
   47         -
   48         -
pub(crate) fn de_operation_with_nested_structure(
   49         -
    _value: &[u8],
   50         -
    mut builder: crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder,
   51         -
) -> ::std::result::Result<
   52         -
    crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder,
   53         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   54         -
> {
   55         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   56         -
    let tokens = &mut tokens_owned;
   57         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   58         -
    loop {
   59         -
        match tokens.next().transpose()? {
   60         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   61         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   62         -
                "dialog" => {
   63         -
                    builder = builder.set_dialog(crate::protocol_serde::shape_dialog::de_dialog(tokens, _value)?);
   64         -
                }
   65         -
                "dialogList" => {
   66         -
                    builder = builder.set_dialog_list(crate::protocol_serde::shape_dialog_list::de_dialog_list(tokens, _value)?);
   67         -
                }
   68         -
                "dialogMap" => {
   69         -
                    builder = builder.set_dialog_map(crate::protocol_serde::shape_dialog_map::de_dialog_map(tokens, _value)?);
   70         -
                }
   71         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   72         -
            },
   73         -
            other => {
   74         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   75         -
                    "expected object key or end object, found: {other:?}"
   76         -
                )))
   77         -
            }
   78         -
        }
   79         -
    }
   80         -
    if tokens.next().is_some() {
   81         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   82         -
            "found more JSON tokens after completing parsing",
   83         -
        ));
   84         -
    }
   85         -
    Ok(builder)
   86         -
}

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

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

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

@@ -1,1 +71,0 @@
   11     11   
    let _response_headers = response.headers();
   12     12   
    Ok({
   13     13   
        #[allow(unused_mut)]
   14     14   
        let mut output = crate::operation::output_stream::builders::OutputStreamOutputBuilder::default();
   15     15   
        output = output.set_stream(Some(crate::protocol_serde::shape_output_stream_output::de_stream_payload(
   16     16   
            _response_body,
   17     17   
        )?));
   18     18   
        output.build().map_err(crate::operation::output_stream::OutputStreamError::unhandled)?
   19     19   
    })
   20     20   
}
   21         -
   22         -
#[allow(clippy::unnecessary_wraps)]
   23         -
pub fn de_output_stream_http_error(
   24         -
    _response_status: u16,
   25         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   26         -
    _response_body: &[u8],
   27         -
) -> std::result::Result<crate::operation::output_stream::OutputStreamOutput, crate::operation::output_stream::OutputStreamError> {
   28         -
    #[allow(unused_mut)]
   29         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   30         -
        .map_err(crate::operation::output_stream::OutputStreamError::unhandled)?;
   31         -
    let generic = generic_builder.build();
   32         -
    let error_code = match generic.code() {
   33         -
        Some(code) => code,
   34         -
        None => return Err(crate::operation::output_stream::OutputStreamError::unhandled(generic)),
   35         -
    };
   36         -
   37         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   38         -
    Err(match error_code {
   39         -
        "ServiceUnavailableError" => crate::operation::output_stream::OutputStreamError::ServiceUnavailableError({
   40         -
            #[allow(unused_mut)]
   41         -
            let mut tmp = {
   42         -
                #[allow(unused_mut)]
   43         -
                let mut output = crate::types::error::builders::ServiceUnavailableErrorBuilder::default();
   44         -
                output = crate::protocol_serde::shape_service_unavailable_error::de_service_unavailable_error_json_err(_response_body, output)
   45         -
                    .map_err(crate::operation::output_stream::OutputStreamError::unhandled)?;
   46         -
                let output = output.meta(generic);
   47         -
                output.build()
   48         -
            };
   49         -
            if tmp.message.is_none() {
   50         -
                tmp.message = _error_message;
   51         -
            }
   52         -
            tmp
   53         -
        }),
   54         -
        "ErrorEvent" => crate::operation::output_stream::OutputStreamError::ErrorEvent({
   55         -
            #[allow(unused_mut)]
   56         -
            let mut tmp = {
   57         -
                #[allow(unused_mut)]
   58         -
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
   59         -
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
   60         -
                    .map_err(crate::operation::output_stream::OutputStreamError::unhandled)?;
   61         -
                let output = output.meta(generic);
   62         -
                output.build()
   63         -
            };
   64         -
            if tmp.message.is_none() {
   65         -
                tmp.message = _error_message;
   66         -
            }
   67         -
            tmp
   68         -
        }),
   69         -
        _ => crate::operation::output_stream::OutputStreamError::generic(generic),
   70         -
    })
   71         -
}

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

@@ -5,5 +73,0 @@
   25     25   
            )?,
   26     26   
        );
   27     27   
        output = output.set_stream(Some(
   28     28   
            crate::protocol_serde::shape_output_stream_with_initial_response_output::de_stream_payload(_response_body)?,
   29     29   
        ));
   30     30   
        crate::serde_util::output_stream_with_initial_response_output_output_correct_errors(output)
   31     31   
            .build()
   32     32   
            .map_err(crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled)?
   33     33   
    })
   34     34   
}
   35         -
   36         -
#[allow(clippy::unnecessary_wraps)]
   37         -
pub fn de_output_stream_with_initial_response_http_error(
   38         -
    _response_status: u16,
   39         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   40         -
    _response_body: &[u8],
   41         -
) -> std::result::Result<
   42         -
    crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
   43         -
    crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
   44         -
> {
   45         -
    #[allow(unused_mut)]
   46         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   47         -
        .map_err(crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled)?;
   48         -
    let generic = generic_builder.build();
   49         -
    let error_code = match generic.code() {
   50         -
        Some(code) => code,
   51         -
        None => return Err(crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled(generic)),
   52         -
    };
   53         -
   54         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   55         -
    Err(match error_code {
   56         -
        "ErrorEvent" => crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::ErrorEvent({
   57         -
            #[allow(unused_mut)]
   58         -
            let mut tmp = {
   59         -
                #[allow(unused_mut)]
   60         -
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
   61         -
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
   62         -
                    .map_err(crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled)?;
   63         -
                let output = output.meta(generic);
   64         -
                output.build()
   65         -
            };
   66         -
            if tmp.message.is_none() {
   67         -
                tmp.message = _error_message;
   68         -
            }
   69         -
            tmp
   70         -
        }),
   71         -
        _ => crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::generic(generic),
   72         -
    })
   73         -
}

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

@@ -1,0 +68,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_payload_config(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::PayloadConfig,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.data {
    7         -
        object.key("data").number(
    8         -
            #[allow(clippy::useless_conversion)]
    9         -
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   10         -
        );
   11         -
    }
   12         -
    Ok(())
   13         -
}
   14         -
   15         -
pub(crate) fn de_payload_config_payload(
   16         -
    _value: &[u8],
   17         -
) -> ::std::result::Result<crate::types::PayloadConfig, ::aws_smithy_json::deserialize::error::DeserializeError> {
   18         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   19         -
    let tokens = &mut tokens_owned;
   20         -
    let result = crate::protocol_serde::shape_payload_config::de_payload_config(tokens, _value)?
   21         -
        .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
   22         -
    if tokens.next().is_some() {
   23         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   24         -
            "found more JSON tokens after completing parsing",
   25         -
        ));
   26         -
    }
   27         -
    result
   28         -
}
   29         -
   30         -
pub(crate) fn de_payload_config<'a, I>(
   31         -
    tokens: &mut ::std::iter::Peekable<I>,
   32         -
    _value: &'a [u8],
   33         -
) -> ::std::result::Result<Option<crate::types::PayloadConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
   34         -
where
   35         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   36         -
{
   37         -
    match tokens.next().transpose()? {
   38         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   39         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   40         -
            #[allow(unused_mut)]
   41         -
            let mut builder = crate::types::builders::PayloadConfigBuilder::default();
   42         -
            loop {
   43         -
                match tokens.next().transpose()? {
   44         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   45         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   46         -
                        "data" => {
   47         -
                            builder = builder.set_data(
   48         -
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   49         -
                                    .map(i32::try_from)
   50         -
                                    .transpose()?,
   51         -
                            );
   52         -
                        }
   53         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   54         -
                    },
   55         -
                    other => {
   56         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   57         -
                            "expected object key or end object, found: {other:?}"
   58         -
                        )))
   59         -
                    }
   60         -
                }
   61         -
            }
   62         -
            Ok(Some(builder.build()))
   63         -
        }
   64         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   65         -
            "expected start object or null",
   66         -
        )),
   67         -
    }
   68         -
}

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

@@ -1,0 +77,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_player_action<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::PlayerAction>, ::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         -
                        "quit" => {
   34         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   35         -
                            Some(crate::types::PlayerAction::Quit)
   36         -
                        }
   37         -
                        _ => {
   38         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   39         -
                            Some(crate::types::PlayerAction::Unknown)
   40         -
                        }
   41         -
                    };
   42         -
                }
   43         -
                other => {
   44         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   45         -
                        "expected object key or end object, found: {other:?}"
   46         -
                    )))
   47         -
                }
   48         -
            }
   49         -
        },
   50         -
        _ => {
   51         -
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   52         -
                "expected start object or null",
   53         -
            ))
   54         -
        }
   55         -
    }
   56         -
    if variant.is_none() {
   57         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   58         -
            "Union did not contain a valid variant.",
   59         -
        ));
   60         -
    }
   61         -
    Ok(variant)
   62         -
}
   63         -
   64         -
pub fn ser_player_action(
   65         -
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   66         -
    input: &crate::types::PlayerAction,
   67         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
   68         -
    match input {
   69         -
        crate::types::PlayerAction::Quit => {
   70         -
            #[allow(unused_mut)]
   71         -
            let mut object_1 = object_2.key("quit").start_object();
   72         -
            object_1.finish();
   73         -
        }
   74         -
        crate::types::PlayerAction::Unknown => return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("PlayerAction")),
   75         -
    }
   76         -
    Ok(())
   77         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_post_player_action.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_post_player_action_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::post_player_action::PostPlayerActionOutput, crate::operation::post_player_action::PostPlayerActionError> {
    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::post_player_action::PostPlayerActionError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::post_player_action::PostPlayerActionError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_post_player_action_http_response(
   17         -
    _response_status: u16,
   18         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   19         -
    _response_body: &[u8],
   20         -
) -> std::result::Result<crate::operation::post_player_action::PostPlayerActionOutput, crate::operation::post_player_action::PostPlayerActionError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder::default();
   24         -
        output = crate::protocol_serde::shape_post_player_action::de_post_player_action(_response_body, output)
   25         -
            .map_err(crate::operation::post_player_action::PostPlayerActionError::unhandled)?;
   26         -
        crate::serde_util::post_player_action_output_output_correct_errors(output)
   27         -
            .build()
   28         -
            .map_err(crate::operation::post_player_action::PostPlayerActionError::unhandled)?
   29         -
    })
   30         -
}
   31         -
   32         -
pub fn ser_post_player_action_input(
   33         -
    input: &crate::operation::post_player_action::PostPlayerActionInput,
   34         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   35         -
    let mut out = String::new();
   36         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   37         -
    crate::protocol_serde::shape_post_player_action_input::ser_post_player_action_input_input(&mut object, input)?;
   38         -
    object.finish();
   39         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   40         -
}
   41         -
   42         -
pub(crate) fn de_post_player_action(
   43         -
    _value: &[u8],
   44         -
    mut builder: crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder,
   45         -
) -> ::std::result::Result<
   46         -
    crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder,
   47         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   48         -
> {
   49         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   50         -
    let tokens = &mut tokens_owned;
   51         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   52         -
    loop {
   53         -
        match tokens.next().transpose()? {
   54         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   55         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   56         -
                "action" => {
   57         -
                    builder = builder.set_action(crate::protocol_serde::shape_player_action::de_player_action(tokens, _value)?);
   58         -
                }
   59         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   60         -
            },
   61         -
            other => {
   62         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   63         -
                    "expected object key or end object, found: {other:?}"
   64         -
                )))
   65         -
            }
   66         -
        }
   67         -
    }
   68         -
    if tokens.next().is_some() {
   69         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   70         -
            "found more JSON tokens after completing parsing",
   71         -
        ));
   72         -
    }
   73         -
    Ok(builder)
   74         -
}

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

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

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

@@ -1,0 +82,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_post_union_with_json_name_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::post_union_with_json_name::PostUnionWithJsonNameOutput,
    9         -
    crate::operation::post_union_with_json_name::PostUnionWithJsonNameError,
   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::post_union_with_json_name::PostUnionWithJsonNameError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::post_union_with_json_name::PostUnionWithJsonNameError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_post_union_with_json_name_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput,
   25         -
    crate::operation::post_union_with_json_name::PostUnionWithJsonNameError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::post_union_with_json_name::builders::PostUnionWithJsonNameOutputBuilder::default();
   30         -
        output = crate::protocol_serde::shape_post_union_with_json_name::de_post_union_with_json_name(_response_body, output)
   31         -
            .map_err(crate::operation::post_union_with_json_name::PostUnionWithJsonNameError::unhandled)?;
   32         -
        crate::serde_util::post_union_with_json_name_output_output_correct_errors(output)
   33         -
            .build()
   34         -
            .map_err(crate::operation::post_union_with_json_name::PostUnionWithJsonNameError::unhandled)?
   35         -
    })
   36         -
}
   37         -
   38         -
pub fn ser_post_union_with_json_name_input(
   39         -
    input: &crate::operation::post_union_with_json_name::PostUnionWithJsonNameInput,
   40         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   41         -
    let mut out = String::new();
   42         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   43         -
    crate::protocol_serde::shape_post_union_with_json_name_input::ser_post_union_with_json_name_input_input(&mut object, input)?;
   44         -
    object.finish();
   45         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   46         -
}
   47         -
   48         -
pub(crate) fn de_post_union_with_json_name(
   49         -
    _value: &[u8],
   50         -
    mut builder: crate::operation::post_union_with_json_name::builders::PostUnionWithJsonNameOutputBuilder,
   51         -
) -> ::std::result::Result<
   52         -
    crate::operation::post_union_with_json_name::builders::PostUnionWithJsonNameOutputBuilder,
   53         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   54         -
> {
   55         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   56         -
    let tokens = &mut tokens_owned;
   57         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   58         -
    loop {
   59         -
        match tokens.next().transpose()? {
   60         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   61         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   62         -
                "value" => {
   63         -
                    builder = builder.set_value(crate::protocol_serde::shape_union_with_json_name::de_union_with_json_name(
   64         -
                        tokens, _value,
   65         -
                    )?);
   66         -
                }
   67         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   68         -
            },
   69         -
            other => {
   70         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   71         -
                    "expected object key or end object, found: {other:?}"
   72         -
                )))
   73         -
            }
   74         -
        }
   75         -
    }
   76         -
    if tokens.next().is_some() {
   77         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   78         -
            "found more JSON tokens after completing parsing",
   79         -
        ));
   80         -
    }
   81         -
    Ok(builder)
   82         -
}