Client Test

Client Test

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/json_rpc11/rust-client-codegen/src/operation/datetime_offsets/_datetime_offsets_input.rs

@@ -1,1 +69,82 @@
   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 DatetimeOffsetsInput {
   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(&DATETIMEOFFSETSINPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&DATETIMEOFFSETSINPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        builder
   47     47   
            .build()
   48     48   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   49     49   
    }
   50     50   
}
          51  +
impl DatetimeOffsetsInput {
          52  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          53  +
    pub fn deserialize_with_response(
          54  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          55  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          56  +
        _status: u16,
          57  +
        _body: &[u8],
          58  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          59  +
        Self::builder()
          60  +
            .build()
          61  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          62  +
    }
          63  +
}
   51     64   
impl DatetimeOffsetsInput {
   52     65   
    /// Creates a new builder-style object to manufacture [`DatetimeOffsetsInput`](crate::operation::datetime_offsets::DatetimeOffsetsInput).
   53     66   
    pub fn builder() -> crate::operation::datetime_offsets::builders::DatetimeOffsetsInputBuilder {
   54     67   
        crate::operation::datetime_offsets::builders::DatetimeOffsetsInputBuilder::default()
   55     68   
    }
   56     69   
}
   57     70   
   58     71   
/// A builder for [`DatetimeOffsetsInput`](crate::operation::datetime_offsets::DatetimeOffsetsInput).
   59     72   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   60     73   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc11/rust-client-codegen/src/operation/datetime_offsets/_datetime_offsets_output.rs

@@ -1,1 +106,118 @@
   19     19   
);
   20     20   
static DATETIMEOFFSETSOUTPUT_MEMBER_DATETIME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   21     21   
    ::aws_smithy_schema::ShapeId::from_static(
   22     22   
        "aws.protocoltests.json.synthetic#DatetimeOffsetsOutput$datetime",
   23     23   
        "aws.protocoltests.json.synthetic",
   24     24   
        "DatetimeOffsetsOutput",
   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 DATETIMEOFFSETSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     32   
    DATETIMEOFFSETSOUTPUT_SCHEMA_ID,
   32     33   
    ::aws_smithy_schema::ShapeType::Structure,
   33     34   
    &[&DATETIMEOFFSETSOUTPUT_MEMBER_DATETIME],
   34     35   
);
   35     36   
impl DatetimeOffsetsOutput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &DATETIMEOFFSETSOUTPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for DatetimeOffsetsOutput {
   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(&DATETIMEOFFSETSOUTPUT_MEMBER_DATETIME, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl DatetimeOffsetsOutput {
   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(&DATETIMEOFFSETSOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&DATETIMEOFFSETSOUTPUT_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 DatetimeOffsetsOutput {
          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 DatetimeOffsetsOutput {
   78     90   
    /// Creates a new builder-style object to manufacture [`DatetimeOffsetsOutput`](crate::operation::datetime_offsets::DatetimeOffsetsOutput).
   79     91   
    pub fn builder() -> crate::operation::datetime_offsets::builders::DatetimeOffsetsOutputBuilder {
   80     92   
        crate::operation::datetime_offsets::builders::DatetimeOffsetsOutputBuilder::default()
   81     93   
    }
   82     94   
}
   83     95   
   84     96   
/// A builder for [`DatetimeOffsetsOutput`](crate::operation::datetime_offsets::DatetimeOffsetsOutput).
   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/json_rpc11/rust-client-codegen/src/operation/empty_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 `EmptyOperation`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct EmptyOperation;
    6      6   
impl EmptyOperation {
    7      7   
    /// Creates a new `EmptyOperation`
    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::empty_operation::EmptyOperationInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::empty_operation::EmptyOperationOutput::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::empty_operation::EmptyOperationInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::empty_operation::EmptyOperationOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::empty_operation::EmptyOperationError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +228,233 @@
  124    128   
                crate::operation::empty_operation::EmptyOperationError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct EmptyOperationResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for EmptyOperationResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         144  +
        #[allow(unused_mut)]
         145  +
        let mut force_error = false;
         146  +
         147  +
        if !success && status != 200 || force_error {
  139    148   
            let headers = response.headers();
  140    149   
            let body = response.body().bytes().expect("body loaded");
  141    150   
            #[allow(unused_mut)]
  142         -
        let mut force_error = false;
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
  143    154   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_empty_operation::de_empty_operation_http_error(status, headers, body)
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         158  +
                    crate::operation::empty_operation::EmptyOperationError::generic(generic),
         159  +
                ),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_empty_operation::de_empty_operation_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let mut deser = protocol
         166  +
                .deserialize_response(response, EmptyOperation::OUTPUT_SCHEMA, _cfg)
         167  +
                .map_err(|e| {
         168  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         169  +
                })?;
         170  +
            let body = response.body().bytes().expect("body loaded");
         171  +
            let output = crate::operation::empty_operation::EmptyOperationOutput::deserialize_with_response(
         172  +
                &mut *deser,
         173  +
                response.headers(),
         174  +
                response.status().into(),
         175  +
                body,
         176  +
            )
         177  +
            .map_err(|e| {
         178  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         179  +
            })?;
         180  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         181  +
        }
  150    182   
    }
  151    183   
}
  152    184   
#[derive(Debug)]
  153    185   
struct EmptyOperationRequestSerializer;
  154    186   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for EmptyOperationRequestSerializer {
  155    187   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    188   
    fn serialize_input(
  157    189   
        &self,
  158    190   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    191   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    192   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    193   
        let input = input
  162    194   
            .downcast::<crate::operation::empty_operation::EmptyOperationInput>()
  163    195   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::empty_operation::EmptyOperationInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::empty_operation::EmptyOperationInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
  189         -
            builder = _header_serialization_settings.set_default_header(
  190         -
                builder,
  191         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  192         -
                "JsonProtocol.EmptyOperation",
  193         -
            );
  194         -
            builder
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_empty_operation::ser_empty_operation_input(&input)?);
         196  +
        let protocol = _cfg
         197  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         198  +
            .expect("a SharedClientProtocol is required");
         199  +
        let mut request = protocol
         200  +
            .serialize_request(&input, EmptyOperation::INPUT_SCHEMA, "", _cfg)
         201  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  197    202   
  198         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         203  +
        return ::std::result::Result::Ok(request);
  199    204   
    }
  200    205   
}
  201    206   
#[derive(Debug)]
  202    207   
struct EmptyOperationEndpointParamsInterceptor;
  203    208   
  204    209   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for EmptyOperationEndpointParamsInterceptor {
  205    210   
    fn name(&self) -> &'static str {
  206    211   
        "EmptyOperationEndpointParamsInterceptor"
  207    212   
    }
  208    213   
@@ -336,341 +481,516 @@
  356    361   
            .expect("the config must have a deserializer");
  357    362   
  358    363   
        let parsed = de.deserialize_streaming(&mut http_response);
  359    364   
        let parsed = parsed.unwrap_or_else(|| {
  360    365   
            let http_response = http_response.map(|body| {
  361    366   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  362    367   
                    body.bytes().unwrap(),
  363    368   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  364    369   
                )))
  365    370   
            });
  366         -
            de.deserialize_nonstreaming(&http_response)
         371  +
            // Build a config bag with the protocol for schema-based deserialization
         372  +
            #[allow(unused_mut)]
         373  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         374  +
            {
         375  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         376  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         377  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         378  +
                ));
         379  +
                test_cfg.push_shared_layer(layer.freeze());
         380  +
            }
         381  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  367    382   
        });
  368    383   
        let parsed = parsed
  369    384   
            .expect("should be successful response")
  370    385   
            .downcast::<crate::operation::empty_operation::EmptyOperationOutput>()
  371    386   
            .unwrap();
  372    387   
    }
  373    388   
  374    389   
    /// This client-only test builds on handles_empty_output_shape,
  375    390   
    /// by including unexpected fields in the JSON. A client
  376    391   
    /// needs to ignore JSON output that is empty or that contains
  377    392   
    /// JSON object data.
  378    393   
    /// Test ID: handles_unexpected_json_output
  379    394   
    #[::tokio::test]
  380    395   
    #[::tracing_test::traced_test]
  381    396   
    async fn handles_unexpected_json_output_response() {
  382    397   
        let expected_output = crate::operation::empty_operation::EmptyOperationOutput::builder().build();
  383    398   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  384    399   
            ::http_1x::response::Builder::new()
  385    400   
                .header("Content-Type", "application/x-amz-json-1.1")
  386    401   
                .status(200)
  387    402   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"foo\": true\n}"))
  388    403   
                .unwrap(),
  389    404   
        )
  390    405   
        .unwrap();
  391    406   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  392    407   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  393    408   
  394    409   
        let op = crate::operation::empty_operation::EmptyOperation::new();
  395    410   
        let config = op.config().expect("the operation has config");
  396    411   
        let de = config
  397    412   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  398    413   
            .expect("the config must have a deserializer");
  399    414   
  400    415   
        let parsed = de.deserialize_streaming(&mut http_response);
  401    416   
        let parsed = parsed.unwrap_or_else(|| {
  402    417   
            let http_response = http_response.map(|body| {
  403    418   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  404    419   
                    body.bytes().unwrap(),
  405    420   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  406    421   
                )))
  407    422   
            });
  408         -
            de.deserialize_nonstreaming(&http_response)
         423  +
            // Build a config bag with the protocol for schema-based deserialization
         424  +
            #[allow(unused_mut)]
         425  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         426  +
            {
         427  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         428  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         429  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         430  +
                ));
         431  +
                test_cfg.push_shared_layer(layer.freeze());
         432  +
            }
         433  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  409    434   
        });
  410    435   
        let parsed = parsed
  411    436   
            .expect("should be successful response")
  412    437   
            .downcast::<crate::operation::empty_operation::EmptyOperationOutput>()
  413    438   
            .unwrap();
  414    439   
    }
  415    440   
  416    441   
    /// When no output is defined, the service is expected to return
  417    442   
    /// an empty payload. Despite the lack of a payload, the service
  418    443   
    /// is expected to always send a Content-Type header. Clients must
  419    444   
    /// handle cases where a service returns a JSON object and where
  420    445   
    /// a service returns no JSON at all.
  421    446   
    /// Test ID: json_1_1_service_responds_with_no_payload
  422    447   
    #[::tokio::test]
  423    448   
    #[::tracing_test::traced_test]
  424    449   
    async fn json_1_1_service_responds_with_no_payload_response() {
  425    450   
        let expected_output = crate::operation::empty_operation::EmptyOperationOutput::builder().build();
  426    451   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  427    452   
            ::http_1x::response::Builder::new()
  428    453   
                .header("Content-Type", "application/x-amz-json-1.1")
  429    454   
                .status(200)
  430    455   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  431    456   
                .unwrap(),
  432    457   
        )
  433    458   
        .unwrap();
  434    459   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  435    460   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  436    461   
  437    462   
        let op = crate::operation::empty_operation::EmptyOperation::new();
  438    463   
        let config = op.config().expect("the operation has config");
  439    464   
        let de = config
  440    465   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  441    466   
            .expect("the config must have a deserializer");
  442    467   
  443    468   
        let parsed = de.deserialize_streaming(&mut http_response);
  444    469   
        let parsed = parsed.unwrap_or_else(|| {
  445    470   
            let http_response = http_response.map(|body| {
  446    471   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  447    472   
                    body.bytes().unwrap(),
  448    473   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  449    474   
                )))
  450    475   
            });
  451         -
            de.deserialize_nonstreaming(&http_response)
         476  +
            // Build a config bag with the protocol for schema-based deserialization
         477  +
            #[allow(unused_mut)]
         478  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         479  +
            {
         480  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         481  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         482  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         483  +
                ));
         484  +
                test_cfg.push_shared_layer(layer.freeze());
         485  +
            }
         486  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  452    487   
        });
  453    488   
        let parsed = parsed
  454    489   
            .expect("should be successful response")
  455    490   
            .downcast::<crate::operation::empty_operation::EmptyOperationOutput>()
  456    491   
            .unwrap();
  457    492   
    }
  458    493   
}
  459    494   
  460    495   
/// Error type for the `EmptyOperationError` operation.
  461    496   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc11/rust-client-codegen/src/operation/empty_operation/_empty_operation_input.rs

@@ -1,1 +69,82 @@
   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 EmptyOperationInput {
   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(&EMPTYOPERATIONINPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&EMPTYOPERATIONINPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        builder
   47     47   
            .build()
   48     48   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   49     49   
    }
   50     50   
}
          51  +
impl EmptyOperationInput {
          52  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          53  +
    pub fn deserialize_with_response(
          54  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          55  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          56  +
        _status: u16,
          57  +
        _body: &[u8],
          58  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          59  +
        Self::builder()
          60  +
            .build()
          61  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          62  +
    }
          63  +
}
   51     64   
impl EmptyOperationInput {
   52     65   
    /// Creates a new builder-style object to manufacture [`EmptyOperationInput`](crate::operation::empty_operation::EmptyOperationInput).
   53     66   
    pub fn builder() -> crate::operation::empty_operation::builders::EmptyOperationInputBuilder {
   54     67   
        crate::operation::empty_operation::builders::EmptyOperationInputBuilder::default()
   55     68   
    }
   56     69   
}
   57     70   
   58     71   
/// A builder for [`EmptyOperationInput`](crate::operation::empty_operation::EmptyOperationInput).
   59     72   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   60     73   
#[non_exhaustive]

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

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

@@ -1,1 +69,82 @@
   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 EndpointOperationInput {
   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(&ENDPOINTOPERATIONINPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&ENDPOINTOPERATIONINPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        builder
   47     47   
            .build()
   48     48   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   49     49   
    }
   50     50   
}
          51  +
impl EndpointOperationInput {
          52  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          53  +
    pub fn deserialize_with_response(
          54  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          55  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          56  +
        _status: u16,
          57  +
        _body: &[u8],
          58  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          59  +
        Self::builder()
          60  +
            .build()
          61  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          62  +
    }
          63  +
}
   51     64   
impl EndpointOperationInput {
   52     65   
    /// Creates a new builder-style object to manufacture [`EndpointOperationInput`](crate::operation::endpoint_operation::EndpointOperationInput).
   53     66   
    pub fn builder() -> crate::operation::endpoint_operation::builders::EndpointOperationInputBuilder {
   54     67   
        crate::operation::endpoint_operation::builders::EndpointOperationInputBuilder::default()
   55     68   
    }
   56     69   
}
   57     70   
   58     71   
/// A builder for [`EndpointOperationInput`](crate::operation::endpoint_operation::EndpointOperationInput).
   59     72   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   60     73   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc11/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/json_rpc11/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 +241,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());
         152  +
        #[allow(unused_mut)]
         153  +
        let mut force_error = false;
         154  +
         155  +
        if !success && status != 200 || force_error {
  145    156   
            let headers = response.headers();
  146    157   
            let body = response.body().bytes().expect("body loaded");
  147    158   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         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  +
            })?;
  149    162   
  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)
         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, "/").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/x-amz-json-1.1");
  197         -
            builder = _header_serialization_settings.set_default_header(
  198         -
                builder,
  199         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  200         -
                "JsonProtocol.EndpointWithHostLabelOperation",
  201         -
            );
  202         -
            builder
  203         -
        };
  204         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  205         -
            crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_input(&input)?,
  206         -
        );
  207         -
        if let Some(content_length) = body.content_length() {
  208         -
            let content_length = content_length.to_string();
  209         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  210         -
        }
  211         -
        ::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);
  212    212   
    }
  213    213   
}
  214    214   
#[derive(Debug)]
  215    215   
struct EndpointWithHostLabelOperationEndpointParamsInterceptor;
  216    216   
  217    217   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for EndpointWithHostLabelOperationEndpointParamsInterceptor {
  218    218   
    fn name(&self) -> &'static str {
  219    219   
        "EndpointWithHostLabelOperationEndpointParamsInterceptor"
  220    220   
    }
  221    221   

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

@@ -24,24 +109,121 @@
   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.label {
   47     47   
            ser.write_string(&ENDPOINTWITHHOSTLABELOPERATIONINPUT_MEMBER_LABEL, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl EndpointWithHostLabelOperationInput {
   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(&ENDPOINTWITHHOSTLABELOPERATIONINPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&ENDPOINTWITHHOSTLABELOPERATIONINPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69     69   
                    builder.label = Some(deser.read_string(member)?);
   70     70   
                }
   71     71   
                _ => {}
   72     72   
            }
   73     73   
            Ok(())
   74     74   
        })?;
          75  +
        builder.label = builder.label.or(Some(String::new()));
   75     76   
        builder
   76     77   
            .build()
   77     78   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   78     79   
    }
   79     80   
}
          81  +
impl EndpointWithHostLabelOperationInput {
          82  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          83  +
    pub fn deserialize_with_response(
          84  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          85  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          86  +
        _status: u16,
          87  +
        _body: &[u8],
          88  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          89  +
        Self::deserialize(deserializer)
          90  +
    }
          91  +
}
   80     92   
impl EndpointWithHostLabelOperationInput {
   81     93   
    /// Creates a new builder-style object to manufacture [`EndpointWithHostLabelOperationInput`](crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput).
   82     94   
    pub fn builder() -> crate::operation::endpoint_with_host_label_operation::builders::EndpointWithHostLabelOperationInputBuilder {
   83     95   
        crate::operation::endpoint_with_host_label_operation::builders::EndpointWithHostLabelOperationInputBuilder::default()
   84     96   
    }
   85     97   
}
   86     98   
   87     99   
/// A builder for [`EndpointWithHostLabelOperationInput`](crate::operation::endpoint_with_host_label_operation::EndpointWithHostLabelOperationInput).
   88    100   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   89    101   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc11/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/json_rpc11/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   
    > {
@@ -104,108 +228,233 @@
  124    128   
                crate::operation::fractional_seconds::FractionalSecondsError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct FractionalSecondsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for FractionalSecondsResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         144  +
        #[allow(unused_mut)]
         145  +
        let mut force_error = false;
         146  +
         147  +
        if !success && status != 200 || force_error {
  139    148   
            let headers = response.headers();
  140    149   
            let body = response.body().bytes().expect("body loaded");
  141    150   
            #[allow(unused_mut)]
  142         -
        let mut force_error = false;
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
  143    154   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_error(status, headers, body)
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         158  +
                    crate::operation::fractional_seconds::FractionalSecondsError::generic(generic),
         159  +
                ),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let mut deser = protocol
         166  +
                .deserialize_response(response, FractionalSeconds::OUTPUT_SCHEMA, _cfg)
         167  +
                .map_err(|e| {
         168  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         169  +
                })?;
         170  +
            let body = response.body().bytes().expect("body loaded");
         171  +
            let output = crate::operation::fractional_seconds::FractionalSecondsOutput::deserialize_with_response(
         172  +
                &mut *deser,
         173  +
                response.headers(),
         174  +
                response.status().into(),
         175  +
                body,
         176  +
            )
         177  +
            .map_err(|e| {
         178  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         179  +
            })?;
         180  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         181  +
        }
  150    182   
    }
  151    183   
}
  152    184   
#[derive(Debug)]
  153    185   
struct FractionalSecondsRequestSerializer;
  154    186   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for FractionalSecondsRequestSerializer {
  155    187   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    188   
    fn serialize_input(
  157    189   
        &self,
  158    190   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    191   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    192   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    193   
        let input = input
  162    194   
            .downcast::<crate::operation::fractional_seconds::FractionalSecondsInput>()
  163    195   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::fractional_seconds::FractionalSecondsInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::fractional_seconds::FractionalSecondsInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
  189         -
            builder = _header_serialization_settings.set_default_header(
  190         -
                builder,
  191         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  192         -
                "JsonProtocol.FractionalSeconds",
  193         -
            );
  194         -
            builder
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_input(&input)?);
         196  +
        let protocol = _cfg
         197  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         198  +
            .expect("a SharedClientProtocol is required");
         199  +
        let mut request = protocol
         200  +
            .serialize_request(&input, FractionalSeconds::INPUT_SCHEMA, "", _cfg)
         201  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  197    202   
  198         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         203  +
        return ::std::result::Result::Ok(request);
  199    204   
    }
  200    205   
}
  201    206   
#[derive(Debug)]
  202    207   
struct FractionalSecondsEndpointParamsInterceptor;
  203    208   
  204    209   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for FractionalSecondsEndpointParamsInterceptor {
  205    210   
    fn name(&self) -> &'static str {
  206    211   
        "FractionalSecondsEndpointParamsInterceptor"
  207    212   
    }
  208    213   
@@ -247,252 +307,322 @@
  267    272   
            .expect("the config must have a deserializer");
  268    273   
  269    274   
        let parsed = de.deserialize_streaming(&mut http_response);
  270    275   
        let parsed = parsed.unwrap_or_else(|| {
  271    276   
            let http_response = http_response.map(|body| {
  272    277   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  273    278   
                    body.bytes().unwrap(),
  274    279   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  275    280   
                )))
  276    281   
            });
  277         -
            de.deserialize_nonstreaming(&http_response)
         282  +
            // Build a config bag with the protocol for schema-based deserialization
         283  +
            #[allow(unused_mut)]
         284  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         285  +
            {
         286  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         287  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         288  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         289  +
                ));
         290  +
                test_cfg.push_shared_layer(layer.freeze());
         291  +
            }
         292  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  278    293   
        });
  279    294   
        let parsed = parsed
  280    295   
            .expect("should be successful response")
  281    296   
            .downcast::<crate::operation::fractional_seconds::FractionalSecondsOutput>()
  282    297   
            .unwrap();
  283    298   
        ::pretty_assertions::assert_eq!(parsed.datetime, expected_output.datetime, "Unexpected value for `datetime`");
  284    299   
    }
  285    300   
}
  286    301   
  287    302   
/// Error type for the `FractionalSecondsError` operation.

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

@@ -1,1 +69,82 @@
   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 FractionalSecondsInput {
   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(&FRACTIONALSECONDSINPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&FRACTIONALSECONDSINPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        builder
   47     47   
            .build()
   48     48   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   49     49   
    }
   50     50   
}
          51  +
impl FractionalSecondsInput {
          52  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          53  +
    pub fn deserialize_with_response(
          54  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          55  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          56  +
        _status: u16,
          57  +
        _body: &[u8],
          58  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          59  +
        Self::builder()
          60  +
            .build()
          61  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          62  +
    }
          63  +
}
   51     64   
impl FractionalSecondsInput {
   52     65   
    /// Creates a new builder-style object to manufacture [`FractionalSecondsInput`](crate::operation::fractional_seconds::FractionalSecondsInput).
   53     66   
    pub fn builder() -> crate::operation::fractional_seconds::builders::FractionalSecondsInputBuilder {
   54     67   
        crate::operation::fractional_seconds::builders::FractionalSecondsInputBuilder::default()
   55     68   
    }
   56     69   
}
   57     70   
   58     71   
/// A builder for [`FractionalSecondsInput`](crate::operation::fractional_seconds::FractionalSecondsInput).
   59     72   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   60     73   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc11/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.json.synthetic#FractionalSecondsOutput$datetime",
   23     23   
        "aws.protocoltests.json.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/json_rpc11/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   
    > {
@@ -104,108 +229,315 @@
  124    128   
                crate::operation::greeting_with_errors::GreetingWithErrorsError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct GreetingWithErrorsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GreetingWithErrorsResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         144  +
        #[allow(unused_mut)]
         145  +
        let mut force_error = false;
         146  +
         147  +
        if !success && status != 200 || force_error {
  139    148   
            let headers = response.headers();
  140    149   
            let body = response.body().bytes().expect("body loaded");
  141    150   
            #[allow(unused_mut)]
  142         -
        let mut force_error = false;
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
  143    154   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_error(status, headers, body)
  146         -
        } else {
  147         -
            crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_response(status, headers, body)
         155  +
            let generic = generic_builder.build();
         156  +
            let error_code = match generic.code() {
         157  +
                ::std::option::Option::Some(code) => code,
         158  +
                ::std::option::Option::None => {
         159  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         160  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(
         161  +
                            crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled(generic),
         162  +
                        ),
         163  +
                    ))
         164  +
                }
         165  +
            };
         166  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         167  +
            let protocol = _cfg
         168  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         169  +
                .expect("a SharedClientProtocol is required");
         170  +
            let err = match error_code {
         171  +
                "InvalidGreeting" => crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting({
         172  +
                    let mut tmp = match protocol
         173  +
                        .deserialize_response(response, crate::types::error::InvalidGreeting::SCHEMA, _cfg)
         174  +
                        .and_then(|mut deser| {
         175  +
                            crate::types::error::InvalidGreeting::deserialize_with_response(
         176  +
                                &mut *deser,
         177  +
                                response.headers(),
         178  +
                                response.status().into(),
         179  +
                                body,
         180  +
                            )
         181  +
                        }) {
         182  +
                        ::std::result::Result::Ok(val) => val,
         183  +
                        ::std::result::Result::Err(e) => {
         184  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         185  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         186  +
                            ))
         187  +
                        }
         188  +
                    };
         189  +
                    tmp.meta = generic;
         190  +
                    if tmp.message.is_none() {
         191  +
                        tmp.message = _error_message;
         192  +
                    }
         193  +
                    tmp
         194  +
                }),
         195  +
                "ComplexError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError({
         196  +
                    let mut tmp = match protocol
         197  +
                        .deserialize_response(response, crate::types::error::ComplexError::SCHEMA, _cfg)
         198  +
                        .and_then(|mut deser| {
         199  +
                            crate::types::error::ComplexError::deserialize_with_response(
         200  +
                                &mut *deser,
         201  +
                                response.headers(),
         202  +
                                response.status().into(),
         203  +
                                body,
         204  +
                            )
         205  +
                        }) {
         206  +
                        ::std::result::Result::Ok(val) => val,
         207  +
                        ::std::result::Result::Err(e) => {
         208  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         209  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         210  +
                            ))
         211  +
                        }
         212  +
                    };
         213  +
                    tmp.meta = generic;
         214  +
                    if tmp.message.is_none() {
         215  +
                        tmp.message = _error_message;
         216  +
                    }
         217  +
                    tmp
         218  +
                }),
         219  +
                "FooError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError({
         220  +
                    let mut tmp = match protocol
         221  +
                        .deserialize_response(response, crate::types::error::FooError::SCHEMA, _cfg)
         222  +
                        .and_then(|mut deser| {
         223  +
                            crate::types::error::FooError::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body)
         224  +
                        }) {
         225  +
                        ::std::result::Result::Ok(val) => val,
         226  +
                        ::std::result::Result::Err(e) => {
         227  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         228  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         229  +
                            ))
         230  +
                        }
         231  +
                    };
         232  +
                    tmp.meta = generic;
         233  +
                    if tmp.message.is_none() {
         234  +
                        tmp.message = _error_message;
         235  +
                    }
         236  +
                    tmp
         237  +
                }),
         238  +
                _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic),
  148    239   
            };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         240  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         241  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         242  +
            ))
         243  +
        } else {
         244  +
            let protocol = _cfg
         245  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         246  +
                .expect("a SharedClientProtocol is required");
         247  +
            let mut deser = protocol
         248  +
                .deserialize_response(response, GreetingWithErrors::OUTPUT_SCHEMA, _cfg)
         249  +
                .map_err(|e| {
         250  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         251  +
                })?;
         252  +
            let body = response.body().bytes().expect("body loaded");
         253  +
            let output = crate::operation::greeting_with_errors::GreetingWithErrorsOutput::deserialize_with_response(
         254  +
                &mut *deser,
         255  +
                response.headers(),
         256  +
                response.status().into(),
         257  +
                body,
         258  +
            )
         259  +
            .map_err(|e| {
         260  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         261  +
            })?;
         262  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         263  +
        }
  150    264   
    }
  151    265   
}
  152    266   
#[derive(Debug)]
  153    267   
struct GreetingWithErrorsRequestSerializer;
  154    268   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GreetingWithErrorsRequestSerializer {
  155    269   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    270   
    fn serialize_input(
  157    271   
        &self,
  158    272   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    273   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    274   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    275   
        let input = input
  162    276   
            .downcast::<crate::operation::greeting_with_errors::GreetingWithErrorsInput>()
  163    277   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::greeting_with_errors::GreetingWithErrorsInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::greeting_with_errors::GreetingWithErrorsInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
  189         -
            builder = _header_serialization_settings.set_default_header(
  190         -
                builder,
  191         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  192         -
                "JsonProtocol.GreetingWithErrors",
  193         -
            );
  194         -
            builder
  195         -
        };
  196         -
        let body =
  197         -
            ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_greeting_with_errors::ser_greeting_with_errors_input(&input)?);
         278  +
        let protocol = _cfg
         279  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         280  +
            .expect("a SharedClientProtocol is required");
         281  +
        let mut request = protocol
         282  +
            .serialize_request(&input, GreetingWithErrors::INPUT_SCHEMA, "", _cfg)
         283  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  198    284   
  199         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         285  +
        return ::std::result::Result::Ok(request);
  200    286   
    }
  201    287   
}
  202    288   
#[derive(Debug)]
  203    289   
struct GreetingWithErrorsEndpointParamsInterceptor;
  204    290   
  205    291   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GreetingWithErrorsEndpointParamsInterceptor {
  206    292   
    fn name(&self) -> &'static str {
  207    293   
        "GreetingWithErrorsEndpointParamsInterceptor"
  208    294   
    }
  209    295   
@@ -246,332 +849,1065 @@
  266    352   
            .expect("the config must have a deserializer");
  267    353   
  268    354   
        let parsed = de.deserialize_streaming(&mut http_response);
  269    355   
        let parsed = parsed.unwrap_or_else(|| {
  270    356   
            let http_response = http_response.map(|body| {
  271    357   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  272    358   
                    body.bytes().unwrap(),
  273    359   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  274    360   
                )))
  275    361   
            });
  276         -
            de.deserialize_nonstreaming(&http_response)
         362  +
            // Build a config bag with the protocol for schema-based deserialization
         363  +
            #[allow(unused_mut)]
         364  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         365  +
            {
         366  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         367  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         368  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         369  +
                ));
         370  +
                test_cfg.push_shared_layer(layer.freeze());
         371  +
            }
         372  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  277    373   
        });
  278    374   
        let parsed = parsed.expect_err("should be error response");
  279    375   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  280    376   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  281    377   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting(parsed) = parsed {
  282    378   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  283    379   
        } else {
  284    380   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  285    381   
        }
  286    382   
    }
  287    383   
  288    384   
    /// Parses a complex error with no message member
  289    385   
    /// Test ID: AwsJson11ComplexError
  290    386   
    #[::tokio::test]
  291    387   
    #[::tracing_test::traced_test]
  292    388   
    async fn aws_json11_complex_error_response() {
  293    389   
        let expected_output = crate::types::error::ComplexError::builder()
  294    390   
            .set_top_level(::std::option::Option::Some("Top level".to_owned()))
  295    391   
            .set_nested(::std::option::Option::Some(
  296    392   
                crate::types::ComplexNestedErrorData::builder()
  297    393   
                    .set_foo(::std::option::Option::Some("bar".to_owned()))
  298    394   
                    .build(),
  299    395   
            ))
  300    396   
            .build();
  301    397   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  302    398   
            ::http_1x::response::Builder::new()
  303    399   
                .header("Content-Type", "application/x-amz-json-1.1")
  304    400   
                .status(400)
  305    401   
                .body(::aws_smithy_types::body::SdkBody::from(
  306    402   
                    "{\n    \"__type\": \"ComplexError\",\n    \"TopLevel\": \"Top level\",\n    \"Nested\": {\n        \"Foo\": \"bar\"\n    }\n}",
  307    403   
                ))
  308    404   
                .unwrap(),
  309    405   
        )
  310    406   
        .unwrap();
  311    407   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  312    408   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  313    409   
  314    410   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  315    411   
        let config = op.config().expect("the operation has config");
  316    412   
        let de = config
  317    413   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  318    414   
            .expect("the config must have a deserializer");
  319    415   
  320    416   
        let parsed = de.deserialize_streaming(&mut http_response);
  321    417   
        let parsed = parsed.unwrap_or_else(|| {
  322    418   
            let http_response = http_response.map(|body| {
  323    419   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  324    420   
                    body.bytes().unwrap(),
  325    421   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  326    422   
                )))
  327    423   
            });
  328         -
            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_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         431  +
                ));
         432  +
                test_cfg.push_shared_layer(layer.freeze());
         433  +
            }
         434  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  329    435   
        });
  330    436   
        let parsed = parsed.expect_err("should be error response");
  331    437   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  332    438   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  333    439   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError(parsed) = parsed {
  334    440   
            ::pretty_assertions::assert_eq!(parsed.top_level, expected_output.top_level, "Unexpected value for `top_level`");
  335    441   
            ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  336    442   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  337    443   
        } else {
  338    444   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  339    445   
        }
  340    446   
    }
  341    447   
    /// Test ID: AwsJson11EmptyComplexError
  342    448   
    #[::tokio::test]
  343    449   
    #[::tracing_test::traced_test]
  344    450   
    async fn aws_json11_empty_complex_error_response() {
  345    451   
        let expected_output = crate::types::error::ComplexError::builder().build();
  346    452   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  347    453   
            ::http_1x::response::Builder::new()
  348    454   
                .header("Content-Type", "application/x-amz-json-1.1")
  349    455   
                .status(400)
  350    456   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"__type\": \"ComplexError\"\n}"))
  351    457   
                .unwrap(),
  352    458   
        )
  353    459   
        .unwrap();
  354    460   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  355    461   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  356    462   
  357    463   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  358    464   
        let config = op.config().expect("the operation has config");
  359    465   
        let de = config
  360    466   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  361    467   
            .expect("the config must have a deserializer");
  362    468   
  363    469   
        let parsed = de.deserialize_streaming(&mut http_response);
  364    470   
        let parsed = parsed.unwrap_or_else(|| {
  365    471   
            let http_response = http_response.map(|body| {
  366    472   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  367    473   
                    body.bytes().unwrap(),
  368    474   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  369    475   
                )))
  370    476   
            });
  371         -
            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_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         484  +
                ));
         485  +
                test_cfg.push_shared_layer(layer.freeze());
         486  +
            }
         487  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  372    488   
        });
  373    489   
        let parsed = parsed.expect_err("should be error response");
  374    490   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  375    491   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  376    492   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError(parsed) = parsed {
  377    493   
            ::pretty_assertions::assert_eq!(parsed.top_level, expected_output.top_level, "Unexpected value for `top_level`");
  378    494   
            ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  379    495   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  380    496   
        } else {
  381    497   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  382    498   
        }
  383    499   
    }
  384    500   
  385    501   
    /// Serializes the X-Amzn-ErrorType header. For an example service, see Amazon EKS.
  386    502   
    /// Test ID: AwsJson11FooErrorUsingXAmznErrorType
  387    503   
    #[::tokio::test]
  388    504   
    #[::tracing_test::traced_test]
  389    505   
    async fn aws_json11_foo_error_using_x_amzn_error_type_response() {
  390    506   
        let expected_output = crate::types::error::FooError::builder().build();
  391    507   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  392    508   
            ::http_1x::response::Builder::new()
  393    509   
                .header("X-Amzn-Errortype", "FooError")
  394    510   
                .status(500)
  395    511   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  396    512   
                .unwrap(),
  397    513   
        )
  398    514   
        .unwrap();
  399    515   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  400    516   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  401    517   
  402    518   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  403    519   
        let config = op.config().expect("the operation has config");
  404    520   
        let de = config
  405    521   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  406    522   
            .expect("the config must have a deserializer");
  407    523   
  408    524   
        let parsed = de.deserialize_streaming(&mut http_response);
  409    525   
        let parsed = parsed.unwrap_or_else(|| {
  410    526   
            let http_response = http_response.map(|body| {
  411    527   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  412    528   
                    body.bytes().unwrap(),
  413    529   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  414    530   
                )))
  415    531   
            });
  416         -
            de.deserialize_nonstreaming(&http_response)
         532  +
            // Build a config bag with the protocol for schema-based deserialization
         533  +
            #[allow(unused_mut)]
         534  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         535  +
            {
         536  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         537  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         538  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         539  +
                ));
         540  +
                test_cfg.push_shared_layer(layer.freeze());
         541  +
            }
         542  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  417    543   
        });
  418    544   
        let parsed = parsed.expect_err("should be error response");
  419    545   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  420    546   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  421    547   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  422    548   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  423    549   
        } else {
  424    550   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  425    551   
        }
  426    552   
    }
  427    553   
  428    554   
    /// 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/'
  429    555   
    /// is to be interpreted as 'ValidationException'.
  430    556   
    ///
  431    557   
    /// For an example service see Amazon Polly.
  432    558   
    /// Test ID: AwsJson11FooErrorUsingXAmznErrorTypeWithUri
  433    559   
    #[::tokio::test]
  434    560   
    #[::tracing_test::traced_test]
  435    561   
    async fn aws_json11_foo_error_using_x_amzn_error_type_with_uri_response() {
  436    562   
        let expected_output = crate::types::error::FooError::builder().build();
  437    563   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  438    564   
            ::http_1x::response::Builder::new()
  439    565   
                .header("X-Amzn-Errortype", "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/")
  440    566   
                .status(500)
  441    567   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  442    568   
                .unwrap(),
  443    569   
        )
  444    570   
        .unwrap();
  445    571   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  446    572   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  447    573   
  448    574   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  449    575   
        let config = op.config().expect("the operation has config");
  450    576   
        let de = config
  451    577   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  452    578   
            .expect("the config must have a deserializer");
  453    579   
  454    580   
        let parsed = de.deserialize_streaming(&mut http_response);
  455    581   
        let parsed = parsed.unwrap_or_else(|| {
  456    582   
            let http_response = http_response.map(|body| {
  457    583   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  458    584   
                    body.bytes().unwrap(),
  459    585   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  460    586   
                )))
  461    587   
            });
  462         -
            de.deserialize_nonstreaming(&http_response)
         588  +
            // Build a config bag with the protocol for schema-based deserialization
         589  +
            #[allow(unused_mut)]
         590  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         591  +
            {
         592  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         593  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         594  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         595  +
                ));
         596  +
                test_cfg.push_shared_layer(layer.freeze());
         597  +
            }
         598  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  463    599   
        });
  464    600   
        let parsed = parsed.expect_err("should be error response");
  465    601   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  466    602   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  467    603   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  468    604   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  469    605   
        } else {
  470    606   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  471    607   
        }
  472    608   
    }
  473    609   
  474    610   
    /// 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.
  475    611   
    /// Test ID: AwsJson11FooErrorUsingXAmznErrorTypeWithUriAndNamespace
  476    612   
    #[::tokio::test]
  477    613   
    #[::tracing_test::traced_test]
  478    614   
    async fn aws_json11_foo_error_using_x_amzn_error_type_with_uri_and_namespace_response() {
  479    615   
        let expected_output = crate::types::error::FooError::builder().build();
  480    616   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  481    617   
            ::http_1x::response::Builder::new()
  482    618   
                .header(
  483    619   
                    "X-Amzn-Errortype",
  484    620   
                    "aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/",
  485    621   
                )
  486    622   
                .status(500)
  487    623   
                .body(::aws_smithy_types::body::SdkBody::from(vec![]))
  488    624   
                .unwrap(),
  489    625   
        )
  490    626   
        .unwrap();
  491    627   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  492    628   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  493    629   
  494    630   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  495    631   
        let config = op.config().expect("the operation has config");
  496    632   
        let de = config
  497    633   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  498    634   
            .expect("the config must have a deserializer");
  499    635   
  500    636   
        let parsed = de.deserialize_streaming(&mut http_response);
  501    637   
        let parsed = parsed.unwrap_or_else(|| {
  502    638   
            let http_response = http_response.map(|body| {
  503    639   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  504    640   
                    body.bytes().unwrap(),
  505    641   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  506    642   
                )))
  507    643   
            });
  508         -
            de.deserialize_nonstreaming(&http_response)
         644  +
            // Build a config bag with the protocol for schema-based deserialization
         645  +
            #[allow(unused_mut)]
         646  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         647  +
            {
         648  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         649  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         650  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         651  +
                ));
         652  +
                test_cfg.push_shared_layer(layer.freeze());
         653  +
            }
         654  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  509    655   
        });
  510    656   
        let parsed = parsed.expect_err("should be error response");
  511    657   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  512    658   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  513    659   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  514    660   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  515    661   
        } else {
  516    662   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  517    663   
        }
  518    664   
    }
  519    665   
  520    666   
    /// 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.
  521    667   
    ///
  522    668   
    /// For example service see Amazon S3 Glacier.
  523    669   
    /// Test ID: AwsJson11FooErrorUsingCode
  524    670   
    #[::tokio::test]
  525    671   
    #[::tracing_test::traced_test]
  526    672   
    async fn aws_json11_foo_error_using_code_response() {
  527    673   
        let expected_output = crate::types::error::FooError::builder().build();
  528    674   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  529    675   
            ::http_1x::response::Builder::new()
  530    676   
                .header("Content-Type", "application/x-amz-json-1.1")
  531    677   
                .status(500)
  532    678   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"code\": \"FooError\"\n}"))
  533    679   
                .unwrap(),
  534    680   
        )
  535    681   
        .unwrap();
  536    682   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  537    683   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  538    684   
  539    685   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  540    686   
        let config = op.config().expect("the operation has config");
  541    687   
        let de = config
  542    688   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  543    689   
            .expect("the config must have a deserializer");
  544    690   
  545    691   
        let parsed = de.deserialize_streaming(&mut http_response);
  546    692   
        let parsed = parsed.unwrap_or_else(|| {
  547    693   
            let http_response = http_response.map(|body| {
  548    694   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  549    695   
                    body.bytes().unwrap(),
  550    696   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  551    697   
                )))
  552    698   
            });
  553         -
            de.deserialize_nonstreaming(&http_response)
         699  +
            // Build a config bag with the protocol for schema-based deserialization
         700  +
            #[allow(unused_mut)]
         701  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         702  +
            {
         703  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         704  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         705  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         706  +
                ));
         707  +
                test_cfg.push_shared_layer(layer.freeze());
         708  +
            }
         709  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  554    710   
        });
  555    711   
        let parsed = parsed.expect_err("should be error response");
  556    712   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  557    713   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  558    714   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  559    715   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  560    716   
        } else {
  561    717   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  562    718   
        }
  563    719   
    }
  564    720   
  565    721   
    /// Some services serialize errors using code, and it might contain a namespace. Clients should just take the last part of the string after '#'.
  566    722   
    /// Test ID: AwsJson11FooErrorUsingCodeAndNamespace
  567    723   
    #[::tokio::test]
  568    724   
    #[::tracing_test::traced_test]
  569    725   
    async fn aws_json11_foo_error_using_code_and_namespace_response() {
  570    726   
        let expected_output = crate::types::error::FooError::builder().build();
  571    727   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  572    728   
            ::http_1x::response::Builder::new()
  573    729   
                .header("Content-Type", "application/x-amz-json-1.1")
  574    730   
                .status(500)
  575    731   
                .body(::aws_smithy_types::body::SdkBody::from(
  576    732   
                    "{\n    \"code\": \"aws.protocoltests.restjson#FooError\"\n}",
  577    733   
                ))
  578    734   
                .unwrap(),
  579    735   
        )
  580    736   
        .unwrap();
  581    737   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  582    738   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  583    739   
  584    740   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  585    741   
        let config = op.config().expect("the operation has config");
  586    742   
        let de = config
  587    743   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  588    744   
            .expect("the config must have a deserializer");
  589    745   
  590    746   
        let parsed = de.deserialize_streaming(&mut http_response);
  591    747   
        let parsed = parsed.unwrap_or_else(|| {
  592    748   
            let http_response = http_response.map(|body| {
  593    749   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  594    750   
                    body.bytes().unwrap(),
  595    751   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  596    752   
                )))
  597    753   
            });
  598         -
            de.deserialize_nonstreaming(&http_response)
         754  +
            // Build a config bag with the protocol for schema-based deserialization
         755  +
            #[allow(unused_mut)]
         756  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         757  +
            {
         758  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         759  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         760  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         761  +
                ));
         762  +
                test_cfg.push_shared_layer(layer.freeze());
         763  +
            }
         764  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  599    765   
        });
  600    766   
        let parsed = parsed.expect_err("should be error response");
  601    767   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  602    768   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  603    769   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  604    770   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  605    771   
        } else {
  606    772   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  607    773   
        }
  608    774   
    }
  609    775   
  610    776   
    /// 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.
  611    777   
    /// Test ID: AwsJson11FooErrorUsingCodeUriAndNamespace
  612    778   
    #[::tokio::test]
  613    779   
    #[::tracing_test::traced_test]
  614    780   
    async fn aws_json11_foo_error_using_code_uri_and_namespace_response() {
  615    781   
        let expected_output = crate::types::error::FooError::builder().build();
  616    782   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  617    783   
            ::http_1x::response::Builder::new()
  618    784   
                .header("Content-Type", "application/x-amz-json-1.1")
  619    785   
                .status(500)
  620    786   
                .body(::aws_smithy_types::body::SdkBody::from(
  621    787   
                    "{\n    \"code\": \"aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/\"\n}",
  622    788   
                ))
  623    789   
                .unwrap(),
  624    790   
        )
  625    791   
        .unwrap();
  626    792   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  627    793   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  628    794   
  629    795   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  630    796   
        let config = op.config().expect("the operation has config");
  631    797   
        let de = config
  632    798   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  633    799   
            .expect("the config must have a deserializer");
  634    800   
  635    801   
        let parsed = de.deserialize_streaming(&mut http_response);
  636    802   
        let parsed = parsed.unwrap_or_else(|| {
  637    803   
            let http_response = http_response.map(|body| {
  638    804   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  639    805   
                    body.bytes().unwrap(),
  640    806   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  641    807   
                )))
  642    808   
            });
  643         -
            de.deserialize_nonstreaming(&http_response)
         809  +
            // Build a config bag with the protocol for schema-based deserialization
         810  +
            #[allow(unused_mut)]
         811  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         812  +
            {
         813  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         814  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         815  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         816  +
                ));
         817  +
                test_cfg.push_shared_layer(layer.freeze());
         818  +
            }
         819  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  644    820   
        });
  645    821   
        let parsed = parsed.expect_err("should be error response");
  646    822   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  647    823   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  648    824   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  649    825   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  650    826   
        } else {
  651    827   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  652    828   
        }
  653    829   
    }
  654    830   
  655    831   
    /// Some services serialize errors using __type.
  656    832   
    /// Test ID: AwsJson11FooErrorWithDunderType
  657    833   
    #[::tokio::test]
  658    834   
    #[::tracing_test::traced_test]
  659    835   
    async fn aws_json11_foo_error_with_dunder_type_response() {
  660    836   
        let expected_output = crate::types::error::FooError::builder().build();
  661    837   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  662    838   
            ::http_1x::response::Builder::new()
  663    839   
                .header("Content-Type", "application/x-amz-json-1.1")
  664    840   
                .status(500)
  665    841   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"__type\": \"FooError\"\n}"))
  666    842   
                .unwrap(),
  667    843   
        )
  668    844   
        .unwrap();
  669    845   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  670    846   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  671    847   
  672    848   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  673    849   
        let config = op.config().expect("the operation has config");
  674    850   
        let de = config
  675    851   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  676    852   
            .expect("the config must have a deserializer");
  677    853   
  678    854   
        let parsed = de.deserialize_streaming(&mut http_response);
  679    855   
        let parsed = parsed.unwrap_or_else(|| {
  680    856   
            let http_response = http_response.map(|body| {
  681    857   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  682    858   
                    body.bytes().unwrap(),
  683    859   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  684    860   
                )))
  685    861   
            });
  686         -
            de.deserialize_nonstreaming(&http_response)
         862  +
            // Build a config bag with the protocol for schema-based deserialization
         863  +
            #[allow(unused_mut)]
         864  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         865  +
            {
         866  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         867  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         868  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         869  +
                ));
         870  +
                test_cfg.push_shared_layer(layer.freeze());
         871  +
            }
         872  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  687    873   
        });
  688    874   
        let parsed = parsed.expect_err("should be error response");
  689    875   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  690    876   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  691    877   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  692    878   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  693    879   
        } else {
  694    880   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  695    881   
        }
  696    882   
    }
  697    883   
  698    884   
    /// Some services serialize errors using __type, and it might contain a namespace. Clients should just take the last part of the string after '#'.
  699    885   
    /// Test ID: AwsJson11FooErrorWithDunderTypeAndNamespace
  700    886   
    #[::tokio::test]
  701    887   
    #[::tracing_test::traced_test]
  702    888   
    async fn aws_json11_foo_error_with_dunder_type_and_namespace_response() {
  703    889   
        let expected_output = crate::types::error::FooError::builder().build();
  704    890   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  705    891   
            ::http_1x::response::Builder::new()
  706    892   
                .header("Content-Type", "application/x-amz-json-1.1")
  707    893   
                .status(500)
  708    894   
                .body(::aws_smithy_types::body::SdkBody::from(
  709    895   
                    "{\n    \"__type\": \"aws.protocoltests.restjson#FooError\"\n}",
  710    896   
                ))
  711    897   
                .unwrap(),
  712    898   
        )
  713    899   
        .unwrap();
  714    900   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  715    901   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  716    902   
  717    903   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  718    904   
        let config = op.config().expect("the operation has config");
  719    905   
        let de = config
  720    906   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  721    907   
            .expect("the config must have a deserializer");
  722    908   
  723    909   
        let parsed = de.deserialize_streaming(&mut http_response);
  724    910   
        let parsed = parsed.unwrap_or_else(|| {
  725    911   
            let http_response = http_response.map(|body| {
  726    912   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  727    913   
                    body.bytes().unwrap(),
  728    914   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  729    915   
                )))
  730    916   
            });
  731         -
            de.deserialize_nonstreaming(&http_response)
         917  +
            // Build a config bag with the protocol for schema-based deserialization
         918  +
            #[allow(unused_mut)]
         919  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         920  +
            {
         921  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         922  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         923  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         924  +
                ));
         925  +
                test_cfg.push_shared_layer(layer.freeze());
         926  +
            }
         927  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  732    928   
        });
  733    929   
        let parsed = parsed.expect_err("should be error response");
  734    930   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  735    931   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  736    932   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  737    933   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  738    934   
        } else {
  739    935   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  740    936   
        }
  741    937   
    }
  742    938   
  743    939   
    /// 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.
  744    940   
    /// Test ID: AwsJson11FooErrorWithDunderTypeUriAndNamespace
  745    941   
    #[::tokio::test]
  746    942   
    #[::tracing_test::traced_test]
  747    943   
    async fn aws_json11_foo_error_with_dunder_type_uri_and_namespace_response() {
  748    944   
        let expected_output = crate::types::error::FooError::builder().build();
  749    945   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  750    946   
            ::http_1x::response::Builder::new()
  751    947   
                .header("Content-Type", "application/x-amz-json-1.1")
  752    948   
                .status(500)
  753    949   
                .body(::aws_smithy_types::body::SdkBody::from(
  754    950   
                    "{\n    \"__type\": \"aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/\"\n}",
  755    951   
                ))
  756    952   
                .unwrap(),
  757    953   
        )
  758    954   
        .unwrap();
  759    955   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  760    956   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  761    957   
  762    958   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  763    959   
        let config = op.config().expect("the operation has config");
  764    960   
        let de = config
  765    961   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  766    962   
            .expect("the config must have a deserializer");
  767    963   
  768    964   
        let parsed = de.deserialize_streaming(&mut http_response);
  769    965   
        let parsed = parsed.unwrap_or_else(|| {
  770    966   
            let http_response = http_response.map(|body| {
  771    967   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  772    968   
                    body.bytes().unwrap(),
  773    969   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  774    970   
                )))
  775    971   
            });
  776         -
            de.deserialize_nonstreaming(&http_response)
         972  +
            // Build a config bag with the protocol for schema-based deserialization
         973  +
            #[allow(unused_mut)]
         974  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         975  +
            {
         976  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         977  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         978  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
         979  +
                ));
         980  +
                test_cfg.push_shared_layer(layer.freeze());
         981  +
            }
         982  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  777    983   
        });
  778    984   
        let parsed = parsed.expect_err("should be error response");
  779    985   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  780    986   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  781    987   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  782    988   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  783    989   
        } else {
  784    990   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  785    991   
        }
  786    992   
    }
  787    993   
  788    994   
    /// 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.
  789    995   
    ///
  790    996   
    /// For an example service see Amazon DynamoDB.
  791    997   
    /// Test ID: AwsJson11FooErrorWithNestedTypeProperty
  792    998   
    #[::tokio::test]
  793    999   
    #[::tracing_test::traced_test]
  794   1000   
    async fn aws_json11_foo_error_with_nested_type_property_response() {
  795   1001   
        let expected_output = crate::types::error::FooError::builder().build();
  796   1002   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(::http_1x::response::Builder::new()
  797   1003   
        .header("Content-Type", "application/x-amz-json-1.1")
  798   1004   
        .status(500)
  799   1005   
                    .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}"))
  800   1006   
                    .unwrap()
  801   1007   
                    ).unwrap();
  802   1008   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  803   1009   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  804   1010   
  805   1011   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  806   1012   
        let config = op.config().expect("the operation has config");
  807   1013   
        let de = config
  808   1014   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  809   1015   
            .expect("the config must have a deserializer");
  810   1016   
  811   1017   
        let parsed = de.deserialize_streaming(&mut http_response);
  812   1018   
        let parsed = parsed.unwrap_or_else(|| {
  813   1019   
            let http_response = http_response.map(|body| {
  814   1020   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  815   1021   
                    body.bytes().unwrap(),
  816   1022   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  817   1023   
                )))
  818   1024   
            });
  819         -
            de.deserialize_nonstreaming(&http_response)
        1025  +
            // Build a config bag with the protocol for schema-based deserialization
        1026  +
            #[allow(unused_mut)]
        1027  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1028  +
            {
        1029  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1030  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1031  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("JsonProtocol"),
        1032  +
                ));
        1033  +
                test_cfg.push_shared_layer(layer.freeze());
        1034  +
            }
        1035  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  820   1036   
        });
  821   1037   
        let parsed = parsed.expect_err("should be error response");
  822   1038   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  823   1039   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  824   1040   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError(parsed) = parsed {
  825   1041   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  826   1042   
        } else {
  827   1043   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  828   1044   
        }
  829   1045   
    }

tmp-codegen-diff/codegen-client-test/json_rpc11/rust-client-codegen/src/operation/greeting_with_errors/_greeting_with_errors_input.rs

@@ -1,1 +70,83 @@
   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 GreetingWithErrorsInput {
   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(&GREETINGWITHERRORSINPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&GREETINGWITHERRORSINPUT_SCHEMA, &mut |member, deser| {
   41     41   
            match member.member_index() {
   42     42   
                _ => {}
   43     43   
            }
   44     44   
            Ok(())
   45     45   
        })?;
   46     46   
        builder
   47     47   
            .build()
   48     48   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   49     49   
    }
   50     50   
}
          51  +
impl GreetingWithErrorsInput {
          52  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          53  +
    pub fn deserialize_with_response(
          54  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          55  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          56  +
        _status: u16,
          57  +
        _body: &[u8],
          58  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          59  +
        Self::builder()
          60  +
            .build()
          61  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          62  +
    }
          63  +
}
   51     64   
impl GreetingWithErrorsInput {
   52     65   
    /// Creates a new builder-style object to manufacture [`GreetingWithErrorsInput`](crate::operation::greeting_with_errors::GreetingWithErrorsInput).
   53     66   
    pub fn builder() -> crate::operation::greeting_with_errors::builders::GreetingWithErrorsInputBuilder {
   54     67   
        crate::operation::greeting_with_errors::builders::GreetingWithErrorsInputBuilder::default()
   55     68   
    }
   56     69   
}
   57     70   
   58     71   
/// A builder for [`GreetingWithErrorsInput`](crate::operation::greeting_with_errors::GreetingWithErrorsInput).
   59     72   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   60     73   
#[non_exhaustive]