Client Test

Client Test

rev. e063993ca0ab793f44c575dbe707d50a5e3e2406

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_timestamp_path_default.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_malformed_timestamp_path_default_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::malformed_timestamp_path_default::MalformedTimestampPathDefaultOutput,
    9         -
    crate::operation::malformed_timestamp_path_default::MalformedTimestampPathDefaultError,
   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::malformed_timestamp_path_default::MalformedTimestampPathDefaultError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::malformed_timestamp_path_default::MalformedTimestampPathDefaultError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_malformed_timestamp_path_default_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::malformed_timestamp_path_default::MalformedTimestampPathDefaultOutput,
   25         -
    crate::operation::malformed_timestamp_path_default::MalformedTimestampPathDefaultError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::malformed_timestamp_path_default::builders::MalformedTimestampPathDefaultOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_timestamp_path_epoch.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_malformed_timestamp_path_epoch_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::malformed_timestamp_path_epoch::MalformedTimestampPathEpochOutput,
    9         -
    crate::operation::malformed_timestamp_path_epoch::MalformedTimestampPathEpochError,
   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::malformed_timestamp_path_epoch::MalformedTimestampPathEpochError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::malformed_timestamp_path_epoch::MalformedTimestampPathEpochError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_malformed_timestamp_path_epoch_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::malformed_timestamp_path_epoch::MalformedTimestampPathEpochOutput,
   25         -
    crate::operation::malformed_timestamp_path_epoch::MalformedTimestampPathEpochError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::malformed_timestamp_path_epoch::builders::MalformedTimestampPathEpochOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_timestamp_path_http_date.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_malformed_timestamp_path_http_date_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::malformed_timestamp_path_http_date::MalformedTimestampPathHttpDateOutput,
    9         -
    crate::operation::malformed_timestamp_path_http_date::MalformedTimestampPathHttpDateError,
   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::malformed_timestamp_path_http_date::MalformedTimestampPathHttpDateError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::malformed_timestamp_path_http_date::MalformedTimestampPathHttpDateError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_malformed_timestamp_path_http_date_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::malformed_timestamp_path_http_date::MalformedTimestampPathHttpDateOutput,
   25         -
    crate::operation::malformed_timestamp_path_http_date::MalformedTimestampPathHttpDateError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::malformed_timestamp_path_http_date::builders::MalformedTimestampPathHttpDateOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_timestamp_query_default.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_malformed_timestamp_query_default_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::malformed_timestamp_query_default::MalformedTimestampQueryDefaultOutput,
    9         -
    crate::operation::malformed_timestamp_query_default::MalformedTimestampQueryDefaultError,
   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::malformed_timestamp_query_default::MalformedTimestampQueryDefaultError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::malformed_timestamp_query_default::MalformedTimestampQueryDefaultError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_malformed_timestamp_query_default_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::malformed_timestamp_query_default::MalformedTimestampQueryDefaultOutput,
   25         -
    crate::operation::malformed_timestamp_query_default::MalformedTimestampQueryDefaultError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::malformed_timestamp_query_default::builders::MalformedTimestampQueryDefaultOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_timestamp_query_epoch.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_malformed_timestamp_query_epoch_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::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochOutput,
    9         -
    crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochError,
   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::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_malformed_timestamp_query_epoch_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::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochOutput,
   25         -
    crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::malformed_timestamp_query_epoch::builders::MalformedTimestampQueryEpochOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_timestamp_query_http_date.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_malformed_timestamp_query_http_date_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::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput,
    9         -
    crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError,
   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::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError::generic(generic))
   16         -
}
   17         -
   18         -
#[allow(clippy::unnecessary_wraps)]
   19         -
pub fn de_malformed_timestamp_query_http_date_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::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput,
   25         -
    crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError,
   26         -
> {
   27         -
    Ok({
   28         -
        #[allow(unused_mut)]
   29         -
        let mut output = crate::operation::malformed_timestamp_query_http_date::builders::MalformedTimestampQueryHttpDateOutputBuilder::default();
   30         -
        output.build()
   31         -
    })
   32         -
}

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

@@ -1,0 +36,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_malformed_union_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::malformed_union::MalformedUnionOutput, crate::operation::malformed_union::MalformedUnionError> {
    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::malformed_union::MalformedUnionError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::malformed_union::MalformedUnionError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_malformed_union_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::malformed_union::MalformedUnionOutput, crate::operation::malformed_union::MalformedUnionError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::malformed_union::builders::MalformedUnionOutputBuilder::default();
   24         -
        output.build()
   25         -
    })
   26         -
}
   27         -
   28         -
pub fn ser_malformed_union_input(
   29         -
    input: &crate::operation::malformed_union::MalformedUnionInput,
   30         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   31         -
    let mut out = String::new();
   32         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   33         -
    crate::protocol_serde::shape_malformed_union_input::ser_malformed_union_input_input(&mut object, input)?;
   34         -
    object.finish();
   35         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   36         -
}

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

@@ -1,0 +13,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_malformed_union_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::malformed_union::MalformedUnionInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.union {
    7         -
        #[allow(unused_mut)]
    8         -
        let mut object_2 = object.key("union").start_object();
    9         -
        crate::protocol_serde::shape_simple_union::ser_simple_union(&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_media_type_header.rs

@@ -1,0 +48,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_media_type_header_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::media_type_header::MediaTypeHeaderOutput, crate::operation::media_type_header::MediaTypeHeaderError> {
    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::media_type_header::MediaTypeHeaderError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::media_type_header::MediaTypeHeaderError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_media_type_header_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::media_type_header::MediaTypeHeaderOutput, crate::operation::media_type_header::MediaTypeHeaderError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::media_type_header::builders::MediaTypeHeaderOutputBuilder::default();
   24         -
        output = output.set_json(
   25         -
            crate::protocol_serde::shape_media_type_header_output::de_json_header(_response_headers)
   26         -
                .map_err(|_| crate::operation::media_type_header::MediaTypeHeaderError::unhandled("Failed to parse json from header `X-Json"))?,
   27         -
        );
   28         -
        output.build()
   29         -
    })
   30         -
}
   31         -
   32         -
pub fn ser_media_type_header_headers(
   33         -
    input: &crate::operation::media_type_header::MediaTypeHeaderInput,
   34         -
    mut builder: ::http_1x::request::Builder,
   35         -
) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   36         -
    if let ::std::option::Option::Some(inner_1) = &input.json {
   37         -
        let formatted_2 = ::aws_smithy_types::base64::encode(inner_1);
   38         -
        let header_value = formatted_2;
   39         -
        let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   40         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   41         -
                "json",
   42         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   43         -
            )
   44         -
        })?;
   45         -
        builder = builder.header("X-Json", header_value);
   46         -
    }
   47         -
    Ok(builder)
   48         -
}

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

@@ -1,0 +27,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_json_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-Json");
    6         -
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
    7         -
    let var_1: std::result::Result<Vec<_>, _> = var_1
    8         -
        .iter()
    9         -
        .map(|s| {
   10         -
            ::aws_smithy_types::base64::decode(s)
   11         -
                .map_err(|_| ::aws_smithy_http::header::ParseError::new("failed to decode base64"))
   12         -
                .and_then(|bytes| {
   13         -
                    String::from_utf8(bytes).map_err(|_| ::aws_smithy_http::header::ParseError::new("base64 encoded data was not valid utf-8"))
   14         -
                })
   15         -
        })
   16         -
        .collect();
   17         -
    let var_1 = var_1?;
   18         -
    if var_1.len() > 1 {
   19         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
   20         -
            "expected one item but found {}",
   21         -
            var_1.len()
   22         -
        )))
   23         -
    } else {
   24         -
        let mut var_1 = var_1;
   25         -
        Ok(var_1.pop())
   26         -
    }
   27         -
}

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

@@ -1,0 +185,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         -
                        "listValue" => Some(crate::types::MyUnion::ListValue(
   77         -
                            crate::protocol_serde::shape_string_list::de_string_list(tokens, _value)?.ok_or_else(|| {
   78         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'listValue' cannot be null")
   79         -
                            })?,
   80         -
                        )),
   81         -
                        "mapValue" => Some(crate::types::MyUnion::MapValue(
   82         -
                            crate::protocol_serde::shape_string_map::de_string_map(tokens, _value)?.ok_or_else(|| {
   83         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'mapValue' cannot be null")
   84         -
                            })?,
   85         -
                        )),
   86         -
                        "structureValue" => Some(crate::types::MyUnion::StructureValue(
   87         -
                            crate::protocol_serde::shape_greeting_struct::de_greeting_struct(tokens, _value)?.ok_or_else(|| {
   88         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'structureValue' cannot be null")
   89         -
                            })?,
   90         -
                        )),
   91         -
                        "renamedStructureValue" => Some(crate::types::MyUnion::RenamedStructureValue(
   92         -
                            crate::protocol_serde::shape_renamed_greeting::de_renamed_greeting(tokens, _value)?.ok_or_else(|| {
   93         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'renamedStructureValue' cannot be null")
   94         -
                            })?,
   95         -
                        )),
   96         -
                        _ => {
   97         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   98         -
                            Some(crate::types::MyUnion::Unknown)
   99         -
                        }
  100         -
                    };
  101         -
                }
  102         -
                other => {
  103         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  104         -
                        "expected object key or end object, found: {other:?}"
  105         -
                    )))
  106         -
                }
  107         -
            }
  108         -
        },
  109         -
        _ => {
  110         -
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  111         -
                "expected start object or null",
  112         -
            ))
  113         -
        }
  114         -
    }
  115         -
    if variant.is_none() {
  116         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  117         -
            "Union did not contain a valid variant.",
  118         -
        ));
  119         -
    }
  120         -
    Ok(variant)
  121         -
}
  122         -
  123         -
pub fn ser_my_union(
  124         -
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
  125         -
    input: &crate::types::MyUnion,
  126         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
  127         -
    match input {
  128         -
        crate::types::MyUnion::StringValue(inner) => {
  129         -
            object_2.key("stringValue").string(inner.as_str());
  130         -
        }
  131         -
        crate::types::MyUnion::BooleanValue(inner) => {
  132         -
            object_2.key("booleanValue").boolean(*inner);
  133         -
        }
  134         -
        crate::types::MyUnion::NumberValue(inner) => {
  135         -
            object_2.key("numberValue").number(
  136         -
                #[allow(clippy::useless_conversion)]
  137         -
                ::aws_smithy_types::Number::NegInt((*inner).into()),
  138         -
            );
  139         -
        }
  140         -
        crate::types::MyUnion::BlobValue(inner) => {
  141         -
            object_2.key("blobValue").string_unchecked(&::aws_smithy_types::base64::encode(inner));
  142         -
        }
  143         -
        crate::types::MyUnion::TimestampValue(inner) => {
  144         -
            object_2
  145         -
                .key("timestampValue")
  146         -
                .date_time(inner, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
  147         -
        }
  148         -
        crate::types::MyUnion::EnumValue(inner) => {
  149         -
            object_2.key("enumValue").string(inner.as_str());
  150         -
        }
  151         -
        crate::types::MyUnion::ListValue(inner) => {
  152         -
            let mut array_1 = object_2.key("listValue").start_array();
  153         -
            for item_2 in inner {
  154         -
                {
  155         -
                    array_1.value().string(item_2.as_str());
  156         -
                }
  157         -
            }
  158         -
            array_1.finish();
  159         -
        }
  160         -
        crate::types::MyUnion::MapValue(inner) => {
  161         -
            #[allow(unused_mut)]
  162         -
            let mut object_3 = object_2.key("mapValue").start_object();
  163         -
            for (key_4, value_5) in inner {
  164         -
                {
  165         -
                    object_3.key(key_4.as_str()).string(value_5.as_str());
  166         -
                }
  167         -
            }
  168         -
            object_3.finish();
  169         -
        }
  170         -
        crate::types::MyUnion::StructureValue(inner) => {
  171         -
            #[allow(unused_mut)]
  172         -
            let mut object_6 = object_2.key("structureValue").start_object();
  173         -
            crate::protocol_serde::shape_greeting_struct::ser_greeting_struct(&mut object_6, inner)?;
  174         -
            object_6.finish();
  175         -
        }
  176         -
        crate::types::MyUnion::RenamedStructureValue(inner) => {
  177         -
            #[allow(unused_mut)]
  178         -
            let mut object_7 = object_2.key("renamedStructureValue").start_object();
  179         -
            crate::protocol_serde::shape_renamed_greeting::ser_renamed_greeting(&mut object_7, inner)?;
  180         -
            object_7.finish();
  181         -
        }
  182         -
        crate::types::MyUnion::Unknown => return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("MyUnion")),
  183         -
    }
  184         -
    Ok(())
  185         -
}

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

@@ -1,0 +75,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_nested_payload(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::NestedPayload,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.greeting {
    7         -
        object.key("greeting").string(var_1.as_str());
    8         -
    }
    9         -
    if let Some(var_2) = &input.name {
   10         -
        object.key("name").string(var_2.as_str());
   11         -
    }
   12         -
    Ok(())
   13         -
}
   14         -
   15         -
pub(crate) fn de_nested_payload_payload(
   16         -
    _value: &[u8],
   17         -
) -> ::std::result::Result<crate::types::NestedPayload, ::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_nested_payload::de_nested_payload(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_nested_payload<'a, I>(
   31         -
    tokens: &mut ::std::iter::Peekable<I>,
   32         -
    _value: &'a [u8],
   33         -
) -> ::std::result::Result<Option<crate::types::NestedPayload>, ::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::NestedPayloadBuilder::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         -
                        "greeting" => {
   47         -
                            builder = builder.set_greeting(
   48         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   49         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   50         -
                                    .transpose()?,
   51         -
                            );
   52         -
                        }
   53         -
                        "name" => {
   54         -
                            builder = builder.set_name(
   55         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   56         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   57         -
                                    .transpose()?,
   58         -
                            );
   59         -
                        }
   60         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   61         -
                    },
   62         -
                    other => {
   63         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   64         -
                            "expected object key or end object, found: {other:?}"
   65         -
                        )))
   66         -
                    }
   67         -
                }
   68         -
            }
   69         -
            Ok(Some(builder.build()))
   70         -
        }
   71         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   72         -
            "expected start object or null",
   73         -
        )),
   74         -
    }
   75         -
}

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

@@ -1,0 +37,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_nested_string_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<::std::vec::Vec<::std::string::String>>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   12         -
            let mut items = Vec::new();
   13         -
            loop {
   14         -
                match tokens.peek() {
   15         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   16         -
                        tokens.next().transpose().unwrap();
   17         -
                        break;
   18         -
                    }
   19         -
                    _ => {
   20         -
                        let value = crate::protocol_serde::shape_string_list::de_string_list(tokens, _value)?;
   21         -
                        if let Some(value) = value {
   22         -
                            items.push(value);
   23         -
                        } else {
   24         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   25         -
                                "dense list cannot contain null values",
   26         -
                            ));
   27         -
                        }
   28         -
                    }
   29         -
                }
   30         -
            }
   31         -
            Ok(Some(items))
   32         -
        }
   33         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34         -
            "expected start array or null",
   35         -
        )),
   36         -
    }
   37         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_no_input_and_no_output.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_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         -
}

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

@@ -1,0 +28,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         -
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_null_and_empty_headers_client.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_client_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_client::NullAndEmptyHeadersClientOutput,
    9         -
    crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
   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_client::NullAndEmptyHeadersClientError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::generic(
   16         -
        generic,
   17         -
    ))
   18         -
}
   19         -
   20         -
#[allow(clippy::unnecessary_wraps)]
   21         -
pub fn de_null_and_empty_headers_client_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_client::NullAndEmptyHeadersClientOutput,
   27         -
    crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
   28         -
> {
   29         -
    Ok({
   30         -
        #[allow(unused_mut)]
   31         -
        let mut output = crate::operation::null_and_empty_headers_client::builders::NullAndEmptyHeadersClientOutputBuilder::default();
   32         -
        output = output.set_a(
   33         -
            crate::protocol_serde::shape_null_and_empty_headers_client_output::de_a_header(_response_headers).map_err(|_| {
   34         -
                crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::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_client_output::de_b_header(_response_headers).map_err(|_| {
   39         -
                crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::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_client_output::de_c_header(_response_headers).map_err(|_| {
   44         -
                crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::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_client_headers(
   52         -
    input: &crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput,
   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         -
}