Client Test

Client Test

rev. ec7b2441254af868911fccffe8d8dca83aff0045

Files changed:

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

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

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

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

@@ -1,1 +65,76 @@
   18     18   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   19     19   
    fn serialize_members(
   20     20   
        &self,
   21     21   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   22     22   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   23     23   
        Ok(())
   24     24   
    }
   25     25   
}
   26     26   
impl MalformedListOutput {
   27     27   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   28         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   29         -
        deserializer: &mut D,
          28  +
    pub fn deserialize(
          29  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   30     30   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   31     31   
        #[allow(unused_variables, unused_mut)]
   32     32   
        let mut builder = Self::builder();
   33     33   
        #[allow(
   34     34   
            unused_variables,
   35     35   
            unreachable_code,
   36     36   
            clippy::single_match,
   37     37   
            clippy::match_single_binding,
   38     38   
            clippy::diverging_sub_expression
   39     39   
        )]
   40         -
        deserializer.read_struct(&MALFORMEDLISTOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDLISTOUTPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        Ok(builder.build())
   47     47   
    }
   48     48   
}
          49  +
impl MalformedListOutput {
          50  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          51  +
    pub fn deserialize_with_response(
          52  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          53  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          54  +
        _status: u16,
          55  +
        _body: &[u8],
          56  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          57  +
        Ok(Self::builder().build())
          58  +
    }
          59  +
}
   49     60   
impl MalformedListOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedListOutput`](crate::operation::malformed_list::MalformedListOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_list::builders::MalformedListOutputBuilder {
   52     63   
        crate::operation::malformed_list::builders::MalformedListOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedListOutput`](crate::operation::malformed_list::MalformedListOutput).
   57     68   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   58     69   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_long.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 `MalformedLong`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedLong;
    6      6   
impl MalformedLong {
    7      7   
    /// Creates a new `MalformedLong`
    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::malformed_long::MalformedLongInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_long::MalformedLongOutput::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::malformed_long::MalformedLongInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::malformed_long::MalformedLongOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::malformed_long::MalformedLongError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +252,267 @@
  124    128   
                crate::operation::malformed_long::MalformedLongError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct MalformedLongResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedLongResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139         -
        let headers = response.headers();
  140         -
        let body = response.body().bytes().expect("body loaded");
  141    144   
        #[allow(unused_mut)]
  142    145   
        let mut force_error = false;
  143    146   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_malformed_long::de_malformed_long_http_error(status, headers, body)
         147  +
        if !success && status != 200 || force_error {
         148  +
            let headers = response.headers();
         149  +
            let body = response.body().bytes().expect("body loaded");
         150  +
            #[allow(unused_mut)]
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
         154  +
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(crate::operation::malformed_long::MalformedLongError::generic(
         158  +
                    generic,
         159  +
                )),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_malformed_long::de_malformed_long_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let mut deser = protocol.deserialize_response(response, MalformedLong::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         166  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         167  +
            })?;
         168  +
            let body = response.body().bytes().expect("body loaded");
         169  +
            let output = crate::operation::malformed_long::MalformedLongOutput::deserialize_with_response(
         170  +
                &mut *deser,
         171  +
                response.headers(),
         172  +
                response.status().into(),
         173  +
                body,
         174  +
            )
         175  +
            .map_err(|e| {
         176  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
            })?;
         178  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         179  +
        }
  150    180   
    }
  151    181   
}
  152    182   
#[derive(Debug)]
  153    183   
struct MalformedLongRequestSerializer;
  154    184   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedLongRequestSerializer {
  155    185   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    186   
    fn serialize_input(
  157    187   
        &self,
  158    188   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    189   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    190   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    191   
        let input = input
  162    192   
            .downcast::<crate::operation::malformed_long::MalformedLongInput>()
  163    193   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::malformed_long::MalformedLongInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                let input_1 = &_input.long_in_path;
  176         -
                let input_1 = input_1
  177         -
                    .as_ref()
  178         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("long_in_path", "cannot be empty or unset"))?;
  179         -
                let mut long_in_path_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_1);
  180         -
                let long_in_path = long_in_path_encoder.encode();
  181         -
                if long_in_path.is_empty() {
  182         -
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
  183         -
                        "long_in_path",
  184         -
                        "cannot be empty or unset",
  185         -
                    ));
         194  +
        let protocol = _cfg
         195  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         196  +
            .expect("a SharedClientProtocol is required");
         197  +
        if protocol.supports_http_bindings() {
         198  +
            let mut request = protocol
         199  +
                .serialize_body(&input, MalformedLong::INPUT_SCHEMA, "", _cfg)
         200  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         201  +
            {
         202  +
                let mut uri = "/MalformedLong/{longInPath}".to_string();
         203  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         204  +
                if let Some(ref val) = input.long_in_path {
         205  +
                    uri = uri.replace("{longInPath}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
  186    206   
                }
  187         -
                ::std::write!(output, "/MalformedLong/{longInPath}", longInPath = long_in_path).expect("formatting should succeed");
  188         -
                ::std::result::Result::Ok(())
  189         -
            }
  190         -
            fn uri_query(
  191         -
                _input: &crate::operation::malformed_long::MalformedLongInput,
  192         -
                mut output: &mut ::std::string::String,
  193         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  194         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  195         -
                if let ::std::option::Option::Some(inner_2) = &_input.long_in_query {
  196         -
                    {
  197         -
                        query.push_kv("longInQuery", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode());
  198         -
                    }
         207  +
                if let Some(ref val) = input.long_in_query {
         208  +
                    query_params.push(("longInQuery".to_string(), val.to_string()));
  199    209   
                }
  200         -
                ::std::result::Result::Ok(())
  201         -
            }
  202         -
            #[allow(clippy::unnecessary_wraps)]
  203         -
            fn update_http_builder(
  204         -
                input: &crate::operation::malformed_long::MalformedLongInput,
  205         -
                builder: ::http_1x::request::Builder,
  206         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  207         -
                let mut uri = ::std::string::String::new();
  208         -
                uri_base(input, &mut uri)?;
  209         -
                uri_query(input, &mut uri)?;
  210         -
                let builder = crate::protocol_serde::shape_malformed_long::ser_malformed_long_headers(input, builder)?;
  211         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         210  +
                if let Some(ref val) = input.long_in_header {
         211  +
                    request.headers_mut().insert("longInHeader", val.to_string());
         212  +
                }
         213  +
                if !query_params.is_empty() {
         214  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         215  +
                    let pairs: Vec<String> = query_params
         216  +
                        .iter()
         217  +
                        .map(|(k, v)| {
         218  +
                            format!(
         219  +
                                "{}={}",
         220  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         221  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         222  +
                            )
         223  +
                        })
         224  +
                        .collect();
         225  +
                    uri.push_str(&pairs.join("&"));
         226  +
                }
         227  +
                request.set_uri(uri.as_str()).expect("valid URI");
  212    228   
            }
  213         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  214         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  215         -
            builder
  216         -
        };
  217         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_malformed_long::ser_malformed_long_input(&input)?);
  218         -
        if let Some(content_length) = body.content_length() {
  219         -
            let content_length = content_length.to_string();
  220         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
         229  +
         230  +
            return ::std::result::Result::Ok(request);
         231  +
        } else {
         232  +
            let mut request = protocol
         233  +
                .serialize_request(&input, MalformedLong::INPUT_SCHEMA, "", _cfg)
         234  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         235  +
         236  +
            return ::std::result::Result::Ok(request);
  221    237   
        }
  222         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  223    238   
    }
  224    239   
}
  225    240   
#[derive(Debug)]
  226    241   
struct MalformedLongEndpointParamsInterceptor;
  227    242   
  228    243   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedLongEndpointParamsInterceptor {
  229    244   
    fn name(&self) -> &'static str {
  230    245   
        "MalformedLongEndpointParamsInterceptor"
  231    246   
    }
  232    247   

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

@@ -15,15 +177,222 @@
   35     35   
    "aws.protocoltests.restjson.synthetic",
   36     36   
    "MalformedLongInput",
   37     37   
);
   38     38   
static MALFORMEDLONGINPUT_MEMBER_LONG_IN_BODY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   39     39   
    ::aws_smithy_schema::ShapeId::from_static(
   40     40   
        "aws.protocoltests.restjson.synthetic#MalformedLongInput$longInBody",
   41     41   
        "aws.protocoltests.restjson.synthetic",
   42     42   
        "MalformedLongInput",
   43     43   
    ),
   44     44   
    ::aws_smithy_schema::ShapeType::Long,
   45         -
    "long_in_body",
          45  +
    "longInBody",
   46     46   
    0,
   47     47   
);
   48     48   
static MALFORMEDLONGINPUT_MEMBER_LONG_IN_PATH: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   49     49   
    ::aws_smithy_schema::ShapeId::from_static(
   50     50   
        "aws.protocoltests.restjson.synthetic#MalformedLongInput$longInPath",
   51     51   
        "aws.protocoltests.restjson.synthetic",
   52     52   
        "MalformedLongInput",
   53     53   
    ),
   54     54   
    ::aws_smithy_schema::ShapeType::Long,
   55         -
    "long_in_path",
          55  +
    "longInPath",
   56     56   
    1,
   57     57   
)
   58     58   
.with_http_label();
   59     59   
static MALFORMEDLONGINPUT_MEMBER_LONG_IN_QUERY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   60     60   
    ::aws_smithy_schema::ShapeId::from_static(
   61     61   
        "aws.protocoltests.restjson.synthetic#MalformedLongInput$longInQuery",
   62     62   
        "aws.protocoltests.restjson.synthetic",
   63     63   
        "MalformedLongInput",
   64     64   
    ),
   65     65   
    ::aws_smithy_schema::ShapeType::Long,
   66         -
    "long_in_query",
          66  +
    "longInQuery",
   67     67   
    2,
   68     68   
)
   69     69   
.with_http_query("longInQuery");
   70     70   
static MALFORMEDLONGINPUT_MEMBER_LONG_IN_HEADER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   71     71   
    ::aws_smithy_schema::ShapeId::from_static(
   72     72   
        "aws.protocoltests.restjson.synthetic#MalformedLongInput$longInHeader",
   73     73   
        "aws.protocoltests.restjson.synthetic",
   74     74   
        "MalformedLongInput",
   75     75   
    ),
   76     76   
    ::aws_smithy_schema::ShapeType::Long,
   77         -
    "long_in_header",
          77  +
    "longInHeader",
   78     78   
    3,
   79     79   
)
   80     80   
.with_http_header("longInHeader");
   81     81   
static MALFORMEDLONGINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   82     82   
    MALFORMEDLONGINPUT_SCHEMA_ID,
   83     83   
    ::aws_smithy_schema::ShapeType::Structure,
   84     84   
    &[
   85     85   
        &MALFORMEDLONGINPUT_MEMBER_LONG_IN_BODY,
   86     86   
        &MALFORMEDLONGINPUT_MEMBER_LONG_IN_PATH,
   87     87   
        &MALFORMEDLONGINPUT_MEMBER_LONG_IN_QUERY,
   88     88   
        &MALFORMEDLONGINPUT_MEMBER_LONG_IN_HEADER,
   89     89   
    ],
   90         -
);
          90  +
)
          91  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/MalformedLong/{longInPath}", None));
   91     92   
impl MalformedLongInput {
   92     93   
    /// The schema for this shape.
   93     94   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MALFORMEDLONGINPUT_SCHEMA;
   94     95   
}
   95     96   
impl ::aws_smithy_schema::serde::SerializableStruct for MalformedLongInput {
   96     97   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   97     98   
    fn serialize_members(
   98     99   
        &self,
   99    100   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  100    101   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  101    102   
        if let Some(ref val) = self.long_in_body {
  102    103   
            ser.write_long(&MALFORMEDLONGINPUT_MEMBER_LONG_IN_BODY, *val)?;
  103    104   
        }
  104    105   
        if let Some(ref val) = self.long_in_path {
  105    106   
            ser.write_long(&MALFORMEDLONGINPUT_MEMBER_LONG_IN_PATH, *val)?;
  106    107   
        }
  107    108   
        if let Some(ref val) = self.long_in_query {
  108    109   
            ser.write_long(&MALFORMEDLONGINPUT_MEMBER_LONG_IN_QUERY, *val)?;
  109    110   
        }
  110    111   
        if let Some(ref val) = self.long_in_header {
  111    112   
            ser.write_long(&MALFORMEDLONGINPUT_MEMBER_LONG_IN_HEADER, *val)?;
  112    113   
        }
  113    114   
        Ok(())
  114    115   
    }
  115    116   
}
  116    117   
impl MalformedLongInput {
  117    118   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  118         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  119         -
        deserializer: &mut D,
         119  +
    pub fn deserialize(
         120  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  120    121   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  121    122   
        #[allow(unused_variables, unused_mut)]
  122    123   
        let mut builder = Self::builder();
  123    124   
        #[allow(
  124    125   
            unused_variables,
  125    126   
            unreachable_code,
  126    127   
            clippy::single_match,
  127    128   
            clippy::match_single_binding,
  128    129   
            clippy::diverging_sub_expression
  129    130   
        )]
  130         -
        deserializer.read_struct(&MALFORMEDLONGINPUT_SCHEMA, (), |_, member, deser| {
         131  +
        deserializer.read_struct(&MALFORMEDLONGINPUT_SCHEMA, &mut |member, deser| {
  131    132   
            match member.member_index() {
  132    133   
                Some(0) => {
  133    134   
                    builder.long_in_body = Some(deser.read_long(member)?);
  134    135   
                }
  135    136   
                Some(1) => {
  136    137   
                    builder.long_in_path = Some(deser.read_long(member)?);
  137    138   
                }
  138    139   
                Some(2) => {
  139    140   
                    builder.long_in_query = Some(deser.read_long(member)?);
  140    141   
                }
  141    142   
                Some(3) => {
  142    143   
                    builder.long_in_header = Some(deser.read_long(member)?);
  143    144   
                }
  144    145   
                _ => {}
  145    146   
            }
  146    147   
            Ok(())
  147    148   
        })?;
         149  +
        builder.long_in_path = builder.long_in_path.or(Some(0i64));
         150  +
        builder
         151  +
            .build()
         152  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         153  +
    }
         154  +
}
         155  +
impl MalformedLongInput {
         156  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         157  +
    /// Header-bound members are read directly from headers, avoiding runtime
         158  +
    /// member iteration overhead. Body members are read via the deserializer.
         159  +
    pub fn deserialize_with_response(
         160  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         161  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         162  +
        _status: u16,
         163  +
        _body: &[u8],
         164  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         165  +
        #[allow(unused_variables, unused_mut)]
         166  +
        let mut builder = Self::builder();
         167  +
        if let Some(val) = headers.get("longInHeader") {
         168  +
            builder.long_in_header = val.parse::<i64>().ok();
         169  +
        }
         170  +
        #[allow(
         171  +
            unused_variables,
         172  +
            unreachable_code,
         173  +
            clippy::single_match,
         174  +
            clippy::match_single_binding,
         175  +
            clippy::diverging_sub_expression
         176  +
        )]
         177  +
        deserializer.read_struct(&MALFORMEDLONGINPUT_SCHEMA, &mut |member, deser| {
         178  +
            match member.member_index() {
         179  +
                Some(0) => {
         180  +
                    builder.long_in_body = Some(deser.read_long(member)?);
         181  +
                }
         182  +
                Some(1) => {
         183  +
                    builder.long_in_path = Some(deser.read_long(member)?);
         184  +
                }
         185  +
                Some(2) => {
         186  +
                    builder.long_in_query = Some(deser.read_long(member)?);
         187  +
                }
         188  +
                Some(3) => { /* read from headers above */ }
         189  +
                _ => {}
         190  +
            }
         191  +
            Ok(())
         192  +
        })?;
  148    193   
        builder
  149    194   
            .build()
  150    195   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  151    196   
    }
  152    197   
}
  153    198   
impl MalformedLongInput {
  154    199   
    /// Creates a new builder-style object to manufacture [`MalformedLongInput`](crate::operation::malformed_long::MalformedLongInput).
  155    200   
    pub fn builder() -> crate::operation::malformed_long::builders::MalformedLongInputBuilder {
  156    201   
        crate::operation::malformed_long::builders::MalformedLongInputBuilder::default()
  157    202   
    }

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

@@ -1,1 +65,76 @@
   18     18   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   19     19   
    fn serialize_members(
   20     20   
        &self,
   21     21   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   22     22   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   23     23   
        Ok(())
   24     24   
    }
   25     25   
}
   26     26   
impl MalformedLongOutput {
   27     27   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   28         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   29         -
        deserializer: &mut D,
          28  +
    pub fn deserialize(
          29  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   30     30   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   31     31   
        #[allow(unused_variables, unused_mut)]
   32     32   
        let mut builder = Self::builder();
   33     33   
        #[allow(
   34     34   
            unused_variables,
   35     35   
            unreachable_code,
   36     36   
            clippy::single_match,
   37     37   
            clippy::match_single_binding,
   38     38   
            clippy::diverging_sub_expression
   39     39   
        )]
   40         -
        deserializer.read_struct(&MALFORMEDLONGOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDLONGOUTPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        Ok(builder.build())
   47     47   
    }
   48     48   
}
          49  +
impl MalformedLongOutput {
          50  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          51  +
    pub fn deserialize_with_response(
          52  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          53  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          54  +
        _status: u16,
          55  +
        _body: &[u8],
          56  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          57  +
        Ok(Self::builder().build())
          58  +
    }
          59  +
}
   49     60   
impl MalformedLongOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedLongOutput`](crate::operation::malformed_long::MalformedLongOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_long::builders::MalformedLongOutputBuilder {
   52     63   
        crate::operation::malformed_long::builders::MalformedLongOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedLongOutput`](crate::operation::malformed_long::MalformedLongOutput).
   57     68   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   58     69   
#[non_exhaustive]

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

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

@@ -1,1 +127,129 @@
   17     17   
    "aws.protocoltests.restjson.synthetic",
   18     18   
    "MalformedMapInput",
   19     19   
);
   20     20   
static MALFORMEDMAPINPUT_MEMBER_BODY_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   21     21   
    ::aws_smithy_schema::ShapeId::from_static(
   22     22   
        "aws.protocoltests.restjson.synthetic#MalformedMapInput$bodyMap",
   23     23   
        "aws.protocoltests.restjson.synthetic",
   24     24   
        "MalformedMapInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Map,
   27         -
    "body_map",
          27  +
    "bodyMap",
   28     28   
    0,
   29     29   
);
   30     30   
static MALFORMEDMAPINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     31   
    MALFORMEDMAPINPUT_SCHEMA_ID,
   32     32   
    ::aws_smithy_schema::ShapeType::Structure,
   33     33   
    &[&MALFORMEDMAPINPUT_MEMBER_BODY_MAP],
   34         -
);
          34  +
)
          35  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/MalformedMap", None));
   35     36   
impl MalformedMapInput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MALFORMEDMAPINPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for MalformedMapInput {
   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.body_map {
   46     47   
            ser.write_map(
   47     48   
                &MALFORMEDMAPINPUT_MEMBER_BODY_MAP,
   48     49   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   49     50   
                    for (key, value) in val {
   50     51   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
   51     52   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
   52     53   
                    }
   53     54   
                    Ok(())
   54     55   
                },
   55     56   
            )?;
   56     57   
        }
   57     58   
        Ok(())
   58     59   
    }
   59     60   
}
   60     61   
impl MalformedMapInput {
   61     62   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   62         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   63         -
        deserializer: &mut D,
          63  +
    pub fn deserialize(
          64  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   64     65   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   65     66   
        #[allow(unused_variables, unused_mut)]
   66     67   
        let mut builder = Self::builder();
   67     68   
        #[allow(
   68     69   
            unused_variables,
   69     70   
            unreachable_code,
   70     71   
            clippy::single_match,
   71     72   
            clippy::match_single_binding,
   72     73   
            clippy::diverging_sub_expression
   73     74   
        )]
   74         -
        deserializer.read_struct(&MALFORMEDMAPINPUT_SCHEMA, (), |_, member, deser| {
          75  +
        deserializer.read_struct(&MALFORMEDMAPINPUT_SCHEMA, &mut |member, deser| {
   75     76   
            match member.member_index() {
   76     77   
                Some(0) => {
   77         -
                    builder.body_map = Some({
   78         -
                        let container = if let Some(cap) = deser.container_size() {
   79         -
                            std::collections::HashMap::with_capacity(cap)
   80         -
                        } else {
   81         -
                            std::collections::HashMap::new()
   82         -
                        };
   83         -
                        deser.read_map(member, container, |mut map, key, deser| {
   84         -
                            map.insert(key, deser.read_string(member)?);
   85         -
                            Ok(map)
   86         -
                        })?
   87         -
                    });
          78  +
                    builder.body_map = Some(deser.read_string_string_map(member)?);
   88     79   
                }
   89     80   
                _ => {}
   90     81   
            }
   91     82   
            Ok(())
   92     83   
        })?;
   93     84   
        builder
   94     85   
            .build()
   95     86   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   96     87   
    }
   97     88   
}
          89  +
impl MalformedMapInput {
          90  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          91  +
    pub fn deserialize_with_response(
          92  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          93  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          94  +
        _status: u16,
          95  +
        _body: &[u8],
          96  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          97  +
        Self::deserialize(deserializer)
          98  +
    }
          99  +
}
   98    100   
impl MalformedMapInput {
   99    101   
    /// Creates a new builder-style object to manufacture [`MalformedMapInput`](crate::operation::malformed_map::MalformedMapInput).
  100    102   
    pub fn builder() -> crate::operation::malformed_map::builders::MalformedMapInputBuilder {
  101    103   
        crate::operation::malformed_map::builders::MalformedMapInputBuilder::default()
  102    104   
    }
  103    105   
}
  104    106   
  105    107   
/// A builder for [`MalformedMapInput`](crate::operation::malformed_map::MalformedMapInput).
  106    108   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  107    109   
#[non_exhaustive]

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

@@ -1,1 +65,76 @@
   18     18   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   19     19   
    fn serialize_members(
   20     20   
        &self,
   21     21   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   22     22   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   23     23   
        Ok(())
   24     24   
    }
   25     25   
}
   26     26   
impl MalformedMapOutput {
   27     27   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   28         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   29         -
        deserializer: &mut D,
          28  +
    pub fn deserialize(
          29  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   30     30   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   31     31   
        #[allow(unused_variables, unused_mut)]
   32     32   
        let mut builder = Self::builder();
   33     33   
        #[allow(
   34     34   
            unused_variables,
   35     35   
            unreachable_code,
   36     36   
            clippy::single_match,
   37     37   
            clippy::match_single_binding,
   38     38   
            clippy::diverging_sub_expression
   39     39   
        )]
   40         -
        deserializer.read_struct(&MALFORMEDMAPOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDMAPOUTPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        Ok(builder.build())
   47     47   
    }
   48     48   
}
          49  +
impl MalformedMapOutput {
          50  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          51  +
    pub fn deserialize_with_response(
          52  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          53  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          54  +
        _status: u16,
          55  +
        _body: &[u8],
          56  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          57  +
        Ok(Self::builder().build())
          58  +
    }
          59  +
}
   49     60   
impl MalformedMapOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedMapOutput`](crate::operation::malformed_map::MalformedMapOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_map::builders::MalformedMapOutputBuilder {
   52     63   
        crate::operation::malformed_map::builders::MalformedMapOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedMapOutput`](crate::operation::malformed_map::MalformedMapOutput).
   57     68   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   58     69   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_request_body.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 `MalformedRequestBody`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedRequestBody;
    6      6   
impl MalformedRequestBody {
    7      7   
    /// Creates a new `MalformedRequestBody`
    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::malformed_request_body::MalformedRequestBodyInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_request_body::MalformedRequestBodyOutput::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::malformed_request_body::MalformedRequestBodyInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::malformed_request_body::MalformedRequestBodyOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::malformed_request_body::MalformedRequestBodyError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +234,239 @@
  130    134   
                crate::operation::malformed_request_body::MalformedRequestBodyError,
  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 MalformedRequestBodyResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedRequestBodyResponseDeserializer {
  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());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    150   
        #[allow(unused_mut)]
  148    151   
        let mut force_error = false;
  149    152   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_malformed_request_body::de_malformed_request_body_http_error(status, headers, body)
         153  +
        if !success && status != 200 || force_error {
         154  +
            let headers = response.headers();
         155  +
            let body = response.body().bytes().expect("body loaded");
         156  +
            #[allow(unused_mut)]
         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  +
            })?;
         160  +
         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::malformed_request_body::MalformedRequestBodyError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_malformed_request_body::de_malformed_request_body_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, MalformedRequestBody::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::malformed_request_body::MalformedRequestBodyOutput::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 MalformedRequestBodyRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedRequestBodyRequestSerializer {
  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::malformed_request_body::MalformedRequestBodyInput>()
  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::malformed_request_body::MalformedRequestBodyInput,
  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, "/MalformedRequestBody").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::malformed_request_body::MalformedRequestBodyInput,
  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_malformed_request_body::ser_malformed_request_body_input(
  198         -
            &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, MalformedRequestBody::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 MalformedRequestBodyEndpointParamsInterceptor;
  209    214   
  210    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedRequestBodyEndpointParamsInterceptor {
  211    216   
    fn name(&self) -> &'static str {
  212    217   
        "MalformedRequestBodyEndpointParamsInterceptor"
  213    218   
    }
  214    219   

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

@@ -20,20 +130,142 @@
   40     40   
        "MalformedRequestBodyInput",
   41     41   
    ),
   42     42   
    ::aws_smithy_schema::ShapeType::Float,
   43     43   
    "float",
   44     44   
    1,
   45     45   
);
   46     46   
static MALFORMEDREQUESTBODYINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   47     47   
    MALFORMEDREQUESTBODYINPUT_SCHEMA_ID,
   48     48   
    ::aws_smithy_schema::ShapeType::Structure,
   49     49   
    &[&MALFORMEDREQUESTBODYINPUT_MEMBER_INT, &MALFORMEDREQUESTBODYINPUT_MEMBER_FLOAT],
   50         -
);
          50  +
)
          51  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/MalformedRequestBody", None));
   51     52   
impl MalformedRequestBodyInput {
   52     53   
    /// The schema for this shape.
   53     54   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MALFORMEDREQUESTBODYINPUT_SCHEMA;
   54     55   
}
   55     56   
impl ::aws_smithy_schema::serde::SerializableStruct for MalformedRequestBodyInput {
   56     57   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   57     58   
    fn serialize_members(
   58     59   
        &self,
   59     60   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   60     61   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   61     62   
        if let Some(ref val) = self.int {
   62     63   
            ser.write_integer(&MALFORMEDREQUESTBODYINPUT_MEMBER_INT, *val)?;
   63     64   
        }
   64     65   
        if let Some(ref val) = self.float {
   65     66   
            ser.write_float(&MALFORMEDREQUESTBODYINPUT_MEMBER_FLOAT, *val)?;
   66     67   
        }
   67     68   
        Ok(())
   68     69   
    }
   69     70   
}
   70     71   
impl MalformedRequestBodyInput {
   71     72   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   72         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   73         -
        deserializer: &mut D,
          73  +
    pub fn deserialize(
          74  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   74     75   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   75     76   
        #[allow(unused_variables, unused_mut)]
   76     77   
        let mut builder = Self::builder();
   77     78   
        #[allow(
   78     79   
            unused_variables,
   79     80   
            unreachable_code,
   80     81   
            clippy::single_match,
   81     82   
            clippy::match_single_binding,
   82     83   
            clippy::diverging_sub_expression
   83     84   
        )]
   84         -
        deserializer.read_struct(&MALFORMEDREQUESTBODYINPUT_SCHEMA, (), |_, member, deser| {
          85  +
        deserializer.read_struct(&MALFORMEDREQUESTBODYINPUT_SCHEMA, &mut |member, deser| {
   85     86   
            match member.member_index() {
   86     87   
                Some(0) => {
   87     88   
                    builder.int = Some(deser.read_integer(member)?);
   88     89   
                }
   89     90   
                Some(1) => {
   90     91   
                    builder.float = Some(deser.read_float(member)?);
   91     92   
                }
   92     93   
                _ => {}
   93     94   
            }
   94     95   
            Ok(())
   95     96   
        })?;
   96     97   
        builder
   97     98   
            .build()
   98     99   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   99    100   
    }
  100    101   
}
         102  +
impl MalformedRequestBodyInput {
         103  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         104  +
    pub fn deserialize_with_response(
         105  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         106  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         107  +
        _status: u16,
         108  +
        _body: &[u8],
         109  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         110  +
        Self::deserialize(deserializer)
         111  +
    }
         112  +
}
  101    113   
impl MalformedRequestBodyInput {
  102    114   
    /// Creates a new builder-style object to manufacture [`MalformedRequestBodyInput`](crate::operation::malformed_request_body::MalformedRequestBodyInput).
  103    115   
    pub fn builder() -> crate::operation::malformed_request_body::builders::MalformedRequestBodyInputBuilder {
  104    116   
        crate::operation::malformed_request_body::builders::MalformedRequestBodyInputBuilder::default()
  105    117   
    }
  106    118   
}
  107    119   
  108    120   
/// A builder for [`MalformedRequestBodyInput`](crate::operation::malformed_request_body::MalformedRequestBodyInput).
  109    121   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  110    122   
#[non_exhaustive]

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

@@ -1,1 +65,76 @@
   18     18   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   19     19   
    fn serialize_members(
   20     20   
        &self,
   21     21   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   22     22   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   23     23   
        Ok(())
   24     24   
    }
   25     25   
}
   26     26   
impl MalformedRequestBodyOutput {
   27     27   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   28         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   29         -
        deserializer: &mut D,
          28  +
    pub fn deserialize(
          29  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   30     30   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   31     31   
        #[allow(unused_variables, unused_mut)]
   32     32   
        let mut builder = Self::builder();
   33     33   
        #[allow(
   34     34   
            unused_variables,
   35     35   
            unreachable_code,
   36     36   
            clippy::single_match,
   37     37   
            clippy::match_single_binding,
   38     38   
            clippy::diverging_sub_expression
   39     39   
        )]
   40         -
        deserializer.read_struct(&MALFORMEDREQUESTBODYOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDREQUESTBODYOUTPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        Ok(builder.build())
   47     47   
    }
   48     48   
}
          49  +
impl MalformedRequestBodyOutput {
          50  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          51  +
    pub fn deserialize_with_response(
          52  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          53  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          54  +
        _status: u16,
          55  +
        _body: &[u8],
          56  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          57  +
        Ok(Self::builder().build())
          58  +
    }
          59  +
}
   49     60   
impl MalformedRequestBodyOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedRequestBodyOutput`](crate::operation::malformed_request_body::MalformedRequestBodyOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_request_body::builders::MalformedRequestBodyOutputBuilder {
   52     63   
        crate::operation::malformed_request_body::builders::MalformedRequestBodyOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedRequestBodyOutput`](crate::operation::malformed_request_body::MalformedRequestBodyOutput).
   57     68   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   58     69   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_short.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 `MalformedShort`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedShort;
    6      6   
impl MalformedShort {
    7      7   
    /// Creates a new `MalformedShort`
    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::malformed_short::MalformedShortInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_short::MalformedShortOutput::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::malformed_short::MalformedShortInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::malformed_short::MalformedShortOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::malformed_short::MalformedShortError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +252,269 @@
  124    128   
                crate::operation::malformed_short::MalformedShortError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct MalformedShortResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedShortResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139         -
        let headers = response.headers();
  140         -
        let body = response.body().bytes().expect("body loaded");
  141    144   
        #[allow(unused_mut)]
  142    145   
        let mut force_error = false;
  143    146   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_malformed_short::de_malformed_short_http_error(status, headers, body)
         147  +
        if !success && status != 200 || force_error {
         148  +
            let headers = response.headers();
         149  +
            let body = response.body().bytes().expect("body loaded");
         150  +
            #[allow(unused_mut)]
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
         154  +
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         158  +
                    crate::operation::malformed_short::MalformedShortError::generic(generic),
         159  +
                ),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_malformed_short::de_malformed_short_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let mut deser = protocol
         166  +
                .deserialize_response(response, MalformedShort::OUTPUT_SCHEMA, _cfg)
         167  +
                .map_err(|e| {
         168  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         169  +
                })?;
         170  +
            let body = response.body().bytes().expect("body loaded");
         171  +
            let output = crate::operation::malformed_short::MalformedShortOutput::deserialize_with_response(
         172  +
                &mut *deser,
         173  +
                response.headers(),
         174  +
                response.status().into(),
         175  +
                body,
         176  +
            )
         177  +
            .map_err(|e| {
         178  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         179  +
            })?;
         180  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         181  +
        }
  150    182   
    }
  151    183   
}
  152    184   
#[derive(Debug)]
  153    185   
struct MalformedShortRequestSerializer;
  154    186   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedShortRequestSerializer {
  155    187   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    188   
    fn serialize_input(
  157    189   
        &self,
  158    190   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    191   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    192   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    193   
        let input = input
  162    194   
            .downcast::<crate::operation::malformed_short::MalformedShortInput>()
  163    195   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::malformed_short::MalformedShortInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                let input_1 = &_input.short_in_path;
  176         -
                let input_1 = input_1
  177         -
                    .as_ref()
  178         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("short_in_path", "cannot be empty or unset"))?;
  179         -
                let mut short_in_path_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_1);
  180         -
                let short_in_path = short_in_path_encoder.encode();
  181         -
                if short_in_path.is_empty() {
  182         -
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
  183         -
                        "short_in_path",
  184         -
                        "cannot be empty or unset",
  185         -
                    ));
         196  +
        let protocol = _cfg
         197  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         198  +
            .expect("a SharedClientProtocol is required");
         199  +
        if protocol.supports_http_bindings() {
         200  +
            let mut request = protocol
         201  +
                .serialize_body(&input, MalformedShort::INPUT_SCHEMA, "", _cfg)
         202  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         203  +
            {
         204  +
                let mut uri = "/MalformedShort/{shortInPath}".to_string();
         205  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         206  +
                if let Some(ref val) = input.short_in_path {
         207  +
                    uri = uri.replace("{shortInPath}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
  186    208   
                }
  187         -
                ::std::write!(output, "/MalformedShort/{shortInPath}", shortInPath = short_in_path).expect("formatting should succeed");
  188         -
                ::std::result::Result::Ok(())
  189         -
            }
  190         -
            fn uri_query(
  191         -
                _input: &crate::operation::malformed_short::MalformedShortInput,
  192         -
                mut output: &mut ::std::string::String,
  193         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  194         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  195         -
                if let ::std::option::Option::Some(inner_2) = &_input.short_in_query {
  196         -
                    {
  197         -
                        query.push_kv("shortInQuery", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode());
  198         -
                    }
         209  +
                if let Some(ref val) = input.short_in_query {
         210  +
                    query_params.push(("shortInQuery".to_string(), val.to_string()));
  199    211   
                }
  200         -
                ::std::result::Result::Ok(())
  201         -
            }
  202         -
            #[allow(clippy::unnecessary_wraps)]
  203         -
            fn update_http_builder(
  204         -
                input: &crate::operation::malformed_short::MalformedShortInput,
  205         -
                builder: ::http_1x::request::Builder,
  206         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  207         -
                let mut uri = ::std::string::String::new();
  208         -
                uri_base(input, &mut uri)?;
  209         -
                uri_query(input, &mut uri)?;
  210         -
                let builder = crate::protocol_serde::shape_malformed_short::ser_malformed_short_headers(input, builder)?;
  211         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         212  +
                if let Some(ref val) = input.short_in_header {
         213  +
                    request.headers_mut().insert("shortInHeader", val.to_string());
         214  +
                }
         215  +
                if !query_params.is_empty() {
         216  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         217  +
                    let pairs: Vec<String> = query_params
         218  +
                        .iter()
         219  +
                        .map(|(k, v)| {
         220  +
                            format!(
         221  +
                                "{}={}",
         222  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         223  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         224  +
                            )
         225  +
                        })
         226  +
                        .collect();
         227  +
                    uri.push_str(&pairs.join("&"));
         228  +
                }
         229  +
                request.set_uri(uri.as_str()).expect("valid URI");
  212    230   
            }
  213         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  214         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  215         -
            builder
  216         -
        };
  217         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_malformed_short::ser_malformed_short_input(&input)?);
  218         -
        if let Some(content_length) = body.content_length() {
  219         -
            let content_length = content_length.to_string();
  220         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
         231  +
         232  +
            return ::std::result::Result::Ok(request);
         233  +
        } else {
         234  +
            let mut request = protocol
         235  +
                .serialize_request(&input, MalformedShort::INPUT_SCHEMA, "", _cfg)
         236  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         237  +
         238  +
            return ::std::result::Result::Ok(request);
  221    239   
        }
  222         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  223    240   
    }
  224    241   
}
  225    242   
#[derive(Debug)]
  226    243   
struct MalformedShortEndpointParamsInterceptor;
  227    244   
  228    245   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedShortEndpointParamsInterceptor {
  229    246   
    fn name(&self) -> &'static str {
  230    247   
        "MalformedShortEndpointParamsInterceptor"
  231    248   
    }
  232    249   

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

@@ -15,15 +177,222 @@
   35     35   
    "aws.protocoltests.restjson.synthetic",
   36     36   
    "MalformedShortInput",
   37     37   
);
   38     38   
static MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_BODY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   39     39   
    ::aws_smithy_schema::ShapeId::from_static(
   40     40   
        "aws.protocoltests.restjson.synthetic#MalformedShortInput$shortInBody",
   41     41   
        "aws.protocoltests.restjson.synthetic",
   42     42   
        "MalformedShortInput",
   43     43   
    ),
   44     44   
    ::aws_smithy_schema::ShapeType::Short,
   45         -
    "short_in_body",
          45  +
    "shortInBody",
   46     46   
    0,
   47     47   
);
   48     48   
static MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_PATH: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   49     49   
    ::aws_smithy_schema::ShapeId::from_static(
   50     50   
        "aws.protocoltests.restjson.synthetic#MalformedShortInput$shortInPath",
   51     51   
        "aws.protocoltests.restjson.synthetic",
   52     52   
        "MalformedShortInput",
   53     53   
    ),
   54     54   
    ::aws_smithy_schema::ShapeType::Short,
   55         -
    "short_in_path",
          55  +
    "shortInPath",
   56     56   
    1,
   57     57   
)
   58     58   
.with_http_label();
   59     59   
static MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_QUERY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   60     60   
    ::aws_smithy_schema::ShapeId::from_static(
   61     61   
        "aws.protocoltests.restjson.synthetic#MalformedShortInput$shortInQuery",
   62     62   
        "aws.protocoltests.restjson.synthetic",
   63     63   
        "MalformedShortInput",
   64     64   
    ),
   65     65   
    ::aws_smithy_schema::ShapeType::Short,
   66         -
    "short_in_query",
          66  +
    "shortInQuery",
   67     67   
    2,
   68     68   
)
   69     69   
.with_http_query("shortInQuery");
   70     70   
static MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_HEADER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   71     71   
    ::aws_smithy_schema::ShapeId::from_static(
   72     72   
        "aws.protocoltests.restjson.synthetic#MalformedShortInput$shortInHeader",
   73     73   
        "aws.protocoltests.restjson.synthetic",
   74     74   
        "MalformedShortInput",
   75     75   
    ),
   76     76   
    ::aws_smithy_schema::ShapeType::Short,
   77         -
    "short_in_header",
          77  +
    "shortInHeader",
   78     78   
    3,
   79     79   
)
   80     80   
.with_http_header("shortInHeader");
   81     81   
static MALFORMEDSHORTINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   82     82   
    MALFORMEDSHORTINPUT_SCHEMA_ID,
   83     83   
    ::aws_smithy_schema::ShapeType::Structure,
   84     84   
    &[
   85     85   
        &MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_BODY,
   86     86   
        &MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_PATH,
   87     87   
        &MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_QUERY,
   88     88   
        &MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_HEADER,
   89     89   
    ],
   90         -
);
          90  +
)
          91  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/MalformedShort/{shortInPath}", None));
   91     92   
impl MalformedShortInput {
   92     93   
    /// The schema for this shape.
   93     94   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MALFORMEDSHORTINPUT_SCHEMA;
   94     95   
}
   95     96   
impl ::aws_smithy_schema::serde::SerializableStruct for MalformedShortInput {
   96     97   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   97     98   
    fn serialize_members(
   98     99   
        &self,
   99    100   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  100    101   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  101    102   
        if let Some(ref val) = self.short_in_body {
  102    103   
            ser.write_short(&MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_BODY, *val)?;
  103    104   
        }
  104    105   
        if let Some(ref val) = self.short_in_path {
  105    106   
            ser.write_short(&MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_PATH, *val)?;
  106    107   
        }
  107    108   
        if let Some(ref val) = self.short_in_query {
  108    109   
            ser.write_short(&MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_QUERY, *val)?;
  109    110   
        }
  110    111   
        if let Some(ref val) = self.short_in_header {
  111    112   
            ser.write_short(&MALFORMEDSHORTINPUT_MEMBER_SHORT_IN_HEADER, *val)?;
  112    113   
        }
  113    114   
        Ok(())
  114    115   
    }
  115    116   
}
  116    117   
impl MalformedShortInput {
  117    118   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  118         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  119         -
        deserializer: &mut D,
         119  +
    pub fn deserialize(
         120  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  120    121   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  121    122   
        #[allow(unused_variables, unused_mut)]
  122    123   
        let mut builder = Self::builder();
  123    124   
        #[allow(
  124    125   
            unused_variables,
  125    126   
            unreachable_code,
  126    127   
            clippy::single_match,
  127    128   
            clippy::match_single_binding,
  128    129   
            clippy::diverging_sub_expression
  129    130   
        )]
  130         -
        deserializer.read_struct(&MALFORMEDSHORTINPUT_SCHEMA, (), |_, member, deser| {
         131  +
        deserializer.read_struct(&MALFORMEDSHORTINPUT_SCHEMA, &mut |member, deser| {
  131    132   
            match member.member_index() {
  132    133   
                Some(0) => {
  133    134   
                    builder.short_in_body = Some(deser.read_short(member)?);
  134    135   
                }
  135    136   
                Some(1) => {
  136    137   
                    builder.short_in_path = Some(deser.read_short(member)?);
  137    138   
                }
  138    139   
                Some(2) => {
  139    140   
                    builder.short_in_query = Some(deser.read_short(member)?);
  140    141   
                }
  141    142   
                Some(3) => {
  142    143   
                    builder.short_in_header = Some(deser.read_short(member)?);
  143    144   
                }
  144    145   
                _ => {}
  145    146   
            }
  146    147   
            Ok(())
  147    148   
        })?;
         149  +
        builder.short_in_path = builder.short_in_path.or(Some(0i16));
         150  +
        builder
         151  +
            .build()
         152  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         153  +
    }
         154  +
}
         155  +
impl MalformedShortInput {
         156  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         157  +
    /// Header-bound members are read directly from headers, avoiding runtime
         158  +
    /// member iteration overhead. Body members are read via the deserializer.
         159  +
    pub fn deserialize_with_response(
         160  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         161  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         162  +
        _status: u16,
         163  +
        _body: &[u8],
         164  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         165  +
        #[allow(unused_variables, unused_mut)]
         166  +
        let mut builder = Self::builder();
         167  +
        if let Some(val) = headers.get("shortInHeader") {
         168  +
            builder.short_in_header = val.parse::<i16>().ok();
         169  +
        }
         170  +
        #[allow(
         171  +
            unused_variables,
         172  +
            unreachable_code,
         173  +
            clippy::single_match,
         174  +
            clippy::match_single_binding,
         175  +
            clippy::diverging_sub_expression
         176  +
        )]
         177  +
        deserializer.read_struct(&MALFORMEDSHORTINPUT_SCHEMA, &mut |member, deser| {
         178  +
            match member.member_index() {
         179  +
                Some(0) => {
         180  +
                    builder.short_in_body = Some(deser.read_short(member)?);
         181  +
                }
         182  +
                Some(1) => {
         183  +
                    builder.short_in_path = Some(deser.read_short(member)?);
         184  +
                }
         185  +
                Some(2) => {
         186  +
                    builder.short_in_query = Some(deser.read_short(member)?);
         187  +
                }
         188  +
                Some(3) => { /* read from headers above */ }
         189  +
                _ => {}
         190  +
            }
         191  +
            Ok(())
         192  +
        })?;
  148    193   
        builder
  149    194   
            .build()
  150    195   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  151    196   
    }
  152    197   
}
  153    198   
impl MalformedShortInput {
  154    199   
    /// Creates a new builder-style object to manufacture [`MalformedShortInput`](crate::operation::malformed_short::MalformedShortInput).
  155    200   
    pub fn builder() -> crate::operation::malformed_short::builders::MalformedShortInputBuilder {
  156    201   
        crate::operation::malformed_short::builders::MalformedShortInputBuilder::default()
  157    202   
    }

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

@@ -1,1 +65,76 @@
   18     18   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   19     19   
    fn serialize_members(
   20     20   
        &self,
   21     21   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   22     22   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   23     23   
        Ok(())
   24     24   
    }
   25     25   
}
   26     26   
impl MalformedShortOutput {
   27     27   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   28         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   29         -
        deserializer: &mut D,
          28  +
    pub fn deserialize(
          29  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   30     30   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   31     31   
        #[allow(unused_variables, unused_mut)]
   32     32   
        let mut builder = Self::builder();
   33     33   
        #[allow(
   34     34   
            unused_variables,
   35     35   
            unreachable_code,
   36     36   
            clippy::single_match,
   37     37   
            clippy::match_single_binding,
   38     38   
            clippy::diverging_sub_expression
   39     39   
        )]
   40         -
        deserializer.read_struct(&MALFORMEDSHORTOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDSHORTOUTPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        Ok(builder.build())
   47     47   
    }
   48     48   
}
          49  +
impl MalformedShortOutput {
          50  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          51  +
    pub fn deserialize_with_response(
          52  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          53  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          54  +
        _status: u16,
          55  +
        _body: &[u8],
          56  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          57  +
        Ok(Self::builder().build())
          58  +
    }
          59  +
}
   49     60   
impl MalformedShortOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedShortOutput`](crate::operation::malformed_short::MalformedShortOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_short::builders::MalformedShortOutputBuilder {
   52     63   
        crate::operation::malformed_short::builders::MalformedShortOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedShortOutput`](crate::operation::malformed_short::MalformedShortOutput).
   57     68   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   58     69   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_string.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 `MalformedString`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedString;
    6      6   
impl MalformedString {
    7      7   
    /// Creates a new `MalformedString`
    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::malformed_string::MalformedStringInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_string::MalformedStringOutput::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::malformed_string::MalformedStringInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::malformed_string::MalformedStringOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::malformed_string::MalformedStringError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +229,271 @@
  130    134   
                crate::operation::malformed_string::MalformedStringError,
  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 MalformedStringResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedStringResponseDeserializer {
  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());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    150   
        #[allow(unused_mut)]
  148    151   
        let mut force_error = false;
  149    152   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_malformed_string::de_malformed_string_http_error(status, headers, body)
         153  +
        if !success && status != 200 || force_error {
         154  +
            let headers = response.headers();
         155  +
            let body = response.body().bytes().expect("body loaded");
         156  +
            #[allow(unused_mut)]
         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  +
            })?;
         160  +
         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::malformed_string::MalformedStringError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_malformed_string::de_malformed_string_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, MalformedString::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::malformed_string::MalformedStringOutput::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 MalformedStringRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedStringRequestSerializer {
  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::malformed_string::MalformedStringInput>()
  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::malformed_string::MalformedStringInput,
  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, "/MalformedString").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::malformed_string::MalformedStringInput,
  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_malformed_string::ser_malformed_string_headers(input, builder)?;
  192         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        if protocol.supports_http_bindings() {
         206  +
            let mut request = protocol
         207  +
                .serialize_body(&input, MalformedString::INPUT_SCHEMA, "", _cfg)
         208  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         209  +
            {
         210  +
                let mut uri = "/MalformedString".to_string();
         211  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         212  +
                if let Some(ref val) = input.blob {
         213  +
                    request
         214  +
                        .headers_mut()
         215  +
                        .insert("amz-media-typed-header", ::aws_smithy_types::base64::encode(val.as_bytes()));
         216  +
                }
         217  +
                if !query_params.is_empty() {
         218  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         219  +
                    let pairs: Vec<String> = query_params
         220  +
                        .iter()
         221  +
                        .map(|(k, v)| {
         222  +
                            format!(
         223  +
                                "{}={}",
         224  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         225  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         226  +
                            )
         227  +
                        })
         228  +
                        .collect();
         229  +
                    uri.push_str(&pairs.join("&"));
         230  +
                }
         231  +
                request.set_uri(uri.as_str()).expect("valid URI");
  193    232   
            }
  194         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  198    233   
  199         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         234  +
            return ::std::result::Result::Ok(request);
         235  +
        } else {
         236  +
            let mut request = protocol
         237  +
                .serialize_request(&input, MalformedString::INPUT_SCHEMA, "", _cfg)
         238  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         239  +
         240  +
            return ::std::result::Result::Ok(request);
         241  +
        }
  200    242   
    }
  201    243   
}
  202    244   
#[derive(Debug)]
  203    245   
struct MalformedStringEndpointParamsInterceptor;
  204    246   
  205    247   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedStringEndpointParamsInterceptor {
  206    248   
    fn name(&self) -> &'static str {
  207    249   
        "MalformedStringEndpointParamsInterceptor"
  208    250   
    }
  209    251