Client Test

Client Test

rev. e063993ca0ab793f44c575dbe707d50a5e3e2406

Files changed:

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

@@ -1,1 +69,83 @@
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct EndpointOperationInput {}
    6      6   
static ENDPOINTOPERATIONINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#EndpointOperationInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "EndpointOperationInput",
   10     10   
);
   11     11   
static ENDPOINTOPERATIONINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(ENDPOINTOPERATIONINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(ENDPOINTOPERATIONINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/EndpointOperation", None));
   13     14   
impl EndpointOperationInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &ENDPOINTOPERATIONINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for EndpointOperationInput {
   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 EndpointOperationInput {
   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(&ENDPOINTOPERATIONINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&ENDPOINTOPERATIONINPUT_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 EndpointOperationInput {
          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 EndpointOperationInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`EndpointOperationInput`](crate::operation::endpoint_operation::EndpointOperationInput).
   53     67   
    pub fn builder() -> crate::operation::endpoint_operation::builders::EndpointOperationInputBuilder {
   54     68   
        crate::operation::endpoint_operation::builders::EndpointOperationInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`EndpointOperationInput`](crate::operation::endpoint_operation::EndpointOperationInput).
   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/endpoint_operation/_endpoint_operation_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 EndpointOperationOutput {
   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(&ENDPOINTOPERATIONOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&ENDPOINTOPERATIONOUTPUT_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 EndpointOperationOutput {
          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 EndpointOperationOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`EndpointOperationOutput`](crate::operation::endpoint_operation::EndpointOperationOutput).
   51     62   
    pub fn builder() -> crate::operation::endpoint_operation::builders::EndpointOperationOutputBuilder {
   52     63   
        crate::operation::endpoint_operation::builders::EndpointOperationOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`EndpointOperationOutput`](crate::operation::endpoint_operation::EndpointOperationOutput).
   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/endpoint_with_host_label_operation.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 `EndpointWithHostLabelOperation`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct EndpointWithHostLabelOperation;
    6      6   
impl EndpointWithHostLabelOperation {
    7      7   
    /// Creates a new `EndpointWithHostLabelOperation`
    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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationOutput::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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +236,241 @@
  130    136   
                crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationError,
  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 EndpointWithHostLabelOperationResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for EndpointWithHostLabelOperationResponseDeserializer {
  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_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_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, EndpointWithHostLabelOperation::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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationOutput::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 EndpointWithHostLabelOperationRequestSerializer;
  162    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for EndpointWithHostLabelOperationRequestSerializer {
  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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput>()
  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::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput,
  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, "/EndpointWithHostLabelOperation").expect("formatting should succeed");
  184         -
                ::std::result::Result::Ok(())
  185         -
            }
  186         -
            #[allow(clippy::unnecessary_wraps)]
  187         -
            fn update_http_builder(
  188         -
                input: &crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput,
  189         -
                builder: ::http_1x::request::Builder,
  190         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  191         -
                let mut uri = ::std::string::String::new();
  192         -
                uri_base(input, &mut uri)?;
  193         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  194         -
            }
  195         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  196         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  197         -
            builder
  198         -
        };
  199         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  200         -
            crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_input(&input)?,
  201         -
        );
  202         -
        if let Some(content_length) = body.content_length() {
  203         -
            let content_length = content_length.to_string();
  204         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  205         -
        }
  206         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        let mut request = protocol
         208  +
            .serialize_request(&input, EndpointWithHostLabelOperation::INPUT_SCHEMA, "", _cfg)
         209  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         210  +
         211  +
        return ::std::result::Result::Ok(request);
  207    212   
    }
  208    213   
}
  209    214   
#[derive(Debug)]
  210    215   
struct EndpointWithHostLabelOperationEndpointParamsInterceptor;
  211    216   
  212    217   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for EndpointWithHostLabelOperationEndpointParamsInterceptor {
  213    218   
    fn name(&self) -> &'static str {
  214    219   
        "EndpointWithHostLabelOperationEndpointParamsInterceptor"
  215    220   
    }
  216    221   

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

@@ -5,5 +109,122 @@
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::String,
   27     27   
    "label",
   28     28   
    0,
   29     29   
)
   30     30   
.with_host_label();
   31     31   
static ENDPOINTWITHHOSTLABELOPERATIONINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   32     32   
    ENDPOINTWITHHOSTLABELOPERATIONINPUT_SCHEMA_ID,
   33     33   
    ::aws_smithy_schema::ShapeType::Structure,
   34     34   
    &[&ENDPOINTWITHHOSTLABELOPERATIONINPUT_MEMBER_LABEL],
   35         -
);
          35  +
)
          36  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/EndpointWithHostLabelOperation", None));
   36     37   
impl EndpointWithHostLabelOperationInput {
   37     38   
    /// The schema for this shape.
   38     39   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &ENDPOINTWITHHOSTLABELOPERATIONINPUT_SCHEMA;
   39     40   
}
   40     41   
impl ::aws_smithy_schema::serde::SerializableStruct for EndpointWithHostLabelOperationInput {
   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.label {
   47     48   
            ser.write_string(&ENDPOINTWITHHOSTLABELOPERATIONINPUT_MEMBER_LABEL, val)?;
   48     49   
        }
   49     50   
        Ok(())
   50     51   
    }
   51     52   
}
   52     53   
impl EndpointWithHostLabelOperationInput {
   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(&ENDPOINTWITHHOSTLABELOPERATIONINPUT_SCHEMA, (), |_, member, deser| {
          67  +
        deserializer.read_struct(&ENDPOINTWITHHOSTLABELOPERATIONINPUT_SCHEMA, &mut |member, deser| {
   67     68   
            match member.member_index() {
   68     69   
                Some(0) => {
   69     70   
                    builder.label = Some(deser.read_string(member)?);
   70     71   
                }
   71     72   
                _ => {}
   72     73   
            }
   73     74   
            Ok(())
   74     75   
        })?;
          76  +
        builder.label = builder.label.or(Some(String::new()));
   75     77   
        builder
   76     78   
            .build()
   77     79   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   78     80   
    }
   79     81   
}
          82  +
impl EndpointWithHostLabelOperationInput {
          83  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          84  +
    pub fn deserialize_with_response(
          85  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          86  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          87  +
        _status: u16,
          88  +
        _body: &[u8],
          89  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          90  +
        Self::deserialize(deserializer)
          91  +
    }
          92  +
}
   80     93   
impl EndpointWithHostLabelOperationInput {
   81     94   
    /// Creates a new builder-style object to manufacture [`EndpointWithHostLabelOperationInput`](crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput).
   82     95   
    pub fn builder() -> crate::operation::endpoint_with_host_label_operation::builders::EndpointWithHostLabelOperationInputBuilder {
   83     96   
        crate::operation::endpoint_with_host_label_operation::builders::EndpointWithHostLabelOperationInputBuilder::default()
   84     97   
    }
   85     98   
}
   86     99   
   87    100   
/// A builder for [`EndpointWithHostLabelOperationInput`](crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput).
   88    101   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   89    102   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/endpoint_with_host_label_operation/_endpoint_with_host_label_operation_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 EndpointWithHostLabelOperationOutput {
   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(&ENDPOINTWITHHOSTLABELOPERATIONOUTPUT_SCHEMA, (), |_, member, deser| {
          43  +
        deserializer.read_struct(&ENDPOINTWITHHOSTLABELOPERATIONOUTPUT_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 EndpointWithHostLabelOperationOutput {
          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 EndpointWithHostLabelOperationOutput {
   53     64   
    /// Creates a new builder-style object to manufacture [`EndpointWithHostLabelOperationOutput`](crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationOutput).
   54     65   
    pub fn builder() -> crate::operation::endpoint_with_host_label_operation::builders::EndpointWithHostLabelOperationOutputBuilder {
   55     66   
        crate::operation::endpoint_with_host_label_operation::builders::EndpointWithHostLabelOperationOutputBuilder::default()
   56     67   
    }
   57     68   
}
   58     69   
   59     70   
/// A builder for [`EndpointWithHostLabelOperationOutput`](crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationOutput).
   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/fractional_seconds.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 `FractionalSeconds`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct FractionalSeconds;
    6      6   
impl FractionalSeconds {
    7      7   
    /// Creates a new `FractionalSeconds`
    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::fractional_seconds::FractionalSecondsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::fractional_seconds::FractionalSecondsOutput::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::fractional_seconds::FractionalSecondsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::fractional_seconds::FractionalSecondsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::fractional_seconds::FractionalSecondsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +228,239 @@
  130    134   
                crate::operation::fractional_seconds::FractionalSecondsError,
  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 FractionalSecondsResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for FractionalSecondsResponseDeserializer {
  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_fractional_seconds::de_fractional_seconds_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::fractional_seconds::FractionalSecondsError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_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, FractionalSeconds::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::fractional_seconds::FractionalSecondsOutput::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 FractionalSecondsRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for FractionalSecondsRequestSerializer {
  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::fractional_seconds::FractionalSecondsInput>()
  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::fractional_seconds::FractionalSecondsInput,
  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, "/FractionalSeconds").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::fractional_seconds::FractionalSecondsInput,
  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, FractionalSeconds::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 FractionalSecondsEndpointParamsInterceptor;
  203    214   
  204    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for FractionalSecondsEndpointParamsInterceptor {
  205    216   
    fn name(&self) -> &'static str {
  206    217   
        "FractionalSecondsEndpointParamsInterceptor"
  207    218   
    }
  208    219   
@@ -246,257 +306,327 @@
  266    277   
            .expect("the config must have a deserializer");
  267    278   
  268    279   
        let parsed = de.deserialize_streaming(&mut http_response);
  269    280   
        let parsed = parsed.unwrap_or_else(|| {
  270    281   
            let http_response = http_response.map(|body| {
  271    282   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  272    283   
                    body.bytes().unwrap(),
  273    284   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  274    285   
                )))
  275    286   
            });
  276         -
            de.deserialize_nonstreaming(&http_response)
         287  +
            // Build a config bag with the protocol for schema-based deserialization
         288  +
            #[allow(unused_mut)]
         289  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         290  +
            {
         291  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         292  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         293  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         294  +
                ));
         295  +
                test_cfg.push_shared_layer(layer.freeze());
         296  +
            }
         297  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  277    298   
        });
  278    299   
        let parsed = parsed
  279    300   
            .expect("should be successful response")
  280    301   
            .downcast::<crate::operation::fractional_seconds::FractionalSecondsOutput>()
  281    302   
            .unwrap();
  282    303   
        ::pretty_assertions::assert_eq!(parsed.datetime, expected_output.datetime, "Unexpected value for `datetime`");
  283    304   
    }
  284    305   
}
  285    306   
  286    307   
/// Error type for the `FractionalSecondsError` operation.

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

@@ -1,1 +69,83 @@
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct FractionalSecondsInput {}
    6      6   
static FRACTIONALSECONDSINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#FractionalSecondsInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "FractionalSecondsInput",
   10     10   
);
   11     11   
static FRACTIONALSECONDSINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(FRACTIONALSECONDSINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(FRACTIONALSECONDSINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/FractionalSeconds", None));
   13     14   
impl FractionalSecondsInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &FRACTIONALSECONDSINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for FractionalSecondsInput {
   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 FractionalSecondsInput {
   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(&FRACTIONALSECONDSINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&FRACTIONALSECONDSINPUT_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 FractionalSecondsInput {
          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 FractionalSecondsInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`FractionalSecondsInput`](crate::operation::fractional_seconds::FractionalSecondsInput).
   53     67   
    pub fn builder() -> crate::operation::fractional_seconds::builders::FractionalSecondsInputBuilder {
   54     68   
        crate::operation::fractional_seconds::builders::FractionalSecondsInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`FractionalSecondsInput`](crate::operation::fractional_seconds::FractionalSecondsInput).
   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/fractional_seconds/_fractional_seconds_output.rs

@@ -1,1 +106,118 @@
   19     19   
);
   20     20   
static FRACTIONALSECONDSOUTPUT_MEMBER_DATETIME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   21     21   
    ::aws_smithy_schema::ShapeId::from_static(
   22     22   
        "aws.protocoltests.restjson.synthetic#FractionalSecondsOutput$datetime",
   23     23   
        "aws.protocoltests.restjson.synthetic",
   24     24   
        "FractionalSecondsOutput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Timestamp,
   27     27   
    "datetime",
   28     28   
    0,
   29         -
);
          29  +
)
          30  +
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::DateTime);
   30     31   
static FRACTIONALSECONDSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     32   
    FRACTIONALSECONDSOUTPUT_SCHEMA_ID,
   32     33   
    ::aws_smithy_schema::ShapeType::Structure,
   33     34   
    &[&FRACTIONALSECONDSOUTPUT_MEMBER_DATETIME],
   34     35   
);
   35     36   
impl FractionalSecondsOutput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &FRACTIONALSECONDSOUTPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for FractionalSecondsOutput {
   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.datetime {
   46     47   
            ser.write_timestamp(&FRACTIONALSECONDSOUTPUT_MEMBER_DATETIME, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl FractionalSecondsOutput {
   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(&FRACTIONALSECONDSOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&FRACTIONALSECONDSOUTPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68     69   
                    builder.datetime = Some(deser.read_timestamp(member)?);
   69     70   
                }
   70     71   
                _ => {}
   71     72   
            }
   72     73   
            Ok(())
   73     74   
        })?;
   74     75   
        Ok(builder.build())
   75     76   
    }
   76     77   
}
          78  +
impl FractionalSecondsOutput {
          79  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          80  +
    pub fn deserialize_with_response(
          81  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          82  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          83  +
        _status: u16,
          84  +
        _body: &[u8],
          85  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          86  +
        Self::deserialize(deserializer)
          87  +
    }
          88  +
}
   77     89   
impl FractionalSecondsOutput {
   78     90   
    /// Creates a new builder-style object to manufacture [`FractionalSecondsOutput`](crate::operation::fractional_seconds::FractionalSecondsOutput).
   79     91   
    pub fn builder() -> crate::operation::fractional_seconds::builders::FractionalSecondsOutputBuilder {
   80     92   
        crate::operation::fractional_seconds::builders::FractionalSecondsOutputBuilder::default()
   81     93   
    }
   82     94   
}
   83     95   
   84     96   
/// A builder for [`FractionalSecondsOutput`](crate::operation::fractional_seconds::FractionalSecondsOutput).
   85     97   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   86     98   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/greeting_with_errors.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 `GreetingWithErrors`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct GreetingWithErrors;
    6      6   
impl GreetingWithErrors {
    7      7   
    /// Creates a new `GreetingWithErrors`
    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::greeting_with_errors::GreetingWithErrorsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::greeting_with_errors::GreetingWithErrorsOutput::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::greeting_with_errors::GreetingWithErrorsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::greeting_with_errors::GreetingWithErrorsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +228,321 @@
  130    134   
                crate::operation::greeting_with_errors::GreetingWithErrorsError,
  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 GreetingWithErrorsResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GreetingWithErrorsResponseDeserializer {
  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_greeting_with_errors::de_greeting_with_errors_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  +
            let error_code = match generic.code() {
         163  +
                ::std::option::Option::Some(code) => code,
         164  +
                ::std::option::Option::None => {
         165  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         166  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(
         167  +
                            crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled(generic),
         168  +
                        ),
         169  +
                    ))
         170  +
                }
         171  +
            };
         172  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         173  +
            let protocol = _cfg
         174  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         175  +
                .expect("a SharedClientProtocol is required");
         176  +
            let err = match error_code {
         177  +
                "InvalidGreeting" => crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting({
         178  +
                    let mut tmp = match protocol
         179  +
                        .deserialize_response(response, crate::types::error::InvalidGreeting::SCHEMA, _cfg)
         180  +
                        .and_then(|mut deser| {
         181  +
                            crate::types::error::InvalidGreeting::deserialize_with_response(
         182  +
                                &mut *deser,
         183  +
                                response.headers(),
         184  +
                                response.status().into(),
         185  +
                                body,
         186  +
                            )
         187  +
                        }) {
         188  +
                        ::std::result::Result::Ok(val) => val,
         189  +
                        ::std::result::Result::Err(e) => {
         190  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         191  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         192  +
                            ))
         193  +
                        }
         194  +
                    };
         195  +
                    tmp.meta = generic;
         196  +
                    if tmp.message.is_none() {
         197  +
                        tmp.message = _error_message;
         198  +
                    }
         199  +
                    tmp
         200  +
                }),
         201  +
                "ComplexError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError({
         202  +
                    let mut tmp = match protocol
         203  +
                        .deserialize_response(response, crate::types::error::ComplexError::SCHEMA, _cfg)
         204  +
                        .and_then(|mut deser| {
         205  +
                            crate::types::error::ComplexError::deserialize_with_response(
         206  +
                                &mut *deser,
         207  +
                                response.headers(),
         208  +
                                response.status().into(),
         209  +
                                body,
         210  +
                            )
         211  +
                        }) {
         212  +
                        ::std::result::Result::Ok(val) => val,
         213  +
                        ::std::result::Result::Err(e) => {
         214  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         215  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         216  +
                            ))
         217  +
                        }
         218  +
                    };
         219  +
                    tmp.meta = generic;
         220  +
                    if tmp.message.is_none() {
         221  +
                        tmp.message = _error_message;
         222  +
                    }
         223  +
                    tmp
         224  +
                }),
         225  +
                "FooError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError({
         226  +
                    let mut tmp = match protocol
         227  +
                        .deserialize_response(response, crate::types::error::FooError::SCHEMA, _cfg)
         228  +
                        .and_then(|mut deser| {
         229  +
                            crate::types::error::FooError::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body)
         230  +
                        }) {
         231  +
                        ::std::result::Result::Ok(val) => val,
         232  +
                        ::std::result::Result::Err(e) => {
         233  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         234  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         235  +
                            ))
         236  +
                        }
         237  +
                    };
         238  +
                    tmp.meta = generic;
         239  +
                    if tmp.message.is_none() {
         240  +
                        tmp.message = _error_message;
         241  +
                    }
         242  +
                    tmp
         243  +
                }),
         244  +
                _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic),
         245  +
            };
         246  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         247  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         248  +
            ))
  152    249   
        } else {
  153         -
            crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         250  +
            let protocol = _cfg
         251  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         252  +
                .expect("a SharedClientProtocol is required");
         253  +
            let mut deser = protocol
         254  +
                .deserialize_response(response, GreetingWithErrors::OUTPUT_SCHEMA, _cfg)
         255  +
                .map_err(|e| {
         256  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         257  +
                })?;
         258  +
            let body = response.body().bytes().expect("body loaded");
         259  +
            let output = crate::operation::greeting_with_errors::GreetingWithErrorsOutput::deserialize_with_response(
         260  +
                &mut *deser,
         261  +
                response.headers(),
         262  +
                response.status().into(),
         263  +
                body,
         264  +
            )
         265  +
            .map_err(|e| {
         266  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         267  +
            })?;
         268  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         269  +
        }
  156    270   
    }
  157    271   
}
  158    272   
#[derive(Debug)]
  159    273   
struct GreetingWithErrorsRequestSerializer;
  160    274   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GreetingWithErrorsRequestSerializer {
  161    275   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    276   
    fn serialize_input(
  163    277   
        &self,
  164    278   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    279   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    280   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    281   
        let input = input
  168    282   
            .downcast::<crate::operation::greeting_with_errors::GreetingWithErrorsInput>()
  169    283   
            .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::greeting_with_errors::GreetingWithErrorsInput,
  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, "/GreetingWithErrors").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::greeting_with_errors::GreetingWithErrorsInput,
  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("PUT").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())
         284  +
        let protocol = _cfg
         285  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         286  +
            .expect("a SharedClientProtocol is required");
         287  +
        let mut request = protocol
         288  +
            .serialize_request(&input, GreetingWithErrors::INPUT_SCHEMA, "", _cfg)
         289  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         290  +
         291  +
        return ::std::result::Result::Ok(request);
  199    292   
    }
  200    293   
}
  201    294   
#[derive(Debug)]
  202    295   
struct GreetingWithErrorsEndpointParamsInterceptor;
  203    296   
  204    297   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GreetingWithErrorsEndpointParamsInterceptor {
  205    298   
    fn name(&self) -> &'static str {
  206    299   
        "GreetingWithErrorsEndpointParamsInterceptor"
  207    300   
    }
  208    301   
@@ -247,340 +943,1186 @@
  267    360   
            .expect("the config must have a deserializer");
  268    361   
  269    362   
        let parsed = de.deserialize_streaming(&mut http_response);
  270    363   
        let parsed = parsed.unwrap_or_else(|| {
  271    364   
            let http_response = http_response.map(|body| {
  272    365   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  273    366   
                    body.bytes().unwrap(),
  274    367   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  275    368   
                )))
  276    369   
            });
  277         -
            de.deserialize_nonstreaming(&http_response)
         370  +
            // Build a config bag with the protocol for schema-based deserialization
         371  +
            #[allow(unused_mut)]
         372  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         373  +
            {
         374  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         375  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         376  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         377  +
                ));
         378  +
                test_cfg.push_shared_layer(layer.freeze());
         379  +
            }
         380  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  278    381   
        });
  279    382   
        let parsed = parsed
  280    383   
            .expect("should be successful response")
  281    384   
            .downcast::<crate::operation::greeting_with_errors::GreetingWithErrorsOutput>()
  282    385   
            .unwrap();
  283    386   
        ::pretty_assertions::assert_eq!(parsed.greeting, expected_output.greeting, "Unexpected value for `greeting`");
  284    387   
    }
  285    388   
  286    389   
    /// This test is similar to RestJsonGreetingWithErrors, but it
  287    390   
    /// ensures that clients can gracefully deal with a server
  288    391   
    /// omitting a response payload.
  289    392   
    /// Test ID: RestJsonGreetingWithErrorsNoPayload
  290    393   
    #[::tokio::test]
  291    394   
    #[::tracing_test::traced_test]
  292    395   
    async fn rest_json_greeting_with_errors_no_payload_response() {
  293    396   
        let expected_output = crate::operation::greeting_with_errors::GreetingWithErrorsOutput::builder()
  294    397   
            .set_greeting(::std::option::Option::Some("Hello".to_owned()))
  295    398   
            .build();
  296    399   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  297    400   
            ::http_1x::response::Builder::new()
  298    401   
                .header("X-Greeting", "Hello")
  299    402   
                .status(200)
  300    403   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  301    404   
                .unwrap(),
  302    405   
        )
  303    406   
        .unwrap();
  304    407   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  305    408   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  306    409   
  307    410   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  308    411   
        let config = op.config().expect("the operation has config");
  309    412   
        let de = config
  310    413   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  311    414   
            .expect("the config must have a deserializer");
  312    415   
  313    416   
        let parsed = de.deserialize_streaming(&mut http_response);
  314    417   
        let parsed = parsed.unwrap_or_else(|| {
  315    418   
            let http_response = http_response.map(|body| {
  316    419   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  317    420   
                    body.bytes().unwrap(),
  318    421   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  319    422   
                )))
  320    423   
            });
  321         -
            de.deserialize_nonstreaming(&http_response)
         424  +
            // Build a config bag with the protocol for schema-based deserialization
         425  +
            #[allow(unused_mut)]
         426  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         427  +
            {
         428  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         429  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         430  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         431  +
                ));
         432  +
                test_cfg.push_shared_layer(layer.freeze());
         433  +
            }
         434  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  322    435   
        });
  323    436   
        let parsed = parsed
  324    437   
            .expect("should be successful response")
  325    438   
            .downcast::<crate::operation::greeting_with_errors::GreetingWithErrorsOutput>()
  326    439   
            .unwrap();
  327    440   
        ::pretty_assertions::assert_eq!(parsed.greeting, expected_output.greeting, "Unexpected value for `greeting`");
  328    441   
    }
  329    442   
  330    443   
    /// Parses simple JSON errors
  331    444   
    /// Test ID: RestJsonInvalidGreetingError
  332    445   
    #[::tokio::test]
  333    446   
    #[::tracing_test::traced_test]
  334    447   
    async fn rest_json_invalid_greeting_error_response() {
  335    448   
        let expected_output = crate::types::error::InvalidGreeting::builder()
  336    449   
            .set_message(::std::option::Option::Some("Hi".to_owned()))
  337    450   
            .build();
  338    451   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  339    452   
            ::http_1x::response::Builder::new()
  340    453   
                .header("Content-Type", "application/json")
  341    454   
                .header("X-Amzn-Errortype", "InvalidGreeting")
  342    455   
                .status(400)
  343    456   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"Message\": \"Hi\"\n}"))
  344    457   
                .unwrap(),
  345    458   
        )
  346    459   
        .unwrap();
  347    460   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  348    461   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  349    462   
  350    463   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  351    464   
        let config = op.config().expect("the operation has config");
  352    465   
        let de = config
  353    466   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  354    467   
            .expect("the config must have a deserializer");
  355    468   
  356    469   
        let parsed = de.deserialize_streaming(&mut http_response);
  357    470   
        let parsed = parsed.unwrap_or_else(|| {
  358    471   
            let http_response = http_response.map(|body| {
  359    472   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  360    473   
                    body.bytes().unwrap(),
  361    474   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  362    475   
                )))
  363    476   
            });
  364         -
            de.deserialize_nonstreaming(&http_response)
         477  +
            // Build a config bag with the protocol for schema-based deserialization
         478  +
            #[allow(unused_mut)]
         479  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         480  +
            {
         481  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         482  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         483  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         484  +
                ));
         485  +
                test_cfg.push_shared_layer(layer.freeze());
         486  +
            }
         487  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  365    488   
        });
  366    489   
        let parsed = parsed.expect_err("should be error response");
  367    490   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  368    491   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  369    492   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting(parsed) = parsed {
  370    493   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  371    494   
        } else {
  372    495   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  373    496   
        }
  374    497   
    }
  375    498   
  376    499   
    /// Serializes a complex error with no message member
  377    500   
    /// Test ID: RestJsonComplexErrorWithNoMessage
  378    501   
    #[::tokio::test]
  379    502   
    #[::tracing_test::traced_test]
  380    503   
    async fn rest_json_complex_error_with_no_message_response() {
  381    504   
        let expected_output = crate::types::error::ComplexError::builder()
  382    505   
            .set_header(::std::option::Option::Some("Header".to_owned()))
  383    506   
            .set_top_level(::std::option::Option::Some("Top level".to_owned()))
  384    507   
            .set_nested(::std::option::Option::Some(
  385    508   
                crate::types::ComplexNestedErrorData::builder()
  386    509   
                    .set_foo(::std::option::Option::Some("bar".to_owned()))
  387    510   
                    .build(),
  388    511   
            ))
  389    512   
            .build();
  390    513   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  391    514   
            ::http_1x::response::Builder::new()
  392    515   
                .header("Content-Type", "application/json")
  393    516   
                .header("X-Amzn-Errortype", "ComplexError")
  394    517   
                .header("X-Header", "Header")
  395    518   
                .status(403)
  396    519   
                .body(::aws_smithy_types::body::SdkBody::from(
  397    520   
                    "{\n    \"TopLevel\": \"Top level\",\n    \"Nested\": {\n        \"Fooooo\": \"bar\"\n    }\n}",
  398    521   
                ))
  399    522   
                .unwrap(),
  400    523   
        )
  401    524   
        .unwrap();
  402    525   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  403    526   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  404    527   
  405    528   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  406    529   
        let config = op.config().expect("the operation has config");
  407    530   
        let de = config
  408    531   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  409    532   
            .expect("the config must have a deserializer");
  410    533   
  411    534   
        let parsed = de.deserialize_streaming(&mut http_response);
  412    535   
        let parsed = parsed.unwrap_or_else(|| {
  413    536   
            let http_response = http_response.map(|body| {
  414    537   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  415    538   
                    body.bytes().unwrap(),
  416    539   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  417    540   
                )))
  418    541   
            });
  419         -
            de.deserialize_nonstreaming(&http_response)
         542  +
            // Build a config bag with the protocol for schema-based deserialization
         543  +
            #[allow(unused_mut)]
         544  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         545  +
            {
         546  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         547  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         548  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         549  +
                ));
         550  +
                test_cfg.push_shared_layer(layer.freeze());
         551  +
            }
         552  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  420    553   
        });
  421    554   
        let parsed = parsed.expect_err("should be error response");
  422    555   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  423    556   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  424    557   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError(parsed) = parsed {
  425    558   
            ::pretty_assertions::assert_eq!(parsed.header, expected_output.header, "Unexpected value for `header`");
  426    559   
            ::pretty_assertions::assert_eq!(parsed.top_level, expected_output.top_level, "Unexpected value for `top_level`");
  427    560   
            ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  428    561   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  429    562   
        } else {
  430    563   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  431    564   
        }
  432    565   
    }
  433    566   
    /// Test ID: RestJsonEmptyComplexErrorWithNoMessage
  434    567   
    #[::tokio::test]
  435    568   
    #[::tracing_test::traced_test]
  436    569   
    async fn rest_json_empty_complex_error_with_no_message_response() {
  437    570   
        let expected_output = crate::types::error::ComplexError::builder().build();
  438    571   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  439    572   
            ::http_1x::response::Builder::new()
  440    573   
                .header("Content-Type", "application/json")
  441    574   
                .header("X-Amzn-Errortype", "ComplexError")
  442    575   
                .status(403)
  443    576   
                .body(::aws_smithy_types::body::SdkBody::from("{}"))
  444    577   
                .unwrap(),
  445    578   
        )
  446    579   
        .unwrap();
  447    580   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  448    581   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  449    582   
  450    583   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  451    584   
        let config = op.config().expect("the operation has config");
  452    585   
        let de = config
  453    586   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  454    587   
            .expect("the config must have a deserializer");
  455    588   
  456    589   
        let parsed = de.deserialize_streaming(&mut http_response);
  457    590   
        let parsed = parsed.unwrap_or_else(|| {
  458    591   
            let http_response = http_response.map(|body| {
  459    592   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  460    593   
                    body.bytes().unwrap(),
  461    594   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  462    595   
                )))
  463    596   
            });
  464         -
            de.deserialize_nonstreaming(&http_response)
         597  +
            // Build a config bag with the protocol for schema-based deserialization
         598  +
            #[allow(unused_mut)]
         599  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         600  +
            {
         601  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         602  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         603  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         604  +
                ));
         605  +
                test_cfg.push_shared_layer(layer.freeze());
         606  +
            }
         607  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  465    608   
        });
  466    609   
        let parsed = parsed.expect_err("should be error response");
  467    610   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  468    611   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  469    612   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError(parsed) = parsed {
  470    613   
            ::pretty_assertions::assert_eq!(parsed.header, expected_output.header, "Unexpected value for `header`");
  471    614   
            ::pretty_assertions::assert_eq!(parsed.top_level, expected_output.top_level, "Unexpected value for `top_level`");
  472    615   
            ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  473    616   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  474    617   
        } else {
  475    618   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  476    619   
        }
  477    620   
    }
  478    621   
  479    622   
    /// Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS.
  480    623   
    /// Test ID: RestJsonFooErrorUsingXAmznErrorType
  481    624   
    #[::tokio::test]
  482    625   
    #[::tracing_test::traced_test]
  483    626   
    async fn rest_json_foo_error_using_x_amzn_error_type_response() {
  484    627   
        let expected_output = crate::types::error::FooError::builder().build();
  485    628   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  486    629   
            ::http_1x::response::Builder::new()
  487    630   
                .header("X-Amzn-Errortype", "FooError")
  488    631   
                .status(500)
  489    632   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  490    633   
                .unwrap(),
  491    634   
        )
  492    635   
        .unwrap();
  493    636   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  494    637   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  495    638   
  496    639   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  497    640   
        let config = op.config().expect("the operation has config");
  498    641   
        let de = config
  499    642   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  500    643   
            .expect("the config must have a deserializer");
  501    644   
  502    645   
        let parsed = de.deserialize_streaming(&mut http_response);
  503    646   
        let parsed = parsed.unwrap_or_else(|| {
  504    647   
            let http_response = http_response.map(|body| {
  505    648   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  506    649   
                    body.bytes().unwrap(),
  507    650   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  508    651   
                )))
  509    652   
            });
  510         -
            de.deserialize_nonstreaming(&http_response)
         653  +
            // Build a config bag with the protocol for schema-based deserialization
         654  +
            #[allow(unused_mut)]
         655  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         656  +
            {
         657  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         658  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         659  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         660  +
                ));
         661  +
                test_cfg.push_shared_layer(layer.freeze());
         662  +
            }
         663  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  511    664   
        });
  512    665   
        let parsed = parsed.expect_err("should be error response");
  513    666   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  514    667   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  515    668   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  516    669   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  517    670   
        } else {
  518    671   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  519    672   
        }
  520    673   
    }
  521    674   
  522    675   
    /// Some X-Amzn-Errortype headers contain URLs. Clients need to split the URL on ':' and take only the first half of the string. For example, 'ValidationException:http://internal.amazon.com/coral/com.amazon.coral.validate/'
  523    676   
    /// is to be interpreted as 'ValidationException'.
  524    677   
    ///
  525    678   
    /// For an example service see Amazon Polly.
  526    679   
    /// Test ID: RestJsonFooErrorUsingXAmznErrorTypeWithUri
  527    680   
    #[::tokio::test]
  528    681   
    #[::tracing_test::traced_test]
  529    682   
    async fn rest_json_foo_error_using_x_amzn_error_type_with_uri_response() {
  530    683   
        let expected_output = crate::types::error::FooError::builder().build();
  531    684   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  532    685   
            ::http_1x::response::Builder::new()
  533    686   
                .header("X-Amzn-Errortype", "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/")
  534    687   
                .status(500)
  535    688   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  536    689   
                .unwrap(),
  537    690   
        )
  538    691   
        .unwrap();
  539    692   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  540    693   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  541    694   
  542    695   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  543    696   
        let config = op.config().expect("the operation has config");
  544    697   
        let de = config
  545    698   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  546    699   
            .expect("the config must have a deserializer");
  547    700   
  548    701   
        let parsed = de.deserialize_streaming(&mut http_response);
  549    702   
        let parsed = parsed.unwrap_or_else(|| {
  550    703   
            let http_response = http_response.map(|body| {
  551    704   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  552    705   
                    body.bytes().unwrap(),
  553    706   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  554    707   
                )))
  555    708   
            });
  556         -
            de.deserialize_nonstreaming(&http_response)
         709  +
            // Build a config bag with the protocol for schema-based deserialization
         710  +
            #[allow(unused_mut)]
         711  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         712  +
            {
         713  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         714  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         715  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         716  +
                ));
         717  +
                test_cfg.push_shared_layer(layer.freeze());
         718  +
            }
         719  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  557    720   
        });
  558    721   
        let parsed = parsed.expect_err("should be error response");
  559    722   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  560    723   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  561    724   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  562    725   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  563    726   
        } else {
  564    727   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  565    728   
        }
  566    729   
    }
  567    730   
  568    731   
    /// X-Amzn-Errortype might contain a URL and a namespace. Client should extract only the shape name. This is a pathalogical case that might not actually happen in any deployed AWS service.
  569    732   
    /// Test ID: RestJsonFooErrorUsingXAmznErrorTypeWithUriAndNamespace
  570    733   
    #[::tokio::test]
  571    734   
    #[::tracing_test::traced_test]
  572    735   
    async fn rest_json_foo_error_using_x_amzn_error_type_with_uri_and_namespace_response() {
  573    736   
        let expected_output = crate::types::error::FooError::builder().build();
  574    737   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  575    738   
            ::http_1x::response::Builder::new()
  576    739   
                .header(
  577    740   
                    "X-Amzn-Errortype",
  578    741   
                    "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/",
  579    742   
                )
  580    743   
                .status(500)
  581    744   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  582    745   
                .unwrap(),
  583    746   
        )
  584    747   
        .unwrap();
  585    748   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  586    749   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  587    750   
  588    751   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  589    752   
        let config = op.config().expect("the operation has config");
  590    753   
        let de = config
  591    754   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  592    755   
            .expect("the config must have a deserializer");
  593    756   
  594    757   
        let parsed = de.deserialize_streaming(&mut http_response);
  595    758   
        let parsed = parsed.unwrap_or_else(|| {
  596    759   
            let http_response = http_response.map(|body| {
  597    760   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  598    761   
                    body.bytes().unwrap(),
  599    762   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  600    763   
                )))
  601    764   
            });
  602         -
            de.deserialize_nonstreaming(&http_response)
         765  +
            // Build a config bag with the protocol for schema-based deserialization
         766  +
            #[allow(unused_mut)]
         767  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         768  +
            {
         769  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         770  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         771  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         772  +
                ));
         773  +
                test_cfg.push_shared_layer(layer.freeze());
         774  +
            }
         775  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  603    776   
        });
  604    777   
        let parsed = parsed.expect_err("should be error response");
  605    778   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  606    779   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  607    780   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  608    781   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  609    782   
        } else {
  610    783   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  611    784   
        }
  612    785   
    }
  613    786   
  614    787   
    /// This example uses the 'code' property in the output rather than X-Amzn-Errortype. Some services do this though it's preferable to send the X-Amzn-Errortype. Client implementations must first check for the X-Amzn-Errortype and then check for a top-level 'code' property.
  615    788   
    ///
  616    789   
    /// For example service see Amazon S3 Glacier.
  617    790   
    /// Test ID: RestJsonFooErrorUsingCode
  618    791   
    #[::tokio::test]
  619    792   
    #[::tracing_test::traced_test]
  620    793   
    async fn rest_json_foo_error_using_code_response() {
  621    794   
        let expected_output = crate::types::error::FooError::builder().build();
  622    795   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  623    796   
            ::http_1x::response::Builder::new()
  624    797   
                .header("Content-Type", "application/json")
  625    798   
                .status(500)
  626    799   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"code\": \"FooError\"\n}"))
  627    800   
                .unwrap(),
  628    801   
        )
  629    802   
        .unwrap();
  630    803   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  631    804   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  632    805   
  633    806   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  634    807   
        let config = op.config().expect("the operation has config");
  635    808   
        let de = config
  636    809   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  637    810   
            .expect("the config must have a deserializer");
  638    811   
  639    812   
        let parsed = de.deserialize_streaming(&mut http_response);
  640    813   
        let parsed = parsed.unwrap_or_else(|| {
  641    814   
            let http_response = http_response.map(|body| {
  642    815   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  643    816   
                    body.bytes().unwrap(),
  644    817   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  645    818   
                )))
  646    819   
            });
  647         -
            de.deserialize_nonstreaming(&http_response)
         820  +
            // Build a config bag with the protocol for schema-based deserialization
         821  +
            #[allow(unused_mut)]
         822  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         823  +
            {
         824  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         825  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         826  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         827  +
                ));
         828  +
                test_cfg.push_shared_layer(layer.freeze());
         829  +
            }
         830  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  648    831   
        });
  649    832   
        let parsed = parsed.expect_err("should be error response");
  650    833   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  651    834   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  652    835   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  653    836   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  654    837   
        } else {
  655    838   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  656    839   
        }
  657    840   
    }
  658    841   
  659    842   
    /// Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'.
  660    843   
    /// Test ID: RestJsonFooErrorUsingCodeAndNamespace
  661    844   
    #[::tokio::test]
  662    845   
    #[::tracing_test::traced_test]
  663    846   
    async fn rest_json_foo_error_using_code_and_namespace_response() {
  664    847   
        let expected_output = crate::types::error::FooError::builder().build();
  665    848   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  666    849   
            ::http_1x::response::Builder::new()
  667    850   
                .header("Content-Type", "application/json")
  668    851   
                .status(500)
  669    852   
                .body(::aws_smithy_types::body::SdkBody::from(
  670    853   
                    "{\n    \"code\": \"aws.protocoltests.restjson#FooError\"\n}",
  671    854   
                ))
  672    855   
                .unwrap(),
  673    856   
        )
  674    857   
        .unwrap();
  675    858   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  676    859   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  677    860   
  678    861   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  679    862   
        let config = op.config().expect("the operation has config");
  680    863   
        let de = config
  681    864   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  682    865   
            .expect("the config must have a deserializer");
  683    866   
  684    867   
        let parsed = de.deserialize_streaming(&mut http_response);
  685    868   
        let parsed = parsed.unwrap_or_else(|| {
  686    869   
            let http_response = http_response.map(|body| {
  687    870   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  688    871   
                    body.bytes().unwrap(),
  689    872   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  690    873   
                )))
  691    874   
            });
  692         -
            de.deserialize_nonstreaming(&http_response)
         875  +
            // Build a config bag with the protocol for schema-based deserialization
         876  +
            #[allow(unused_mut)]
         877  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         878  +
            {
         879  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         880  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         881  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         882  +
                ));
         883  +
                test_cfg.push_shared_layer(layer.freeze());
         884  +
            }
         885  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  693    886   
        });
  694    887   
        let parsed = parsed.expect_err("should be error response");
  695    888   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  696    889   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  697    890   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  698    891   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  699    892   
        } else {
  700    893   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  701    894   
        }
  702    895   
    }
  703    896   
  704    897   
    /// Some services serialize errors using code, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service.
  705    898   
    /// Test ID: RestJsonFooErrorUsingCodeUriAndNamespace
  706    899   
    #[::tokio::test]
  707    900   
    #[::tracing_test::traced_test]
  708    901   
    async fn rest_json_foo_error_using_code_uri_and_namespace_response() {
  709    902   
        let expected_output = crate::types::error::FooError::builder().build();
  710    903   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  711    904   
            ::http_1x::response::Builder::new()
  712    905   
                .header("Content-Type", "application/json")
  713    906   
                .status(500)
  714    907   
                .body(::aws_smithy_types::body::SdkBody::from(
  715    908   
                    "{\n    \"code\": \"aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/\"\n}",
  716    909   
                ))
  717    910   
                .unwrap(),
  718    911   
        )
  719    912   
        .unwrap();
  720    913   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  721    914   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  722    915   
  723    916   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  724    917   
        let config = op.config().expect("the operation has config");
  725    918   
        let de = config
  726    919   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  727    920   
            .expect("the config must have a deserializer");
  728    921   
  729    922   
        let parsed = de.deserialize_streaming(&mut http_response);
  730    923   
        let parsed = parsed.unwrap_or_else(|| {
  731    924   
            let http_response = http_response.map(|body| {
  732    925   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  733    926   
                    body.bytes().unwrap(),
  734    927   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  735    928   
                )))
  736    929   
            });
  737         -
            de.deserialize_nonstreaming(&http_response)
         930  +
            // Build a config bag with the protocol for schema-based deserialization
         931  +
            #[allow(unused_mut)]
         932  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         933  +
            {
         934  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         935  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         936  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         937  +
                ));
         938  +
                test_cfg.push_shared_layer(layer.freeze());
         939  +
            }
         940  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  738    941   
        });
  739    942   
        let parsed = parsed.expect_err("should be error response");
  740    943   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  741    944   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  742    945   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  743    946   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  744    947   
        } else {
  745    948   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  746    949   
        }
  747    950   
    }
  748    951   
  749    952   
    /// Some services serialize errors using __type.
  750    953   
    /// Test ID: RestJsonFooErrorWithDunderType
  751    954   
    #[::tokio::test]
  752    955   
    #[::tracing_test::traced_test]
  753    956   
    async fn rest_json_foo_error_with_dunder_type_response() {
  754    957   
        let expected_output = crate::types::error::FooError::builder().build();
  755    958   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  756    959   
            ::http_1x::response::Builder::new()
  757    960   
                .header("Content-Type", "application/json")
  758    961   
                .status(500)
  759    962   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"__type\": \"FooError\"\n}"))
  760    963   
                .unwrap(),
  761    964   
        )
  762    965   
        .unwrap();
  763    966   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  764    967   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  765    968   
  766    969   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  767    970   
        let config = op.config().expect("the operation has config");
  768    971   
        let de = config
  769    972   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  770    973   
            .expect("the config must have a deserializer");
  771    974   
  772    975   
        let parsed = de.deserialize_streaming(&mut http_response);
  773    976   
        let parsed = parsed.unwrap_or_else(|| {
  774    977   
            let http_response = http_response.map(|body| {
  775    978   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  776    979   
                    body.bytes().unwrap(),
  777    980   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  778    981   
                )))
  779    982   
            });
  780         -
            de.deserialize_nonstreaming(&http_response)
         983  +
            // Build a config bag with the protocol for schema-based deserialization
         984  +
            #[allow(unused_mut)]
         985  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         986  +
            {
         987  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         988  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         989  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         990  +
                ));
         991  +
                test_cfg.push_shared_layer(layer.freeze());
         992  +
            }
         993  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  781    994   
        });
  782    995   
        let parsed = parsed.expect_err("should be error response");
  783    996   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  784    997   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  785    998   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  786    999   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  787   1000   
        } else {
  788   1001   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  789   1002   
        }
  790   1003   
    }
  791   1004   
  792   1005   
    /// Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'.
  793   1006   
    /// Test ID: RestJsonFooErrorWithDunderTypeAndNamespace
  794   1007   
    #[::tokio::test]
  795   1008   
    #[::tracing_test::traced_test]
  796   1009   
    async fn rest_json_foo_error_with_dunder_type_and_namespace_response() {
  797   1010   
        let expected_output = crate::types::error::FooError::builder().build();
  798   1011   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  799   1012   
            ::http_1x::response::Builder::new()
  800   1013   
                .header("Content-Type", "application/json")
  801   1014   
                .status(500)
  802   1015   
                .body(::aws_smithy_types::body::SdkBody::from(
  803   1016   
                    "{\n    \"__type\": \"aws.protocoltests.restjson#FooError\"\n}",
  804   1017   
                ))
  805   1018   
                .unwrap(),
  806   1019   
        )
  807   1020   
        .unwrap();
  808   1021   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  809   1022   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  810   1023   
  811   1024   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  812   1025   
        let config = op.config().expect("the operation has config");
  813   1026   
        let de = config
  814   1027   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  815   1028   
            .expect("the config must have a deserializer");
  816   1029   
  817   1030   
        let parsed = de.deserialize_streaming(&mut http_response);
  818   1031   
        let parsed = parsed.unwrap_or_else(|| {
  819   1032   
            let http_response = http_response.map(|body| {
  820   1033   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  821   1034   
                    body.bytes().unwrap(),
  822   1035   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  823   1036   
                )))
  824   1037   
            });
  825         -
            de.deserialize_nonstreaming(&http_response)
        1038  +
            // Build a config bag with the protocol for schema-based deserialization
        1039  +
            #[allow(unused_mut)]
        1040  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1041  +
            {
        1042  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1043  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1044  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
        1045  +
                ));
        1046  +
                test_cfg.push_shared_layer(layer.freeze());
        1047  +
            }
        1048  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  826   1049   
        });
  827   1050   
        let parsed = parsed.expect_err("should be error response");
  828   1051   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  829   1052   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  830   1053   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  831   1054   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  832   1055   
        } else {
  833   1056   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  834   1057   
        }
  835   1058   
    }
  836   1059   
  837   1060   
    /// Some services serialize errors using __type, and it might contain a namespace. It also might contain a URI. Clients should just take the last part of the string after '#' and before ":". This is a pathalogical case that might not occur in any deployed AWS service.
  838   1061   
    /// Test ID: RestJsonFooErrorWithDunderTypeUriAndNamespace
  839   1062   
    #[::tokio::test]
  840   1063   
    #[::tracing_test::traced_test]
  841   1064   
    async fn rest_json_foo_error_with_dunder_type_uri_and_namespace_response() {
  842   1065   
        let expected_output = crate::types::error::FooError::builder().build();
  843   1066   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  844   1067   
            ::http_1x::response::Builder::new()
  845   1068   
                .header("Content-Type", "application/json")
  846   1069   
                .status(500)
  847   1070   
                .body(::aws_smithy_types::body::SdkBody::from(
  848   1071   
                    "{\n    \"__type\": \"aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/\"\n}",
  849   1072   
                ))
  850   1073   
                .unwrap(),
  851   1074   
        )
  852   1075   
        .unwrap();
  853   1076   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  854   1077   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  855   1078   
  856   1079   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  857   1080   
        let config = op.config().expect("the operation has config");
  858   1081   
        let de = config
  859   1082   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  860   1083   
            .expect("the config must have a deserializer");
  861   1084   
  862   1085   
        let parsed = de.deserialize_streaming(&mut http_response);
  863   1086   
        let parsed = parsed.unwrap_or_else(|| {
  864   1087   
            let http_response = http_response.map(|body| {
  865   1088   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  866   1089   
                    body.bytes().unwrap(),
  867   1090   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  868   1091   
                )))
  869   1092   
            });
  870         -
            de.deserialize_nonstreaming(&http_response)
        1093  +
            // Build a config bag with the protocol for schema-based deserialization
        1094  +
            #[allow(unused_mut)]
        1095  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1096  +
            {
        1097  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1098  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1099  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
        1100  +
                ));
        1101  +
                test_cfg.push_shared_layer(layer.freeze());
        1102  +
            }
        1103  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  871   1104   
        });
  872   1105   
        let parsed = parsed.expect_err("should be error response");
  873   1106   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  874   1107   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  875   1108   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  876   1109   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  877   1110   
        } else {
  878   1111   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  879   1112   
        }
  880   1113   
    }
  881   1114   
  882   1115   
    /// Some services serialize errors using __type, and if the response includes additional shapes that belong to a different namespace there'll be a nested __type property that must not be considered when determining which error to be surfaced.
  883   1116   
    ///
  884   1117   
    /// For an example service see Amazon DynamoDB.
  885   1118   
    /// Test ID: RestJsonFooErrorWithNestedTypeProperty
  886   1119   
    #[::tokio::test]
  887   1120   
    #[::tracing_test::traced_test]
  888   1121   
    async fn rest_json_foo_error_with_nested_type_property_response() {
  889   1122   
        let expected_output = crate::types::error::FooError::builder().build();
  890   1123   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(::http_1x::response::Builder::new()
  891   1124   
        .header("Content-Type", "application/json")
  892   1125   
        .status(500)
  893   1126   
                    .body(::aws_smithy_types::body::SdkBody::from("{\n    \"__type\": \"aws.protocoltests.restjson#FooError\",\n    \"ErrorDetails\": [\n      {\n          \"__type\": \"com.amazon.internal#ErrorDetails\",\n          \"reason\": \"Some reason\"\n      }\n    ]\n}"))
  894   1127   
                    .unwrap()
  895   1128   
                    ).unwrap();
  896   1129   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  897   1130   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  898   1131   
  899   1132   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  900   1133   
        let config = op.config().expect("the operation has config");
  901   1134   
        let de = config
  902   1135   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  903   1136   
            .expect("the config must have a deserializer");
  904   1137   
  905   1138   
        let parsed = de.deserialize_streaming(&mut http_response);
  906   1139   
        let parsed = parsed.unwrap_or_else(|| {
  907   1140   
            let http_response = http_response.map(|body| {
  908   1141   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  909   1142   
                    body.bytes().unwrap(),
  910   1143   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  911   1144   
                )))
  912   1145   
            });
  913         -
            de.deserialize_nonstreaming(&http_response)
        1146  +
            // Build a config bag with the protocol for schema-based deserialization
        1147  +
            #[allow(unused_mut)]
        1148  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1149  +
            {
        1150  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1151  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1152  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
        1153  +
                ));
        1154  +
                test_cfg.push_shared_layer(layer.freeze());
        1155  +
            }
        1156  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  914   1157   
        });
  915   1158   
        let parsed = parsed.expect_err("should be error response");
  916   1159   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  917   1160   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  918   1161   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  919   1162   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  920   1163   
        } else {
  921   1164   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  922   1165   
        }
  923   1166   
    }

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/greeting_with_errors/_greeting_with_errors_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 GreetingWithErrorsInput {}
    6      6   
static GREETINGWITHERRORSINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#GreetingWithErrorsInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "GreetingWithErrorsInput",
   10     10   
);
   11     11   
static GREETINGWITHERRORSINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(GREETINGWITHERRORSINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(GREETINGWITHERRORSINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("PUT", "/GreetingWithErrors", None));
   13     14   
impl GreetingWithErrorsInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &GREETINGWITHERRORSINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for GreetingWithErrorsInput {
   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 GreetingWithErrorsInput {
   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(&GREETINGWITHERRORSINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&GREETINGWITHERRORSINPUT_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 GreetingWithErrorsInput {
          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 GreetingWithErrorsInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`GreetingWithErrorsInput`](crate::operation::greeting_with_errors::GreetingWithErrorsInput).
   53     67   
    pub fn builder() -> crate::operation::greeting_with_errors::builders::GreetingWithErrorsInputBuilder {
   54     68   
        crate::operation::greeting_with_errors::builders::GreetingWithErrorsInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`GreetingWithErrorsInput`](crate::operation::greeting_with_errors::GreetingWithErrorsInput).
   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/greeting_with_errors/_greeting_with_errors_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.greeting {
   47     47   
            ser.write_string(&GREETINGWITHERRORSOUTPUT_MEMBER_GREETING, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl GreetingWithErrorsOutput {
   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(&GREETINGWITHERRORSOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&GREETINGWITHERRORSOUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69     69   
                    builder.greeting = 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 GreetingWithErrorsOutput {
          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-Greeting") {
          91  +
            builder.greeting = Some(val.to_string());
          92  +
        }
          93  +
        Ok(builder.build())
          94  +
    }
          95  +
}
   78     96   
impl GreetingWithErrorsOutput {
   79     97   
    /// Creates a new builder-style object to manufacture [`GreetingWithErrorsOutput`](crate::operation::greeting_with_errors::GreetingWithErrorsOutput).
   80     98   
    pub fn builder() -> crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder {
   81     99   
        crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder::default()
   82    100   
    }
   83    101   
}
   84    102   
   85    103   
/// A builder for [`GreetingWithErrorsOutput`](crate::operation::greeting_with_errors::GreetingWithErrorsOutput).
   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/host_with_path_operation.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 `HostWithPathOperation`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HostWithPathOperation;
    6      6   
impl HostWithPathOperation {
    7      7   
    /// Creates a new `HostWithPathOperation`
    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::host_with_path_operation::HostWithPathOperationInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::host_with_path_operation::HostWithPathOperationOutput::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::host_with_path_operation::HostWithPathOperationInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::host_with_path_operation::HostWithPathOperationOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::host_with_path_operation::HostWithPathOperationError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +228,239 @@
  130    134   
                crate::operation::host_with_path_operation::HostWithPathOperationError,
  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 HostWithPathOperationResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HostWithPathOperationResponseDeserializer {
  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_host_with_path_operation::de_host_with_path_operation_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::host_with_path_operation::HostWithPathOperationError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_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, HostWithPathOperation::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::host_with_path_operation::HostWithPathOperationOutput::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 HostWithPathOperationRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HostWithPathOperationRequestSerializer {
  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::host_with_path_operation::HostWithPathOperationInput>()
  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::host_with_path_operation::HostWithPathOperationInput,
  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, "/HostWithPathOperation").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::host_with_path_operation::HostWithPathOperationInput,
  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("GET").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, HostWithPathOperation::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 HostWithPathOperationEndpointParamsInterceptor;
  203    214   
  204    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HostWithPathOperationEndpointParamsInterceptor {
  205    216   
    fn name(&self) -> &'static str {
  206    217   
        "HostWithPathOperationEndpointParamsInterceptor"
  207    218   
    }
  208    219   

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/host_with_path_operation/_host_with_path_operation_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 HostWithPathOperationInput {}
    6      6   
static HOSTWITHPATHOPERATIONINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#HostWithPathOperationInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "HostWithPathOperationInput",
   10     10   
);
   11     11   
static HOSTWITHPATHOPERATIONINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(HOSTWITHPATHOPERATIONINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(HOSTWITHPATHOPERATIONINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/HostWithPathOperation", None));
   13     14   
impl HostWithPathOperationInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HOSTWITHPATHOPERATIONINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for HostWithPathOperationInput {
   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 HostWithPathOperationInput {
   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(&HOSTWITHPATHOPERATIONINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&HOSTWITHPATHOPERATIONINPUT_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 HostWithPathOperationInput {
          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 HostWithPathOperationInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`HostWithPathOperationInput`](crate::operation::host_with_path_operation::HostWithPathOperationInput).
   53     67   
    pub fn builder() -> crate::operation::host_with_path_operation::builders::HostWithPathOperationInputBuilder {
   54     68   
        crate::operation::host_with_path_operation::builders::HostWithPathOperationInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`HostWithPathOperationInput`](crate::operation::host_with_path_operation::HostWithPathOperationInput).
   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/host_with_path_operation/_host_with_path_operation_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 HostWithPathOperationOutput {
   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(&HOSTWITHPATHOPERATIONOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&HOSTWITHPATHOPERATIONOUTPUT_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 HostWithPathOperationOutput {
          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 HostWithPathOperationOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`HostWithPathOperationOutput`](crate::operation::host_with_path_operation::HostWithPathOperationOutput).
   51     62   
    pub fn builder() -> crate::operation::host_with_path_operation::builders::HostWithPathOperationOutputBuilder {
   52     63   
        crate::operation::host_with_path_operation::builders::HostWithPathOperationOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`HostWithPathOperationOutput`](crate::operation::host_with_path_operation::HostWithPathOperationOutput).
   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/http_checksum_required.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 `HttpChecksumRequired`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpChecksumRequired;
    6      6   
impl HttpChecksumRequired {
    7      7   
    /// Creates a new `HttpChecksumRequired`
    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::http_checksum_required::HttpChecksumRequiredInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::http_checksum_required::HttpChecksumRequiredOutput::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::http_checksum_required::HttpChecksumRequiredInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::http_checksum_required::HttpChecksumRequiredOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::http_checksum_required::HttpChecksumRequiredError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +234,239 @@
  130    134   
                crate::operation::http_checksum_required::HttpChecksumRequiredError,
  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 HttpChecksumRequiredResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpChecksumRequiredResponseDeserializer {
  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_http_checksum_required::de_http_checksum_required_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::http_checksum_required::HttpChecksumRequiredError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_http_checksum_required::de_http_checksum_required_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, HttpChecksumRequired::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::http_checksum_required::HttpChecksumRequiredOutput::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 HttpChecksumRequiredRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HttpChecksumRequiredRequestSerializer {
  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::http_checksum_required::HttpChecksumRequiredInput>()
  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::http_checksum_required::HttpChecksumRequiredInput,
  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, "/HttpChecksumRequired").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::http_checksum_required::HttpChecksumRequiredInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_http_checksum_required::ser_http_checksum_required_input(
  198         -
            &input,
  199         -
        )?);
  200         -
        if let Some(content_length) = body.content_length() {
  201         -
            let content_length = content_length.to_string();
  202         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  203         -
        }
  204         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, HttpChecksumRequired::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  205    210   
    }
  206    211   
}
  207    212   
#[derive(Debug)]
  208    213   
struct HttpChecksumRequiredEndpointParamsInterceptor;
  209    214   
  210    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HttpChecksumRequiredEndpointParamsInterceptor {
  211    216   
    fn name(&self) -> &'static str {
  212    217   
        "HttpChecksumRequiredEndpointParamsInterceptor"
  213    218   
    }
  214    219   

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

@@ -4,4 +108,120 @@
   24     24   
        "HttpChecksumRequiredInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::String,
   27     27   
    "foo",
   28     28   
    0,
   29     29   
);
   30     30   
static HTTPCHECKSUMREQUIREDINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     31   
    HTTPCHECKSUMREQUIREDINPUT_SCHEMA_ID,
   32     32   
    ::aws_smithy_schema::ShapeType::Structure,
   33     33   
    &[&HTTPCHECKSUMREQUIREDINPUT_MEMBER_FOO],
   34         -
);
          34  +
)
          35  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/HttpChecksumRequired", None));
   35     36   
impl HttpChecksumRequiredInput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPCHECKSUMREQUIREDINPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpChecksumRequiredInput {
   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.foo {
   46     47   
            ser.write_string(&HTTPCHECKSUMREQUIREDINPUT_MEMBER_FOO, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl HttpChecksumRequiredInput {
   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(&HTTPCHECKSUMREQUIREDINPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&HTTPCHECKSUMREQUIREDINPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68     69   
                    builder.foo = Some(deser.read_string(member)?);
   69     70   
                }
   70     71   
                _ => {}
   71     72   
            }
   72     73   
            Ok(())
   73     74   
        })?;
   74     75   
        builder
   75     76   
            .build()
   76     77   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   77     78   
    }
   78     79   
}
          80  +
impl HttpChecksumRequiredInput {
          81  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          82  +
    pub fn deserialize_with_response(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        Self::deserialize(deserializer)
          89  +
    }
          90  +
}
   79     91   
impl HttpChecksumRequiredInput {
   80     92   
    /// Creates a new builder-style object to manufacture [`HttpChecksumRequiredInput`](crate::operation::http_checksum_required::HttpChecksumRequiredInput).
   81     93   
    pub fn builder() -> crate::operation::http_checksum_required::builders::HttpChecksumRequiredInputBuilder {
   82     94   
        crate::operation::http_checksum_required::builders::HttpChecksumRequiredInputBuilder::default()
   83     95   
    }
   84     96   
}
   85     97   
   86     98   
/// A builder for [`HttpChecksumRequiredInput`](crate::operation::http_checksum_required::HttpChecksumRequiredInput).
   87     99   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   88    100   
#[non_exhaustive]