Client Test

Client Test

rev. 32b1b3c3761061baed26023be3219639e42d7d12 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/operation/structs.rs

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `Structs`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct Structs;
    6      6   
impl Structs {
    7      7   
    /// Creates a new `Structs`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::structs::StructsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::structs::StructsOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::structs::StructsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::structs::StructsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::structs::StructsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -106,110 +231,227 @@
  126    130   
                crate::operation::structs::StructsError,
  127    131   
            >::new());
  128    132   
  129    133   
        ::std::borrow::Cow::Owned(rcb)
  130    134   
    }
  131    135   
}
  132    136   
  133    137   
#[derive(Debug)]
  134    138   
struct StructsResponseDeserializer;
  135    139   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StructsResponseDeserializer {
  136         -
    fn deserialize_nonstreaming(
         140  +
    fn deserialize_nonstreaming_with_config(
  137    141   
        &self,
  138    142   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         143  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  139    144   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  140    145   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         146  +
        #[allow(unused_mut)]
         147  +
        let mut force_error = false;
         148  +
         149  +
        if !success && status != 200 || force_error {
  141    150   
            let headers = response.headers();
  142    151   
            let body = response.body().bytes().expect("body loaded");
  143    152   
            #[allow(unused_mut)]
  144         -
        let mut force_error = false;
         153  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         154  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         155  +
            })?;
  145    156   
  146         -
        let parse_result = if !success && status != 200 || force_error {
  147         -
            crate::protocol_serde::shape_structs::de_structs_http_error(status, headers, body)
         157  +
            let generic = generic_builder.build();
         158  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         159  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(crate::operation::structs::StructsError::generic(generic)),
         160  +
            ))
  148    161   
        } else {
  149         -
            crate::protocol_serde::shape_structs::de_structs_http_response(status, headers, body)
  150         -
        };
  151         -
        crate::protocol_serde::type_erase_result(parse_result)
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let mut deser = protocol.deserialize_response(response, Structs::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         166  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         167  +
            })?;
         168  +
            let body = response.body().bytes().expect("body loaded");
         169  +
            let output =
         170  +
                crate::operation::structs::StructsOutput::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body)
         171  +
                    .map_err(|e| {
         172  +
                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
         173  +
                            e,
         174  +
                        ))
         175  +
                    })?;
         176  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         177  +
        }
  152    178   
    }
  153    179   
}
  154    180   
#[derive(Debug)]
  155    181   
struct StructsRequestSerializer;
  156    182   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StructsRequestSerializer {
  157    183   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  158    184   
    fn serialize_input(
  159    185   
        &self,
  160    186   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  161    187   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  162    188   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  163    189   
        let input = input.downcast::<crate::operation::structs::StructsInput>().expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::structs::StructsInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::structs::StructsInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
  189         -
            builder = _header_serialization_settings.set_default_header(
  190         -
                builder,
  191         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  192         -
                "NamingObstacleCourseStructs.Structs",
  193         -
            );
  194         -
            builder
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_structs::ser_structs_input(&input)?);
  197         -
        if let Some(content_length) = body.content_length() {
  198         -
            let content_length = content_length.to_string();
  199         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  200         -
        }
  201         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         190  +
        let protocol = _cfg
         191  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         192  +
            .expect("a SharedClientProtocol is required");
         193  +
        let mut request = protocol
         194  +
            .serialize_request(&input, Structs::INPUT_SCHEMA, "", _cfg)
         195  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         196  +
         197  +
        return ::std::result::Result::Ok(request);
  202    198   
    }
  203    199   
}
  204    200   
#[derive(Debug)]
  205    201   
struct StructsEndpointParamsInterceptor;
  206    202   
  207    203   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StructsEndpointParamsInterceptor {
  208    204   
    fn name(&self) -> &'static str {
  209    205   
        "StructsEndpointParamsInterceptor"
  210    206   
    }
  211    207   

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/operation/structs/_structs_input.rs

@@ -35,35 +242,247 @@
   55     55   
    "result",
   56     56   
    0,
   57     57   
);
   58     58   
static STRUCTSINPUT_MEMBER_RESULT_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   59     59   
    ::aws_smithy_schema::ShapeId::from_static(
   60     60   
        "naming_obs_structs.synthetic#StructsInput$resultList",
   61     61   
        "naming_obs_structs.synthetic",
   62     62   
        "StructsInput",
   63     63   
    ),
   64     64   
    ::aws_smithy_schema::ShapeType::List,
   65         -
    "result_list",
          65  +
    "resultList",
   66     66   
    1,
   67     67   
);
   68     68   
static STRUCTSINPUT_MEMBER_OPTION: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   69     69   
    ::aws_smithy_schema::ShapeId::from_static(
   70     70   
        "naming_obs_structs.synthetic#StructsInput$option",
   71     71   
        "naming_obs_structs.synthetic",
   72     72   
        "StructsInput",
   73     73   
    ),
   74     74   
    ::aws_smithy_schema::ShapeType::Structure,
   75     75   
    "option",
   76     76   
    2,
   77     77   
);
   78     78   
static STRUCTSINPUT_MEMBER_OPTION_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   79     79   
    ::aws_smithy_schema::ShapeId::from_static(
   80     80   
        "naming_obs_structs.synthetic#StructsInput$optionList",
   81     81   
        "naming_obs_structs.synthetic",
   82     82   
        "StructsInput",
   83     83   
    ),
   84     84   
    ::aws_smithy_schema::ShapeType::List,
   85         -
    "option_list",
          85  +
    "optionList",
   86     86   
    3,
   87     87   
);
   88     88   
static STRUCTSINPUT_MEMBER_SOMETHING_ELSE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   89     89   
    ::aws_smithy_schema::ShapeId::from_static(
   90     90   
        "naming_obs_structs.synthetic#StructsInput$somethingElse",
   91     91   
        "naming_obs_structs.synthetic",
   92     92   
        "StructsInput",
   93     93   
    ),
   94     94   
    ::aws_smithy_schema::ShapeType::Structure,
   95         -
    "something_else",
          95  +
    "somethingElse",
   96     96   
    4,
   97     97   
);
   98     98   
static STRUCTSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   99     99   
    STRUCTSINPUT_SCHEMA_ID,
  100    100   
    ::aws_smithy_schema::ShapeType::Structure,
  101    101   
    &[
  102    102   
        &STRUCTSINPUT_MEMBER_RESULT,
  103    103   
        &STRUCTSINPUT_MEMBER_RESULT_LIST,
  104    104   
        &STRUCTSINPUT_MEMBER_OPTION,
  105    105   
        &STRUCTSINPUT_MEMBER_OPTION_LIST,
  106    106   
        &STRUCTSINPUT_MEMBER_SOMETHING_ELSE,
  107    107   
    ],
  108    108   
);
  109    109   
impl StructsInput {
  110    110   
    /// The schema for this shape.
  111    111   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &STRUCTSINPUT_SCHEMA;
  112    112   
}
  113    113   
impl ::aws_smithy_schema::serde::SerializableStruct for StructsInput {
  114    114   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  115    115   
    fn serialize_members(
  116    116   
        &self,
  117    117   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  118    118   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  119    119   
        if let Some(ref val) = self.result {
  120    120   
            ser.write_struct(&STRUCTSINPUT_MEMBER_RESULT, val)?;
  121    121   
        }
  122    122   
        if let Some(ref val) = self.result_list {
  123    123   
            ser.write_list(
  124    124   
                &STRUCTSINPUT_MEMBER_RESULT_LIST,
  125    125   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  126    126   
                    for item in val {
  127    127   
                        ser.write_struct(crate::types::Result::SCHEMA, item)?;
  128    128   
                    }
  129    129   
                    Ok(())
  130    130   
                },
  131    131   
            )?;
  132    132   
        }
  133    133   
        if let Some(ref val) = self.option {
  134    134   
            ser.write_struct(&STRUCTSINPUT_MEMBER_OPTION, val)?;
  135    135   
        }
  136    136   
        if let Some(ref val) = self.option_list {
  137    137   
            ser.write_list(
  138    138   
                &STRUCTSINPUT_MEMBER_OPTION_LIST,
  139    139   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  140    140   
                    for item in val {
  141    141   
                        ser.write_struct(crate::types::Result::SCHEMA, item)?;
  142    142   
                    }
  143    143   
                    Ok(())
  144    144   
                },
  145    145   
            )?;
  146    146   
        }
  147    147   
        if let Some(ref val) = self.something_else {
  148    148   
            ser.write_struct(&STRUCTSINPUT_MEMBER_SOMETHING_ELSE, val)?;
  149    149   
        }
  150    150   
        Ok(())
  151    151   
    }
  152    152   
}
  153    153   
impl StructsInput {
  154    154   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  155         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  156         -
        deserializer: &mut D,
         155  +
    pub fn deserialize(
         156  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  157    157   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  158    158   
        #[allow(unused_variables, unused_mut)]
  159    159   
        let mut builder = Self::builder();
  160    160   
        #[allow(
  161    161   
            unused_variables,
  162    162   
            unreachable_code,
  163    163   
            clippy::single_match,
  164    164   
            clippy::match_single_binding,
  165    165   
            clippy::diverging_sub_expression
  166    166   
        )]
  167         -
        deserializer.read_struct(&STRUCTSINPUT_SCHEMA, (), |_, member, deser| {
         167  +
        deserializer.read_struct(&STRUCTSINPUT_SCHEMA, &mut |member, deser| {
  168    168   
            match member.member_index() {
  169    169   
                Some(0) => {
  170    170   
                    builder.result = Some(crate::types::Result::deserialize(deser)?);
  171    171   
                }
  172    172   
                Some(1) => {
  173    173   
                    builder.result_list = Some({
  174         -
                        let container = if let Some(cap) = deser.container_size() {
  175         -
                            Vec::with_capacity(cap)
  176         -
                        } else {
  177         -
                            Vec::new()
  178         -
                        };
  179         -
                        deser.read_list(member, container, |mut list, deser| {
  180         -
                            list.push(crate::types::Result::deserialize(deser)?);
  181         -
                            Ok(list)
  182         -
                        })?
         174  +
                        let mut container = Vec::new();
         175  +
                        deser.read_list(member, &mut |deser| {
         176  +
                            container.push(crate::types::Result::deserialize(deser)?);
         177  +
                            Ok(())
         178  +
                        })?;
         179  +
                        container
  183    180   
                    });
  184    181   
                }
  185    182   
                Some(2) => {
  186    183   
                    builder.option = Some(crate::types::Option::deserialize(deser)?);
  187    184   
                }
  188    185   
                Some(3) => {
  189    186   
                    builder.option_list = Some({
  190         -
                        let container = if let Some(cap) = deser.container_size() {
  191         -
                            Vec::with_capacity(cap)
  192         -
                        } else {
  193         -
                            Vec::new()
  194         -
                        };
  195         -
                        deser.read_list(member, container, |mut list, deser| {
  196         -
                            list.push(crate::types::Result::deserialize(deser)?);
  197         -
                            Ok(list)
  198         -
                        })?
         187  +
                        let mut container = Vec::new();
         188  +
                        deser.read_list(member, &mut |deser| {
         189  +
                            container.push(crate::types::Result::deserialize(deser)?);
         190  +
                            Ok(())
         191  +
                        })?;
         192  +
                        container
  199    193   
                    });
  200    194   
                }
  201    195   
                Some(4) => {
  202    196   
                    builder.something_else = Some(crate::types::SomethingElse::deserialize(deser)?);
  203    197   
                }
  204    198   
                _ => {}
  205    199   
            }
  206    200   
            Ok(())
  207    201   
        })?;
  208    202   
        builder
  209    203   
            .build()
  210    204   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  211    205   
    }
  212    206   
}
         207  +
impl StructsInput {
         208  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         209  +
    pub fn deserialize_with_response(
         210  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         211  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         212  +
        _status: u16,
         213  +
        _body: &[u8],
         214  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         215  +
        Self::deserialize(deserializer)
         216  +
    }
         217  +
}
  213    218   
impl StructsInput {
  214    219   
    /// Creates a new builder-style object to manufacture [`StructsInput`](crate::operation::structs::StructsInput).
  215    220   
    pub fn builder() -> crate::operation::structs::builders::StructsInputBuilder {
  216    221   
        crate::operation::structs::builders::StructsInputBuilder::default()
  217    222   
    }
  218    223   
}
  219    224   
  220    225   
/// A builder for [`StructsInput`](crate::operation::structs::StructsInput).
  221    226   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  222    227   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/operation/structs/_structs_output.rs

@@ -35,35 +240,245 @@
   55     55   
    "result",
   56     56   
    0,
   57     57   
);
   58     58   
static STRUCTSOUTPUT_MEMBER_RESULT_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   59     59   
    ::aws_smithy_schema::ShapeId::from_static(
   60     60   
        "naming_obs_structs.synthetic#StructsOutput$resultList",
   61     61   
        "naming_obs_structs.synthetic",
   62     62   
        "StructsOutput",
   63     63   
    ),
   64     64   
    ::aws_smithy_schema::ShapeType::List,
   65         -
    "result_list",
          65  +
    "resultList",
   66     66   
    1,
   67     67   
);
   68     68   
static STRUCTSOUTPUT_MEMBER_OPTION: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   69     69   
    ::aws_smithy_schema::ShapeId::from_static(
   70     70   
        "naming_obs_structs.synthetic#StructsOutput$option",
   71     71   
        "naming_obs_structs.synthetic",
   72     72   
        "StructsOutput",
   73     73   
    ),
   74     74   
    ::aws_smithy_schema::ShapeType::Structure,
   75     75   
    "option",
   76     76   
    2,
   77     77   
);
   78     78   
static STRUCTSOUTPUT_MEMBER_OPTION_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   79     79   
    ::aws_smithy_schema::ShapeId::from_static(
   80     80   
        "naming_obs_structs.synthetic#StructsOutput$optionList",
   81     81   
        "naming_obs_structs.synthetic",
   82     82   
        "StructsOutput",
   83     83   
    ),
   84     84   
    ::aws_smithy_schema::ShapeType::List,
   85         -
    "option_list",
          85  +
    "optionList",
   86     86   
    3,
   87     87   
);
   88     88   
static STRUCTSOUTPUT_MEMBER_SOMETHING_ELSE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   89     89   
    ::aws_smithy_schema::ShapeId::from_static(
   90     90   
        "naming_obs_structs.synthetic#StructsOutput$somethingElse",
   91     91   
        "naming_obs_structs.synthetic",
   92     92   
        "StructsOutput",
   93     93   
    ),
   94     94   
    ::aws_smithy_schema::ShapeType::Structure,
   95         -
    "something_else",
          95  +
    "somethingElse",
   96     96   
    4,
   97     97   
);
   98     98   
static STRUCTSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   99     99   
    STRUCTSOUTPUT_SCHEMA_ID,
  100    100   
    ::aws_smithy_schema::ShapeType::Structure,
  101    101   
    &[
  102    102   
        &STRUCTSOUTPUT_MEMBER_RESULT,
  103    103   
        &STRUCTSOUTPUT_MEMBER_RESULT_LIST,
  104    104   
        &STRUCTSOUTPUT_MEMBER_OPTION,
  105    105   
        &STRUCTSOUTPUT_MEMBER_OPTION_LIST,
  106    106   
        &STRUCTSOUTPUT_MEMBER_SOMETHING_ELSE,
  107    107   
    ],
  108    108   
);
  109    109   
impl StructsOutput {
  110    110   
    /// The schema for this shape.
  111    111   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &STRUCTSOUTPUT_SCHEMA;
  112    112   
}
  113    113   
impl ::aws_smithy_schema::serde::SerializableStruct for StructsOutput {
  114    114   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  115    115   
    fn serialize_members(
  116    116   
        &self,
  117    117   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  118    118   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  119    119   
        if let Some(ref val) = self.result {
  120    120   
            ser.write_struct(&STRUCTSOUTPUT_MEMBER_RESULT, val)?;
  121    121   
        }
  122    122   
        if let Some(ref val) = self.result_list {
  123    123   
            ser.write_list(
  124    124   
                &STRUCTSOUTPUT_MEMBER_RESULT_LIST,
  125    125   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  126    126   
                    for item in val {
  127    127   
                        ser.write_struct(crate::types::Result::SCHEMA, item)?;
  128    128   
                    }
  129    129   
                    Ok(())
  130    130   
                },
  131    131   
            )?;
  132    132   
        }
  133    133   
        if let Some(ref val) = self.option {
  134    134   
            ser.write_struct(&STRUCTSOUTPUT_MEMBER_OPTION, val)?;
  135    135   
        }
  136    136   
        if let Some(ref val) = self.option_list {
  137    137   
            ser.write_list(
  138    138   
                &STRUCTSOUTPUT_MEMBER_OPTION_LIST,
  139    139   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  140    140   
                    for item in val {
  141    141   
                        ser.write_struct(crate::types::Result::SCHEMA, item)?;
  142    142   
                    }
  143    143   
                    Ok(())
  144    144   
                },
  145    145   
            )?;
  146    146   
        }
  147    147   
        if let Some(ref val) = self.something_else {
  148    148   
            ser.write_struct(&STRUCTSOUTPUT_MEMBER_SOMETHING_ELSE, val)?;
  149    149   
        }
  150    150   
        Ok(())
  151    151   
    }
  152    152   
}
  153    153   
impl StructsOutput {
  154    154   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  155         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  156         -
        deserializer: &mut D,
         155  +
    pub fn deserialize(
         156  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  157    157   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  158    158   
        #[allow(unused_variables, unused_mut)]
  159    159   
        let mut builder = Self::builder();
  160    160   
        #[allow(
  161    161   
            unused_variables,
  162    162   
            unreachable_code,
  163    163   
            clippy::single_match,
  164    164   
            clippy::match_single_binding,
  165    165   
            clippy::diverging_sub_expression
  166    166   
        )]
  167         -
        deserializer.read_struct(&STRUCTSOUTPUT_SCHEMA, (), |_, member, deser| {
         167  +
        deserializer.read_struct(&STRUCTSOUTPUT_SCHEMA, &mut |member, deser| {
  168    168   
            match member.member_index() {
  169    169   
                Some(0) => {
  170    170   
                    builder.result = Some(crate::types::Result::deserialize(deser)?);
  171    171   
                }
  172    172   
                Some(1) => {
  173    173   
                    builder.result_list = Some({
  174         -
                        let container = if let Some(cap) = deser.container_size() {
  175         -
                            Vec::with_capacity(cap)
  176         -
                        } else {
  177         -
                            Vec::new()
  178         -
                        };
  179         -
                        deser.read_list(member, container, |mut list, deser| {
  180         -
                            list.push(crate::types::Result::deserialize(deser)?);
  181         -
                            Ok(list)
  182         -
                        })?
         174  +
                        let mut container = Vec::new();
         175  +
                        deser.read_list(member, &mut |deser| {
         176  +
                            container.push(crate::types::Result::deserialize(deser)?);
         177  +
                            Ok(())
         178  +
                        })?;
         179  +
                        container
  183    180   
                    });
  184    181   
                }
  185    182   
                Some(2) => {
  186    183   
                    builder.option = Some(crate::types::Option::deserialize(deser)?);
  187    184   
                }
  188    185   
                Some(3) => {
  189    186   
                    builder.option_list = Some({
  190         -
                        let container = if let Some(cap) = deser.container_size() {
  191         -
                            Vec::with_capacity(cap)
  192         -
                        } else {
  193         -
                            Vec::new()
  194         -
                        };
  195         -
                        deser.read_list(member, container, |mut list, deser| {
  196         -
                            list.push(crate::types::Result::deserialize(deser)?);
  197         -
                            Ok(list)
  198         -
                        })?
         187  +
                        let mut container = Vec::new();
         188  +
                        deser.read_list(member, &mut |deser| {
         189  +
                            container.push(crate::types::Result::deserialize(deser)?);
         190  +
                            Ok(())
         191  +
                        })?;
         192  +
                        container
  199    193   
                    });
  200    194   
                }
  201    195   
                Some(4) => {
  202    196   
                    builder.something_else = Some(crate::types::SomethingElse::deserialize(deser)?);
  203    197   
                }
  204    198   
                _ => {}
  205    199   
            }
  206    200   
            Ok(())
  207    201   
        })?;
  208    202   
        Ok(builder.build())
  209    203   
    }
  210    204   
}
         205  +
impl StructsOutput {
         206  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         207  +
    pub fn deserialize_with_response(
         208  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         209  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         210  +
        _status: u16,
         211  +
        _body: &[u8],
         212  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         213  +
        Self::deserialize(deserializer)
         214  +
    }
         215  +
}
  211    216   
impl StructsOutput {
  212    217   
    /// Creates a new builder-style object to manufacture [`StructsOutput`](crate::operation::structs::StructsOutput).
  213    218   
    pub fn builder() -> crate::operation::structs::builders::StructsOutputBuilder {
  214    219   
        crate::operation::structs::builders::StructsOutputBuilder::default()
  215    220   
    }
  216    221   
}
  217    222   
  218    223   
/// A builder for [`StructsOutput`](crate::operation::structs::StructsOutput).
  219    224   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  220    225   
#[non_exhaustive]

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

@@ -1,1 +48,0 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn type_erase_result<O, E>(
    3         -
    result: ::std::result::Result<O, E>,
    4         -
) -> ::std::result::Result<
    5         -
    ::aws_smithy_runtime_api::client::interceptors::context::Output,
    6         -
    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError<::aws_smithy_runtime_api::client::interceptors::context::Error>,
    7         -
>
    8         -
where
    9         -
    O: ::std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
   10         -
    E: ::std::error::Error + std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
   11         -
{
   12         -
    result
   13         -
        .map(|output| ::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
   14         -
        .map_err(|error| ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(error))
   15         -
        .map_err(::std::convert::Into::into)
   16         -
}
   17         -
   18      2   
pub fn parse_http_error_metadata(
   19      3   
    _response_status: u16,
   20      4   
    response_headers: &::aws_smithy_runtime_api::http::Headers,
   21      5   
    response_body: &[u8],
   22      6   
) -> ::std::result::Result<::aws_smithy_types::error::metadata::Builder, ::aws_smithy_json::deserialize::error::DeserializeError> {
   23      7   
    crate::json_errors::parse_error_metadata(response_body, response_headers)
   24      8   
}
   25         -
   26         -
pub(crate) mod shape_structs;
   27         -
   28         -
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   29         -
    if data.is_empty() {
   30         -
        b"{}"
   31         -
    } else {
   32         -
        data
   33         -
    }
   34         -
}
   35         -
   36         -
pub(crate) mod shape_structs_input;
   37         -
   38         -
pub(crate) mod shape_option;
   39         -
   40         -
pub(crate) mod shape_option_list;
   41         -
   42         -
pub(crate) mod shape_result;
   43         -
   44         -
pub(crate) mod shape_result_list;
   45         -
   46         -
pub(crate) mod shape_something_else;
   47         -
   48         -
pub(crate) mod shape_some_union;

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/protocol_serde/shape_option.rs

@@ -1,0 +50,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_option<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::Option>, ::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::OptionBuilder::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         -
}
   41         -
   42         -
pub fn ser_option(
   43         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   44         -
    input: &crate::types::Option,
   45         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
   46         -
    if let Some(var_1) = &input.value {
   47         -
        object.key("value").string(var_1.as_str());
   48         -
    }
   49         -
    Ok(())
   50         -
}

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/protocol_serde/shape_option_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_option_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::Result>>, ::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_result::de_result(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/naming_test_structs/rust-client-codegen/src/protocol_serde/shape_result.rs

@@ -1,0 +50,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_result<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::Result>, ::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::ResultBuilder::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         -
}
   41         -
   42         -
pub fn ser_result(
   43         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   44         -
    input: &crate::types::Result,
   45         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
   46         -
    if let Some(var_1) = &input.value {
   47         -
        object.key("value").string(var_1.as_str());
   48         -
    }
   49         -
    Ok(())
   50         -
}

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/protocol_serde/shape_result_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_result_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::Result>>, ::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_result::de_result(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/naming_test_structs/rust-client-codegen/src/protocol_serde/shape_some_union.rs

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

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/protocol_serde/shape_something_else.rs

@@ -1,0 +97,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_something_else<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::SomethingElse>, ::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::SomethingElseBuilder::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         -
                        "result" => {
   19         -
                            builder = builder.set_result(crate::protocol_serde::shape_result::de_result(tokens, _value)?);
   20         -
                        }
   21         -
                        "resultList" => {
   22         -
                            builder = builder.set_result_list(crate::protocol_serde::shape_result_list::de_result_list(tokens, _value)?);
   23         -
                        }
   24         -
                        "option" => {
   25         -
                            builder = builder.set_option(crate::protocol_serde::shape_option::de_option(tokens, _value)?);
   26         -
                        }
   27         -
                        "optionList" => {
   28         -
                            builder = builder.set_option_list(crate::protocol_serde::shape_option_list::de_option_list(tokens, _value)?);
   29         -
                        }
   30         -
                        "someUnion" => {
   31         -
                            builder = builder.set_some_union(crate::protocol_serde::shape_some_union::de_some_union(tokens, _value)?);
   32         -
                        }
   33         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   34         -
                    },
   35         -
                    other => {
   36         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   37         -
                            "expected object key or end object, found: {other:?}"
   38         -
                        )))
   39         -
                    }
   40         -
                }
   41         -
            }
   42         -
            Ok(Some(builder.build()))
   43         -
        }
   44         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   45         -
            "expected start object or null",
   46         -
        )),
   47         -
    }
   48         -
}
   49         -
   50         -
pub fn ser_something_else(
   51         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   52         -
    input: &crate::types::SomethingElse,
   53         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
   54         -
    if let Some(var_1) = &input.result {
   55         -
        #[allow(unused_mut)]
   56         -
        let mut object_2 = object.key("result").start_object();
   57         -
        crate::protocol_serde::shape_result::ser_result(&mut object_2, var_1)?;
   58         -
        object_2.finish();
   59         -
    }
   60         -
    if let Some(var_3) = &input.result_list {
   61         -
        let mut array_4 = object.key("resultList").start_array();
   62         -
        for item_5 in var_3 {
   63         -
            {
   64         -
                #[allow(unused_mut)]
   65         -
                let mut object_6 = array_4.value().start_object();
   66         -
                crate::protocol_serde::shape_result::ser_result(&mut object_6, item_5)?;
   67         -
                object_6.finish();
   68         -
            }
   69         -
        }
   70         -
        array_4.finish();
   71         -
    }
   72         -
    if let Some(var_7) = &input.option {
   73         -
        #[allow(unused_mut)]
   74         -
        let mut object_8 = object.key("option").start_object();
   75         -
        crate::protocol_serde::shape_option::ser_option(&mut object_8, var_7)?;
   76         -
        object_8.finish();
   77         -
    }
   78         -
    if let Some(var_9) = &input.option_list {
   79         -
        let mut array_10 = object.key("optionList").start_array();
   80         -
        for item_11 in var_9 {
   81         -
            {
   82         -
                #[allow(unused_mut)]
   83         -
                let mut object_12 = array_10.value().start_object();
   84         -
                crate::protocol_serde::shape_result::ser_result(&mut object_12, item_11)?;
   85         -
                object_12.finish();
   86         -
            }
   87         -
        }
   88         -
        array_10.finish();
   89         -
    }
   90         -
    if let Some(var_13) = &input.some_union {
   91         -
        #[allow(unused_mut)]
   92         -
        let mut object_14 = object.key("someUnion").start_object();
   93         -
        crate::protocol_serde::shape_some_union::ser_some_union(&mut object_14, var_13)?;
   94         -
        object_14.finish();
   95         -
    }
   96         -
    Ok(())
   97         -
}

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/protocol_serde/shape_structs.rs

@@ -1,0 +81,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_structs_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::structs::StructsOutput, crate::operation::structs::StructsError> {
    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::structs::StructsError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::structs::StructsError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_structs_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::structs::StructsOutput, crate::operation::structs::StructsError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::structs::builders::StructsOutputBuilder::default();
   24         -
        output =
   25         -
            crate::protocol_serde::shape_structs::de_structs(_response_body, output).map_err(crate::operation::structs::StructsError::unhandled)?;
   26         -
        output.build()
   27         -
    })
   28         -
}
   29         -
   30         -
pub fn ser_structs_input(
   31         -
    input: &crate::operation::structs::StructsInput,
   32         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   33         -
    let mut out = String::new();
   34         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   35         -
    crate::protocol_serde::shape_structs_input::ser_structs_input_input(&mut object, input)?;
   36         -
    object.finish();
   37         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   38         -
}
   39         -
   40         -
pub(crate) fn de_structs(
   41         -
    _value: &[u8],
   42         -
    mut builder: crate::operation::structs::builders::StructsOutputBuilder,
   43         -
) -> ::std::result::Result<crate::operation::structs::builders::StructsOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
   44         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   45         -
    let tokens = &mut tokens_owned;
   46         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   47         -
    loop {
   48         -
        match tokens.next().transpose()? {
   49         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   50         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   51         -
                "result" => {
   52         -
                    builder = builder.set_result(crate::protocol_serde::shape_result::de_result(tokens, _value)?);
   53         -
                }
   54         -
                "resultList" => {
   55         -
                    builder = builder.set_result_list(crate::protocol_serde::shape_result_list::de_result_list(tokens, _value)?);
   56         -
                }
   57         -
                "option" => {
   58         -
                    builder = builder.set_option(crate::protocol_serde::shape_option::de_option(tokens, _value)?);
   59         -
                }
   60         -
                "optionList" => {
   61         -
                    builder = builder.set_option_list(crate::protocol_serde::shape_option_list::de_option_list(tokens, _value)?);
   62         -
                }
   63         -
                "somethingElse" => {
   64         -
                    builder = builder.set_something_else(crate::protocol_serde::shape_something_else::de_something_else(tokens, _value)?);
   65         -
                }
   66         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   67         -
            },
   68         -
            other => {
   69         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   70         -
                    "expected object key or end object, found: {other:?}"
   71         -
                )))
   72         -
            }
   73         -
        }
   74         -
    }
   75         -
    if tokens.next().is_some() {
   76         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   77         -
            "found more JSON tokens after completing parsing",
   78         -
        ));
   79         -
    }
   80         -
    Ok(builder)
   81         -
}

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/protocol_serde/shape_structs_input.rs

@@ -1,0 +49,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_structs_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::structs::StructsInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.result {
    7         -
        #[allow(unused_mut)]
    8         -
        let mut object_2 = object.key("result").start_object();
    9         -
        crate::protocol_serde::shape_result::ser_result(&mut object_2, var_1)?;
   10         -
        object_2.finish();
   11         -
    }
   12         -
    if let Some(var_3) = &input.result_list {
   13         -
        let mut array_4 = object.key("resultList").start_array();
   14         -
        for item_5 in var_3 {
   15         -
            {
   16         -
                #[allow(unused_mut)]
   17         -
                let mut object_6 = array_4.value().start_object();
   18         -
                crate::protocol_serde::shape_result::ser_result(&mut object_6, item_5)?;
   19         -
                object_6.finish();
   20         -
            }
   21         -
        }
   22         -
        array_4.finish();
   23         -
    }
   24         -
    if let Some(var_7) = &input.option {
   25         -
        #[allow(unused_mut)]
   26         -
        let mut object_8 = object.key("option").start_object();
   27         -
        crate::protocol_serde::shape_option::ser_option(&mut object_8, var_7)?;
   28         -
        object_8.finish();
   29         -
    }
   30         -
    if let Some(var_9) = &input.option_list {
   31         -
        let mut array_10 = object.key("optionList").start_array();
   32         -
        for item_11 in var_9 {
   33         -
            {
   34         -
                #[allow(unused_mut)]
   35         -
                let mut object_12 = array_10.value().start_object();
   36         -
                crate::protocol_serde::shape_result::ser_result(&mut object_12, item_11)?;
   37         -
                object_12.finish();
   38         -
            }
   39         -
        }
   40         -
        array_10.finish();
   41         -
    }
   42         -
    if let Some(var_13) = &input.something_else {
   43         -
        #[allow(unused_mut)]
   44         -
        let mut object_14 = object.key("somethingElse").start_object();
   45         -
        crate::protocol_serde::shape_something_else::ser_something_else(&mut object_14, var_13)?;
   46         -
        object_14.finish();
   47         -
    }
   48         -
    Ok(())
   49         -
}

tmp-codegen-diff/codegen-client-test/naming_test_structs/rust-client-codegen/src/serialization_settings.rs

@@ -1,0 +89,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
/*
    3         -
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    4         -
 * SPDX-License-Identifier: Apache-2.0
    5         -
 */
    6         -
    7         -
#![allow(dead_code)]
    8         -
    9         -
use aws_smithy_http::header::set_request_header_if_absent;
   10         -
use aws_smithy_types::config_bag::{Storable, StoreReplace};
   11         -
use http_1x::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
   12         -
   13         -
/// Configuration for how default protocol headers are serialized
   14         -
#[derive(Clone, Debug, Default)]
   15         -
pub(crate) struct HeaderSerializationSettings {
   16         -
    omit_default_content_length: bool,
   17         -
    omit_default_content_type: bool,
   18         -
}
   19         -
   20         -
impl HeaderSerializationSettings {
   21         -
    /// Creates new [`HeaderSerializationSettings`]
   22         -
    pub(crate) fn new() -> Self {
   23         -
        Default::default()
   24         -
    }
   25         -
   26         -
    /// Omit the default `Content-Length` header during serialization
   27         -
    pub(crate) fn omit_default_content_length(self) -> Self {
   28         -
        Self {
   29         -
            omit_default_content_length: true,
   30         -
            ..self
   31         -
        }
   32         -
    }
   33         -
   34         -
    /// Omit the default `Content-Type` header during serialization
   35         -
    pub(crate) fn omit_default_content_type(self) -> Self {
   36         -
        Self {
   37         -
            omit_default_content_type: true,
   38         -
            ..self
   39         -
        }
   40         -
    }
   41         -
   42         -
    /// Returns true if the given default header name should be serialized
   43         -
    fn include_header(&self, header: &HeaderName) -> bool {
   44         -
        (!self.omit_default_content_length || header != CONTENT_LENGTH) && (!self.omit_default_content_type || header != CONTENT_TYPE)
   45         -
    }
   46         -
   47         -
    /// Sets a default header on the given request builder if it should be serialized
   48         -
    pub(crate) fn set_default_header(
   49         -
        &self,
   50         -
        mut request: http_1x::request::Builder,
   51         -
        header_name: HeaderName,
   52         -
        value: &str,
   53         -
    ) -> http_1x::request::Builder {
   54         -
        if self.include_header(&header_name) {
   55         -
            request = set_request_header_if_absent(request, header_name, value);
   56         -
        }
   57         -
        request
   58         -
    }
   59         -
}
   60         -
   61         -
impl Storable for HeaderSerializationSettings {
   62         -
    type Storer = StoreReplace<Self>;
   63         -
}
   64         -
   65         -
#[cfg(test)]
   66         -
mod tests {
   67         -
    use super::*;
   68         -
   69         -
    #[test]
   70         -
    fn test_include_header() {
   71         -
        let settings = HeaderSerializationSettings::default();
   72         -
        assert!(settings.include_header(&CONTENT_LENGTH));
   73         -
        assert!(settings.include_header(&CONTENT_TYPE));
   74         -
   75         -
        let settings = HeaderSerializationSettings::default().omit_default_content_length();
   76         -
        assert!(!settings.include_header(&CONTENT_LENGTH));
   77         -
        assert!(settings.include_header(&CONTENT_TYPE));
   78         -
   79         -
        let settings = HeaderSerializationSettings::default().omit_default_content_type();
   80         -
        assert!(settings.include_header(&CONTENT_LENGTH));
   81         -
        assert!(!settings.include_header(&CONTENT_TYPE));
   82         -
   83         -
        let settings = HeaderSerializationSettings::default()
   84         -
            .omit_default_content_type()
   85         -
            .omit_default_content_length();
   86         -
        assert!(!settings.include_header(&CONTENT_LENGTH));
   87         -
        assert!(!settings.include_header(&CONTENT_TYPE));
   88         -
    }
   89         -
}

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

@@ -13,13 +96,107 @@
   33     33   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   34     34   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   35     35   
        if let Some(ref val) = self.value {
   36     36   
            ser.write_string(&OPTION_MEMBER_VALUE, val)?;
   37     37   
        }
   38     38   
        Ok(())
   39     39   
    }
   40     40   
}
   41     41   
impl Option {
   42     42   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   43         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   44         -
        deserializer: &mut D,
          43  +
    pub fn deserialize(
          44  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   45     45   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   46     46   
        #[allow(unused_variables, unused_mut)]
   47     47   
        let mut builder = Self::builder();
   48     48   
        #[allow(
   49     49   
            unused_variables,
   50     50   
            unreachable_code,
   51     51   
            clippy::single_match,
   52     52   
            clippy::match_single_binding,
   53     53   
            clippy::diverging_sub_expression
   54     54   
        )]
   55         -
        deserializer.read_struct(&OPTION_SCHEMA, (), |_, member, deser| {
          55  +
        deserializer.read_struct(&OPTION_SCHEMA, &mut |member, deser| {
   56     56   
            match member.member_index() {
   57     57   
                Some(0) => {
   58     58   
                    builder.value = Some(deser.read_string(member)?);
   59     59   
                }
   60     60   
                _ => {}
   61     61   
            }
   62     62   
            Ok(())
   63     63   
        })?;
   64     64   
        Ok(builder.build())
   65     65   
    }
   66     66   
}
          67  +
impl Option {
          68  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          69  +
    pub fn deserialize_with_response(
          70  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          71  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          72  +
        _status: u16,
          73  +
        _body: &[u8],
          74  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          75  +
        Self::deserialize(deserializer)
          76  +
    }
          77  +
}
   67     78   
impl Option {
   68     79   
    /// Creates a new builder-style object to manufacture [`Option`](crate::types::Option).
   69     80   
    pub fn builder() -> crate::types::builders::OptionBuilder {
   70     81   
        crate::types::builders::OptionBuilder::default()
   71     82   
    }
   72     83   
}
   73     84   
   74     85   
/// A builder for [`Option`](crate::types::Option).
   75     86   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   76     87   
#[non_exhaustive]

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

@@ -13,13 +96,107 @@
   33     33   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   34     34   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   35     35   
        if let Some(ref val) = self.value {
   36     36   
            ser.write_string(&RESULT_MEMBER_VALUE, val)?;
   37     37   
        }
   38     38   
        Ok(())
   39     39   
    }
   40     40   
}
   41     41   
impl Result {
   42     42   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   43         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   44         -
        deserializer: &mut D,
          43  +
    pub fn deserialize(
          44  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   45     45   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   46     46   
        #[allow(unused_variables, unused_mut)]
   47     47   
        let mut builder = Self::builder();
   48     48   
        #[allow(
   49     49   
            unused_variables,
   50     50   
            unreachable_code,
   51     51   
            clippy::single_match,
   52     52   
            clippy::match_single_binding,
   53     53   
            clippy::diverging_sub_expression
   54     54   
        )]
   55         -
        deserializer.read_struct(&RESULT_SCHEMA, (), |_, member, deser| {
          55  +
        deserializer.read_struct(&RESULT_SCHEMA, &mut |member, deser| {
   56     56   
            match member.member_index() {
   57     57   
                Some(0) => {
   58     58   
                    builder.value = Some(deser.read_string(member)?);
   59     59   
                }
   60     60   
                _ => {}
   61     61   
            }
   62     62   
            Ok(())
   63     63   
        })?;
   64     64   
        Ok(builder.build())
   65     65   
    }
   66     66   
}
          67  +
impl Result {
          68  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          69  +
    pub fn deserialize_with_response(
          70  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          71  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          72  +
        _status: u16,
          73  +
        _body: &[u8],
          74  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          75  +
        Self::deserialize(deserializer)
          76  +
    }
          77  +
}
   67     78   
impl Result {
   68     79   
    /// Creates a new builder-style object to manufacture [`Result`](crate::types::Result).
   69     80   
    pub fn builder() -> crate::types::builders::ResultBuilder {
   70     81   
        crate::types::builders::ResultBuilder::default()
   71     82   
    }
   72     83   
}
   73     84   
   74     85   
/// A builder for [`Result`](crate::types::Result).
   75     86   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   76     87   
#[non_exhaustive]

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

@@ -22,22 +0,110 @@
   42     42   
    }
   43     43   
    /// Returns true if this is a [`Result`](crate::types::SomeUnion::Result).
   44     44   
    pub fn is_result(&self) -> bool {
   45     45   
        self.as_result().is_ok()
   46     46   
    }
   47     47   
    /// Returns true if the enum instance is the `Unknown` variant.
   48     48   
    pub fn is_unknown(&self) -> bool {
   49     49   
        matches!(self, Self::Unknown)
   50     50   
    }
   51     51   
}
          52  +
static SOMEUNION_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
          53  +
    ::aws_smithy_schema::ShapeId::from_static("naming_obs_structs#SomeUnion", "naming_obs_structs", "SomeUnion");
          54  +
static SOMEUNION_MEMBER_RESULT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
          55  +
    ::aws_smithy_schema::ShapeId::from_static("naming_obs_structs#SomeUnion$Result", "naming_obs_structs", "SomeUnion"),
          56  +
    ::aws_smithy_schema::ShapeType::Structure,
          57  +
    "Result",
          58  +
    0,
          59  +
);
          60  +
static SOMEUNION_MEMBER_OPTION: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
          61  +
    ::aws_smithy_schema::ShapeId::from_static("naming_obs_structs#SomeUnion$Option", "naming_obs_structs", "SomeUnion"),
          62  +
    ::aws_smithy_schema::ShapeType::Structure,
          63  +
    "Option",
          64  +
    1,
          65  +
);
          66  +
static SOMEUNION_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
          67  +
    SOMEUNION_SCHEMA_ID,
          68  +
    ::aws_smithy_schema::ShapeType::Union,
          69  +
    &[&SOMEUNION_MEMBER_RESULT, &SOMEUNION_MEMBER_OPTION],
          70  +
);
          71  +
impl SomeUnion {
          72  +
    /// The schema for this shape.
          73  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &SOMEUNION_SCHEMA;
          74  +
}
          75  +
impl ::aws_smithy_schema::serde::SerializableStruct for SomeUnion {
          76  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          77  +
    fn serialize_members(
          78  +
        &self,
          79  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          80  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          81  +
        match self {
          82  +
            Self::Result(val) => {
          83  +
                ser.write_struct(&SOMEUNION_MEMBER_RESULT, val)?;
          84  +
            }
          85  +
            Self::Option(val) => {
          86  +
                ser.write_struct(&SOMEUNION_MEMBER_OPTION, val)?;
          87  +
            }
          88  +
            Self::Unknown => return Err(::aws_smithy_schema::serde::SerdeError::custom("cannot serialize unknown union variant")),
          89  +
        }
          90  +
        Ok(())
          91  +
    }
          92  +
}
          93  +
impl SomeUnion {
          94  +
    /// Deserializes this union from a [`ShapeDeserializer`].
          95  +
    pub fn deserialize(
          96  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          97  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          98  +
        let mut result: ::std::option::Option<Self> = ::std::option::Option::None;
          99  +
        #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding)]
         100  +
        deserializer.read_struct(&SOMEUNION_SCHEMA, &mut |member, deser| {
         101  +
            result = ::std::option::Option::Some(match member.member_index() {
         102  +
                Some(0) => Self::Result(crate::types::Result::deserialize(deser)?),
         103  +
                Some(1) => Self::Option(crate::types::Option::deserialize(deser)?),
         104  +
                _ => Self::Unknown,
         105  +
            });
         106  +
            Ok(())
         107  +
        })?;
         108  +
        result.ok_or_else(|| ::aws_smithy_schema::serde::SerdeError::custom("expected a union variant"))
         109  +
    }
         110  +
}