Client Test

Client Test

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c

Files changed:

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_host_with_path_operation.rs

@@ -1,0 +38,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_host_with_path_operation_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<
    8         -
    crate::operation::host_with_path_operation::HostWithPathOperationOutput,
    9         -
    crate::operation::host_with_path_operation::HostWithPathOperationError,
   10         -
> {
   11         -
    #[allow(unused_mut)]
   12         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13         -
        .map_err(crate::operation::host_with_path_operation::HostWithPathOperationError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::host_with_path_operation::HostWithPathOperationError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_host_with_path_operation_http_response(
   20         -
    _response_status: u16,
   21         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22         -
    _response_body: &[u8],
   23         -
) -> std::result::Result<
   24         -
    crate::operation::host_with_path_operation::HostWithPathOperationOutput,
   25         -
    crate::operation::host_with_path_operation::HostWithPathOperationError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::host_with_path_operation::builders::HostWithPathOperationOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}
   33         -
   34         -
pub fn ser_host_with_path_operation_input(
   35         -
    _input: &crate::operation::host_with_path_operation::HostWithPathOperationInput,
   36         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   37         -
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
   38         -
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_invalid_greeting.rs

@@ -1,0 +35,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_invalid_greeting_json_err(
    3         -
    _value: &[u8],
    4         -
    mut builder: crate::types::error::builders::InvalidGreetingBuilder,
    5         -
) -> ::std::result::Result<crate::types::error::builders::InvalidGreetingBuilder, ::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/json_rpc10/rust-client-codegen/src/protocol_serde/shape_json_unions.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_json_unions_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::json_unions::JsonUnionsOutput, crate::operation::json_unions::JsonUnionsError> {
    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::json_unions::JsonUnionsError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::json_unions::JsonUnionsError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_json_unions_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::json_unions::JsonUnionsOutput, crate::operation::json_unions::JsonUnionsError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::json_unions::builders::JsonUnionsOutputBuilder::default();
   24         -
        output = crate::protocol_serde::shape_json_unions::de_json_unions(_response_body, output)
   25         -
            .map_err(crate::operation::json_unions::JsonUnionsError::unhandled)?;
   26         -
        output.build()
   27         -
    })
   28         -
}
   29         -
   30         -
pub fn ser_json_unions_input(
   31         -
    input: &crate::operation::json_unions::JsonUnionsInput,
   32         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   33         -
    let mut out = String::new();
   34         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   35         -
    crate::protocol_serde::shape_json_unions_input::ser_json_unions_input_input(&mut object, input)?;
   36         -
    object.finish();
   37         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   38         -
}
   39         -
   40         -
pub(crate) fn de_json_unions(
   41         -
    _value: &[u8],
   42         -
    mut builder: crate::operation::json_unions::builders::JsonUnionsOutputBuilder,
   43         -
) -> ::std::result::Result<crate::operation::json_unions::builders::JsonUnionsOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError>
   44         -
{
   45         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   46         -
    let tokens = &mut tokens_owned;
   47         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   48         -
    loop {
   49         -
        match tokens.next().transpose()? {
   50         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   51         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   52         -
                "contents" => {
   53         -
                    builder = builder.set_contents(crate::protocol_serde::shape_my_union::de_my_union(tokens, _value)?);
   54         -
                }
   55         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   56         -
            },
   57         -
            other => {
   58         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   59         -
                    "expected object key or end object, found: {other:?}"
   60         -
                )))
   61         -
            }
   62         -
        }
   63         -
    }
   64         -
    if tokens.next().is_some() {
   65         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   66         -
            "found more JSON tokens after completing parsing",
   67         -
        ));
   68         -
    }
   69         -
    Ok(builder)
   70         -
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_json_unions_input.rs

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

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_my_union.rs

@@ -1,0 +188,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_my_union<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::MyUnion>, ::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         -
                        "stringValue" => Some(crate::types::MyUnion::StringValue(
   34         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   35         -
                                .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   36         -
                                .transpose()?
   37         -
                                .ok_or_else(|| {
   38         -
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'stringValue' cannot be null")
   39         -
                                })?,
   40         -
                        )),
   41         -
                        "booleanValue" => Some(crate::types::MyUnion::BooleanValue(
   42         -
                            ::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?.ok_or_else(|| {
   43         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'booleanValue' cannot be null")
   44         -
                            })?,
   45         -
                        )),
   46         -
                        "numberValue" => Some(crate::types::MyUnion::NumberValue(
   47         -
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   48         -
                                .map(i32::try_from)
   49         -
                                .transpose()?
   50         -
                                .ok_or_else(|| {
   51         -
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'numberValue' cannot be null")
   52         -
                                })?,
   53         -
                        )),
   54         -
                        "blobValue" => Some(crate::types::MyUnion::BlobValue(
   55         -
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?.ok_or_else(|| {
   56         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'blobValue' cannot be null")
   57         -
                            })?,
   58         -
                        )),
   59         -
                        "timestampValue" => Some(crate::types::MyUnion::TimestampValue(
   60         -
                            ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   61         -
                                tokens.next(),
   62         -
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
   63         -
                            )?
   64         -
                            .ok_or_else(|| {
   65         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'timestampValue' cannot be null")
   66         -
                            })?,
   67         -
                        )),
   68         -
                        "enumValue" => Some(crate::types::MyUnion::EnumValue(
   69         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   70         -
                                .map(|s| s.to_unescaped().map(|u| crate::types::FooEnum::from(u.as_ref())))
   71         -
                                .transpose()?
   72         -
                                .ok_or_else(|| {
   73         -
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'enumValue' cannot be null")
   74         -
                                })?,
   75         -
                        )),
   76         -
                        "intEnumValue" => Some(crate::types::MyUnion::IntEnumValue(
   77         -
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   78         -
                                .map(i32::try_from)
   79         -
                                .transpose()?
   80         -
                                .ok_or_else(|| {
   81         -
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'intEnumValue' cannot be null")
   82         -
                                })?,
   83         -
                        )),
   84         -
                        "listValue" => Some(crate::types::MyUnion::ListValue(
   85         -
                            crate::protocol_serde::shape_string_list::de_string_list(tokens, _value)?.ok_or_else(|| {
   86         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'listValue' cannot be null")
   87         -
                            })?,
   88         -
                        )),
   89         -
                        "mapValue" => Some(crate::types::MyUnion::MapValue(
   90         -
                            crate::protocol_serde::shape_string_map::de_string_map(tokens, _value)?.ok_or_else(|| {
   91         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'mapValue' cannot be null")
   92         -
                            })?,
   93         -
                        )),
   94         -
                        "structureValue" => Some(crate::types::MyUnion::StructureValue(
   95         -
                            crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens, _value)?.ok_or_else(|| {
   96         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'structureValue' cannot be null")
   97         -
                            })?,
   98         -
                        )),
   99         -
                        _ => {
  100         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
  101         -
                            Some(crate::types::MyUnion::Unknown)
  102         -
                        }
  103         -
                    };
  104         -
                }
  105         -
                other => {
  106         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  107         -
                        "expected object key or end object, found: {other:?}"
  108         -
                    )))
  109         -
                }
  110         -
            }
  111         -
        },
  112         -
        _ => {
  113         -
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  114         -
                "expected start object or null",
  115         -
            ))
  116         -
        }
  117         -
    }
  118         -
    if variant.is_none() {
  119         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  120         -
            "Union did not contain a valid variant.",
  121         -
        ));
  122         -
    }
  123         -
    Ok(variant)
  124         -
}
  125         -
  126         -
pub fn ser_my_union(
  127         -
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
  128         -
    input: &crate::types::MyUnion,
  129         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
  130         -
    match input {
  131         -
        crate::types::MyUnion::StringValue(inner) => {
  132         -
            object_2.key("stringValue").string(inner.as_str());
  133         -
        }
  134         -
        crate::types::MyUnion::BooleanValue(inner) => {
  135         -
            object_2.key("booleanValue").boolean(*inner);
  136         -
        }
  137         -
        crate::types::MyUnion::NumberValue(inner) => {
  138         -
            object_2.key("numberValue").number(
  139         -
                #[allow(clippy::useless_conversion)]
  140         -
                ::aws_smithy_types::Number::NegInt((*inner).into()),
  141         -
            );
  142         -
        }
  143         -
        crate::types::MyUnion::BlobValue(inner) => {
  144         -
            object_2.key("blobValue").string_unchecked(&::aws_smithy_types::base64::encode(inner));
  145         -
        }
  146         -
        crate::types::MyUnion::TimestampValue(inner) => {
  147         -
            object_2
  148         -
                .key("timestampValue")
  149         -
                .date_time(inner, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
  150         -
        }
  151         -
        crate::types::MyUnion::EnumValue(inner) => {
  152         -
            object_2.key("enumValue").string(inner.as_str());
  153         -
        }
  154         -
        crate::types::MyUnion::IntEnumValue(inner) => {
  155         -
            object_2.key("intEnumValue").number(
  156         -
                #[allow(clippy::useless_conversion)]
  157         -
                ::aws_smithy_types::Number::NegInt((*inner).into()),
  158         -
            );
  159         -
        }
  160         -
        crate::types::MyUnion::ListValue(inner) => {
  161         -
            let mut array_1 = object_2.key("listValue").start_array();
  162         -
            for item_2 in inner {
  163         -
                {
  164         -
                    array_1.value().string(item_2.as_str());
  165         -
                }
  166         -
            }
  167         -
            array_1.finish();
  168         -
        }
  169         -
        crate::types::MyUnion::MapValue(inner) => {
  170         -
            #[allow(unused_mut)]
  171         -
            let mut object_3 = object_2.key("mapValue").start_object();
  172         -
            for (key_4, value_5) in inner {
  173         -
                {
  174         -
                    object_3.key(key_4.as_str()).string(value_5.as_str());
  175         -
                }
  176         -
            }
  177         -
            object_3.finish();
  178         -
        }
  179         -
        crate::types::MyUnion::StructureValue(inner) => {
  180         -
            #[allow(unused_mut)]
  181         -
            let mut object_6 = object_2.key("structureValue").start_object();
  182         -
            crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(&mut object_6, inner)?;
  183         -
            object_6.finish();
  184         -
        }
  185         -
        crate::types::MyUnion::Unknown => return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("MyUnion")),
  186         -
    }
  187         -
    Ok(())
  188         -
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_no_input_and_no_output.rs

@@ -1,0 +38,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_no_input_and_no_output_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::no_input_and_no_output::NoInputAndNoOutputOutput,
    9         -
    crate::operation::no_input_and_no_output::NoInputAndNoOutputError,
   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::no_input_and_no_output::NoInputAndNoOutputError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::no_input_and_no_output::NoInputAndNoOutputError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_no_input_and_no_output_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::no_input_and_no_output::NoInputAndNoOutputOutput,
   25         -
    crate::operation::no_input_and_no_output::NoInputAndNoOutputError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}
   33         -
   34         -
pub fn ser_no_input_and_no_output_input(
   35         -
    _input: &crate::operation::no_input_and_no_output::NoInputAndNoOutputInput,
   36         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   37         -
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
   38         -
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_no_input_and_output.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_no_input_and_output_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::no_input_and_output::NoInputAndOutputOutput, crate::operation::no_input_and_output::NoInputAndOutputError>
    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::no_input_and_output::NoInputAndOutputError::unhandled)?;
   12         -
    let generic = generic_builder.build();
   13         -
    Err(crate::operation::no_input_and_output::NoInputAndOutputError::generic(generic))
   14         -
}
   15         -
   16         -
#[allow(clippy::unnecessary_wraps)]
   17         -
pub fn de_no_input_and_output_http_response(
   18         -
    _response_status: u16,
   19         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   20         -
    _response_body: &[u8],
   21         -
) -> std::result::Result<crate::operation::no_input_and_output::NoInputAndOutputOutput, crate::operation::no_input_and_output::NoInputAndOutputError>
   22         -
{
   23         -
    Ok({
   24         -
        #[allow(unused_mut)]
   25         -
        let mut output = crate::operation::no_input_and_output::builders::NoInputAndOutputOutputBuilder::default();
   26         -
        output.build()
   27         -
    })
   28         -
}
   29         -
   30         -
pub fn ser_no_input_and_output_input(
   31         -
    _input: &crate::operation::no_input_and_output::NoInputAndOutputInput,
   32         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   33         -
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
   34         -
}

tmp-codegen-diff/codegen-client-test/json_rpc10/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         -
                "defaultString" => {
   61         -
                    builder = builder.set_default_string(
   62         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   63         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   64         -
                            .transpose()?,
   65         -
                    );
   66         -
                }
   67         -
                "defaultBoolean" => {
   68         -
                    builder = builder.set_default_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
   69         -
                }
   70         -
                "defaultList" => {
   71         -
                    builder = builder.set_default_list(crate::protocol_serde::shape_test_string_list::de_test_string_list(tokens, _value)?);
   72         -
                }
   73         -
                "defaultDocumentMap" => {
   74         -
                    builder = builder.set_default_document_map(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   75         -
                }
   76         -
                "defaultDocumentString" => {
   77         -
                    builder = builder.set_default_document_string(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   78         -
                }
   79         -
                "defaultDocumentBoolean" => {
   80         -
                    builder = builder.set_default_document_boolean(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   81         -
                }
   82         -
                "defaultDocumentList" => {
   83         -
                    builder = builder.set_default_document_list(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   84         -
                }
   85         -
                "defaultNullDocument" => {
   86         -
                    builder = builder.set_default_null_document(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
   87         -
                }
   88         -
                "defaultTimestamp" => {
   89         -
                    builder = builder.set_default_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   90         -
                        tokens.next(),
   91         -
                        ::aws_smithy_types::date_time::Format::EpochSeconds,
   92         -
                    )?);
   93         -
                }
   94         -
                "defaultBlob" => {
   95         -
                    builder = builder.set_default_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
   96         -
                }
   97         -
                "defaultByte" => {
   98         -
                    builder = builder.set_default_byte(
   99         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  100         -
                            .map(i8::try_from)
  101         -
                            .transpose()?,
  102         -
                    );
  103         -
                }
  104         -
                "defaultShort" => {
  105         -
                    builder = builder.set_default_short(
  106         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  107         -
                            .map(i16::try_from)
  108         -
                            .transpose()?,
  109         -
                    );
  110         -
                }
  111         -
                "defaultInteger" => {
  112         -
                    builder = builder.set_default_integer(
  113         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  114         -
                            .map(i32::try_from)
  115         -
                            .transpose()?,
  116         -
                    );
  117         -
                }
  118         -
                "defaultLong" => {
  119         -
                    builder = builder.set_default_long(
  120         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  121         -
                            .map(i64::try_from)
  122         -
                            .transpose()?,
  123         -
                    );
  124         -
                }
  125         -
                "defaultFloat" => {
  126         -
                    builder = builder
  127         -
                        .set_default_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
  128         -
                }
  129         -
                "defaultDouble" => {
  130         -
                    builder = builder
  131         -
                        .set_default_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
  132         -
                }
  133         -
                "defaultMap" => {
  134         -
                    builder = builder.set_default_map(crate::protocol_serde::shape_test_string_map::de_test_string_map(tokens, _value)?);
  135         -
                }
  136         -
                "defaultEnum" => {
  137         -
                    builder = builder.set_default_enum(
  138         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  139         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::TestEnum::from(u.as_ref())))
  140         -
                            .transpose()?,
  141         -
                    );
  142         -
                }
  143         -
                "defaultIntEnum" => {
  144         -
                    builder = builder.set_default_int_enum(
  145         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  146         -
                            .map(i32::try_from)
  147         -
                            .transpose()?,
  148         -
                    );
  149         -
                }
  150         -
                "emptyString" => {
  151         -
                    builder = builder.set_empty_string(
  152         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  153         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  154         -
                            .transpose()?,
  155         -
                    );
  156         -
                }
  157         -
                "falseBoolean" => {
  158         -
                    builder = builder.set_false_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
  159         -
                }
  160         -
                "emptyBlob" => {
  161         -
                    builder = builder.set_empty_blob(::aws_smithy_json::deserialize::token::expect_blob_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         -
                "zeroShort" => {
  171         -
                    builder = builder.set_zero_short(
  172         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  173         -
                            .map(i16::try_from)
  174         -
                            .transpose()?,
  175         -
                    );
  176         -
                }
  177         -
                "zeroInteger" => {
  178         -
                    builder = builder.set_zero_integer(
  179         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  180         -
                            .map(i32::try_from)
  181         -
                            .transpose()?,
  182         -
                    );
  183         -
                }
  184         -
                "zeroLong" => {
  185         -
                    builder = builder.set_zero_long(
  186         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  187         -
                            .map(i64::try_from)
  188         -
                            .transpose()?,
  189         -
                    );
  190         -
                }
  191         -
                "zeroFloat" => {
  192         -
                    builder = builder
  193         -
                        .set_zero_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
  194         -
                }
  195         -
                "zeroDouble" => {
  196         -
                    builder = builder
  197         -
                        .set_zero_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
  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/json_rpc10/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.defaults {
    7         -
        #[allow(unused_mut)]
    8         -
        let mut object_2 = object.key("defaults").start_object();
    9         -
        crate::protocol_serde::shape_defaults::ser_defaults(&mut object_2, var_1)?;
   10         -
        object_2.finish();
   11         -
    }
   12         -
    if let Some(var_3) = &input.client_optional_defaults {
   13         -
        #[allow(unused_mut)]
   14         -
        let mut object_4 = object.key("clientOptionalDefaults").start_object();
   15         -
        crate::protocol_serde::shape_client_optional_defaults::ser_client_optional_defaults(&mut object_4, var_3)?;
   16         -
        object_4.finish();
   17         -
    }
   18         -
    if let Some(var_5) = &input.top_level_default {
   19         -
        object.key("topLevelDefault").string(var_5.as_str());
   20         -
    }
   21         -
    if let Some(var_6) = &input.other_top_level_default {
   22         -
        object.key("otherTopLevelDefault").number(
   23         -
            #[allow(clippy::useless_conversion)]
   24         -
            ::aws_smithy_types::Number::NegInt((*var_6).into()),
   25         -
        );
   26         -
    }
   27         -
    Ok(())
   28         -
}

tmp-codegen-diff/codegen-client-test/json_rpc10/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/json_rpc10/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/json_rpc10/rust-client-codegen/src/protocol_serde/shape_operation_with_required_members.rs

@@ -1,0 +136,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_required_members_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_required_members::OperationWithRequiredMembersOutput,
    9         -
    crate::operation::operation_with_required_members::OperationWithRequiredMembersError,
   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_required_members::OperationWithRequiredMembersError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::operation_with_required_members::OperationWithRequiredMembersError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_operation_with_required_members_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_required_members::OperationWithRequiredMembersOutput,
   25         -
    crate::operation::operation_with_required_members::OperationWithRequiredMembersError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::operation_with_required_members::builders::OperationWithRequiredMembersOutputBuilder::default();
   30         -
        output = crate::protocol_serde::shape_operation_with_required_members::de_operation_with_required_members(_response_body, output)
   31         -
            .map_err(crate::operation::operation_with_required_members::OperationWithRequiredMembersError::unhandled)?;
   32         -
        crate::serde_util::operation_with_required_members_output_output_correct_errors(output)
   33         -
            .build()
   34         -
            .map_err(crate::operation::operation_with_required_members::OperationWithRequiredMembersError::unhandled)?
   35         -
    })
   36         -
}
   37         -
   38         -
pub fn ser_operation_with_required_members_input(
   39         -
    _input: &crate::operation::operation_with_required_members::OperationWithRequiredMembersInput,
   40         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   41         -
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
   42         -
}
   43         -
   44         -
pub(crate) fn de_operation_with_required_members(
   45         -
    _value: &[u8],
   46         -
    mut builder: crate::operation::operation_with_required_members::builders::OperationWithRequiredMembersOutputBuilder,
   47         -
) -> ::std::result::Result<
   48         -
    crate::operation::operation_with_required_members::builders::OperationWithRequiredMembersOutputBuilder,
   49         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   50         -
> {
   51         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   52         -
    let tokens = &mut tokens_owned;
   53         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   54         -
    loop {
   55         -
        match tokens.next().transpose()? {
   56         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   57         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   58         -
                "requiredString" => {
   59         -
                    builder = builder.set_required_string(
   60         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   61         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   62         -
                            .transpose()?,
   63         -
                    );
   64         -
                }
   65         -
                "requiredBoolean" => {
   66         -
                    builder = builder.set_required_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
   67         -
                }
   68         -
                "requiredList" => {
   69         -
                    builder = builder.set_required_list(crate::protocol_serde::shape_required_string_list::de_required_string_list(
   70         -
                        tokens, _value,
   71         -
                    )?);
   72         -
                }
   73         -
                "requiredTimestamp" => {
   74         -
                    builder = builder.set_required_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   75         -
                        tokens.next(),
   76         -
                        ::aws_smithy_types::date_time::Format::EpochSeconds,
   77         -
                    )?);
   78         -
                }
   79         -
                "requiredBlob" => {
   80         -
                    builder = builder.set_required_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
   81         -
                }
   82         -
                "requiredByte" => {
   83         -
                    builder = builder.set_required_byte(
   84         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   85         -
                            .map(i8::try_from)
   86         -
                            .transpose()?,
   87         -
                    );
   88         -
                }
   89         -
                "requiredShort" => {
   90         -
                    builder = builder.set_required_short(
   91         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   92         -
                            .map(i16::try_from)
   93         -
                            .transpose()?,
   94         -
                    );
   95         -
                }
   96         -
                "requiredInteger" => {
   97         -
                    builder = builder.set_required_integer(
   98         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   99         -
                            .map(i32::try_from)
  100         -
                            .transpose()?,
  101         -
                    );
  102         -
                }
  103         -
                "requiredLong" => {
  104         -
                    builder = builder.set_required_long(
  105         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  106         -
                            .map(i64::try_from)
  107         -
                            .transpose()?,
  108         -
                    );
  109         -
                }
  110         -
                "requiredFloat" => {
  111         -
                    builder = builder
  112         -
                        .set_required_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
  113         -
                }
  114         -
                "requiredDouble" => {
  115         -
                    builder = builder
  116         -
                        .set_required_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
  117         -
                }
  118         -
                "requiredMap" => {
  119         -
                    builder = builder.set_required_map(crate::protocol_serde::shape_required_string_map::de_required_string_map(tokens, _value)?);
  120         -
                }
  121         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  122         -
            },
  123         -
            other => {
  124         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  125         -
                    "expected object key or end object, found: {other:?}"
  126         -
                )))
  127         -
            }
  128         -
        }
  129         -
    }
  130         -
    if tokens.next().is_some() {
  131         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  132         -
            "found more JSON tokens after completing parsing",
  133         -
        ));
  134         -
    }
  135         -
    Ok(builder)
  136         -
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/protocol_serde/shape_operation_with_required_members_with_defaults.rs

@@ -1,0 +153,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_required_members_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_required_members_with_defaults::OperationWithRequiredMembersWithDefaultsOutput,
    9         -
    crate::operation::operation_with_required_members_with_defaults::OperationWithRequiredMembersWithDefaultsError,
   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_required_members_with_defaults::OperationWithRequiredMembersWithDefaultsError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::operation_with_required_members_with_defaults::OperationWithRequiredMembersWithDefaultsError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_operation_with_required_members_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_required_members_with_defaults::OperationWithRequiredMembersWithDefaultsOutput,
   25         -
    crate::operation::operation_with_required_members_with_defaults::OperationWithRequiredMembersWithDefaultsError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output =
   30         -
            crate::operation::operation_with_required_members_with_defaults::builders::OperationWithRequiredMembersWithDefaultsOutputBuilder::default(
   31         -
            );
   32         -
        output = crate::protocol_serde::shape_operation_with_required_members_with_defaults::de_operation_with_required_members_with_defaults(
   33         -
            _response_body,
   34         -
            output,
   35         -
        )
   36         -
        .map_err(crate::operation::operation_with_required_members_with_defaults::OperationWithRequiredMembersWithDefaultsError::unhandled)?;
   37         -
        crate::serde_util::operation_with_required_members_with_defaults_output_output_correct_errors(output).build()
   38         -
    })
   39         -
}
   40         -
   41         -
pub fn ser_operation_with_required_members_with_defaults_input(
   42         -
    _input: &crate::operation::operation_with_required_members_with_defaults::OperationWithRequiredMembersWithDefaultsInput,
   43         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   44         -
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
   45         -
}
   46         -
   47         -
pub(crate) fn de_operation_with_required_members_with_defaults(
   48         -
    _value: &[u8],
   49         -
    mut builder: crate::operation::operation_with_required_members_with_defaults::builders::OperationWithRequiredMembersWithDefaultsOutputBuilder,
   50         -
) -> ::std::result::Result<
   51         -
    crate::operation::operation_with_required_members_with_defaults::builders::OperationWithRequiredMembersWithDefaultsOutputBuilder,
   52         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   53         -
> {
   54         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   55         -
    let tokens = &mut tokens_owned;
   56         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   57         -
    loop {
   58         -
        match tokens.next().transpose()? {
   59         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   60         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   61         -
                "requiredString" => {
   62         -
                    builder = builder.set_required_string(
   63         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   64         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   65         -
                            .transpose()?,
   66         -
                    );
   67         -
                }
   68         -
                "requiredBoolean" => {
   69         -
                    builder = builder.set_required_boolean(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
   70         -
                }
   71         -
                "requiredList" => {
   72         -
                    builder = builder.set_required_list(crate::protocol_serde::shape_required_string_list::de_required_string_list(
   73         -
                        tokens, _value,
   74         -
                    )?);
   75         -
                }
   76         -
                "requiredTimestamp" => {
   77         -
                    builder = builder.set_required_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   78         -
                        tokens.next(),
   79         -
                        ::aws_smithy_types::date_time::Format::EpochSeconds,
   80         -
                    )?);
   81         -
                }
   82         -
                "requiredBlob" => {
   83         -
                    builder = builder.set_required_blob(::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?);
   84         -
                }
   85         -
                "requiredByte" => {
   86         -
                    builder = builder.set_required_byte(
   87         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   88         -
                            .map(i8::try_from)
   89         -
                            .transpose()?,
   90         -
                    );
   91         -
                }
   92         -
                "requiredShort" => {
   93         -
                    builder = builder.set_required_short(
   94         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   95         -
                            .map(i16::try_from)
   96         -
                            .transpose()?,
   97         -
                    );
   98         -
                }
   99         -
                "requiredInteger" => {
  100         -
                    builder = builder.set_required_integer(
  101         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  102         -
                            .map(i32::try_from)
  103         -
                            .transpose()?,
  104         -
                    );
  105         -
                }
  106         -
                "requiredLong" => {
  107         -
                    builder = builder.set_required_long(
  108         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  109         -
                            .map(i64::try_from)
  110         -
                            .transpose()?,
  111         -
                    );
  112         -
                }
  113         -
                "requiredFloat" => {
  114         -
                    builder = builder
  115         -
                        .set_required_float(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f32_lossy()));
  116         -
                }
  117         -
                "requiredDouble" => {
  118         -
                    builder = builder
  119         -
                        .set_required_double(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
  120         -
                }
  121         -
                "requiredMap" => {
  122         -
                    builder = builder.set_required_map(crate::protocol_serde::shape_required_string_map::de_required_string_map(tokens, _value)?);
  123         -
                }
  124         -
                "requiredEnum" => {
  125         -
                    builder = builder.set_required_enum(
  126         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  127         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::RequiredEnum::from(u.as_ref())))
  128         -
                            .transpose()?,
  129         -
                    );
  130         -
                }
  131         -
                "requiredIntEnum" => {
  132         -
                    builder = builder.set_required_int_enum(
  133         -
                        ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
  134         -
                            .map(i32::try_from)
  135         -
                            .transpose()?,
  136         -
                    );
  137         -
                }
  138         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  139         -
            },
  140         -
            other => {
  141         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  142         -
                    "expected object key or end object, found: {other:?}"
  143         -
                )))
  144         -
            }
  145         -
        }
  146         -
    }
  147         -
    if tokens.next().is_some() {
  148         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  149         -
            "found more JSON tokens after completing parsing",
  150         -
        ));
  151         -
    }
  152         -
    Ok(builder)
  153         -
}