Client Test

Client Test

rev. e063993ca0ab793f44c575dbe707d50a5e3e2406 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/operation_with_nested_structure/_operation_with_nested_structure_input.rs

@@ -1,1 +108,120 @@
   17     17   
    "aws.protocoltests.restjson.synthetic",
   18     18   
    "OperationWithNestedStructureInput",
   19     19   
);
   20     20   
static OPERATIONWITHNESTEDSTRUCTUREINPUT_MEMBER_TOP_LEVEL: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   21     21   
    ::aws_smithy_schema::ShapeId::from_static(
   22     22   
        "aws.protocoltests.restjson.synthetic#OperationWithNestedStructureInput$topLevel",
   23     23   
        "aws.protocoltests.restjson.synthetic",
   24     24   
        "OperationWithNestedStructureInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Structure,
   27         -
    "top_level",
          27  +
    "topLevel",
   28     28   
    0,
   29     29   
);
   30     30   
static OPERATIONWITHNESTEDSTRUCTUREINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     31   
    OPERATIONWITHNESTEDSTRUCTUREINPUT_SCHEMA_ID,
   32     32   
    ::aws_smithy_schema::ShapeType::Structure,
   33     33   
    &[&OPERATIONWITHNESTEDSTRUCTUREINPUT_MEMBER_TOP_LEVEL],
   34         -
);
          34  +
)
          35  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/OperationWithNestedStructure", None));
   35     36   
impl OperationWithNestedStructureInput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &OPERATIONWITHNESTEDSTRUCTUREINPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for OperationWithNestedStructureInput {
   40     41   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   41     42   
    fn serialize_members(
   42     43   
        &self,
   43     44   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     46   
        if let Some(ref val) = self.top_level {
   46     47   
            ser.write_struct(&OPERATIONWITHNESTEDSTRUCTUREINPUT_MEMBER_TOP_LEVEL, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl OperationWithNestedStructureInput {
   52     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   53         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   54         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   55     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   56     57   
        #[allow(unused_variables, unused_mut)]
   57     58   
        let mut builder = Self::builder();
   58     59   
        #[allow(
   59     60   
            unused_variables,
   60     61   
            unreachable_code,
   61     62   
            clippy::single_match,
   62     63   
            clippy::match_single_binding,
   63     64   
            clippy::diverging_sub_expression
   64     65   
        )]
   65         -
        deserializer.read_struct(&OPERATIONWITHNESTEDSTRUCTUREINPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&OPERATIONWITHNESTEDSTRUCTUREINPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68     69   
                    builder.top_level = Some(crate::types::TopLevel::deserialize(deser)?);
   69     70   
                }
   70     71   
                _ => {}
   71     72   
            }
   72     73   
            Ok(())
   73     74   
        })?;
   74     75   
        builder
   75     76   
            .build()
   76     77   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   77     78   
    }
   78     79   
}
          80  +
impl OperationWithNestedStructureInput {
          81  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          82  +
    pub fn deserialize_with_response(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        Self::deserialize(deserializer)
          89  +
    }
          90  +
}
   79     91   
impl OperationWithNestedStructureInput {
   80     92   
    /// Creates a new builder-style object to manufacture [`OperationWithNestedStructureInput`](crate::operation::operation_with_nested_structure::OperationWithNestedStructureInput).
   81     93   
    pub fn builder() -> crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureInputBuilder {
   82     94   
        crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureInputBuilder::default()
   83     95   
    }
   84     96   
}
   85     97   
   86     98   
/// A builder for [`OperationWithNestedStructureInput`](crate::operation::operation_with_nested_structure::OperationWithNestedStructureInput).
   87     99   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   88    100   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/operation_with_nested_structure/_operation_with_nested_structure_output.rs

@@ -20,20 +199,204 @@
   40     40   
    "dialog",
   41     41   
    0,
   42     42   
);
   43     43   
static OPERATIONWITHNESTEDSTRUCTUREOUTPUT_MEMBER_DIALOG_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   44     44   
    ::aws_smithy_schema::ShapeId::from_static(
   45     45   
        "aws.protocoltests.restjson.synthetic#OperationWithNestedStructureOutput$dialogList",
   46     46   
        "aws.protocoltests.restjson.synthetic",
   47     47   
        "OperationWithNestedStructureOutput",
   48     48   
    ),
   49     49   
    ::aws_smithy_schema::ShapeType::List,
   50         -
    "dialog_list",
          50  +
    "dialogList",
   51     51   
    1,
   52     52   
);
   53     53   
static OPERATIONWITHNESTEDSTRUCTUREOUTPUT_MEMBER_DIALOG_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   54     54   
    ::aws_smithy_schema::ShapeId::from_static(
   55     55   
        "aws.protocoltests.restjson.synthetic#OperationWithNestedStructureOutput$dialogMap",
   56     56   
        "aws.protocoltests.restjson.synthetic",
   57     57   
        "OperationWithNestedStructureOutput",
   58     58   
    ),
   59     59   
    ::aws_smithy_schema::ShapeType::Map,
   60         -
    "dialog_map",
          60  +
    "dialogMap",
   61     61   
    2,
   62     62   
);
   63     63   
static OPERATIONWITHNESTEDSTRUCTUREOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   64     64   
    OPERATIONWITHNESTEDSTRUCTUREOUTPUT_SCHEMA_ID,
   65     65   
    ::aws_smithy_schema::ShapeType::Structure,
   66     66   
    &[
   67     67   
        &OPERATIONWITHNESTEDSTRUCTUREOUTPUT_MEMBER_DIALOG,
   68     68   
        &OPERATIONWITHNESTEDSTRUCTUREOUTPUT_MEMBER_DIALOG_LIST,
   69     69   
        &OPERATIONWITHNESTEDSTRUCTUREOUTPUT_MEMBER_DIALOG_MAP,
   70     70   
    ],
   71     71   
);
   72     72   
impl OperationWithNestedStructureOutput {
   73     73   
    /// The schema for this shape.
   74     74   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &OPERATIONWITHNESTEDSTRUCTUREOUTPUT_SCHEMA;
   75     75   
}
   76     76   
impl ::aws_smithy_schema::serde::SerializableStruct for OperationWithNestedStructureOutput {
   77     77   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   78     78   
    fn serialize_members(
   79     79   
        &self,
   80     80   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   81     81   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   82     82   
        {
   83     83   
            let val = &self.dialog;
   84     84   
            ser.write_struct(&OPERATIONWITHNESTEDSTRUCTUREOUTPUT_MEMBER_DIALOG, val)?;
   85     85   
        }
   86     86   
        {
   87     87   
            let val = &self.dialog_list;
   88     88   
   89     89   
            ser.write_list(
   90     90   
                &OPERATIONWITHNESTEDSTRUCTUREOUTPUT_MEMBER_DIALOG_LIST,
   91     91   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   92     92   
                    for item in val {
   93     93   
                        ser.write_struct(crate::types::Dialog::SCHEMA, item)?;
   94     94   
                    }
   95     95   
                    Ok(())
   96     96   
                },
   97     97   
            )?;
   98     98   
        }
   99     99   
        {
  100    100   
            let val = &self.dialog_map;
  101    101   
  102    102   
            ser.write_map(
  103    103   
                &OPERATIONWITHNESTEDSTRUCTUREOUTPUT_MEMBER_DIALOG_MAP,
  104    104   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  105    105   
                    for (key, value) in val {
  106    106   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
  107    107   
                        ser.write_struct(crate::types::Dialog::SCHEMA, value)?;
  108    108   
                    }
  109    109   
                    Ok(())
  110    110   
                },
  111    111   
            )?;
  112    112   
        }
  113    113   
        Ok(())
  114    114   
    }
  115    115   
}
  116    116   
impl OperationWithNestedStructureOutput {
  117    117   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  118         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  119         -
        deserializer: &mut D,
         118  +
    pub fn deserialize(
         119  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  120    120   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  121    121   
        #[allow(unused_variables, unused_mut)]
  122    122   
        let mut builder = Self::builder();
  123    123   
        #[allow(
  124    124   
            unused_variables,
  125    125   
            unreachable_code,
  126    126   
            clippy::single_match,
  127    127   
            clippy::match_single_binding,
  128    128   
            clippy::diverging_sub_expression
  129    129   
        )]
  130         -
        deserializer.read_struct(&OPERATIONWITHNESTEDSTRUCTUREOUTPUT_SCHEMA, (), |_, member, deser| {
         130  +
        deserializer.read_struct(&OPERATIONWITHNESTEDSTRUCTUREOUTPUT_SCHEMA, &mut |member, deser| {
  131    131   
            match member.member_index() {
  132    132   
                Some(0) => {
  133    133   
                    builder.dialog = Some(crate::types::Dialog::deserialize(deser)?);
  134    134   
                }
  135    135   
                Some(1) => {
  136    136   
                    builder.dialog_list = Some({
  137         -
                        let container = if let Some(cap) = deser.container_size() {
  138         -
                            Vec::with_capacity(cap)
  139         -
                        } else {
  140         -
                            Vec::new()
  141         -
                        };
  142         -
                        deser.read_list(member, container, |mut list, deser| {
  143         -
                            list.push(crate::types::Dialog::deserialize(deser)?);
  144         -
                            Ok(list)
  145         -
                        })?
         137  +
                        let mut container = Vec::new();
         138  +
                        deser.read_list(member, &mut |deser| {
         139  +
                            container.push(crate::types::Dialog::deserialize(deser)?);
         140  +
                            Ok(())
         141  +
                        })?;
         142  +
                        container
  146    143   
                    });
  147    144   
                }
  148    145   
                Some(2) => {
  149    146   
                    builder.dialog_map = Some({
  150         -
                        let container = if let Some(cap) = deser.container_size() {
  151         -
                            std::collections::HashMap::with_capacity(cap)
  152         -
                        } else {
  153         -
                            std::collections::HashMap::new()
  154         -
                        };
  155         -
                        deser.read_map(member, container, |mut map, key, deser| {
  156         -
                            map.insert(key, crate::types::Dialog::deserialize(deser)?);
  157         -
                            Ok(map)
  158         -
                        })?
         147  +
                        let mut container = std::collections::HashMap::new();
         148  +
                        deser.read_map(member, &mut |key, deser| {
         149  +
                            container.insert(key, crate::types::Dialog::deserialize(deser)?);
         150  +
                            Ok(())
         151  +
                        })?;
         152  +
                        container
  159    153   
                    });
  160    154   
                }
  161    155   
                _ => {}
  162    156   
            }
  163    157   
            Ok(())
  164    158   
        })?;
  165    159   
        builder
  166    160   
            .build()
  167    161   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  168    162   
    }
  169    163   
}
         164  +
impl OperationWithNestedStructureOutput {
         165  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         166  +
    pub fn deserialize_with_response(
         167  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         168  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         169  +
        _status: u16,
         170  +
        _body: &[u8],
         171  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         172  +
        Self::deserialize(deserializer)
         173  +
    }
         174  +
}
  170    175   
impl OperationWithNestedStructureOutput {
  171    176   
    /// Creates a new builder-style object to manufacture [`OperationWithNestedStructureOutput`](crate::operation::operation_with_nested_structure::OperationWithNestedStructureOutput).
  172    177   
    pub fn builder() -> crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder {
  173    178   
        crate::operation::operation_with_nested_structure::builders::OperationWithNestedStructureOutputBuilder::default()
  174    179   
    }
  175    180   
}
  176    181   
  177    182   
/// A builder for [`OperationWithNestedStructureOutput`](crate::operation::operation_with_nested_structure::OperationWithNestedStructureOutput).
  178    183   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  179    184   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/output_stream.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 `OutputStream`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct OutputStream;
    6      6   
impl OutputStream {
    7      7   
    /// Creates a new `OutputStream`
    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::output_stream::OutputStreamInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::output_stream::OutputStreamOutput::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::output_stream::OutputStreamInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::output_stream::OutputStreamOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::output_stream::OutputStreamError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -119,123 +232,280 @@
  139    143   
  140    144   
        // If this is an error, defer to the non-streaming parser
  141    145   
        if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
  142    146   
            return ::std::option::Option::None;
  143    147   
        }
  144    148   
        ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
  145    149   
            crate::protocol_serde::shape_output_stream::de_output_stream_http_response(response),
  146    150   
        ))
  147    151   
    }
  148    152   
  149         -
    fn deserialize_nonstreaming(
         153  +
    fn deserialize_nonstreaming_with_config(
  150    154   
        &self,
  151    155   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         156  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  152    157   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  153    158   
        // For streaming operations, we only hit this case if its an error
  154    159   
        let body = response.body().bytes().expect("body loaded");
  155         -
        crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_output_stream::de_output_stream_http_error(
  156         -
            response.status().as_u16(),
         160  +
        let status = response.status().as_u16();
         161  +
        let headers = response.headers();
         162  +
        #[allow(unused_mut)]
         163  +
        let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         164  +
            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         165  +
        })?;
         166  +
         167  +
        let generic = generic_builder.build();
         168  +
        let error_code = match generic.code() {
         169  +
            ::std::option::Option::Some(code) => code,
         170  +
            ::std::option::Option::None => {
         171  +
                return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         172  +
                    ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::output_stream::OutputStreamError::unhandled(generic)),
         173  +
                ))
         174  +
            }
         175  +
        };
         176  +
        let _error_message = generic.message().map(|msg| msg.to_owned());
         177  +
        let protocol = _cfg
         178  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         179  +
            .expect("a SharedClientProtocol is required");
         180  +
        let err = match error_code {
         181  +
            "ServiceUnavailableError" => crate::operation::output_stream::OutputStreamError::ServiceUnavailableError({
         182  +
                let mut tmp = match protocol
         183  +
                    .deserialize_response(response, crate::types::error::ServiceUnavailableError::SCHEMA, _cfg)
         184  +
                    .and_then(|mut deser| {
         185  +
                        crate::types::error::ServiceUnavailableError::deserialize_with_response(
         186  +
                            &mut *deser,
  157    187   
                            response.headers(),
         188  +
                            response.status().into(),
  158    189   
                            body,
         190  +
                        )
         191  +
                    }) {
         192  +
                    ::std::result::Result::Ok(val) => val,
         193  +
                    ::std::result::Result::Err(e) => {
         194  +
                        return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         195  +
                            ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         196  +
                        ))
         197  +
                    }
         198  +
                };
         199  +
                tmp.meta = generic;
         200  +
                if tmp.message.is_none() {
         201  +
                    tmp.message = _error_message;
         202  +
                }
         203  +
                tmp
         204  +
            }),
         205  +
            "ErrorEvent" => crate::operation::output_stream::OutputStreamError::ErrorEvent({
         206  +
                let mut tmp = match protocol
         207  +
                    .deserialize_response(response, crate::types::error::ErrorEvent::SCHEMA, _cfg)
         208  +
                    .and_then(|mut deser| {
         209  +
                        crate::types::error::ErrorEvent::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body)
         210  +
                    }) {
         211  +
                    ::std::result::Result::Ok(val) => val,
         212  +
                    ::std::result::Result::Err(e) => {
         213  +
                        return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         214  +
                            ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         215  +
                        ))
         216  +
                    }
         217  +
                };
         218  +
                tmp.meta = generic;
         219  +
                if tmp.message.is_none() {
         220  +
                    tmp.message = _error_message;
         221  +
                }
         222  +
                tmp
         223  +
            }),
         224  +
            _ => crate::operation::output_stream::OutputStreamError::generic(generic),
         225  +
        };
         226  +
        ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         227  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
  159    228   
        ))
  160    229   
    }
  161    230   
}
  162    231   
#[derive(Debug)]
  163    232   
struct OutputStreamRequestSerializer;
  164    233   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OutputStreamRequestSerializer {
  165    234   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  166    235   
    fn serialize_input(
  167    236   
        &self,
  168    237   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  169    238   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  170    239   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  171    240   
        let input = input
  172    241   
            .downcast::<crate::operation::output_stream::OutputStreamInput>()
  173    242   
            .expect("correct type");
  174         -
        let _header_serialization_settings = _cfg
  175         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  176         -
            .cloned()
  177         -
            .unwrap_or_default();
  178         -
        let mut request_builder = {
  179         -
            #[allow(clippy::uninlined_format_args)]
  180         -
            fn uri_base(
  181         -
                _input: &crate::operation::output_stream::OutputStreamInput,
  182         -
                output: &mut ::std::string::String,
  183         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  184         -
                use ::std::fmt::Write as _;
  185         -
                ::std::write!(output, "/OutputStream").expect("formatting should succeed");
  186         -
                ::std::result::Result::Ok(())
  187         -
            }
  188         -
            #[allow(clippy::unnecessary_wraps)]
  189         -
            fn update_http_builder(
  190         -
                input: &crate::operation::output_stream::OutputStreamInput,
  191         -
                builder: ::http_1x::request::Builder,
  192         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  193         -
                let mut uri = ::std::string::String::new();
  194         -
                uri_base(input, &mut uri)?;
  195         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  196         -
            }
  197         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  198         -
            builder
  199         -
        };
  200         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
         243  +
        let protocol = _cfg
         244  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         245  +
            .expect("a SharedClientProtocol is required");
         246  +
        let mut request = protocol
         247  +
            .serialize_request(&input, OutputStream::INPUT_SCHEMA, "", _cfg)
         248  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  201    249   
  202         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         250  +
        return ::std::result::Result::Ok(request);
  203    251   
    }
  204    252   
}
  205    253   
#[derive(Debug)]
  206    254   
struct OutputStreamEndpointParamsInterceptor;
  207    255   
  208    256   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OutputStreamEndpointParamsInterceptor {
  209    257   
    fn name(&self) -> &'static str {
  210    258   
        "OutputStreamEndpointParamsInterceptor"
  211    259   
    }
  212    260   

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/output_stream/_output_stream_input.rs

@@ -1,1 +69,83 @@
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct OutputStreamInput {}
    6      6   
static OUTPUTSTREAMINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#OutputStreamInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "OutputStreamInput",
   10     10   
);
   11     11   
static OUTPUTSTREAMINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(OUTPUTSTREAMINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(OUTPUTSTREAMINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/OutputStream", None));
   13     14   
impl OutputStreamInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &OUTPUTSTREAMINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for OutputStreamInput {
   18     19   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   19     20   
    fn serialize_members(
   20     21   
        &self,
   21     22   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   22     23   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   23     24   
        Ok(())
   24     25   
    }
   25     26   
}
   26     27   
impl OutputStreamInput {
   27     28   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   28         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   29         -
        deserializer: &mut D,
          29  +
    pub fn deserialize(
          30  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   30     31   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   31     32   
        #[allow(unused_variables, unused_mut)]
   32     33   
        let mut builder = Self::builder();
   33     34   
        #[allow(
   34     35   
            unused_variables,
   35     36   
            unreachable_code,
   36     37   
            clippy::single_match,
   37     38   
            clippy::match_single_binding,
   38     39   
            clippy::diverging_sub_expression
   39     40   
        )]
   40         -
        deserializer.read_struct(&OUTPUTSTREAMINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&OUTPUTSTREAMINPUT_SCHEMA, &mut |member, deser| {
   41     42   
            match member.member_index() {
   42     43   
                _ => {}
   43     44   
            }
   44     45   
            Ok(())
   45     46   
        })?;
   46     47   
        builder
   47     48   
            .build()
   48     49   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   49     50   
    }
   50     51   
}
          52  +
impl OutputStreamInput {
          53  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          54  +
    pub fn deserialize_with_response(
          55  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          56  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          57  +
        _status: u16,
          58  +
        _body: &[u8],
          59  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          60  +
        Self::builder()
          61  +
            .build()
          62  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          63  +
    }
          64  +
}
   51     65   
impl OutputStreamInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`OutputStreamInput`](crate::operation::output_stream::OutputStreamInput).
   53     67   
    pub fn builder() -> crate::operation::output_stream::builders::OutputStreamInputBuilder {
   54     68   
        crate::operation::output_stream::builders::OutputStreamInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`OutputStreamInput`](crate::operation::output_stream::OutputStreamInput).
   59     73   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   60     74   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/output_stream/_output_stream_output.rs

@@ -16,16 +113,120 @@
   36     36   
impl OutputStreamOutput {
   37     37   
    /// The schema for this shape.
   38     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &OUTPUTSTREAMOUTPUT_SCHEMA;
   39     39   
}
   40     40   
impl ::aws_smithy_schema::serde::SerializableStruct for OutputStreamOutput {
   41     41   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   42     42   
    fn serialize_members(
   43     43   
        &self,
   44     44   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   45     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   46         -
        {
   47         -
            let val = &self.stream;
   48         -
            ser.write_null(&OUTPUTSTREAMOUTPUT_MEMBER_STREAM)?;
   49         -
        }
   50     46   
        Ok(())
   51     47   
    }
   52     48   
}
   53     49   
impl OutputStreamOutput {
   54     50   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   55         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   56         -
        deserializer: &mut D,
          51  +
    pub fn deserialize(
          52  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   57     53   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   58     54   
        #[allow(unused_variables, unused_mut)]
   59     55   
        let mut builder = Self::builder();
   60     56   
        #[allow(
   61     57   
            unused_variables,
   62     58   
            unreachable_code,
   63     59   
            clippy::single_match,
   64     60   
            clippy::match_single_binding,
   65     61   
            clippy::diverging_sub_expression
   66     62   
        )]
   67         -
        deserializer.read_struct(&OUTPUTSTREAMOUTPUT_SCHEMA, (), |_, member, deser| {
          63  +
        deserializer.read_struct(&OUTPUTSTREAMOUTPUT_SCHEMA, &mut |member, deser| {
   68     64   
            match member.member_index() {
   69     65   
                Some(0) => {
   70     66   
                    builder.stream = Some({
   71     67   
                        let _ = member;
   72         -
                        todo!("deserialize aggregate")
          68  +
                        todo!("deserialize streaming union")
   73     69   
                    });
   74     70   
                }
   75     71   
                _ => {}
   76     72   
            }
   77     73   
            Ok(())
   78     74   
        })?;
   79     75   
        builder
   80     76   
            .build()
   81     77   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   82     78   
    }
   83     79   
}
          80  +
impl OutputStreamOutput {
          81  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          82  +
    pub fn deserialize_with_response(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        Self::deserialize(deserializer)
          89  +
    }
          90  +
}
   84     91   
impl OutputStreamOutput {
   85     92   
    /// Creates a new builder-style object to manufacture [`OutputStreamOutput`](crate::operation::output_stream::OutputStreamOutput).
   86     93   
    pub fn builder() -> crate::operation::output_stream::builders::OutputStreamOutputBuilder {
   87     94   
        crate::operation::output_stream::builders::OutputStreamOutputBuilder::default()
   88     95   
    }
   89     96   
}
   90     97   
   91     98   
/// A builder for [`OutputStreamOutput`](crate::operation::output_stream::OutputStreamOutput).
   92     99   
#[derive(::std::default::Default, ::std::fmt::Debug)]
   93    100   
#[non_exhaustive]

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

@@ -1,1 +40,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `OutputStreamWithInitialResponse`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct OutputStreamWithInitialResponse;
    6      6   
impl OutputStreamWithInitialResponse {
    7      7   
    /// Creates a new `OutputStreamWithInitialResponse`
    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 =
          13  +
        crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput::SCHEMA;
   11     17   
    pub(crate) async fn orchestrate(
   12     18   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     19   
        input: crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -125,131 +240,266 @@
  145    151   
  146    152   
        // If this is an error, defer to the non-streaming parser
  147    153   
        if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
  148    154   
            return ::std::option::Option::None;
  149    155   
        }
  150    156   
        ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
  151    157   
            crate::protocol_serde::shape_output_stream_with_initial_response::de_output_stream_with_initial_response_http_response(response),
  152    158   
        ))
  153    159   
    }
  154    160   
  155         -
    fn deserialize_nonstreaming(
         161  +
    fn deserialize_nonstreaming_with_config(
  156    162   
        &self,
  157    163   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         164  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  158    165   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  159    166   
        // For streaming operations, we only hit this case if its an error
  160    167   
        let body = response.body().bytes().expect("body loaded");
  161         -
        crate::protocol_serde::type_erase_result(
  162         -
            crate::protocol_serde::shape_output_stream_with_initial_response::de_output_stream_with_initial_response_http_error(
  163         -
                response.status().as_u16(),
  164         -
                response.headers(),
  165         -
                body,
         168  +
        let status = response.status().as_u16();
         169  +
        let headers = response.headers();
         170  +
        #[allow(unused_mut)]
         171  +
        let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         172  +
            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         173  +
        })?;
         174  +
         175  +
        let generic = generic_builder.build();
         176  +
        let error_code = match generic.code() {
         177  +
            ::std::option::Option::Some(code) => code,
         178  +
            ::std::option::Option::None => {
         179  +
                return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         180  +
                    ::aws_smithy_runtime_api::box_error::BoxError::from(
         181  +
                        crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::unhandled(generic),
  166    182   
                    ),
  167         -
        )
         183  +
                ))
         184  +
            }
         185  +
        };
         186  +
        let _error_message = generic.message().map(|msg| msg.to_owned());
         187  +
        let protocol = _cfg
         188  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         189  +
            .expect("a SharedClientProtocol is required");
         190  +
        let err = match error_code {
         191  +
            "ErrorEvent" => crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::ErrorEvent({
         192  +
                let mut tmp = match protocol
         193  +
                    .deserialize_response(response, crate::types::error::ErrorEvent::SCHEMA, _cfg)
         194  +
                    .and_then(|mut deser| {
         195  +
                        crate::types::error::ErrorEvent::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body)
         196  +
                    }) {
         197  +
                    ::std::result::Result::Ok(val) => val,
         198  +
                    ::std::result::Result::Err(e) => {
         199  +
                        return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         200  +
                            ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         201  +
                        ))
         202  +
                    }
         203  +
                };
         204  +
                tmp.meta = generic;
         205  +
                if tmp.message.is_none() {
         206  +
                    tmp.message = _error_message;
         207  +
                }
         208  +
                tmp
         209  +
            }),
         210  +
            _ => crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError::generic(generic),
         211  +
        };
         212  +
        ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         213  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         214  +
        ))
  168    215   
    }
  169    216   
}
  170    217   
#[derive(Debug)]
  171    218   
struct OutputStreamWithInitialResponseRequestSerializer;
  172    219   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OutputStreamWithInitialResponseRequestSerializer {
  173    220   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  174    221   
    fn serialize_input(
  175    222   
        &self,
  176    223   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  177    224   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  178    225   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  179    226   
        let input = input
  180    227   
            .downcast::<crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseInput>()
  181    228   
            .expect("correct type");
  182         -
        let _header_serialization_settings = _cfg
  183         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  184         -
            .cloned()
  185         -
            .unwrap_or_default();
  186         -
        let mut request_builder = {
  187         -
            #[allow(clippy::uninlined_format_args)]
  188         -
            fn uri_base(
  189         -
                _input: &crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseInput,
  190         -
                output: &mut ::std::string::String,
  191         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  192         -
                use ::std::fmt::Write as _;
  193         -
                ::std::write!(output, "/OutputStreamWithInitialResponse").expect("formatting should succeed");
  194         -
                ::std::result::Result::Ok(())
  195         -
            }
  196         -
            #[allow(clippy::unnecessary_wraps)]
  197         -
            fn update_http_builder(
  198         -
                input: &crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseInput,
  199         -
                builder: ::http_1x::request::Builder,
  200         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  201         -
                let mut uri = ::std::string::String::new();
  202         -
                uri_base(input, &mut uri)?;
  203         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  204         -
            }
  205         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  206         -
            builder
  207         -
        };
  208         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
         229  +
        let protocol = _cfg
         230  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         231  +
            .expect("a SharedClientProtocol is required");
         232  +
        let mut request = protocol
         233  +
            .serialize_request(&input, OutputStreamWithInitialResponse::INPUT_SCHEMA, "", _cfg)
         234  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  209    235   
  210         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         236  +
        return ::std::result::Result::Ok(request);
  211    237   
    }
  212    238   
}
  213    239   
#[derive(Debug)]
  214    240   
struct OutputStreamWithInitialResponseEndpointParamsInterceptor;
  215    241   
  216    242   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OutputStreamWithInitialResponseEndpointParamsInterceptor {
  217    243   
    fn name(&self) -> &'static str {
  218    244   
        "OutputStreamWithInitialResponseEndpointParamsInterceptor"
  219    245   
    }
  220    246   

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/output_stream_with_initial_response/_output_stream_with_initial_response_input.rs

@@ -1,1 +75,93 @@
    5      5   
pub struct OutputStreamWithInitialResponseInput {}
    6      6   
static OUTPUTSTREAMWITHINITIALRESPONSEINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#OutputStreamWithInitialResponseInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "OutputStreamWithInitialResponseInput",
   10     10   
);
   11     11   
static OUTPUTSTREAMWITHINITIALRESPONSEINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   12     12   
    OUTPUTSTREAMWITHINITIALRESPONSEINPUT_SCHEMA_ID,
   13     13   
    ::aws_smithy_schema::ShapeType::Structure,
   14     14   
    &[],
   15         -
);
          15  +
)
          16  +
.with_http(aws_smithy_schema::traits::HttpTrait::new(
          17  +
    "POST",
          18  +
    "/OutputStreamWithInitialResponse",
          19  +
    None,
          20  +
));
   16     21   
impl OutputStreamWithInitialResponseInput {
   17     22   
    /// The schema for this shape.
   18     23   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &OUTPUTSTREAMWITHINITIALRESPONSEINPUT_SCHEMA;
   19     24   
}
   20     25   
impl ::aws_smithy_schema::serde::SerializableStruct for OutputStreamWithInitialResponseInput {
   21     26   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   22     27   
    fn serialize_members(
   23     28   
        &self,
   24     29   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   25     30   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   26     31   
        Ok(())
   27     32   
    }
   28     33   
}
   29     34   
impl OutputStreamWithInitialResponseInput {
   30     35   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   31         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   32         -
        deserializer: &mut D,
          36  +
    pub fn deserialize(
          37  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   33     38   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   34     39   
        #[allow(unused_variables, unused_mut)]
   35     40   
        let mut builder = Self::builder();
   36     41   
        #[allow(
   37     42   
            unused_variables,
   38     43   
            unreachable_code,
   39     44   
            clippy::single_match,
   40     45   
            clippy::match_single_binding,
   41     46   
            clippy::diverging_sub_expression
   42     47   
        )]
   43         -
        deserializer.read_struct(&OUTPUTSTREAMWITHINITIALRESPONSEINPUT_SCHEMA, (), |_, member, deser| {
          48  +
        deserializer.read_struct(&OUTPUTSTREAMWITHINITIALRESPONSEINPUT_SCHEMA, &mut |member, deser| {
   44     49   
            match member.member_index() {
   45     50   
                _ => {}
   46     51   
            }
   47     52   
            Ok(())
   48     53   
        })?;
   49     54   
        builder
   50     55   
            .build()
   51     56   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   52     57   
    }
   53     58   
}
          59  +
impl OutputStreamWithInitialResponseInput {
          60  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          61  +
    pub fn deserialize_with_response(
          62  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          63  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          64  +
        _status: u16,
          65  +
        _body: &[u8],
          66  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          67  +
        Self::builder()
          68  +
            .build()
          69  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          70  +
    }
          71  +
}
   54     72   
impl OutputStreamWithInitialResponseInput {
   55     73   
    /// Creates a new builder-style object to manufacture [`OutputStreamWithInitialResponseInput`](crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseInput).
   56     74   
    pub fn builder() -> crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseInputBuilder {
   57     75   
        crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseInputBuilder::default()
   58     76   
    }
   59     77   
}
   60     78   
   61     79   
/// A builder for [`OutputStreamWithInitialResponseInput`](crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseInput).
   62     80   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   63     81   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/output_stream_with_initial_response/_output_stream_with_initial_response_output.rs

@@ -4,4 +130,167 @@
   24     24   
    "aws.protocoltests.restjson.synthetic",
   25     25   
    "OutputStreamWithInitialResponseOutput",
   26     26   
);
   27     27   
static OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_MEMBER_INITIAL_RESPONSE_MEMBER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   28     28   
    ::aws_smithy_schema::ShapeId::from_static(
   29     29   
        "aws.protocoltests.restjson.synthetic#OutputStreamWithInitialResponseOutput$initialResponseMember",
   30     30   
        "aws.protocoltests.restjson.synthetic",
   31     31   
        "OutputStreamWithInitialResponseOutput",
   32     32   
    ),
   33     33   
    ::aws_smithy_schema::ShapeType::String,
   34         -
    "initial_response_member",
          34  +
    "initialResponseMember",
   35     35   
    0,
   36     36   
)
   37     37   
.with_http_header("initial-response-member");
   38     38   
static OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_MEMBER_STREAM: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   39     39   
    ::aws_smithy_schema::ShapeId::from_static(
   40     40   
        "aws.protocoltests.restjson.synthetic#OutputStreamWithInitialResponseOutput$stream",
   41     41   
        "aws.protocoltests.restjson.synthetic",
   42     42   
        "OutputStreamWithInitialResponseOutput",
   43     43   
    ),
   44     44   
    ::aws_smithy_schema::ShapeType::Union,
   45     45   
    "stream",
   46     46   
    1,
   47     47   
)
   48     48   
.with_http_payload();
   49     49   
static OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   50     50   
    OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_SCHEMA_ID,
   51     51   
    ::aws_smithy_schema::ShapeType::Structure,
   52     52   
    &[
   53     53   
        &OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_MEMBER_INITIAL_RESPONSE_MEMBER,
   54     54   
        &OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_MEMBER_STREAM,
   55     55   
    ],
   56     56   
);
   57     57   
impl OutputStreamWithInitialResponseOutput {
   58     58   
    /// The schema for this shape.
   59     59   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_SCHEMA;
   60     60   
}
   61     61   
impl ::aws_smithy_schema::serde::SerializableStruct for OutputStreamWithInitialResponseOutput {
   62     62   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   63     63   
    fn serialize_members(
   64     64   
        &self,
   65     65   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   66     66   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   67     67   
        {
   68     68   
            let val = &self.initial_response_member;
   69     69   
            ser.write_string(&OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_MEMBER_INITIAL_RESPONSE_MEMBER, val)?;
   70     70   
        }
   71         -
        {
   72         -
            let val = &self.stream;
   73         -
            ser.write_null(&OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_MEMBER_STREAM)?;
   74         -
        }
   75     71   
        Ok(())
   76     72   
    }
   77     73   
}
   78     74   
impl OutputStreamWithInitialResponseOutput {
   79     75   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   80         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   81         -
        deserializer: &mut D,
          76  +
    pub fn deserialize(
          77  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   82     78   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   83     79   
        #[allow(unused_variables, unused_mut)]
   84     80   
        let mut builder = Self::builder();
   85     81   
        #[allow(
   86     82   
            unused_variables,
   87     83   
            unreachable_code,
   88     84   
            clippy::single_match,
   89     85   
            clippy::match_single_binding,
   90     86   
            clippy::diverging_sub_expression
   91     87   
        )]
   92         -
        deserializer.read_struct(&OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_SCHEMA, (), |_, member, deser| {
          88  +
        deserializer.read_struct(&OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_SCHEMA, &mut |member, deser| {
   93     89   
            match member.member_index() {
   94     90   
                Some(0) => {
   95     91   
                    builder.initial_response_member = Some(deser.read_string(member)?);
   96     92   
                }
   97     93   
                Some(1) => {
   98     94   
                    builder.stream = Some({
   99     95   
                        let _ = member;
  100         -
                        todo!("deserialize aggregate")
          96  +
                        todo!("deserialize streaming union")
          97  +
                    });
          98  +
                }
          99  +
                _ => {}
         100  +
            }
         101  +
            Ok(())
         102  +
        })?;
         103  +
        builder.initial_response_member = builder.initial_response_member.or(Some(String::new()));
         104  +
        builder
         105  +
            .build()
         106  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         107  +
    }
         108  +
}
         109  +
impl OutputStreamWithInitialResponseOutput {
         110  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         111  +
    /// Header-bound members are read directly from headers, avoiding runtime
         112  +
    /// member iteration overhead. Body members are read via the deserializer.
         113  +
    pub fn deserialize_with_response(
         114  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         115  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         116  +
        _status: u16,
         117  +
        _body: &[u8],
         118  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         119  +
        #[allow(unused_variables, unused_mut)]
         120  +
        let mut builder = Self::builder();
         121  +
        if let Some(val) = headers.get("initial-response-member") {
         122  +
            builder.initial_response_member = Some(val.to_string());
         123  +
        }
         124  +
        #[allow(
         125  +
            unused_variables,
         126  +
            unreachable_code,
         127  +
            clippy::single_match,
         128  +
            clippy::match_single_binding,
         129  +
            clippy::diverging_sub_expression
         130  +
        )]
         131  +
        deserializer.read_struct(&OUTPUTSTREAMWITHINITIALRESPONSEOUTPUT_SCHEMA, &mut |member, deser| {
         132  +
            match member.member_index() {
         133  +
                Some(0) => { /* read from headers above */ }
         134  +
                Some(1) => {
         135  +
                    builder.stream = Some({
         136  +
                        let _ = member;
         137  +
                        todo!("deserialize streaming union")
  101    138   
                    });
  102    139   
                }
  103    140   
                _ => {}
  104    141   
            }
  105    142   
            Ok(())
  106    143   
        })?;
  107    144   
        builder
  108    145   
            .build()
  109    146   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  110    147   
    }

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/post_player_action.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 `PostPlayerAction`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct PostPlayerAction;
    6      6   
impl PostPlayerAction {
    7      7   
    /// Creates a new `PostPlayerAction`
    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::post_player_action::PostPlayerActionInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::post_player_action::PostPlayerActionOutput::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::post_player_action::PostPlayerActionInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::post_player_action::PostPlayerActionOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::post_player_action::PostPlayerActionError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +232,239 @@
  130    134   
                crate::operation::post_player_action::PostPlayerActionError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct PostPlayerActionResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PostPlayerActionResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         150  +
        #[allow(unused_mut)]
         151  +
        let mut force_error = false;
         152  +
         153  +
        if !success && status != 200 || force_error {
  145    154   
            let headers = response.headers();
  146    155   
            let body = response.body().bytes().expect("body loaded");
  147    156   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
  149    160   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_post_player_action::de_post_player_action_http_error(status, headers, body)
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::post_player_action::PostPlayerActionError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_post_player_action::de_post_player_action_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, PostPlayerAction::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::post_player_action::PostPlayerActionOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct PostPlayerActionRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PostPlayerActionRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::post_player_action::PostPlayerActionInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::post_player_action::PostPlayerActionInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/PostPlayerAction").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::post_player_action::PostPlayerActionInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_post_player_action::ser_post_player_action_input(&input)?);
  198         -
        if let Some(content_length) = body.content_length() {
  199         -
            let content_length = content_length.to_string();
  200         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  201         -
        }
  202         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, PostPlayerAction::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  203    210   
    }
  204    211   
}
  205    212   
#[derive(Debug)]
  206    213   
struct PostPlayerActionEndpointParamsInterceptor;
  207    214   
  208    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PostPlayerActionEndpointParamsInterceptor {
  209    216   
    fn name(&self) -> &'static str {
  210    217   
        "PostPlayerActionEndpointParamsInterceptor"
  211    218   
    }
  212    219   
@@ -284,291 +344,361 @@
  304    311   
            .expect("the config must have a deserializer");
  305    312   
  306    313   
        let parsed = de.deserialize_streaming(&mut http_response);
  307    314   
        let parsed = parsed.unwrap_or_else(|| {
  308    315   
            let http_response = http_response.map(|body| {
  309    316   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  310    317   
                    body.bytes().unwrap(),
  311    318   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  312    319   
                )))
  313    320   
            });
  314         -
            de.deserialize_nonstreaming(&http_response)
         321  +
            // Build a config bag with the protocol for schema-based deserialization
         322  +
            #[allow(unused_mut)]
         323  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         324  +
            {
         325  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         326  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         327  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         328  +
                ));
         329  +
                test_cfg.push_shared_layer(layer.freeze());
         330  +
            }
         331  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  315    332   
        });
  316    333   
        let parsed = parsed
  317    334   
            .expect("should be successful response")
  318    335   
            .downcast::<crate::operation::post_player_action::PostPlayerActionOutput>()
  319    336   
            .unwrap();
  320    337   
        ::pretty_assertions::assert_eq!(parsed.action, expected_output.action, "Unexpected value for `action`");
  321    338   
    }
  322    339   
}
  323    340   
  324    341   
/// Error type for the `PostPlayerActionError` operation.

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/post_player_action/_post_player_action_input.rs

@@ -4,4 +111,120 @@
   24     24   
        "PostPlayerActionInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Union,
   27     27   
    "action",
   28     28   
    0,
   29     29   
);
   30     30   
static POSTPLAYERACTIONINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     31   
    POSTPLAYERACTIONINPUT_SCHEMA_ID,
   32     32   
    ::aws_smithy_schema::ShapeType::Structure,
   33     33   
    &[&POSTPLAYERACTIONINPUT_MEMBER_ACTION],
   34         -
);
          34  +
)
          35  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/PostPlayerAction", None));
   35     36   
impl PostPlayerActionInput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &POSTPLAYERACTIONINPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for PostPlayerActionInput {
   40     41   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   41     42   
    fn serialize_members(
   42     43   
        &self,
   43     44   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     46   
        if let Some(ref val) = self.action {
   46         -
            ser.write_null(&POSTPLAYERACTIONINPUT_MEMBER_ACTION)?;
          47  +
            ser.write_struct(&POSTPLAYERACTIONINPUT_MEMBER_ACTION, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl PostPlayerActionInput {
   52     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   53         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   54         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   55     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   56     57   
        #[allow(unused_variables, unused_mut)]
   57     58   
        let mut builder = Self::builder();
   58     59   
        #[allow(
   59     60   
            unused_variables,
   60     61   
            unreachable_code,
   61     62   
            clippy::single_match,
   62     63   
            clippy::match_single_binding,
   63     64   
            clippy::diverging_sub_expression
   64     65   
        )]
   65         -
        deserializer.read_struct(&POSTPLAYERACTIONINPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&POSTPLAYERACTIONINPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68         -
                    builder.action = Some({
   69         -
                        let _ = member;
   70         -
                        todo!("deserialize aggregate")
   71         -
                    });
          69  +
                    builder.action = Some(crate::types::PlayerAction::deserialize(deser)?);
   72     70   
                }
   73     71   
                _ => {}
   74     72   
            }
   75     73   
            Ok(())
   76     74   
        })?;
   77     75   
        builder
   78     76   
            .build()
   79     77   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   80     78   
    }
   81     79   
}
          80  +
impl PostPlayerActionInput {
          81  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          82  +
    pub fn deserialize_with_response(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        Self::deserialize(deserializer)
          89  +
    }
          90  +
}
   82     91   
impl PostPlayerActionInput {
   83     92   
    /// Creates a new builder-style object to manufacture [`PostPlayerActionInput`](crate::operation::post_player_action::PostPlayerActionInput).
   84     93   
    pub fn builder() -> crate::operation::post_player_action::builders::PostPlayerActionInputBuilder {
   85     94   
        crate::operation::post_player_action::builders::PostPlayerActionInputBuilder::default()
   86     95   
    }
   87     96   
}
   88     97   
   89     98   
/// A builder for [`PostPlayerActionInput`](crate::operation::post_player_action::PostPlayerActionInput).
   90     99   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   91    100   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/post_player_action/_post_player_action_output.rs

@@ -17,17 +112,120 @@
   37     37   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &POSTPLAYERACTIONOUTPUT_SCHEMA;
   38     38   
}
   39     39   
impl ::aws_smithy_schema::serde::SerializableStruct for PostPlayerActionOutput {
   40     40   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   41     41   
    fn serialize_members(
   42     42   
        &self,
   43     43   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     44   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     45   
        {
   46     46   
            let val = &self.action;
   47         -
            ser.write_null(&POSTPLAYERACTIONOUTPUT_MEMBER_ACTION)?;
          47  +
            ser.write_struct(&POSTPLAYERACTIONOUTPUT_MEMBER_ACTION, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl PostPlayerActionOutput {
   53     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   54         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   55         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   56     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   57     57   
        #[allow(unused_variables, unused_mut)]
   58     58   
        let mut builder = Self::builder();
   59     59   
        #[allow(
   60     60   
            unused_variables,
   61     61   
            unreachable_code,
   62     62   
            clippy::single_match,
   63     63   
            clippy::match_single_binding,
   64     64   
            clippy::diverging_sub_expression
   65     65   
        )]
   66         -
        deserializer.read_struct(&POSTPLAYERACTIONOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&POSTPLAYERACTIONOUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69         -
                    builder.action = Some({
   70         -
                        let _ = member;
   71         -
                        todo!("deserialize aggregate")
   72         -
                    });
          69  +
                    builder.action = Some(crate::types::PlayerAction::deserialize(deser)?);
   73     70   
                }
   74     71   
                _ => {}
   75     72   
            }
   76     73   
            Ok(())
   77     74   
        })?;
   78     75   
        builder
   79     76   
            .build()
   80     77   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   81     78   
    }
   82     79   
}
          80  +
impl PostPlayerActionOutput {
          81  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          82  +
    pub fn deserialize_with_response(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        Self::deserialize(deserializer)
          89  +
    }
          90  +
}
   83     91   
impl PostPlayerActionOutput {
   84     92   
    /// Creates a new builder-style object to manufacture [`PostPlayerActionOutput`](crate::operation::post_player_action::PostPlayerActionOutput).
   85     93   
    pub fn builder() -> crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder {
   86     94   
        crate::operation::post_player_action::builders::PostPlayerActionOutputBuilder::default()
   87     95   
    }
   88     96   
}
   89     97   
   90     98   
/// A builder for [`PostPlayerActionOutput`](crate::operation::post_player_action::PostPlayerActionOutput).
   91     99   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   92    100   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/post_union_with_json_name.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 `PostUnionWithJsonName`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct PostUnionWithJsonName;
    6      6   
impl PostUnionWithJsonName {
    7      7   
    /// Creates a new `PostUnionWithJsonName`
    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::post_union_with_json_name::PostUnionWithJsonNameInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput::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::post_union_with_json_name::PostUnionWithJsonNameInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::post_union_with_json_name::PostUnionWithJsonNameError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +234,239 @@
  130    134   
                crate::operation::post_union_with_json_name::PostUnionWithJsonNameError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct PostUnionWithJsonNameResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PostUnionWithJsonNameResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         150  +
        #[allow(unused_mut)]
         151  +
        let mut force_error = false;
         152  +
         153  +
        if !success && status != 200 || force_error {
  145    154   
            let headers = response.headers();
  146    155   
            let body = response.body().bytes().expect("body loaded");
  147    156   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
  149    160   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_post_union_with_json_name::de_post_union_with_json_name_http_error(status, headers, body)
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::post_union_with_json_name::PostUnionWithJsonNameError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_post_union_with_json_name::de_post_union_with_json_name_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, PostUnionWithJsonName::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct PostUnionWithJsonNameRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PostUnionWithJsonNameRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::post_union_with_json_name::PostUnionWithJsonNameInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::post_union_with_json_name::PostUnionWithJsonNameInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/PostUnionWithJsonName").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::post_union_with_json_name::PostUnionWithJsonNameInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  198         -
            crate::protocol_serde::shape_post_union_with_json_name::ser_post_union_with_json_name_input(&input)?,
  199         -
        );
  200         -
        if let Some(content_length) = body.content_length() {
  201         -
            let content_length = content_length.to_string();
  202         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  203         -
        }
  204         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, PostUnionWithJsonName::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  205    210   
    }
  206    211   
}
  207    212   
#[derive(Debug)]
  208    213   
struct PostUnionWithJsonNameEndpointParamsInterceptor;
  209    214   
  210    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PostUnionWithJsonNameEndpointParamsInterceptor {
  211    216   
    fn name(&self) -> &'static str {
  212    217   
        "PostUnionWithJsonNameEndpointParamsInterceptor"
  213    218   
    }
  214    219   
@@ -354,359 +504,539 @@
  374    379   
            .expect("the config must have a deserializer");
  375    380   
  376    381   
        let parsed = de.deserialize_streaming(&mut http_response);
  377    382   
        let parsed = parsed.unwrap_or_else(|| {
  378    383   
            let http_response = http_response.map(|body| {
  379    384   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  380    385   
                    body.bytes().unwrap(),
  381    386   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  382    387   
                )))
  383    388   
            });
  384         -
            de.deserialize_nonstreaming(&http_response)
         389  +
            // Build a config bag with the protocol for schema-based deserialization
         390  +
            #[allow(unused_mut)]
         391  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         392  +
            {
         393  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         394  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         395  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         396  +
                ));
         397  +
                test_cfg.push_shared_layer(layer.freeze());
         398  +
            }
         399  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  385    400   
        });
  386    401   
        let parsed = parsed
  387    402   
            .expect("should be successful response")
  388    403   
            .downcast::<crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput>()
  389    404   
            .unwrap();
  390    405   
        ::pretty_assertions::assert_eq!(parsed.value, expected_output.value, "Unexpected value for `value`");
  391    406   
    }
  392    407   
  393    408   
    /// Tests that jsonName works with union members.
  394    409   
    /// Test ID: PostUnionWithJsonNameResponse2
  395    410   
    #[::tokio::test]
  396    411   
    #[::tracing_test::traced_test]
  397    412   
    async fn post_union_with_json_name_response2_response() {
  398    413   
        let expected_output = crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput::builder()
  399    414   
            .set_value(::std::option::Option::Some(crate::types::UnionWithJsonName::Baz("hi".to_owned())))
  400    415   
            .build()
  401    416   
            .unwrap();
  402    417   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  403    418   
            ::http_1x::response::Builder::new()
  404    419   
                .header("Content-Type", "application/json")
  405    420   
                .status(200)
  406    421   
                .body(::aws_smithy_types::body::SdkBody::from(
  407    422   
                    "{\n    \"value\": {\n        \"_baz\": \"hi\"\n    }\n}",
  408    423   
                ))
  409    424   
                .unwrap(),
  410    425   
        )
  411    426   
        .unwrap();
  412    427   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  413    428   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  414    429   
  415    430   
        let op = crate::operation::post_union_with_json_name::PostUnionWithJsonName::new();
  416    431   
        let config = op.config().expect("the operation has config");
  417    432   
        let de = config
  418    433   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  419    434   
            .expect("the config must have a deserializer");
  420    435   
  421    436   
        let parsed = de.deserialize_streaming(&mut http_response);
  422    437   
        let parsed = parsed.unwrap_or_else(|| {
  423    438   
            let http_response = http_response.map(|body| {
  424    439   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  425    440   
                    body.bytes().unwrap(),
  426    441   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  427    442   
                )))
  428    443   
            });
  429         -
            de.deserialize_nonstreaming(&http_response)
         444  +
            // Build a config bag with the protocol for schema-based deserialization
         445  +
            #[allow(unused_mut)]
         446  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         447  +
            {
         448  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         449  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         450  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         451  +
                ));
         452  +
                test_cfg.push_shared_layer(layer.freeze());
         453  +
            }
         454  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  430    455   
        });
  431    456   
        let parsed = parsed
  432    457   
            .expect("should be successful response")
  433    458   
            .downcast::<crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput>()
  434    459   
            .unwrap();
  435    460   
        ::pretty_assertions::assert_eq!(parsed.value, expected_output.value, "Unexpected value for `value`");
  436    461   
    }
  437    462   
  438    463   
    /// Tests that jsonName works with union members.
  439    464   
    /// Test ID: PostUnionWithJsonNameResponse3
  440    465   
    #[::tokio::test]
  441    466   
    #[::tracing_test::traced_test]
  442    467   
    async fn post_union_with_json_name_response3_response() {
  443    468   
        let expected_output = crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput::builder()
  444    469   
            .set_value(::std::option::Option::Some(crate::types::UnionWithJsonName::Bar("hi".to_owned())))
  445    470   
            .build()
  446    471   
            .unwrap();
  447    472   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  448    473   
            ::http_1x::response::Builder::new()
  449    474   
                .header("Content-Type", "application/json")
  450    475   
                .status(200)
  451    476   
                .body(::aws_smithy_types::body::SdkBody::from(
  452    477   
                    "{\n    \"value\": {\n        \"bar\": \"hi\"\n    }\n}",
  453    478   
                ))
  454    479   
                .unwrap(),
  455    480   
        )
  456    481   
        .unwrap();
  457    482   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  458    483   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  459    484   
  460    485   
        let op = crate::operation::post_union_with_json_name::PostUnionWithJsonName::new();
  461    486   
        let config = op.config().expect("the operation has config");
  462    487   
        let de = config
  463    488   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  464    489   
            .expect("the config must have a deserializer");
  465    490   
  466    491   
        let parsed = de.deserialize_streaming(&mut http_response);
  467    492   
        let parsed = parsed.unwrap_or_else(|| {
  468    493   
            let http_response = http_response.map(|body| {
  469    494   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  470    495   
                    body.bytes().unwrap(),
  471    496   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  472    497   
                )))
  473    498   
            });
  474         -
            de.deserialize_nonstreaming(&http_response)
         499  +
            // Build a config bag with the protocol for schema-based deserialization
         500  +
            #[allow(unused_mut)]
         501  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         502  +
            {
         503  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         504  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         505  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         506  +
                ));
         507  +
                test_cfg.push_shared_layer(layer.freeze());
         508  +
            }
         509  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  475    510   
        });
  476    511   
        let parsed = parsed
  477    512   
            .expect("should be successful response")
  478    513   
            .downcast::<crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput>()
  479    514   
            .unwrap();
  480    515   
        ::pretty_assertions::assert_eq!(parsed.value, expected_output.value, "Unexpected value for `value`");
  481    516   
    }
  482    517   
}
  483    518   
  484    519   
/// Error type for the `PostUnionWithJsonNameError` operation.

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/post_union_with_json_name/_post_union_with_json_name_input.rs

@@ -4,4 +111,120 @@
   24     24   
        "PostUnionWithJsonNameInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Union,
   27     27   
    "value",
   28     28   
    0,
   29     29   
);
   30     30   
static POSTUNIONWITHJSONNAMEINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     31   
    POSTUNIONWITHJSONNAMEINPUT_SCHEMA_ID,
   32     32   
    ::aws_smithy_schema::ShapeType::Structure,
   33     33   
    &[&POSTUNIONWITHJSONNAMEINPUT_MEMBER_VALUE],
   34         -
);
          34  +
)
          35  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/PostUnionWithJsonName", None));
   35     36   
impl PostUnionWithJsonNameInput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &POSTUNIONWITHJSONNAMEINPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for PostUnionWithJsonNameInput {
   40     41   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   41     42   
    fn serialize_members(
   42     43   
        &self,
   43     44   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     46   
        if let Some(ref val) = self.value {
   46         -
            ser.write_null(&POSTUNIONWITHJSONNAMEINPUT_MEMBER_VALUE)?;
          47  +
            ser.write_struct(&POSTUNIONWITHJSONNAMEINPUT_MEMBER_VALUE, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl PostUnionWithJsonNameInput {
   52     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   53         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   54         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   55     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   56     57   
        #[allow(unused_variables, unused_mut)]
   57     58   
        let mut builder = Self::builder();
   58     59   
        #[allow(
   59     60   
            unused_variables,
   60     61   
            unreachable_code,
   61     62   
            clippy::single_match,
   62     63   
            clippy::match_single_binding,
   63     64   
            clippy::diverging_sub_expression
   64     65   
        )]
   65         -
        deserializer.read_struct(&POSTUNIONWITHJSONNAMEINPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&POSTUNIONWITHJSONNAMEINPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68         -
                    builder.value = Some({
   69         -
                        let _ = member;
   70         -
                        todo!("deserialize aggregate")
   71         -
                    });
          69  +
                    builder.value = Some(crate::types::UnionWithJsonName::deserialize(deser)?);
   72     70   
                }
   73     71   
                _ => {}
   74     72   
            }
   75     73   
            Ok(())
   76     74   
        })?;
   77     75   
        builder
   78     76   
            .build()
   79     77   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   80     78   
    }
   81     79   
}
          80  +
impl PostUnionWithJsonNameInput {
          81  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          82  +
    pub fn deserialize_with_response(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        Self::deserialize(deserializer)
          89  +
    }
          90  +
}
   82     91   
impl PostUnionWithJsonNameInput {
   83     92   
    /// Creates a new builder-style object to manufacture [`PostUnionWithJsonNameInput`](crate::operation::post_union_with_json_name::PostUnionWithJsonNameInput).
   84     93   
    pub fn builder() -> crate::operation::post_union_with_json_name::builders::PostUnionWithJsonNameInputBuilder {
   85     94   
        crate::operation::post_union_with_json_name::builders::PostUnionWithJsonNameInputBuilder::default()
   86     95   
    }
   87     96   
}
   88     97   
   89     98   
/// A builder for [`PostUnionWithJsonNameInput`](crate::operation::post_union_with_json_name::PostUnionWithJsonNameInput).
   90     99   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   91    100   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/post_union_with_json_name/_post_union_with_json_name_output.rs

@@ -17,17 +112,120 @@
   37     37   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &POSTUNIONWITHJSONNAMEOUTPUT_SCHEMA;
   38     38   
}
   39     39   
impl ::aws_smithy_schema::serde::SerializableStruct for PostUnionWithJsonNameOutput {
   40     40   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   41     41   
    fn serialize_members(
   42     42   
        &self,
   43     43   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     44   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     45   
        {
   46     46   
            let val = &self.value;
   47         -
            ser.write_null(&POSTUNIONWITHJSONNAMEOUTPUT_MEMBER_VALUE)?;
          47  +
            ser.write_struct(&POSTUNIONWITHJSONNAMEOUTPUT_MEMBER_VALUE, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl PostUnionWithJsonNameOutput {
   53     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   54         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   55         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   56     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   57     57   
        #[allow(unused_variables, unused_mut)]
   58     58   
        let mut builder = Self::builder();
   59     59   
        #[allow(
   60     60   
            unused_variables,
   61     61   
            unreachable_code,
   62     62   
            clippy::single_match,
   63     63   
            clippy::match_single_binding,
   64     64   
            clippy::diverging_sub_expression
   65     65   
        )]
   66         -
        deserializer.read_struct(&POSTUNIONWITHJSONNAMEOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&POSTUNIONWITHJSONNAMEOUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69         -
                    builder.value = Some({
   70         -
                        let _ = member;
   71         -
                        todo!("deserialize aggregate")
   72         -
                    });
          69  +
                    builder.value = Some(crate::types::UnionWithJsonName::deserialize(deser)?);
   73     70   
                }
   74     71   
                _ => {}
   75     72   
            }
   76     73   
            Ok(())
   77     74   
        })?;
   78     75   
        builder
   79     76   
            .build()
   80     77   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   81     78   
    }
   82     79   
}
          80  +
impl PostUnionWithJsonNameOutput {
          81  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          82  +
    pub fn deserialize_with_response(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        Self::deserialize(deserializer)
          89  +
    }
          90  +
}
   83     91   
impl PostUnionWithJsonNameOutput {
   84     92   
    /// Creates a new builder-style object to manufacture [`PostUnionWithJsonNameOutput`](crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput).
   85     93   
    pub fn builder() -> crate::operation::post_union_with_json_name::builders::PostUnionWithJsonNameOutputBuilder {
   86     94   
        crate::operation::post_union_with_json_name::builders::PostUnionWithJsonNameOutputBuilder::default()
   87     95   
    }
   88     96   
}
   89     97   
   90     98   
/// A builder for [`PostUnionWithJsonNameOutput`](crate::operation::post_union_with_json_name::PostUnionWithJsonNameOutput).
   91     99   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   92    100   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/put_with_content_encoding.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 `PutWithContentEncoding`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct PutWithContentEncoding;
    6      6   
impl PutWithContentEncoding {
    7      7   
    /// Creates a new `PutWithContentEncoding`
    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::put_with_content_encoding::PutWithContentEncodingInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::put_with_content_encoding::PutWithContentEncodingOutput::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::put_with_content_encoding::PutWithContentEncodingInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::put_with_content_encoding::PutWithContentEncodingOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::put_with_content_encoding::PutWithContentEncodingError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +235,239 @@
  130    134   
                crate::operation::put_with_content_encoding::PutWithContentEncodingError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct PutWithContentEncodingResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PutWithContentEncodingResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         150  +
        #[allow(unused_mut)]
         151  +
        let mut force_error = false;
         152  +
         153  +
        if !success && status != 200 || force_error {
  145    154   
            let headers = response.headers();
  146    155   
            let body = response.body().bytes().expect("body loaded");
  147    156   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
  149    160   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_error(status, headers, body)
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::put_with_content_encoding::PutWithContentEncodingError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, PutWithContentEncoding::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::put_with_content_encoding::PutWithContentEncodingOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct PutWithContentEncodingRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PutWithContentEncodingRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::put_with_content_encoding::PutWithContentEncodingInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::put_with_content_encoding::PutWithContentEncodingInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/requestcompression/putcontentwithencoding").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::put_with_content_encoding::PutWithContentEncodingInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                let builder = crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_headers(input, builder)?;
  192         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  193         -
            }
  194         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  195         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  196         -
            builder
  197         -
        };
  198         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  199         -
            crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_input(&input)?,
  200         -
        );
  201         -
        if let Some(content_length) = body.content_length() {
  202         -
            let content_length = content_length.to_string();
  203         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  204         -
        }
  205         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, PutWithContentEncoding::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  206    210   
    }
  207    211   
}
  208    212   
#[derive(Debug)]
  209    213   
struct PutWithContentEncodingEndpointParamsInterceptor;
  210    214   
  211    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutWithContentEncodingEndpointParamsInterceptor {
  212    216   
    fn name(&self) -> &'static str {
  213    217   
        "PutWithContentEncodingEndpointParamsInterceptor"
  214    218   
    }
  215    219   

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/put_with_content_encoding/_put_with_content_encoding_input.rs

@@ -21,21 +131,173 @@
   41     41   
        "PutWithContentEncodingInput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::String,
   44     44   
    "data",
   45     45   
    1,
   46     46   
);
   47     47   
static PUTWITHCONTENTENCODINGINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   48     48   
    PUTWITHCONTENTENCODINGINPUT_SCHEMA_ID,
   49     49   
    ::aws_smithy_schema::ShapeType::Structure,
   50     50   
    &[&PUTWITHCONTENTENCODINGINPUT_MEMBER_ENCODING, &PUTWITHCONTENTENCODINGINPUT_MEMBER_DATA],
   51         -
);
          51  +
)
          52  +
.with_http(aws_smithy_schema::traits::HttpTrait::new(
          53  +
    "POST",
          54  +
    "/requestcompression/putcontentwithencoding",
          55  +
    None,
          56  +
));
   52     57   
impl PutWithContentEncodingInput {
   53     58   
    /// The schema for this shape.
   54     59   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &PUTWITHCONTENTENCODINGINPUT_SCHEMA;
   55     60   
}
   56     61   
impl ::aws_smithy_schema::serde::SerializableStruct for PutWithContentEncodingInput {
   57     62   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   58     63   
    fn serialize_members(
   59     64   
        &self,
   60     65   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   61     66   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   62     67   
        if let Some(ref val) = self.encoding {
   63     68   
            ser.write_string(&PUTWITHCONTENTENCODINGINPUT_MEMBER_ENCODING, val)?;
   64     69   
        }
   65     70   
        if let Some(ref val) = self.data {
   66     71   
            ser.write_string(&PUTWITHCONTENTENCODINGINPUT_MEMBER_DATA, val)?;
   67     72   
        }
   68     73   
        Ok(())
   69     74   
    }
   70     75   
}
   71     76   
impl PutWithContentEncodingInput {
   72     77   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   73         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   74         -
        deserializer: &mut D,
          78  +
    pub fn deserialize(
          79  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   75     80   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   76     81   
        #[allow(unused_variables, unused_mut)]
   77     82   
        let mut builder = Self::builder();
   78     83   
        #[allow(
   79     84   
            unused_variables,
   80     85   
            unreachable_code,
   81     86   
            clippy::single_match,
   82     87   
            clippy::match_single_binding,
   83     88   
            clippy::diverging_sub_expression
   84     89   
        )]
   85         -
        deserializer.read_struct(&PUTWITHCONTENTENCODINGINPUT_SCHEMA, (), |_, member, deser| {
          90  +
        deserializer.read_struct(&PUTWITHCONTENTENCODINGINPUT_SCHEMA, &mut |member, deser| {
   86     91   
            match member.member_index() {
   87     92   
                Some(0) => {
   88     93   
                    builder.encoding = Some(deser.read_string(member)?);
   89     94   
                }
   90     95   
                Some(1) => {
   91     96   
                    builder.data = Some(deser.read_string(member)?);
   92     97   
                }
   93     98   
                _ => {}
   94     99   
            }
   95    100   
            Ok(())
   96    101   
        })?;
   97    102   
        builder
   98    103   
            .build()
   99    104   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  100    105   
    }
  101    106   
}
         107  +
impl PutWithContentEncodingInput {
         108  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         109  +
    /// Header-bound members are read directly from headers, avoiding runtime
         110  +
    /// member iteration overhead. Body members are read via the deserializer.
         111  +
    pub fn deserialize_with_response(
         112  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         113  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         114  +
        _status: u16,
         115  +
        _body: &[u8],
         116  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         117  +
        #[allow(unused_variables, unused_mut)]
         118  +
        let mut builder = Self::builder();
         119  +
        if let Some(val) = headers.get("Content-Encoding") {
         120  +
            builder.encoding = Some(val.to_string());
         121  +
        }
         122  +
        #[allow(
         123  +
            unused_variables,
         124  +
            unreachable_code,
         125  +
            clippy::single_match,
         126  +
            clippy::match_single_binding,
         127  +
            clippy::diverging_sub_expression
         128  +
        )]
         129  +
        deserializer.read_struct(&PUTWITHCONTENTENCODINGINPUT_SCHEMA, &mut |member, deser| {
         130  +
            match member.member_index() {
         131  +
                Some(0) => { /* read from headers above */ }
         132  +
                Some(1) => {
         133  +
                    builder.data = Some(deser.read_string(member)?);
         134  +
                }
         135  +
                _ => {}
         136  +
            }
         137  +
            Ok(())
         138  +
        })?;
         139  +
        builder
         140  +
            .build()
         141  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         142  +
    }
         143  +
}
  102    144   
impl PutWithContentEncodingInput {
  103    145   
    /// Creates a new builder-style object to manufacture [`PutWithContentEncodingInput`](crate::operation::put_with_content_encoding::PutWithContentEncodingInput).
  104    146   
    pub fn builder() -> crate::operation::put_with_content_encoding::builders::PutWithContentEncodingInputBuilder {
  105    147   
        crate::operation::put_with_content_encoding::builders::PutWithContentEncodingInputBuilder::default()
  106    148   
    }
  107    149   
}
  108    150   
  109    151   
/// A builder for [`PutWithContentEncodingInput`](crate::operation::put_with_content_encoding::PutWithContentEncodingInput).
  110    152   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  111    153   
#[non_exhaustive]