Client Test

Client Test

rev. ec7b2441254af868911fccffe8d8dca83aff0045

Files changed:

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

@@ -1,1 +40,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `MalformedTimestampQueryEpoch`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedTimestampQueryEpoch;
    6      6   
impl MalformedTimestampQueryEpoch {
    7      7   
    /// Creates a new `MalformedTimestampQueryEpoch`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          13  +
        crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochOutput::SCHEMA;
   11     17   
    pub(crate) async fn orchestrate(
   12     18   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     19   
        input: crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +244,274 @@
  130    136   
                crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochError,
  131    137   
            >::new());
  132    138   
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct MalformedTimestampQueryEpochResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedTimestampQueryEpochResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        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    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_malformed_timestamp_query_epoch::de_malformed_timestamp_query_epoch_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_malformed_timestamp_query_epoch::de_malformed_timestamp_query_epoch_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, MalformedTimestampQueryEpoch::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
         184  +
            )
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  156    190   
    }
  157    191   
}
  158    192   
#[derive(Debug)]
  159    193   
struct MalformedTimestampQueryEpochRequestSerializer;
  160    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedTimestampQueryEpochRequestSerializer {
  161    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    196   
    fn serialize_input(
  163    197   
        &self,
  164    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    201   
        let input = input
  168    202   
            .downcast::<crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochInput>()
  169    203   
            .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_timestamp_query_epoch::MalformedTimestampQueryEpochInput,
  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, "/MalformedTimestampQueryEpoch").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            fn uri_query(
  185         -
                _input: &crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochInput,
  186         -
                mut output: &mut ::std::string::String,
  187         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  188         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  189         -
                let inner_1 = &_input.timestamp;
  190         -
                let inner_1 = inner_1
  191         -
                    .as_ref()
  192         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("timestamp", "cannot be empty or unset"))?;
  193         -
                query.push_kv(
  194         -
                    "timestamp",
  195         -
                    &::aws_smithy_http::query::fmt_timestamp(inner_1, ::aws_smithy_types::date_time::Format::EpochSeconds)?,
  196         -
                );
  197         -
                ::std::result::Result::Ok(())
  198         -
            }
  199         -
            #[allow(clippy::unnecessary_wraps)]
  200         -
            fn update_http_builder(
  201         -
                input: &crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochInput,
  202         -
                builder: ::http_1x::request::Builder,
  203         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  204         -
                let mut uri = ::std::string::String::new();
  205         -
                uri_base(input, &mut uri)?;
  206         -
                uri_query(input, &mut uri)?;
  207         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        if protocol.supports_http_bindings() {
         208  +
            let mut request = protocol
         209  +
                .serialize_body(&input, MalformedTimestampQueryEpoch::INPUT_SCHEMA, "", _cfg)
         210  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         211  +
            {
         212  +
                let mut uri = "/MalformedTimestampQueryEpoch".to_string();
         213  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         214  +
                if let Some(ref val) = input.timestamp {
         215  +
                    query_params.push((
         216  +
                        "timestamp".to_string(),
         217  +
                        val.fmt(::aws_smithy_types::date_time::Format::EpochSeconds).expect("valid timestamp"),
         218  +
                    ));
         219  +
                }
         220  +
                if !query_params.is_empty() {
         221  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         222  +
                    let pairs: Vec<String> = query_params
         223  +
                        .iter()
         224  +
                        .map(|(k, v)| {
         225  +
                            format!(
         226  +
                                "{}={}",
         227  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         228  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         229  +
                            )
         230  +
                        })
         231  +
                        .collect();
         232  +
                    uri.push_str(&pairs.join("&"));
         233  +
                }
         234  +
                request.set_uri(uri.as_str()).expect("valid URI");
  208    235   
            }
  209         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  210         -
            builder
  211         -
        };
  212         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  213    236   
  214         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         237  +
            return ::std::result::Result::Ok(request);
         238  +
        } else {
         239  +
            let mut request = protocol
         240  +
                .serialize_request(&input, MalformedTimestampQueryEpoch::INPUT_SCHEMA, "", _cfg)
         241  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         242  +
         243  +
            return ::std::result::Result::Ok(request);
         244  +
        }
  215    245   
    }
  216    246   
}
  217    247   
#[derive(Debug)]
  218    248   
struct MalformedTimestampQueryEpochEndpointParamsInterceptor;
  219    249   
  220    250   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedTimestampQueryEpochEndpointParamsInterceptor {
  221    251   
    fn name(&self) -> &'static str {
  222    252   
        "MalformedTimestampQueryEpochEndpointParamsInterceptor"
  223    253   
    }
  224    254   

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

@@ -6,6 +110,123 @@
   26     26   
    ::aws_smithy_schema::ShapeType::Timestamp,
   27     27   
    "timestamp",
   28     28   
    0,
   29     29   
)
   30     30   
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::EpochSeconds)
   31     31   
.with_http_query("timestamp");
   32     32   
static MALFORMEDTIMESTAMPQUERYEPOCHINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   33     33   
    MALFORMEDTIMESTAMPQUERYEPOCHINPUT_SCHEMA_ID,
   34     34   
    ::aws_smithy_schema::ShapeType::Structure,
   35     35   
    &[&MALFORMEDTIMESTAMPQUERYEPOCHINPUT_MEMBER_TIMESTAMP],
   36         -
);
          36  +
)
          37  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/MalformedTimestampQueryEpoch", None));
   37     38   
impl MalformedTimestampQueryEpochInput {
   38     39   
    /// The schema for this shape.
   39     40   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MALFORMEDTIMESTAMPQUERYEPOCHINPUT_SCHEMA;
   40     41   
}
   41     42   
impl ::aws_smithy_schema::serde::SerializableStruct for MalformedTimestampQueryEpochInput {
   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.timestamp {
   48     49   
            ser.write_timestamp(&MALFORMEDTIMESTAMPQUERYEPOCHINPUT_MEMBER_TIMESTAMP, val)?;
   49     50   
        }
   50     51   
        Ok(())
   51     52   
    }
   52     53   
}
   53     54   
impl MalformedTimestampQueryEpochInput {
   54     55   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   55         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   56         -
        deserializer: &mut D,
          56  +
    pub fn deserialize(
          57  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   57     58   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   58     59   
        #[allow(unused_variables, unused_mut)]
   59     60   
        let mut builder = Self::builder();
   60     61   
        #[allow(
   61     62   
            unused_variables,
   62     63   
            unreachable_code,
   63     64   
            clippy::single_match,
   64     65   
            clippy::match_single_binding,
   65     66   
            clippy::diverging_sub_expression
   66     67   
        )]
   67         -
        deserializer.read_struct(&MALFORMEDTIMESTAMPQUERYEPOCHINPUT_SCHEMA, (), |_, member, deser| {
          68  +
        deserializer.read_struct(&MALFORMEDTIMESTAMPQUERYEPOCHINPUT_SCHEMA, &mut |member, deser| {
   68     69   
            match member.member_index() {
   69     70   
                Some(0) => {
   70     71   
                    builder.timestamp = Some(deser.read_timestamp(member)?);
   71     72   
                }
   72     73   
                _ => {}
   73     74   
            }
   74     75   
            Ok(())
   75     76   
        })?;
          77  +
        builder.timestamp = builder.timestamp.or(Some(::aws_smithy_types::DateTime::from_secs(0)));
   76     78   
        builder
   77     79   
            .build()
   78     80   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   79     81   
    }
   80     82   
}
          83  +
impl MalformedTimestampQueryEpochInput {
          84  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          85  +
    pub fn deserialize_with_response(
          86  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          87  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          88  +
        _status: u16,
          89  +
        _body: &[u8],
          90  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          91  +
        Self::deserialize(deserializer)
          92  +
    }
          93  +
}
   81     94   
impl MalformedTimestampQueryEpochInput {
   82     95   
    /// Creates a new builder-style object to manufacture [`MalformedTimestampQueryEpochInput`](crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochInput).
   83     96   
    pub fn builder() -> crate::operation::malformed_timestamp_query_epoch::builders::MalformedTimestampQueryEpochInputBuilder {
   84     97   
        crate::operation::malformed_timestamp_query_epoch::builders::MalformedTimestampQueryEpochInputBuilder::default()
   85     98   
    }
   86     99   
}
   87    100   
   88    101   
/// A builder for [`MalformedTimestampQueryEpochInput`](crate::operation::malformed_timestamp_query_epoch::MalformedTimestampQueryEpochInput).
   89    102   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   90    103   
#[non_exhaustive]

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

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

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

@@ -1,1 +40,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `MalformedTimestampQueryHttpDate`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedTimestampQueryHttpDate;
    6      6   
impl MalformedTimestampQueryHttpDate {
    7      7   
    /// Creates a new `MalformedTimestampQueryHttpDate`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          13  +
        crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput::SCHEMA;
   11     17   
    pub(crate) async fn orchestrate(
   12     18   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     19   
        input: crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +246,274 @@
  130    136   
                crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError,
  131    137   
            >::new());
  132    138   
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct MalformedTimestampQueryHttpDateResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedTimestampQueryHttpDateResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        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    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_malformed_timestamp_query_http_date::de_malformed_timestamp_query_http_date_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_malformed_timestamp_query_http_date::de_malformed_timestamp_query_http_date_http_response(
  154         -
                status, headers, body,
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, MalformedTimestampQueryHttpDate::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
  155    184   
            )
  156         -
        };
  157         -
        crate::protocol_serde::type_erase_result(parse_result)
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  158    190   
    }
  159    191   
}
  160    192   
#[derive(Debug)]
  161    193   
struct MalformedTimestampQueryHttpDateRequestSerializer;
  162    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedTimestampQueryHttpDateRequestSerializer {
  163    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  164    196   
    fn serialize_input(
  165    197   
        &self,
  166    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  167    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  168    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  169    201   
        let input = input
  170    202   
            .downcast::<crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput>()
  171    203   
            .expect("correct type");
  172         -
        let _header_serialization_settings = _cfg
  173         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  174         -
            .cloned()
  175         -
            .unwrap_or_default();
  176         -
        let mut request_builder = {
  177         -
            #[allow(clippy::uninlined_format_args)]
  178         -
            fn uri_base(
  179         -
                _input: &crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput,
  180         -
                output: &mut ::std::string::String,
  181         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  182         -
                use ::std::fmt::Write as _;
  183         -
                ::std::write!(output, "/MalformedTimestampQueryHttpDate").expect("formatting should succeed");
  184         -
                ::std::result::Result::Ok(())
  185         -
            }
  186         -
            fn uri_query(
  187         -
                _input: &crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput,
  188         -
                mut output: &mut ::std::string::String,
  189         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  190         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  191         -
                let inner_1 = &_input.timestamp;
  192         -
                let inner_1 = inner_1
  193         -
                    .as_ref()
  194         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("timestamp", "cannot be empty or unset"))?;
  195         -
                query.push_kv(
  196         -
                    "timestamp",
  197         -
                    &::aws_smithy_http::query::fmt_timestamp(inner_1, ::aws_smithy_types::date_time::Format::HttpDate)?,
  198         -
                );
  199         -
                ::std::result::Result::Ok(())
  200         -
            }
  201         -
            #[allow(clippy::unnecessary_wraps)]
  202         -
            fn update_http_builder(
  203         -
                input: &crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput,
  204         -
                builder: ::http_1x::request::Builder,
  205         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  206         -
                let mut uri = ::std::string::String::new();
  207         -
                uri_base(input, &mut uri)?;
  208         -
                uri_query(input, &mut uri)?;
  209         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        if protocol.supports_http_bindings() {
         208  +
            let mut request = protocol
         209  +
                .serialize_body(&input, MalformedTimestampQueryHttpDate::INPUT_SCHEMA, "", _cfg)
         210  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         211  +
            {
         212  +
                let mut uri = "/MalformedTimestampQueryHttpDate".to_string();
         213  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         214  +
                if let Some(ref val) = input.timestamp {
         215  +
                    query_params.push((
         216  +
                        "timestamp".to_string(),
         217  +
                        val.fmt(::aws_smithy_types::date_time::Format::HttpDate).expect("valid timestamp"),
         218  +
                    ));
         219  +
                }
         220  +
                if !query_params.is_empty() {
         221  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         222  +
                    let pairs: Vec<String> = query_params
         223  +
                        .iter()
         224  +
                        .map(|(k, v)| {
         225  +
                            format!(
         226  +
                                "{}={}",
         227  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         228  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         229  +
                            )
         230  +
                        })
         231  +
                        .collect();
         232  +
                    uri.push_str(&pairs.join("&"));
         233  +
                }
         234  +
                request.set_uri(uri.as_str()).expect("valid URI");
  210    235   
            }
  211         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  212         -
            builder
  213         -
        };
  214         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  215    236   
  216         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         237  +
            return ::std::result::Result::Ok(request);
         238  +
        } else {
         239  +
            let mut request = protocol
         240  +
                .serialize_request(&input, MalformedTimestampQueryHttpDate::INPUT_SCHEMA, "", _cfg)
         241  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         242  +
         243  +
            return ::std::result::Result::Ok(request);
         244  +
        }
  217    245   
    }
  218    246   
}
  219    247   
#[derive(Debug)]
  220    248   
struct MalformedTimestampQueryHttpDateEndpointParamsInterceptor;
  221    249   
  222    250   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedTimestampQueryHttpDateEndpointParamsInterceptor {
  223    251   
    fn name(&self) -> &'static str {
  224    252   
        "MalformedTimestampQueryHttpDateEndpointParamsInterceptor"
  225    253   
    }
  226    254   

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

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

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

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_union.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 `MalformedUnion`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedUnion;
    6      6   
impl MalformedUnion {
    7      7   
    /// Creates a new `MalformedUnion`
    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_union::MalformedUnionInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_union::MalformedUnionOutput::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_union::MalformedUnionInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::malformed_union::MalformedUnionOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::malformed_union::MalformedUnionError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +226,233 @@
  124    128   
                crate::operation::malformed_union::MalformedUnionError,
  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 MalformedUnionResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedUnionResponseDeserializer {
  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_union::de_malformed_union_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_union::MalformedUnionError::generic(generic),
         159  +
                ),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_malformed_union::de_malformed_union_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, MalformedUnion::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_union::MalformedUnionOutput::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 MalformedUnionRequestSerializer;
  154    186   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedUnionRequestSerializer {
  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_union::MalformedUnionInput>()
  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_union::MalformedUnionInput,
  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, "/MalformedUnion").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_union::MalformedUnionInput,
  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_union::ser_malformed_union_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())
         196  +
        let protocol = _cfg
         197  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         198  +
            .expect("a SharedClientProtocol is required");
         199  +
        let mut request = protocol
         200  +
            .serialize_request(&input, MalformedUnion::INPUT_SCHEMA, "", _cfg)
         201  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         202  +
         203  +
        return ::std::result::Result::Ok(request);
  197    204   
    }
  198    205   
}
  199    206   
#[derive(Debug)]
  200    207   
struct MalformedUnionEndpointParamsInterceptor;
  201    208   
  202    209   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedUnionEndpointParamsInterceptor {
  203    210   
    fn name(&self) -> &'static str {
  204    211   
        "MalformedUnionEndpointParamsInterceptor"
  205    212   
    }
  206    213   

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

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_union/_malformed_union_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 MalformedUnionOutput {
   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(&MALFORMEDUNIONOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDUNIONOUTPUT_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 MalformedUnionOutput {
          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 MalformedUnionOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedUnionOutput`](crate::operation::malformed_union::MalformedUnionOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_union::builders::MalformedUnionOutputBuilder {
   52     63   
        crate::operation::malformed_union::builders::MalformedUnionOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedUnionOutput`](crate::operation::malformed_union::MalformedUnionOutput).
   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/media_type_header.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 `MediaTypeHeader`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MediaTypeHeader;
    6      6   
impl MediaTypeHeader {
    7      7   
    /// Creates a new `MediaTypeHeader`
    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::media_type_header::MediaTypeHeaderInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::media_type_header::MediaTypeHeaderOutput::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::media_type_header::MediaTypeHeaderInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::media_type_header::MediaTypeHeaderOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::media_type_header::MediaTypeHeaderError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +229,269 @@
  130    134   
                crate::operation::media_type_header::MediaTypeHeaderError,
  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 MediaTypeHeaderResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MediaTypeHeaderResponseDeserializer {
  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_media_type_header::de_media_type_header_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::media_type_header::MediaTypeHeaderError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_media_type_header::de_media_type_header_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, MediaTypeHeader::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::media_type_header::MediaTypeHeaderOutput::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 MediaTypeHeaderRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MediaTypeHeaderRequestSerializer {
  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::media_type_header::MediaTypeHeaderInput>()
  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::media_type_header::MediaTypeHeaderInput,
  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, "/MediaTypeHeader").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::media_type_header::MediaTypeHeaderInput,
  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_media_type_header::ser_media_type_header_headers(input, builder)?;
  192         -
                ::std::result::Result::Ok(builder.method("GET").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, MediaTypeHeader::INPUT_SCHEMA, "", _cfg)
         208  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         209  +
            {
         210  +
                let mut uri = "/MediaTypeHeader".to_string();
         211  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         212  +
                if let Some(ref val) = input.json {
         213  +
                    request.headers_mut().insert("X-Json", ::aws_smithy_types::base64::encode(val.as_bytes()));
         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");
  193    230   
            }
  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    231   
  199         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         232  +
            return ::std::result::Result::Ok(request);
         233  +
        } else {
         234  +
            let mut request = protocol
         235  +
                .serialize_request(&input, MediaTypeHeader::INPUT_SCHEMA, "", _cfg)
         236  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         237  +
         238  +
            return ::std::result::Result::Ok(request);
         239  +
        }
  200    240   
    }
  201    241   
}
  202    242   
#[derive(Debug)]
  203    243   
struct MediaTypeHeaderEndpointParamsInterceptor;
  204    244   
  205    245   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MediaTypeHeaderEndpointParamsInterceptor {
  206    246   
    fn name(&self) -> &'static str {
  207    247   
        "MediaTypeHeaderEndpointParamsInterceptor"
  208    248   
    }
  209    249   
@@ -275,315 +335,385 @@
  295    335   
            .expect("the config must have a deserializer");
  296    336   
  297    337   
        let parsed = de.deserialize_streaming(&mut http_response);
  298    338   
        let parsed = parsed.unwrap_or_else(|| {
  299    339   
            let http_response = http_response.map(|body| {
  300    340   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  301    341   
                    body.bytes().unwrap(),
  302    342   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  303    343   
                )))
  304    344   
            });
  305         -
            de.deserialize_nonstreaming(&http_response)
         345  +
            // Build a config bag with the protocol for schema-based deserialization
         346  +
            #[allow(unused_mut)]
         347  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         348  +
            {
         349  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         350  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         351  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         352  +
                ));
         353  +
                test_cfg.push_shared_layer(layer.freeze());
         354  +
            }
         355  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  306    356   
        });
  307    357   
        let parsed = parsed
  308    358   
            .expect("should be successful response")
  309    359   
            .downcast::<crate::operation::media_type_header::MediaTypeHeaderOutput>()
  310    360   
            .unwrap();
  311    361   
        ::pretty_assertions::assert_eq!(parsed.json, expected_output.json, "Unexpected value for `json`");
  312    362   
    }
  313    363   
}
  314    364   
  315    365   
/// Error type for the `MediaTypeHeaderError` operation.

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

@@ -5,5 +109,130 @@
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::String,
   27     27   
    "json",
   28     28   
    0,
   29     29   
)
   30     30   
.with_http_header("X-Json");
   31     31   
static MEDIATYPEHEADERINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   32     32   
    MEDIATYPEHEADERINPUT_SCHEMA_ID,
   33     33   
    ::aws_smithy_schema::ShapeType::Structure,
   34     34   
    &[&MEDIATYPEHEADERINPUT_MEMBER_JSON],
   35         -
);
          35  +
)
          36  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/MediaTypeHeader", None));
   36     37   
impl MediaTypeHeaderInput {
   37     38   
    /// The schema for this shape.
   38     39   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MEDIATYPEHEADERINPUT_SCHEMA;
   39     40   
}
   40     41   
impl ::aws_smithy_schema::serde::SerializableStruct for MediaTypeHeaderInput {
   41     42   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   42     43   
    fn serialize_members(
   43     44   
        &self,
   44     45   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   45     46   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   46     47   
        if let Some(ref val) = self.json {
   47     48   
            ser.write_string(&MEDIATYPEHEADERINPUT_MEMBER_JSON, val)?;
   48     49   
        }
   49     50   
        Ok(())
   50     51   
    }
   51     52   
}
   52     53   
impl MediaTypeHeaderInput {
   53     54   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   54         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   55         -
        deserializer: &mut D,
          55  +
    pub fn deserialize(
          56  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   56     57   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   57     58   
        #[allow(unused_variables, unused_mut)]
   58     59   
        let mut builder = Self::builder();
   59     60   
        #[allow(
   60     61   
            unused_variables,
   61     62   
            unreachable_code,
   62     63   
            clippy::single_match,
   63     64   
            clippy::match_single_binding,
   64     65   
            clippy::diverging_sub_expression
   65     66   
        )]
   66         -
        deserializer.read_struct(&MEDIATYPEHEADERINPUT_SCHEMA, (), |_, member, deser| {
          67  +
        deserializer.read_struct(&MEDIATYPEHEADERINPUT_SCHEMA, &mut |member, deser| {
   67     68   
            match member.member_index() {
   68     69   
                Some(0) => {
   69     70   
                    builder.json = Some(deser.read_string(member)?);
   70     71   
                }
   71     72   
                _ => {}
   72     73   
            }
   73     74   
            Ok(())
   74     75   
        })?;
   75     76   
        builder
   76     77   
            .build()
   77     78   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   78     79   
    }
   79     80   
}
          81  +
impl MediaTypeHeaderInput {
          82  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
          83  +
    /// Header-bound members are read directly from headers, avoiding runtime
          84  +
    /// member iteration overhead. Body members are read via the deserializer.
          85  +
    pub fn deserialize_with_response(
          86  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          87  +
        headers: &::aws_smithy_runtime_api::http::Headers,
          88  +
        _status: u16,
          89  +
        _body: &[u8],
          90  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          91  +
        #[allow(unused_variables, unused_mut)]
          92  +
        let mut builder = Self::builder();
          93  +
        if let Some(val) = headers.get("X-Json") {
          94  +
            builder.json = ::aws_smithy_types::base64::decode(val).ok().and_then(|b| String::from_utf8(b).ok());
          95  +
        }
          96  +
        builder
          97  +
            .build()
          98  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          99  +
    }
         100  +
}
   80    101   
impl MediaTypeHeaderInput {
   81    102   
    /// Creates a new builder-style object to manufacture [`MediaTypeHeaderInput`](crate::operation::media_type_header::MediaTypeHeaderInput).
   82    103   
    pub fn builder() -> crate::operation::media_type_header::builders::MediaTypeHeaderInputBuilder {
   83    104   
        crate::operation::media_type_header::builders::MediaTypeHeaderInputBuilder::default()
   84    105   
    }
   85    106   
}
   86    107   
   87    108   
/// A builder for [`MediaTypeHeaderInput`](crate::operation::media_type_header::MediaTypeHeaderInput).
   88    109   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   89    110   
#[non_exhaustive]

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

@@ -24,24 +107,125 @@
   44     44   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   45     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   46     46   
        if let Some(ref val) = self.json {
   47     47   
            ser.write_string(&MEDIATYPEHEADEROUTPUT_MEMBER_JSON, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl MediaTypeHeaderOutput {
   53     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   54         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   55         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   56     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   57     57   
        #[allow(unused_variables, unused_mut)]
   58     58   
        let mut builder = Self::builder();
   59     59   
        #[allow(
   60     60   
            unused_variables,
   61     61   
            unreachable_code,
   62     62   
            clippy::single_match,
   63     63   
            clippy::match_single_binding,
   64     64   
            clippy::diverging_sub_expression
   65     65   
        )]
   66         -
        deserializer.read_struct(&MEDIATYPEHEADEROUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&MEDIATYPEHEADEROUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69     69   
                    builder.json = Some(deser.read_string(member)?);
   70     70   
                }
   71     71   
                _ => {}
   72     72   
            }
   73     73   
            Ok(())
   74     74   
        })?;
   75     75   
        Ok(builder.build())
   76     76   
    }
   77     77   
}
          78  +
impl MediaTypeHeaderOutput {
          79  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
          80  +
    /// Header-bound members are read directly from headers, avoiding runtime
          81  +
    /// member iteration overhead. Body members are read via the deserializer.
          82  +
    pub fn deserialize_with_response(
          83  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        #[allow(unused_variables, unused_mut)]
          89  +
        let mut builder = Self::builder();
          90  +
        if let Some(val) = headers.get("X-Json") {
          91  +
            builder.json = ::aws_smithy_types::base64::decode(val).ok().and_then(|b| String::from_utf8(b).ok());
          92  +
        }
          93  +
        Ok(builder.build())
          94  +
    }
          95  +
}
   78     96   
impl MediaTypeHeaderOutput {
   79     97   
    /// Creates a new builder-style object to manufacture [`MediaTypeHeaderOutput`](crate::operation::media_type_header::MediaTypeHeaderOutput).
   80     98   
    pub fn builder() -> crate::operation::media_type_header::builders::MediaTypeHeaderOutputBuilder {
   81     99   
        crate::operation::media_type_header::builders::MediaTypeHeaderOutputBuilder::default()
   82    100   
    }
   83    101   
}
   84    102   
   85    103   
/// A builder for [`MediaTypeHeaderOutput`](crate::operation::media_type_header::MediaTypeHeaderOutput).
   86    104   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   87    105   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/no_input_and_no_output.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 `NoInputAndNoOutput`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct NoInputAndNoOutput;
    6      6   
impl NoInputAndNoOutput {
    7      7   
    /// Creates a new `NoInputAndNoOutput`
    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::no_input_and_no_output::NoInputAndNoOutputInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput::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::no_input_and_no_output::NoInputAndNoOutputInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::no_input_and_no_output::NoInputAndNoOutputError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +228,239 @@
  130    134   
                crate::operation::no_input_and_no_output::NoInputAndNoOutputError,
  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 NoInputAndNoOutputResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for NoInputAndNoOutputResponseDeserializer {
  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_no_input_and_no_output::de_no_input_and_no_output_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::no_input_and_no_output::NoInputAndNoOutputError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_no_input_and_no_output::de_no_input_and_no_output_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, NoInputAndNoOutput::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::no_input_and_no_output::NoInputAndNoOutputOutput::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 NoInputAndNoOutputRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for NoInputAndNoOutputRequestSerializer {
  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::no_input_and_no_output::NoInputAndNoOutputInput>()
  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::no_input_and_no_output::NoInputAndNoOutputInput,
  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, "/NoInputAndNoOutput").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::no_input_and_no_output::NoInputAndNoOutputInput,
  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
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
         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, NoInputAndNoOutput::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  197    208   
  198         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         209  +
        return ::std::result::Result::Ok(request);
  199    210   
    }
  200    211   
}
  201    212   
#[derive(Debug)]
  202    213   
struct NoInputAndNoOutputEndpointParamsInterceptor;
  203    214   
  204    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NoInputAndNoOutputEndpointParamsInterceptor {
  205    216   
    fn name(&self) -> &'static str {
  206    217   
        "NoInputAndNoOutputEndpointParamsInterceptor"
  207    218   
    }
  208    219   
@@ -269,280 +329,350 @@
  289    300   
            .expect("the config must have a deserializer");
  290    301   
  291    302   
        let parsed = de.deserialize_streaming(&mut http_response);
  292    303   
        let parsed = parsed.unwrap_or_else(|| {
  293    304   
            let http_response = http_response.map(|body| {
  294    305   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  295    306   
                    body.bytes().unwrap(),
  296    307   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  297    308   
                )))
  298    309   
            });
  299         -
            de.deserialize_nonstreaming(&http_response)
         310  +
            // Build a config bag with the protocol for schema-based deserialization
         311  +
            #[allow(unused_mut)]
         312  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         313  +
            {
         314  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         315  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         316  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         317  +
                ));
         318  +
                test_cfg.push_shared_layer(layer.freeze());
         319  +
            }
         320  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  300    321   
        });
  301    322   
        let parsed = parsed
  302    323   
            .expect("should be successful response")
  303    324   
            .downcast::<crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput>()
  304    325   
            .unwrap();
  305    326   
    }
  306    327   
}
  307    328   
  308    329   
/// Error type for the `NoInputAndNoOutputError` operation.
  309    330   
#[non_exhaustive]

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

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/no_input_and_no_output/_no_input_and_no_output_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 NoInputAndNoOutputOutput {
   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(&NOINPUTANDNOOUTPUTOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&NOINPUTANDNOOUTPUTOUTPUT_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 NoInputAndNoOutputOutput {
          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 NoInputAndNoOutputOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`NoInputAndNoOutputOutput`](crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput).
   51     62   
    pub fn builder() -> crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputOutputBuilder {
   52     63   
        crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`NoInputAndNoOutputOutput`](crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput).
   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/no_input_and_output.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 `NoInputAndOutput`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct NoInputAndOutput;
    6      6   
impl NoInputAndOutput {
    7      7   
    /// Creates a new `NoInputAndOutput`
    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::no_input_and_output::NoInputAndOutputInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::no_input_and_output::NoInputAndOutputOutput::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::no_input_and_output::NoInputAndOutputInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::no_input_and_output::NoInputAndOutputOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::no_input_and_output::NoInputAndOutputError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +228,239 @@
  130    134   
                crate::operation::no_input_and_output::NoInputAndOutputError,
  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 NoInputAndOutputResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for NoInputAndOutputResponseDeserializer {
  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_no_input_and_output::de_no_input_and_output_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::no_input_and_output::NoInputAndOutputError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_no_input_and_output::de_no_input_and_output_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, NoInputAndOutput::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::no_input_and_output::NoInputAndOutputOutput::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 NoInputAndOutputRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for NoInputAndOutputRequestSerializer {
  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::no_input_and_output::NoInputAndOutputInput>()
  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::no_input_and_output::NoInputAndOutputInput,
  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, "/NoInputAndOutputOutput").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::no_input_and_output::NoInputAndOutputInput,
  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
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  197         -
  198         -
        ::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, NoInputAndOutput::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  199    210   
    }
  200    211   
}
  201    212   
#[derive(Debug)]
  202    213   
struct NoInputAndOutputEndpointParamsInterceptor;
  203    214   
  204    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NoInputAndOutputEndpointParamsInterceptor {
  205    216   
    fn name(&self) -> &'static str {
  206    217   
        "NoInputAndOutputEndpointParamsInterceptor"
  207    218   
    }
  208    219   
@@ -269,280 +369,400 @@
  289    300   
            .expect("the config must have a deserializer");
  290    301   
  291    302   
        let parsed = de.deserialize_streaming(&mut http_response);
  292    303   
        let parsed = parsed.unwrap_or_else(|| {
  293    304   
            let http_response = http_response.map(|body| {
  294    305   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  295    306   
                    body.bytes().unwrap(),
  296    307   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  297    308   
                )))
  298    309   
            });
  299         -
            de.deserialize_nonstreaming(&http_response)
         310  +
            // Build a config bag with the protocol for schema-based deserialization
         311  +
            #[allow(unused_mut)]
         312  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         313  +
            {
         314  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         315  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         316  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         317  +
                ));
         318  +
                test_cfg.push_shared_layer(layer.freeze());
         319  +
            }
         320  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  300    321   
        });
  301    322   
        let parsed = parsed
  302    323   
            .expect("should be successful response")
  303    324   
            .downcast::<crate::operation::no_input_and_output::NoInputAndOutputOutput>()
  304    325   
            .unwrap();
  305    326   
    }
  306    327   
  307    328   
    /// This test is similar to RestJsonNoInputAndOutputWithJson, but
  308    329   
    /// it ensures that clients can gracefully handle responses that
  309    330   
    /// omit a JSON payload.
  310    331   
    /// Test ID: RestJsonNoInputAndOutputNoPayload
  311    332   
    #[::tokio::test]
  312    333   
    #[::tracing_test::traced_test]
  313    334   
    async fn rest_json_no_input_and_output_no_payload_response() {
  314    335   
        let expected_output = crate::operation::no_input_and_output::NoInputAndOutputOutput::builder().build();
  315    336   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  316    337   
            ::http_1x::response::Builder::new()
  317    338   
                .status(200)
  318    339   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  319    340   
                .unwrap(),
  320    341   
        )
  321    342   
        .unwrap();
  322    343   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  323    344   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  324    345   
  325    346   
        let op = crate::operation::no_input_and_output::NoInputAndOutput::new();
  326    347   
        let config = op.config().expect("the operation has config");
  327    348   
        let de = config
  328    349   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  329    350   
            .expect("the config must have a deserializer");
  330    351   
  331    352   
        let parsed = de.deserialize_streaming(&mut http_response);
  332    353   
        let parsed = parsed.unwrap_or_else(|| {
  333    354   
            let http_response = http_response.map(|body| {
  334    355   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  335    356   
                    body.bytes().unwrap(),
  336    357   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  337    358   
                )))
  338    359   
            });
  339         -
            de.deserialize_nonstreaming(&http_response)
         360  +
            // Build a config bag with the protocol for schema-based deserialization
         361  +
            #[allow(unused_mut)]
         362  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         363  +
            {
         364  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         365  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         366  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         367  +
                ));
         368  +
                test_cfg.push_shared_layer(layer.freeze());
         369  +
            }
         370  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  340    371   
        });
  341    372   
        let parsed = parsed
  342    373   
            .expect("should be successful response")
  343    374   
            .downcast::<crate::operation::no_input_and_output::NoInputAndOutputOutput>()
  344    375   
            .unwrap();
  345    376   
    }
  346    377   
}
  347    378   
  348    379   
/// Error type for the `NoInputAndOutputError` operation.
  349    380   
#[non_exhaustive]