Client Test

Client Test

rev. 7254d43655ed63111c94f599437f2b0d3f55446e (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,12 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn de_stream_payload(
           3  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           4  +
) -> std::result::Result<
           5  +
    crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>,
           6  +
    crate::operation::output_stream::OutputStreamError,
           7  +
> {
           8  +
    let unmarshaller = crate::event_stream_serde::EventStreamUnmarshaller::new();
           9  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          10  +
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
          11  +
    Ok(receiver)
          12  +
}

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

@@ -0,1 +0,73 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub fn de_output_stream_with_initial_response_http_response(
           4  +
    response: &mut ::aws_smithy_runtime_api::http::Response,
           5  +
) -> std::result::Result<
           6  +
    crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
           7  +
    crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
           8  +
> {
           9  +
    let mut _response_body = ::aws_smithy_types::body::SdkBody::taken();
          10  +
    std::mem::swap(&mut _response_body, response.body_mut());
          11  +
    let _response_body = &mut _response_body;
          12  +
          13  +
    let _response_status = response.status().as_u16();
          14  +
    let _response_headers = response.headers();
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut output = crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseOutputBuilder::default();
          18  +
        output = output.set_initial_response_member(
          19  +
            crate::protocol_serde::shape_output_stream_with_initial_response_output::de_initial_response_member_header(_response_headers).map_err(
          20  +
                |_| {
          21  +
                    crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled(
          22  +
                        "Failed to parse initialResponseMember from header `initial-response-member",
          23  +
                    )
          24  +
                },
          25  +
            )?,
          26  +
        );
          27  +
        output = output.set_stream(Some(
          28  +
            crate::protocol_serde::shape_output_stream_with_initial_response_output::de_stream_payload(_response_body)?,
          29  +
        ));
          30  +
        crate::serde_util::output_stream_with_initial_response_output_output_correct_errors(output)
          31  +
            .build()
          32  +
            .map_err(crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled)?
          33  +
    })
          34  +
}
          35  +
          36  +
#[allow(clippy::unnecessary_wraps)]
          37  +
pub fn de_output_stream_with_initial_response_http_error(
          38  +
    _response_status: u16,
          39  +
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
          40  +
    _response_body: &[u8],
          41  +
) -> std::result::Result<
          42  +
    crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
          43  +
    crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
          44  +
> {
          45  +
    #[allow(unused_mut)]
          46  +
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
          47  +
        .map_err(crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled)?;
          48  +
    let generic = generic_builder.build();
          49  +
    let error_code = match generic.code() {
          50  +
        Some(code) => code,
          51  +
        None => return Err(crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled(generic)),
          52  +
    };
          53  +
          54  +
    let _error_message = generic.message().map(|msg| msg.to_owned());
          55  +
    Err(match error_code {
          56  +
        "ErrorEvent" => crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::ErrorEvent({
          57  +
            #[allow(unused_mut)]
          58  +
            let mut tmp = {
          59  +
                #[allow(unused_mut)]
          60  +
                let mut output = crate::types::error::builders::ErrorEventBuilder::default();
          61  +
                output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
          62  +
                    .map_err(crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled)?;
          63  +
                let output = output.meta(generic);
          64  +
                output.build()
          65  +
            };
          66  +
            if tmp.message.is_none() {
          67  +
                tmp.message = _error_message;
          68  +
            }
          69  +
            tmp
          70  +
        }),
          71  +
        _ => crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::generic(generic),
          72  +
    })
          73  +
}

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

@@ -0,1 +0,19 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_initial_response_member_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("initial-response-member");
           6  +
    ::aws_smithy_http::header::one_or_none(headers)
           7  +
}
           8  +
           9  +
pub fn de_stream_payload(
          10  +
    body: &mut ::aws_smithy_types::body::SdkBody,
          11  +
) -> std::result::Result<
          12  +
    crate::event_receiver::EventReceiver<crate::types::EventStream, crate::types::error::EventStreamError>,
          13  +
    crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
          14  +
> {
          15  +
    let unmarshaller = crate::event_stream_serde::EventStreamUnmarshaller::new();
          16  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          17  +
    let receiver = crate::event_receiver::EventReceiver::new(::aws_smithy_http::event_stream::Receiver::new(unmarshaller, body));
          18  +
    Ok(receiver)
          19  +
}

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

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

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

@@ -0,1 +0,94 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_payload_union(
           3  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::types::PayloadUnion,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    match input {
           7  +
        crate::types::PayloadUnion::UnionMember(inner) => {
           8  +
            object.key("unionMember").string(inner.as_str());
           9  +
        }
          10  +
        crate::types::PayloadUnion::Unknown => return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("PayloadUnion")),
          11  +
    }
          12  +
    Ok(())
          13  +
}
          14  +
          15  +
pub(crate) fn de_payload_union_payload(
          16  +
    _value: &[u8],
          17  +
) -> ::std::result::Result<crate::types::PayloadUnion, ::aws_smithy_json::deserialize::error::DeserializeError> {
          18  +
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
          19  +
    let tokens = &mut tokens_owned;
          20  +
    let result = crate::protocol_serde::shape_payload_union::de_payload_union(tokens, _value)?
          21  +
        .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
          22  +
    if tokens.next().is_some() {
          23  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          24  +
            "found more JSON tokens after completing parsing",
          25  +
        ));
          26  +
    }
          27  +
    result
          28  +
}
          29  +
          30  +
pub(crate) fn de_payload_union<'a, I>(
          31  +
    tokens: &mut ::std::iter::Peekable<I>,
          32  +
    _value: &'a [u8],
          33  +
) -> ::std::result::Result<Option<crate::types::PayloadUnion>, ::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  +
    let mut variant = None;
          38  +
    match tokens.next().transpose()? {
          39  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
          40  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          41  +
            match tokens.next().transpose()? {
          42  +
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          43  +
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          44  +
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
          45  +
                        tokens.peek()
          46  +
                    {
          47  +
                        let _ = tokens.next().expect("peek returned a token")?;
          48  +
                        continue;
          49  +
                    }
          50  +
                    let key = key.to_unescaped()?;
          51  +
                    if key == "__type" {
          52  +
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          53  +
                        continue;
          54  +
                    }
          55  +
                    if variant.is_some() {
          56  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          57  +
                            "encountered mixed variants in union",
          58  +
                        ));
          59  +
                    }
          60  +
                    variant = match key.as_ref() {
          61  +
                        "unionMember" => Some(crate::types::PayloadUnion::UnionMember(
          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  +
                                .ok_or_else(|| {
          66  +
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'unionMember' cannot be null")
          67  +
                                })?,
          68  +
                        )),
          69  +
                        _ => {
          70  +
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          71  +
                            Some(crate::types::PayloadUnion::Unknown)
          72  +
                        }
          73  +
                    };
          74  +
                }
          75  +
                other => {
          76  +
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          77  +
                        "expected object key or end object, found: {other:?}"
          78  +
                    )))
          79  +
                }
          80  +
            }
          81  +
        },
          82  +
        _ => {
          83  +
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          84  +
                "expected start object or null",
          85  +
            ))
          86  +
        }
          87  +
    }
          88  +
    if variant.is_none() {
          89  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          90  +
            "Union did not contain a valid variant.",
          91  +
        ));
          92  +
    }
          93  +
    Ok(variant)
          94  +
}

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

@@ -0,1 +0,35 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_service_unavailable_error_json_err(
           3  +
    _value: &[u8],
           4  +
    mut builder: crate::types::error::builders::ServiceUnavailableErrorBuilder,
           5  +
) -> ::std::result::Result<crate::types::error::builders::ServiceUnavailableErrorBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
           6  +
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
           7  +
    let tokens = &mut tokens_owned;
           8  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
           9  +
    loop {
          10  +
        match tokens.next().transpose()? {
          11  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          12  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          13  +
                "message" => {
          14  +
                    builder = builder.set_message(
          15  +
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          16  +
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          17  +
                            .transpose()?,
          18  +
                    );
          19  +
                }
          20  +
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          21  +
            },
          22  +
            other => {
          23  +
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          24  +
                    "expected object key or end object, found: {other:?}"
          25  +
                )))
          26  +
            }
          27  +
        }
          28  +
    }
          29  +
    if tokens.next().is_some() {
          30  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          31  +
            "found more JSON tokens after completing parsing",
          32  +
        ));
          33  +
    }
          34  +
    Ok(builder)
          35  +
}

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

@@ -0,1 +0,40 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_singleton_event<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
    _value: &'a [u8],
           5  +
) -> ::std::result::Result<Option<crate::types::SingletonEvent>, ::aws_smithy_json::deserialize::error::DeserializeError>
           6  +
where
           7  +
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
           8  +
{
           9  +
    match tokens.next().transpose()? {
          10  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          11  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          12  +
            #[allow(unused_mut)]
          13  +
            let mut builder = crate::types::builders::SingletonEventBuilder::default();
          14  +
            loop {
          15  +
                match tokens.next().transpose()? {
          16  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          17  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          18  +
                        "value" => {
          19  +
                            builder = builder.set_value(
          20  +
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          21  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          22  +
                                    .transpose()?,
          23  +
                            );
          24  +
                        }
          25  +
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          26  +
                    },
          27  +
                    other => {
          28  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          29  +
                            "expected object key or end object, found: {other:?}"
          30  +
                        )))
          31  +
                    }
          32  +
                }
          33  +
            }
          34  +
            Ok(Some(builder.build()))
          35  +
        }
          36  +
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          37  +
            "expected start object or null",
          38  +
        )),
          39  +
    }
          40  +
}

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

@@ -0,1 +0,78 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_singleton_event_stream_payload(
           3  +
    _value: &[u8],
           4  +
) -> ::std::result::Result<crate::types::SingletonEventStream, ::aws_smithy_json::deserialize::error::DeserializeError> {
           5  +
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
           6  +
    let tokens = &mut tokens_owned;
           7  +
    let result = crate::protocol_serde::shape_singleton_event_stream::de_singleton_event_stream(tokens, _value)?
           8  +
        .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("expected payload member value"));
           9  +
    if tokens.next().is_some() {
          10  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          11  +
            "found more JSON tokens after completing parsing",
          12  +
        ));
          13  +
    }
          14  +
    result
          15  +
}
          16  +
          17  +
pub(crate) fn de_singleton_event_stream<'a, I>(
          18  +
    tokens: &mut ::std::iter::Peekable<I>,
          19  +
    _value: &'a [u8],
          20  +
) -> ::std::result::Result<Option<crate::types::SingletonEventStream>, ::aws_smithy_json::deserialize::error::DeserializeError>
          21  +
where
          22  +
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
          23  +
{
          24  +
    let mut variant = None;
          25  +
    match tokens.next().transpose()? {
          26  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
          27  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          28  +
            match tokens.next().transpose()? {
          29  +
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          30  +
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          31  +
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
          32  +
                        tokens.peek()
          33  +
                    {
          34  +
                        let _ = tokens.next().expect("peek returned a token")?;
          35  +
                        continue;
          36  +
                    }
          37  +
                    let key = key.to_unescaped()?;
          38  +
                    if key == "__type" {
          39  +
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          40  +
                        continue;
          41  +
                    }
          42  +
                    if variant.is_some() {
          43  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          44  +
                            "encountered mixed variants in union",
          45  +
                        ));
          46  +
                    }
          47  +
                    variant = match key.as_ref() {
          48  +
                        "singleton" => Some(crate::types::SingletonEventStream::Singleton(
          49  +
                            crate::protocol_serde::shape_singleton_event::de_singleton_event(tokens, _value)?.ok_or_else(|| {
          50  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'singleton' cannot be null")
          51  +
                            })?,
          52  +
                        )),
          53  +
                        _ => {
          54  +
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          55  +
                            Some(crate::types::SingletonEventStream::Unknown)
          56  +
                        }
          57  +
                    };
          58  +
                }
          59  +
                other => {
          60  +
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          61  +
                        "expected object key or end object, found: {other:?}"
          62  +
                    )))
          63  +
                }
          64  +
            }
          65  +
        },
          66  +
        _ => {
          67  +
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          68  +
                "expected start object or null",
          69  +
            ))
          70  +
        }
          71  +
    }
          72  +
    if variant.is_none() {
          73  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          74  +
            "Union did not contain a valid variant.",
          75  +
        ));
          76  +
    }
          77  +
    Ok(variant)
          78  +
}

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

@@ -0,1 +0,10 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_payload_payload(
           3  +
    input: &crate::types::PayloadStructure,
           4  +
) -> std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_payload_structure::ser_payload_structure(&mut object, input)?;
           8  +
    object.finish();
           9  +
    Ok(out.into_bytes())
          10  +
}

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

@@ -0,1 +0,10 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_payload_payload(
           3  +
    input: &crate::types::PayloadUnion,
           4  +
) -> std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_payload_union::ser_payload_union(&mut object, input)?;
           8  +
    object.finish();
           9  +
    Ok(out.into_bytes())
          10  +
}

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

@@ -1,1 +39,57 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn duplex_stream_with_initial_messages_output_output_correct_errors(
           3  +
    mut builder: crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesOutputBuilder,
           4  +
) -> crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesOutputBuilder {
           5  +
    if builder.initial_response_member.is_none() {
           6  +
        builder.initial_response_member = Some(Default::default())
           7  +
    }
           8  +
    builder
           9  +
}
          10  +
    2     11   
pub(crate) fn operation_with_nested_structure_output_output_correct_errors(
    3     12   
    mut builder: crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder,
    4     13   
) -> crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder {
    5     14   
    if builder.dialog.is_none() {
    6     15   
        builder.dialog = {
    7     16   
            let builder = crate::types::builders::DialogBuilder::default();
    8     17   
            Some(builder.build())
    9     18   
        }
   10     19   
    }
   11     20   
    builder
   12     21   
}
   13     22   
          23  +
pub(crate) fn output_stream_with_initial_response_output_output_correct_errors(
          24  +
    mut builder: crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseOutputBuilder,
          25  +
) -> crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseOutputBuilder {
          26  +
    if builder.initial_response_member.is_none() {
          27  +
        builder.initial_response_member = Some(Default::default())
          28  +
    }
          29  +
    builder
          30  +
}
          31  +
   14     32   
pub(crate) fn post_player_action_output_output_correct_errors(
   15     33   
    mut builder: crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder,
   16     34   
) -> crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder {
   17     35   
    if builder.action.is_none() {
   18     36   
        builder.action = Some(crate::types::PlayerAction::Unknown)
   19     37   
    }
   20     38   
    builder
   21     39   
}
   22     40   
   23     41   
pub(crate) fn post_union_with_json_name_output_output_correct_errors(

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

@@ -1,1 +98,146 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub use crate::types::_dialog::Dialog;
           2  +
pub use crate::types::_foo_enum::FooEnum;
    3      3   
    4         -
pub use crate::types::_farewell::Farewell;
           4  +
pub use crate::types::_nested_payload::NestedPayload;
    5      5   
    6         -
pub use crate::types::_top_level::TopLevel;
           6  +
pub use crate::types::_string_enum::StringEnum;
    7      7   
    8         -
pub use crate::types::_test_enum::TestEnum;
           8  +
pub use crate::types::_union_payload::UnionPayload;
    9      9   
   10         -
pub use crate::types::_client_optional_defaults::ClientOptionalDefaults;
          10  +
pub use crate::types::_complex_nested_error_data::ComplexNestedErrorData;
   11     11   
   12         -
pub use crate::types::_defaults::Defaults;
          12  +
pub use crate::types::_recursive_shapes_input_output_nested1::RecursiveShapesInputOutputNested1;
   13     13   
   14         -
pub use crate::types::_payload_config::PayloadConfig;
          14  +
pub use crate::types::_my_union::MyUnion;
   15     15   
   16         -
pub use crate::types::_test_config::TestConfig;
          16  +
pub use crate::types::_player_action::PlayerAction;
          17  +
          18  +
pub use crate::types::_union_with_json_name::UnionWithJsonName;
   17     19   
   18     20   
pub use crate::types::_simple_union::SimpleUnion;
   19     21   
   20         -
pub use crate::types::_union_with_json_name::UnionWithJsonName;
          22  +
pub use crate::types::_test_config::TestConfig;
   21     23   
   22         -
pub use crate::types::_player_action::PlayerAction;
          24  +
pub use crate::types::_payload_config::PayloadConfig;
   23     25   
   24         -
pub use crate::types::_unit::Unit;
          26  +
pub use crate::types::_defaults::Defaults;
   25     27   
   26         -
pub use crate::types::_my_union::MyUnion;
          28  +
pub use crate::types::_client_optional_defaults::ClientOptionalDefaults;
   27     29   
   28         -
pub use crate::types::_renamed_greeting::RenamedGreeting;
          30  +
pub use crate::types::_test_enum::TestEnum;
   29     31   
   30         -
pub use crate::types::_greeting_struct::GreetingStruct;
          32  +
pub use crate::types::_top_level::TopLevel;
   31     33   
   32         -
pub use crate::types::_foo_enum::FooEnum;
          34  +
pub use crate::types::_dialog::Dialog;
   33     35   
   34         -
pub use crate::types::_structure_list_member::StructureListMember;
          36  +
pub use crate::types::_event_stream::EventStream;
   35     37   
   36         -
pub use crate::types::_recursive_shapes_input_output_nested1::RecursiveShapesInputOutputNested1;
          38  +
pub use crate::types::_singleton_event_stream::SingletonEventStream;
   37     39   
   38     40   
pub use crate::types::_recursive_shapes_input_output_nested2::RecursiveShapesInputOutputNested2;
   39     41   
   40         -
pub use crate::types::_complex_nested_error_data::ComplexNestedErrorData;
          42  +
pub use crate::types::_structure_list_member::StructureListMember;
   41     43   
   42         -
pub use crate::types::_union_payload::UnionPayload;
          44  +
pub use crate::types::_greeting_struct::GreetingStruct;
   43     45   
   44         -
pub use crate::types::_string_enum::StringEnum;
          46  +
pub use crate::types::_renamed_greeting::RenamedGreeting;
   45     47   
   46         -
pub use crate::types::_nested_payload::NestedPayload;
          48  +
pub use crate::types::_unit::Unit;
          49  +
          50  +
pub use crate::types::_farewell::Farewell;
          51  +
          52  +
pub use crate::types::_headers_event::HeadersEvent;
          53  +
          54  +
pub use crate::types::_blob_payload_event::BlobPayloadEvent;
          55  +
          56  +
pub use crate::types::_string_payload_event::StringPayloadEvent;
          57  +
          58  +
pub use crate::types::_structure_payload_event::StructurePayloadEvent;
          59  +
          60  +
pub use crate::types::_union_payload_event::UnionPayloadEvent;
          61  +
          62  +
pub use crate::types::_headers_and_explicit_payload_event::HeadersAndExplicitPayloadEvent;
          63  +
          64  +
pub use crate::types::_headers_and_implicit_payload_event::HeadersAndImplicitPayloadEvent;
          65  +
          66  +
pub use crate::types::_singleton_event::SingletonEvent;
          67  +
          68  +
pub use crate::types::_payload_structure::PayloadStructure;
          69  +
          70  +
pub use crate::types::_payload_union::PayloadUnion;
          71  +
          72  +
mod _blob_payload_event;
   47     73   
   48     74   
mod _client_optional_defaults;
   49     75   
   50     76   
mod _complex_nested_error_data;
   51     77   
   52     78   
mod _defaults;
   53     79   
   54     80   
mod _dialog;
   55     81   
          82  +
mod _event_stream;
          83  +
   56     84   
mod _farewell;
   57     85   
   58     86   
mod _foo_enum;
   59     87   
   60     88   
mod _greeting_struct;
   61     89   
          90  +
mod _headers_and_explicit_payload_event;
          91  +
          92  +
mod _headers_and_implicit_payload_event;
          93  +
          94  +
mod _headers_event;
          95  +
   62     96   
mod _my_union;
   63     97   
   64     98   
mod _nested_payload;
   65     99   
   66    100   
mod _payload_config;
   67    101   
         102  +
mod _payload_structure;
         103  +
         104  +
mod _payload_union;
         105  +
   68    106   
mod _player_action;
   69    107   
   70    108   
mod _recursive_shapes_input_output_nested1;
   71    109   
   72    110   
mod _recursive_shapes_input_output_nested2;
   73    111   
   74    112   
mod _renamed_greeting;
   75    113   
   76    114   
mod _simple_union;
   77    115   
         116  +
mod _singleton_event;
         117  +
         118  +
mod _singleton_event_stream;
         119  +
   78    120   
mod _string_enum;
   79    121   
         122  +
mod _string_payload_event;
         123  +
   80    124   
mod _structure_list_member;
   81    125   
         126  +
mod _structure_payload_event;
         127  +
   82    128   
mod _test_config;
   83    129   
   84    130   
mod _test_enum;
   85    131   
   86    132   
mod _top_level;
   87    133   
   88    134   
mod _union_payload;
   89    135   
         136  +
mod _union_payload_event;
         137  +
   90    138   
mod _union_with_json_name;
   91    139   
   92    140   
mod _unit;
   93    141   
   94    142   
/// Builders
   95    143   
pub mod builders;
   96    144   
   97    145   
/// Error types that Sample Rest Json Protocol Service can respond with.
   98    146   
pub mod error;

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/types/_blob_payload_event.rs

@@ -0,1 +0,47 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[non_exhaustive]
           4  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           5  +
pub struct BlobPayloadEvent {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    pub payload: ::std::option::Option<::aws_smithy_types::Blob>,
           8  +
}
           9  +
impl BlobPayloadEvent {
          10  +
    #[allow(missing_docs)] // documentation missing in model
          11  +
    pub fn payload(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
          12  +
        self.payload.as_ref()
          13  +
    }
          14  +
}
          15  +
impl BlobPayloadEvent {
          16  +
    /// Creates a new builder-style object to manufacture [`BlobPayloadEvent`](crate::types::BlobPayloadEvent).
          17  +
    pub fn builder() -> crate::types::builders::BlobPayloadEventBuilder {
          18  +
        crate::types::builders::BlobPayloadEventBuilder::default()
          19  +
    }
          20  +
}
          21  +
          22  +
/// A builder for [`BlobPayloadEvent`](crate::types::BlobPayloadEvent).
          23  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          24  +
#[non_exhaustive]
          25  +
pub struct BlobPayloadEventBuilder {
          26  +
    pub(crate) payload: ::std::option::Option<::aws_smithy_types::Blob>,
          27  +
}
          28  +
impl BlobPayloadEventBuilder {
          29  +
    #[allow(missing_docs)] // documentation missing in model
          30  +
    pub fn payload(mut self, input: ::aws_smithy_types::Blob) -> Self {
          31  +
        self.payload = ::std::option::Option::Some(input);
          32  +
        self
          33  +
    }
          34  +
    #[allow(missing_docs)] // documentation missing in model
          35  +
    pub fn set_payload(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
          36  +
        self.payload = input;
          37  +
        self
          38  +
    }
          39  +
    #[allow(missing_docs)] // documentation missing in model
          40  +
    pub fn get_payload(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
          41  +
        &self.payload
          42  +
    }
          43  +
    /// Consumes the builder and constructs a [`BlobPayloadEvent`](crate::types::BlobPayloadEvent).
          44  +
    pub fn build(self) -> crate::types::BlobPayloadEvent {
          45  +
        crate::types::BlobPayloadEvent { payload: self.payload }
          46  +
    }
          47  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/types/_event_stream.rs

@@ -0,1 +0,126 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[non_exhaustive]
           4  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           5  +
pub enum EventStream {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    BlobPayload(crate::types::BlobPayloadEvent),
           8  +
    #[allow(missing_docs)] // documentation missing in model
           9  +
    Headers(crate::types::HeadersEvent),
          10  +
    #[allow(missing_docs)] // documentation missing in model
          11  +
    HeadersAndExplicitPayload(crate::types::HeadersAndExplicitPayloadEvent),
          12  +
    #[allow(missing_docs)] // documentation missing in model
          13  +
    HeadersAndImplicitPayload(crate::types::HeadersAndImplicitPayloadEvent),
          14  +
    #[allow(missing_docs)] // documentation missing in model
          15  +
    StringPayload(crate::types::StringPayloadEvent),
          16  +
    #[allow(missing_docs)] // documentation missing in model
          17  +
    StructurePayload(crate::types::StructurePayloadEvent),
          18  +
    #[allow(missing_docs)] // documentation missing in model
          19  +
    UnionPayload(crate::types::UnionPayloadEvent),
          20  +
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          21  +
    /// An unknown enum variant
          22  +
    ///
          23  +
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
          24  +
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
          25  +
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
          26  +
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
          27  +
    #[non_exhaustive]
          28  +
    Unknown,
          29  +
}
          30  +
impl EventStream {
          31  +
    /// Tries to convert the enum instance into [`BlobPayload`](crate::types::EventStream::BlobPayload), extracting the inner [`BlobPayloadEvent`](crate::types::BlobPayloadEvent).
          32  +
    /// Returns `Err(&Self)` if it can't be converted.
          33  +
    pub fn as_blob_payload(&self) -> ::std::result::Result<&crate::types::BlobPayloadEvent, &Self> {
          34  +
        if let EventStream::BlobPayload(val) = &self {
          35  +
            ::std::result::Result::Ok(val)
          36  +
        } else {
          37  +
            ::std::result::Result::Err(self)
          38  +
        }
          39  +
    }
          40  +
    /// Returns true if this is a [`BlobPayload`](crate::types::EventStream::BlobPayload).
          41  +
    pub fn is_blob_payload(&self) -> bool {
          42  +
        self.as_blob_payload().is_ok()
          43  +
    }
          44  +
    /// Tries to convert the enum instance into [`Headers`](crate::types::EventStream::Headers), extracting the inner [`HeadersEvent`](crate::types::HeadersEvent).
          45  +
    /// Returns `Err(&Self)` if it can't be converted.
          46  +
    pub fn as_headers(&self) -> ::std::result::Result<&crate::types::HeadersEvent, &Self> {
          47  +
        if let EventStream::Headers(val) = &self {
          48  +
            ::std::result::Result::Ok(val)
          49  +
        } else {
          50  +
            ::std::result::Result::Err(self)
          51  +
        }
          52  +
    }
          53  +
    /// Returns true if this is a [`Headers`](crate::types::EventStream::Headers).
          54  +
    pub fn is_headers(&self) -> bool {
          55  +
        self.as_headers().is_ok()
          56  +
    }
          57  +
    /// Tries to convert the enum instance into [`HeadersAndExplicitPayload`](crate::types::EventStream::HeadersAndExplicitPayload), extracting the inner [`HeadersAndExplicitPayloadEvent`](crate::types::HeadersAndExplicitPayloadEvent).
          58  +
    /// Returns `Err(&Self)` if it can't be converted.
          59  +
    pub fn as_headers_and_explicit_payload(&self) -> ::std::result::Result<&crate::types::HeadersAndExplicitPayloadEvent, &Self> {
          60  +
        if let EventStream::HeadersAndExplicitPayload(val) = &self {
          61  +
            ::std::result::Result::Ok(val)
          62  +
        } else {
          63  +
            ::std::result::Result::Err(self)
          64  +
        }
          65  +
    }
          66  +
    /// Returns true if this is a [`HeadersAndExplicitPayload`](crate::types::EventStream::HeadersAndExplicitPayload).
          67  +
    pub fn is_headers_and_explicit_payload(&self) -> bool {
          68  +
        self.as_headers_and_explicit_payload().is_ok()
          69  +
    }
          70  +
    /// Tries to convert the enum instance into [`HeadersAndImplicitPayload`](crate::types::EventStream::HeadersAndImplicitPayload), extracting the inner [`HeadersAndImplicitPayloadEvent`](crate::types::HeadersAndImplicitPayloadEvent).
          71  +
    /// Returns `Err(&Self)` if it can't be converted.
          72  +
    pub fn as_headers_and_implicit_payload(&self) -> ::std::result::Result<&crate::types::HeadersAndImplicitPayloadEvent, &Self> {
          73  +
        if let EventStream::HeadersAndImplicitPayload(val) = &self {
          74  +
            ::std::result::Result::Ok(val)
          75  +
        } else {
          76  +
            ::std::result::Result::Err(self)
          77  +
        }
          78  +
    }
          79  +
    /// Returns true if this is a [`HeadersAndImplicitPayload`](crate::types::EventStream::HeadersAndImplicitPayload).
          80  +
    pub fn is_headers_and_implicit_payload(&self) -> bool {
          81  +
        self.as_headers_and_implicit_payload().is_ok()
          82  +
    }
          83  +
    /// Tries to convert the enum instance into [`StringPayload`](crate::types::EventStream::StringPayload), extracting the inner [`StringPayloadEvent`](crate::types::StringPayloadEvent).
          84  +
    /// Returns `Err(&Self)` if it can't be converted.
          85  +
    pub fn as_string_payload(&self) -> ::std::result::Result<&crate::types::StringPayloadEvent, &Self> {
          86  +
        if let EventStream::StringPayload(val) = &self {
          87  +
            ::std::result::Result::Ok(val)
          88  +
        } else {
          89  +
            ::std::result::Result::Err(self)
          90  +
        }
          91  +
    }
          92  +
    /// Returns true if this is a [`StringPayload`](crate::types::EventStream::StringPayload).
          93  +
    pub fn is_string_payload(&self) -> bool {
          94  +
        self.as_string_payload().is_ok()
          95  +
    }
          96  +
    /// Tries to convert the enum instance into [`StructurePayload`](crate::types::EventStream::StructurePayload), extracting the inner [`StructurePayloadEvent`](crate::types::StructurePayloadEvent).
          97  +
    /// Returns `Err(&Self)` if it can't be converted.
          98  +
    pub fn as_structure_payload(&self) -> ::std::result::Result<&crate::types::StructurePayloadEvent, &Self> {
          99  +
        if let EventStream::StructurePayload(val) = &self {
         100  +
            ::std::result::Result::Ok(val)
         101  +
        } else {
         102  +
            ::std::result::Result::Err(self)
         103  +
        }
         104  +
    }
         105  +
    /// Returns true if this is a [`StructurePayload`](crate::types::EventStream::StructurePayload).
         106  +
    pub fn is_structure_payload(&self) -> bool {
         107  +
        self.as_structure_payload().is_ok()
         108  +
    }
         109  +
    /// Tries to convert the enum instance into [`UnionPayload`](crate::types::EventStream::UnionPayload), extracting the inner [`UnionPayloadEvent`](crate::types::UnionPayloadEvent).
         110  +
    /// Returns `Err(&Self)` if it can't be converted.
         111  +
    pub fn as_union_payload(&self) -> ::std::result::Result<&crate::types::UnionPayloadEvent, &Self> {
         112  +
        if let EventStream::UnionPayload(val) = &self {
         113  +
            ::std::result::Result::Ok(val)
         114  +
        } else {
         115  +
            ::std::result::Result::Err(self)
         116  +
        }
         117  +
    }
         118  +
    /// Returns true if this is a [`UnionPayload`](crate::types::EventStream::UnionPayload).
         119  +
    pub fn is_union_payload(&self) -> bool {
         120  +
        self.as_union_payload().is_ok()
         121  +
    }
         122  +
    /// Returns true if the enum instance is the `Unknown` variant.
         123  +
    pub fn is_unknown(&self) -> bool {
         124  +
        matches!(self, Self::Unknown)
         125  +
    }
         126  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/types/_headers_and_explicit_payload_event.rs

@@ -0,1 +0,71 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[non_exhaustive]
           4  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           5  +
pub struct HeadersAndExplicitPayloadEvent {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    pub header: ::std::option::Option<::std::string::String>,
           8  +
    #[allow(missing_docs)] // documentation missing in model
           9  +
    pub payload: ::std::option::Option<crate::types::PayloadStructure>,
          10  +
}
          11  +
impl HeadersAndExplicitPayloadEvent {
          12  +
    #[allow(missing_docs)] // documentation missing in model
          13  +
    pub fn header(&self) -> ::std::option::Option<&str> {
          14  +
        self.header.as_deref()
          15  +
    }
          16  +
    #[allow(missing_docs)] // documentation missing in model
          17  +
    pub fn payload(&self) -> ::std::option::Option<&crate::types::PayloadStructure> {
          18  +
        self.payload.as_ref()
          19  +
    }
          20  +
}
          21  +
impl HeadersAndExplicitPayloadEvent {
          22  +
    /// Creates a new builder-style object to manufacture [`HeadersAndExplicitPayloadEvent`](crate::types::HeadersAndExplicitPayloadEvent).
          23  +
    pub fn builder() -> crate::types::builders::HeadersAndExplicitPayloadEventBuilder {
          24  +
        crate::types::builders::HeadersAndExplicitPayloadEventBuilder::default()
          25  +
    }
          26  +
}
          27  +
          28  +
/// A builder for [`HeadersAndExplicitPayloadEvent`](crate::types::HeadersAndExplicitPayloadEvent).
          29  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          30  +
#[non_exhaustive]
          31  +
pub struct HeadersAndExplicitPayloadEventBuilder {
          32  +
    pub(crate) header: ::std::option::Option<::std::string::String>,
          33  +
    pub(crate) payload: ::std::option::Option<crate::types::PayloadStructure>,
          34  +
}
          35  +
impl HeadersAndExplicitPayloadEventBuilder {
          36  +
    #[allow(missing_docs)] // documentation missing in model
          37  +
    pub fn header(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          38  +
        self.header = ::std::option::Option::Some(input.into());
          39  +
        self
          40  +
    }
          41  +
    #[allow(missing_docs)] // documentation missing in model
          42  +
    pub fn set_header(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          43  +
        self.header = input;
          44  +
        self
          45  +
    }
          46  +
    #[allow(missing_docs)] // documentation missing in model
          47  +
    pub fn get_header(&self) -> &::std::option::Option<::std::string::String> {
          48  +
        &self.header
          49  +
    }
          50  +
    #[allow(missing_docs)] // documentation missing in model
          51  +
    pub fn payload(mut self, input: crate::types::PayloadStructure) -> Self {
          52  +
        self.payload = ::std::option::Option::Some(input);
          53  +
        self
          54  +
    }
          55  +
    #[allow(missing_docs)] // documentation missing in model
          56  +
    pub fn set_payload(mut self, input: ::std::option::Option<crate::types::PayloadStructure>) -> Self {
          57  +
        self.payload = input;
          58  +
        self
          59  +
    }
          60  +
    #[allow(missing_docs)] // documentation missing in model
          61  +
    pub fn get_payload(&self) -> &::std::option::Option<crate::types::PayloadStructure> {
          62  +
        &self.payload
          63  +
    }
          64  +
    /// Consumes the builder and constructs a [`HeadersAndExplicitPayloadEvent`](crate::types::HeadersAndExplicitPayloadEvent).
          65  +
    pub fn build(self) -> crate::types::HeadersAndExplicitPayloadEvent {
          66  +
        crate::types::HeadersAndExplicitPayloadEvent {
          67  +
            header: self.header,
          68  +
            payload: self.payload,
          69  +
        }
          70  +
    }
          71  +
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/types/_headers_and_implicit_payload_event.rs

@@ -0,1 +0,71 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[non_exhaustive]
           4  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           5  +
pub struct HeadersAndImplicitPayloadEvent {
           6  +
    #[allow(missing_docs)] // documentation missing in model
           7  +
    pub header: ::std::option::Option<::std::string::String>,
           8  +
    #[allow(missing_docs)] // documentation missing in model
           9  +
    pub payload: ::std::option::Option<::std::string::String>,
          10  +
}
          11  +
impl HeadersAndImplicitPayloadEvent {
          12  +
    #[allow(missing_docs)] // documentation missing in model
          13  +
    pub fn header(&self) -> ::std::option::Option<&str> {
          14  +
        self.header.as_deref()
          15  +
    }
          16  +
    #[allow(missing_docs)] // documentation missing in model
          17  +
    pub fn payload(&self) -> ::std::option::Option<&str> {
          18  +
        self.payload.as_deref()
          19  +
    }
          20  +
}
          21  +
impl HeadersAndImplicitPayloadEvent {
          22  +
    /// Creates a new builder-style object to manufacture [`HeadersAndImplicitPayloadEvent`](crate::types::HeadersAndImplicitPayloadEvent).
          23  +
    pub fn builder() -> crate::types::builders::HeadersAndImplicitPayloadEventBuilder {
          24  +
        crate::types::builders::HeadersAndImplicitPayloadEventBuilder::default()
          25  +
    }
          26  +
}
          27  +
          28  +
/// A builder for [`HeadersAndImplicitPayloadEvent`](crate::types::HeadersAndImplicitPayloadEvent).
          29  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          30  +
#[non_exhaustive]
          31  +
pub struct HeadersAndImplicitPayloadEventBuilder {
          32  +
    pub(crate) header: ::std::option::Option<::std::string::String>,
          33  +
    pub(crate) payload: ::std::option::Option<::std::string::String>,
          34  +
}
          35  +
impl HeadersAndImplicitPayloadEventBuilder {
          36  +
    #[allow(missing_docs)] // documentation missing in model
          37  +
    pub fn header(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          38  +
        self.header = ::std::option::Option::Some(input.into());
          39  +
        self
          40  +
    }
          41  +
    #[allow(missing_docs)] // documentation missing in model
          42  +
    pub fn set_header(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          43  +
        self.header = input;
          44  +
        self
          45  +
    }
          46  +
    #[allow(missing_docs)] // documentation missing in model
          47  +
    pub fn get_header(&self) -> &::std::option::Option<::std::string::String> {
          48  +
        &self.header
          49  +
    }
          50  +
    #[allow(missing_docs)] // documentation missing in model
          51  +
    pub fn payload(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          52  +
        self.payload = ::std::option::Option::Some(input.into());
          53  +
        self
          54  +
    }
          55  +
    #[allow(missing_docs)] // documentation missing in model
          56  +
    pub fn set_payload(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          57  +
        self.payload = input;
          58  +
        self
          59  +
    }
          60  +
    #[allow(missing_docs)] // documentation missing in model
          61  +
    pub fn get_payload(&self) -> &::std::option::Option<::std::string::String> {
          62  +
        &self.payload
          63  +
    }
          64  +
    /// Consumes the builder and constructs a [`HeadersAndImplicitPayloadEvent`](crate::types::HeadersAndImplicitPayloadEvent).
          65  +
    pub fn build(self) -> crate::types::HeadersAndImplicitPayloadEvent {
          66  +
        crate::types::HeadersAndImplicitPayloadEvent {
          67  +
            header: self.header,
          68  +
            payload: self.payload,
          69  +
        }
          70  +
    }
          71  +
}