Client Test

Client Test

rev. e063993ca0ab793f44c575dbe707d50a5e3e2406

Files changed:

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

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/operation/empty_input_and_empty_output/_empty_input_and_empty_output_input.rs

@@ -1,1 +72,85 @@
   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 EmptyInputAndEmptyOutputInput {
   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(&EMPTYINPUTANDEMPTYOUTPUTINPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&EMPTYINPUTANDEMPTYOUTPUTINPUT_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 EmptyInputAndEmptyOutputInput {
          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 EmptyInputAndEmptyOutputInput {
   52     65   
    /// Creates a new builder-style object to manufacture [`EmptyInputAndEmptyOutputInput`](crate::operation::empty_input_and_empty_output::EmptyInputAndEmptyOutputInput).
   53     66   
    pub fn builder() -> crate::operation::empty_input_and_empty_output::builders::EmptyInputAndEmptyOutputInputBuilder {
   54     67   
        crate::operation::empty_input_and_empty_output::builders::EmptyInputAndEmptyOutputInputBuilder::default()
   55     68   
    }
   56     69   
}
   57     70   
   58     71   
/// A builder for [`EmptyInputAndEmptyOutputInput`](crate::operation::empty_input_and_empty_output::EmptyInputAndEmptyOutputInput).
   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_rpc10/rust-client-codegen/src/operation/empty_input_and_empty_output/_empty_input_and_empty_output_output.rs

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

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

@@ -23,23 +108,119 @@
   43     43   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     44   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     45   
        if let Some(ref val) = self.greeting {
   46     46   
            ser.write_string(&GREETINGWITHERRORSINPUT_MEMBER_GREETING, val)?;
   47     47   
        }
   48     48   
        Ok(())
   49     49   
    }
   50     50   
}
   51     51   
impl GreetingWithErrorsInput {
   52     52   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   53         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   54         -
        deserializer: &mut D,
          53  +
    pub fn deserialize(
          54  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   55     55   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   56     56   
        #[allow(unused_variables, unused_mut)]
   57     57   
        let mut builder = Self::builder();
   58     58   
        #[allow(
   59     59   
            unused_variables,
   60     60   
            unreachable_code,
   61     61   
            clippy::single_match,
   62     62   
            clippy::match_single_binding,
   63     63   
            clippy::diverging_sub_expression
   64     64   
        )]
   65         -
        deserializer.read_struct(&GREETINGWITHERRORSINPUT_SCHEMA, (), |_, member, deser| {
          65  +
        deserializer.read_struct(&GREETINGWITHERRORSINPUT_SCHEMA, &mut |member, deser| {
   66     66   
            match member.member_index() {
   67     67   
                Some(0) => {
   68     68   
                    builder.greeting = Some(deser.read_string(member)?);
   69     69   
                }
   70     70   
                _ => {}
   71     71   
            }
   72     72   
            Ok(())
   73     73   
        })?;
   74     74   
        builder
   75     75   
            .build()
   76     76   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   77     77   
    }
   78     78   
}
          79  +
impl GreetingWithErrorsInput {
          80  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          81  +
    pub fn deserialize_with_response(
          82  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          83  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          84  +
        _status: u16,
          85  +
        _body: &[u8],
          86  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          87  +
        Self::deserialize(deserializer)
          88  +
    }
          89  +
}
   79     90   
impl GreetingWithErrorsInput {
   80     91   
    /// Creates a new builder-style object to manufacture [`GreetingWithErrorsInput`](crate::operation::greeting_with_errors::GreetingWithErrorsInput).
   81     92   
    pub fn builder() -> crate::operation::greeting_with_errors::builders::GreetingWithErrorsInputBuilder {
   82     93   
        crate::operation::greeting_with_errors::builders::GreetingWithErrorsInputBuilder::default()
   83     94   
    }
   84     95   
}
   85     96   
   86     97   
/// A builder for [`GreetingWithErrorsInput`](crate::operation::greeting_with_errors::GreetingWithErrorsInput).
   87     98   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   88     99   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/operation/greeting_with_errors/_greeting_with_errors_output.rs

@@ -23,23 +106,117 @@
   43     43   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     44   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     45   
        if let Some(ref val) = self.greeting {
   46     46   
            ser.write_string(&GREETINGWITHERRORSOUTPUT_MEMBER_GREETING, val)?;
   47     47   
        }
   48     48   
        Ok(())
   49     49   
    }
   50     50   
}
   51     51   
impl GreetingWithErrorsOutput {
   52     52   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   53         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   54         -
        deserializer: &mut D,
          53  +
    pub fn deserialize(
          54  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   55     55   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   56     56   
        #[allow(unused_variables, unused_mut)]
   57     57   
        let mut builder = Self::builder();
   58     58   
        #[allow(
   59     59   
            unused_variables,
   60     60   
            unreachable_code,
   61     61   
            clippy::single_match,
   62     62   
            clippy::match_single_binding,
   63     63   
            clippy::diverging_sub_expression
   64     64   
        )]
   65         -
        deserializer.read_struct(&GREETINGWITHERRORSOUTPUT_SCHEMA, (), |_, member, deser| {
          65  +
        deserializer.read_struct(&GREETINGWITHERRORSOUTPUT_SCHEMA, &mut |member, deser| {
   66     66   
            match member.member_index() {
   67     67   
                Some(0) => {
   68     68   
                    builder.greeting = Some(deser.read_string(member)?);
   69     69   
                }
   70     70   
                _ => {}
   71     71   
            }
   72     72   
            Ok(())
   73     73   
        })?;
   74     74   
        Ok(builder.build())
   75     75   
    }
   76     76   
}
          77  +
impl GreetingWithErrorsOutput {
          78  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          79  +
    pub fn deserialize_with_response(
          80  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          81  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          82  +
        _status: u16,
          83  +
        _body: &[u8],
          84  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          85  +
        Self::deserialize(deserializer)
          86  +
    }
          87  +
}
   77     88   
impl GreetingWithErrorsOutput {
   78     89   
    /// Creates a new builder-style object to manufacture [`GreetingWithErrorsOutput`](crate::operation::greeting_with_errors::GreetingWithErrorsOutput).
   79     90   
    pub fn builder() -> crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder {
   80     91   
        crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder::default()
   81     92   
    }
   82     93   
}
   83     94   
   84     95   
/// A builder for [`GreetingWithErrorsOutput`](crate::operation::greeting_with_errors::GreetingWithErrorsOutput).
   85     96   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   86     97   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/operation/host_with_path_operation.rs

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `HostWithPathOperation`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HostWithPathOperation;
    6      6   
impl HostWithPathOperation {
    7      7   
    /// Creates a new `HostWithPathOperation`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::host_with_path_operation::HostWithPathOperationInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::host_with_path_operation::HostWithPathOperationOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::host_with_path_operation::HostWithPathOperationInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::host_with_path_operation::HostWithPathOperationOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::host_with_path_operation::HostWithPathOperationError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +230,233 @@
  124    128   
                crate::operation::host_with_path_operation::HostWithPathOperationError,
  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 HostWithPathOperationResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HostWithPathOperationResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139         -
        let headers = response.headers();
  140         -
        let body = response.body().bytes().expect("body loaded");
  141    144   
        #[allow(unused_mut)]
  142    145   
        let mut force_error = false;
  143    146   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_error(status, headers, body)
         147  +
        if !success && status != 200 || force_error {
         148  +
            let headers = response.headers();
         149  +
            let body = response.body().bytes().expect("body loaded");
         150  +
            #[allow(unused_mut)]
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
         154  +
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         158  +
                    crate::operation::host_with_path_operation::HostWithPathOperationError::generic(generic),
         159  +
                ),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_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, HostWithPathOperation::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::host_with_path_operation::HostWithPathOperationOutput::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 HostWithPathOperationRequestSerializer;
  154    186   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HostWithPathOperationRequestSerializer {
  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::host_with_path_operation::HostWithPathOperationInput>()
  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::host_with_path_operation::HostWithPathOperationInput,
  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::host_with_path_operation::HostWithPathOperationInput,
  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.0");
  189         -
            builder = _header_serialization_settings.set_default_header(
  190         -
                builder,
  191         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  192         -
                "JsonRpc10.HostWithPathOperation",
  193         -
            );
  194         -
            builder
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  197         -
            crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_input(&input)?,
  198         -
        );
         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, HostWithPathOperation::INPUT_SCHEMA, "", _cfg)
         201  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  199    202   
  200         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         203  +
        return ::std::result::Result::Ok(request);
  201    204   
    }
  202    205   
}
  203    206   
#[derive(Debug)]
  204    207   
struct HostWithPathOperationEndpointParamsInterceptor;
  205    208   
  206    209   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HostWithPathOperationEndpointParamsInterceptor {
  207    210   
    fn name(&self) -> &'static str {
  208    211   
        "HostWithPathOperationEndpointParamsInterceptor"
  209    212   
    }
  210    213   

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/operation/host_with_path_operation/_host_with_path_operation_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 HostWithPathOperationInput {
   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(&HOSTWITHPATHOPERATIONINPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&HOSTWITHPATHOPERATIONINPUT_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 HostWithPathOperationInput {
          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 HostWithPathOperationInput {
   52     65   
    /// Creates a new builder-style object to manufacture [`HostWithPathOperationInput`](crate::operation::host_with_path_operation::HostWithPathOperationInput).
   53     66   
    pub fn builder() -> crate::operation::host_with_path_operation::builders::HostWithPathOperationInputBuilder {
   54     67   
        crate::operation::host_with_path_operation::builders::HostWithPathOperationInputBuilder::default()
   55     68   
    }
   56     69   
}
   57     70   
   58     71   
/// A builder for [`HostWithPathOperationInput`](crate::operation::host_with_path_operation::HostWithPathOperationInput).
   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_rpc10/rust-client-codegen/src/operation/host_with_path_operation/_host_with_path_operation_output.rs

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

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/operation/json_unions.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 `JsonUnions`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct JsonUnions;
    6      6   
impl JsonUnions {
    7      7   
    /// Creates a new `JsonUnions`
    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::json_unions::JsonUnionsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_unions::JsonUnionsOutput::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::json_unions::JsonUnionsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::json_unions::JsonUnionsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::json_unions::JsonUnionsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -101,105 +226,226 @@
  121    125   
                crate::operation::json_unions::JsonUnionsError,
  122    126   
            >::new());
  123    127   
  124    128   
        ::std::borrow::Cow::Owned(rcb)
  125    129   
    }
  126    130   
}
  127    131   
  128    132   
#[derive(Debug)]
  129    133   
struct JsonUnionsResponseDeserializer;
  130    134   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for JsonUnionsResponseDeserializer {
  131         -
    fn deserialize_nonstreaming(
         135  +
    fn deserialize_nonstreaming_with_config(
  132    136   
        &self,
  133    137   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         138  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  134    139   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  135    140   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  136         -
        let headers = response.headers();
  137         -
        let body = response.body().bytes().expect("body loaded");
  138    141   
        #[allow(unused_mut)]
  139    142   
        let mut force_error = false;
  140    143   
  141         -
        let parse_result = if !success && status != 200 || force_error {
  142         -
            crate::protocol_serde::shape_json_unions::de_json_unions_http_error(status, headers, body)
         144  +
        if !success && status != 200 || force_error {
         145  +
            let headers = response.headers();
         146  +
            let body = response.body().bytes().expect("body loaded");
         147  +
            #[allow(unused_mut)]
         148  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         149  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         150  +
            })?;
         151  +
         152  +
            let generic = generic_builder.build();
         153  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         154  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(crate::operation::json_unions::JsonUnionsError::generic(
         155  +
                    generic,
         156  +
                )),
         157  +
            ))
  143    158   
        } else {
  144         -
            crate::protocol_serde::shape_json_unions::de_json_unions_http_response(status, headers, body)
  145         -
        };
  146         -
        crate::protocol_serde::type_erase_result(parse_result)
         159  +
            let protocol = _cfg
         160  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         161  +
                .expect("a SharedClientProtocol is required");
         162  +
            let mut deser = protocol.deserialize_response(response, JsonUnions::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         163  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         164  +
            })?;
         165  +
            let body = response.body().bytes().expect("body loaded");
         166  +
            let output = crate::operation::json_unions::JsonUnionsOutput::deserialize_with_response(
         167  +
                &mut *deser,
         168  +
                response.headers(),
         169  +
                response.status().into(),
         170  +
                body,
         171  +
            )
         172  +
            .map_err(|e| {
         173  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         174  +
            })?;
         175  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         176  +
        }
  147    177   
    }
  148    178   
}
  149    179   
#[derive(Debug)]
  150    180   
struct JsonUnionsRequestSerializer;
  151    181   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for JsonUnionsRequestSerializer {
  152    182   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  153    183   
    fn serialize_input(
  154    184   
        &self,
  155    185   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  156    186   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  157    187   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  158    188   
        let input = input.downcast::<crate::operation::json_unions::JsonUnionsInput>().expect("correct type");
  159         -
        let _header_serialization_settings = _cfg
  160         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  161         -
            .cloned()
  162         -
            .unwrap_or_default();
  163         -
        let mut request_builder = {
  164         -
            #[allow(clippy::uninlined_format_args)]
  165         -
            fn uri_base(
  166         -
                _input: &crate::operation::json_unions::JsonUnionsInput,
  167         -
                output: &mut ::std::string::String,
  168         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  169         -
                use ::std::fmt::Write as _;
  170         -
                ::std::write!(output, "/").expect("formatting should succeed");
  171         -
                ::std::result::Result::Ok(())
  172         -
            }
  173         -
            #[allow(clippy::unnecessary_wraps)]
  174         -
            fn update_http_builder(
  175         -
                input: &crate::operation::json_unions::JsonUnionsInput,
  176         -
                builder: ::http_1x::request::Builder,
  177         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  178         -
                let mut uri = ::std::string::String::new();
  179         -
                uri_base(input, &mut uri)?;
  180         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  181         -
            }
  182         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  183         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
  184         -
            builder = _header_serialization_settings.set_default_header(
  185         -
                builder,
  186         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  187         -
                "JsonRpc10.JsonUnions",
  188         -
            );
  189         -
            builder
  190         -
        };
  191         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_json_unions::ser_json_unions_input(&input)?);
  192         -
        if let Some(content_length) = body.content_length() {
  193         -
            let content_length = content_length.to_string();
  194         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  195         -
        }
  196         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         189  +
        let protocol = _cfg
         190  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         191  +
            .expect("a SharedClientProtocol is required");
         192  +
        let mut request = protocol
         193  +
            .serialize_request(&input, JsonUnions::INPUT_SCHEMA, "", _cfg)
         194  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         195  +
         196  +
        return ::std::result::Result::Ok(request);
  197    197   
    }
  198    198   
}
  199    199   
#[derive(Debug)]
  200    200   
struct JsonUnionsEndpointParamsInterceptor;
  201    201   
  202    202   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for JsonUnionsEndpointParamsInterceptor {
  203    203   
    fn name(&self) -> &'static str {
  204    204   
        "JsonUnionsEndpointParamsInterceptor"
  205    205   
    }
  206    206   
@@ -601,601 +1159,1279 @@
  621    621   
            .expect("the config must have a deserializer");
  622    622   
  623    623   
        let parsed = de.deserialize_streaming(&mut http_response);
  624    624   
        let parsed = parsed.unwrap_or_else(|| {
  625    625   
            let http_response = http_response.map(|body| {
  626    626   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  627    627   
                    body.bytes().unwrap(),
  628    628   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  629    629   
                )))
  630    630   
            });
  631         -
            de.deserialize_nonstreaming(&http_response)
         631  +
            // Build a config bag with the protocol for schema-based deserialization
         632  +
            #[allow(unused_mut)]
         633  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         634  +
            {
         635  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         636  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         637  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
         638  +
                ));
         639  +
                test_cfg.push_shared_layer(layer.freeze());
         640  +
            }
         641  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  632    642   
        });
  633    643   
        let parsed = parsed
  634    644   
            .expect("should be successful response")
  635    645   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  636    646   
            .unwrap();
  637    647   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  638    648   
    }
  639    649   
  640    650   
    /// Deserializes a boolean union value
  641    651   
    /// Test ID: AwsJson10DeserializeBooleanUnionValue
  642    652   
    #[::tokio::test]
  643    653   
    #[::tracing_test::traced_test]
  644    654   
    async fn aws_json10_deserialize_boolean_union_value_response() {
  645    655   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  646    656   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::BooleanValue(true)))
  647    657   
            .build();
  648    658   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  649    659   
            ::http_1x::response::Builder::new()
  650    660   
                .header("Content-Type", "application/x-amz-json-1.0")
  651    661   
                .status(200)
  652    662   
                .body(::aws_smithy_types::body::SdkBody::from(
  653    663   
                    "{\n    \"contents\": {\n        \"booleanValue\": true\n    }\n}",
  654    664   
                ))
  655    665   
                .unwrap(),
  656    666   
        )
  657    667   
        .unwrap();
  658    668   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  659    669   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  660    670   
  661    671   
        let op = crate::operation::json_unions::JsonUnions::new();
  662    672   
        let config = op.config().expect("the operation has config");
  663    673   
        let de = config
  664    674   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  665    675   
            .expect("the config must have a deserializer");
  666    676   
  667    677   
        let parsed = de.deserialize_streaming(&mut http_response);
  668    678   
        let parsed = parsed.unwrap_or_else(|| {
  669    679   
            let http_response = http_response.map(|body| {
  670    680   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  671    681   
                    body.bytes().unwrap(),
  672    682   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  673    683   
                )))
  674    684   
            });
  675         -
            de.deserialize_nonstreaming(&http_response)
         685  +
            // Build a config bag with the protocol for schema-based deserialization
         686  +
            #[allow(unused_mut)]
         687  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         688  +
            {
         689  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         690  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         691  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
         692  +
                ));
         693  +
                test_cfg.push_shared_layer(layer.freeze());
         694  +
            }
         695  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  676    696   
        });
  677    697   
        let parsed = parsed
  678    698   
            .expect("should be successful response")
  679    699   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  680    700   
            .unwrap();
  681    701   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  682    702   
    }
  683    703   
  684    704   
    /// Deserializes a number union value
  685    705   
    /// Test ID: AwsJson10DeserializeNumberUnionValue
  686    706   
    #[::tokio::test]
  687    707   
    #[::tracing_test::traced_test]
  688    708   
    async fn aws_json10_deserialize_number_union_value_response() {
  689    709   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  690    710   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::NumberValue(1)))
  691    711   
            .build();
  692    712   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  693    713   
            ::http_1x::response::Builder::new()
  694    714   
                .header("Content-Type", "application/x-amz-json-1.0")
  695    715   
                .status(200)
  696    716   
                .body(::aws_smithy_types::body::SdkBody::from(
  697    717   
                    "{\n    \"contents\": {\n        \"numberValue\": 1\n    }\n}",
  698    718   
                ))
  699    719   
                .unwrap(),
  700    720   
        )
  701    721   
        .unwrap();
  702    722   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  703    723   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  704    724   
  705    725   
        let op = crate::operation::json_unions::JsonUnions::new();
  706    726   
        let config = op.config().expect("the operation has config");
  707    727   
        let de = config
  708    728   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  709    729   
            .expect("the config must have a deserializer");
  710    730   
  711    731   
        let parsed = de.deserialize_streaming(&mut http_response);
  712    732   
        let parsed = parsed.unwrap_or_else(|| {
  713    733   
            let http_response = http_response.map(|body| {
  714    734   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  715    735   
                    body.bytes().unwrap(),
  716    736   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  717    737   
                )))
  718    738   
            });
  719         -
            de.deserialize_nonstreaming(&http_response)
         739  +
            // Build a config bag with the protocol for schema-based deserialization
         740  +
            #[allow(unused_mut)]
         741  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         742  +
            {
         743  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         744  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         745  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
         746  +
                ));
         747  +
                test_cfg.push_shared_layer(layer.freeze());
         748  +
            }
         749  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  720    750   
        });
  721    751   
        let parsed = parsed
  722    752   
            .expect("should be successful response")
  723    753   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  724    754   
            .unwrap();
  725    755   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  726    756   
    }
  727    757   
  728    758   
    /// Deserializes a blob union value
  729    759   
    /// Test ID: AwsJson10DeserializeBlobUnionValue
  730    760   
    #[::tokio::test]
  731    761   
    #[::tracing_test::traced_test]
  732    762   
    async fn aws_json10_deserialize_blob_union_value_response() {
  733    763   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  734    764   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::BlobValue(
  735    765   
                ::aws_smithy_types::Blob::new("foo"),
  736    766   
            )))
  737    767   
            .build();
  738    768   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  739    769   
            ::http_1x::response::Builder::new()
  740    770   
                .header("Content-Type", "application/x-amz-json-1.0")
  741    771   
                .status(200)
  742    772   
                .body(::aws_smithy_types::body::SdkBody::from(
  743    773   
                    "{\n    \"contents\": {\n        \"blobValue\": \"Zm9v\"\n    }\n}",
  744    774   
                ))
  745    775   
                .unwrap(),
  746    776   
        )
  747    777   
        .unwrap();
  748    778   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  749    779   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  750    780   
  751    781   
        let op = crate::operation::json_unions::JsonUnions::new();
  752    782   
        let config = op.config().expect("the operation has config");
  753    783   
        let de = config
  754    784   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  755    785   
            .expect("the config must have a deserializer");
  756    786   
  757    787   
        let parsed = de.deserialize_streaming(&mut http_response);
  758    788   
        let parsed = parsed.unwrap_or_else(|| {
  759    789   
            let http_response = http_response.map(|body| {
  760    790   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  761    791   
                    body.bytes().unwrap(),
  762    792   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  763    793   
                )))
  764    794   
            });
  765         -
            de.deserialize_nonstreaming(&http_response)
         795  +
            // Build a config bag with the protocol for schema-based deserialization
         796  +
            #[allow(unused_mut)]
         797  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         798  +
            {
         799  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         800  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         801  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
         802  +
                ));
         803  +
                test_cfg.push_shared_layer(layer.freeze());
         804  +
            }
         805  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  766    806   
        });
  767    807   
        let parsed = parsed
  768    808   
            .expect("should be successful response")
  769    809   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  770    810   
            .unwrap();
  771    811   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  772    812   
    }
  773    813   
  774    814   
    /// Deserializes a timestamp union value
  775    815   
    /// Test ID: AwsJson10DeserializeTimestampUnionValue
  776    816   
    #[::tokio::test]
  777    817   
    #[::tracing_test::traced_test]
  778    818   
    async fn aws_json10_deserialize_timestamp_union_value_response() {
  779    819   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  780    820   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::TimestampValue(
  781    821   
                ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
  782    822   
            )))
  783    823   
            .build();
  784    824   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  785    825   
            ::http_1x::response::Builder::new()
  786    826   
                .header("Content-Type", "application/x-amz-json-1.0")
  787    827   
                .status(200)
  788    828   
                .body(::aws_smithy_types::body::SdkBody::from(
  789    829   
                    "{\n    \"contents\": {\n        \"timestampValue\": 1398796238\n    }\n}",
  790    830   
                ))
  791    831   
                .unwrap(),
  792    832   
        )
  793    833   
        .unwrap();
  794    834   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  795    835   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  796    836   
  797    837   
        let op = crate::operation::json_unions::JsonUnions::new();
  798    838   
        let config = op.config().expect("the operation has config");
  799    839   
        let de = config
  800    840   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  801    841   
            .expect("the config must have a deserializer");
  802    842   
  803    843   
        let parsed = de.deserialize_streaming(&mut http_response);
  804    844   
        let parsed = parsed.unwrap_or_else(|| {
  805    845   
            let http_response = http_response.map(|body| {
  806    846   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  807    847   
                    body.bytes().unwrap(),
  808    848   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  809    849   
                )))
  810    850   
            });
  811         -
            de.deserialize_nonstreaming(&http_response)
         851  +
            // Build a config bag with the protocol for schema-based deserialization
         852  +
            #[allow(unused_mut)]
         853  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         854  +
            {
         855  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         856  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         857  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
         858  +
                ));
         859  +
                test_cfg.push_shared_layer(layer.freeze());
         860  +
            }
         861  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  812    862   
        });
  813    863   
        let parsed = parsed
  814    864   
            .expect("should be successful response")
  815    865   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  816    866   
            .unwrap();
  817    867   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  818    868   
    }
  819    869   
  820    870   
    /// Deserializes an enum union value
  821    871   
    /// Test ID: AwsJson10DeserializeEnumUnionValue
  822    872   
    #[::tokio::test]
  823    873   
    #[::tracing_test::traced_test]
  824    874   
    async fn aws_json10_deserialize_enum_union_value_response() {
  825    875   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  826    876   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::EnumValue(
  827    877   
                "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
  828    878   
            )))
  829    879   
            .build();
  830    880   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  831    881   
            ::http_1x::response::Builder::new()
  832    882   
                .header("Content-Type", "application/x-amz-json-1.0")
  833    883   
                .status(200)
  834    884   
                .body(::aws_smithy_types::body::SdkBody::from(
  835    885   
                    "{\n    \"contents\": {\n        \"enumValue\": \"Foo\"\n    }\n}",
  836    886   
                ))
  837    887   
                .unwrap(),
  838    888   
        )
  839    889   
        .unwrap();
  840    890   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  841    891   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  842    892   
  843    893   
        let op = crate::operation::json_unions::JsonUnions::new();
  844    894   
        let config = op.config().expect("the operation has config");
  845    895   
        let de = config
  846    896   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  847    897   
            .expect("the config must have a deserializer");
  848    898   
  849    899   
        let parsed = de.deserialize_streaming(&mut http_response);
  850    900   
        let parsed = parsed.unwrap_or_else(|| {
  851    901   
            let http_response = http_response.map(|body| {
  852    902   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  853    903   
                    body.bytes().unwrap(),
  854    904   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  855    905   
                )))
  856    906   
            });
  857         -
            de.deserialize_nonstreaming(&http_response)
         907  +
            // Build a config bag with the protocol for schema-based deserialization
         908  +
            #[allow(unused_mut)]
         909  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         910  +
            {
         911  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         912  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         913  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
         914  +
                ));
         915  +
                test_cfg.push_shared_layer(layer.freeze());
         916  +
            }
         917  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  858    918   
        });
  859    919   
        let parsed = parsed
  860    920   
            .expect("should be successful response")
  861    921   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  862    922   
            .unwrap();
  863    923   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  864    924   
    }
  865    925   
  866    926   
    /// Deserializes an intEnum union value
  867    927   
    /// Test ID: AwsJson10DeserializeIntEnumUnionValue
  868    928   
    #[::tokio::test]
  869    929   
    #[::tracing_test::traced_test]
  870    930   
    async fn aws_json10_deserialize_int_enum_union_value_response() {
  871    931   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  872    932   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::IntEnumValue(1)))
  873    933   
            .build();
  874    934   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  875    935   
            ::http_1x::response::Builder::new()
  876    936   
                .header("Content-Type", "application/x-amz-json-1.0")
  877    937   
                .status(200)
  878    938   
                .body(::aws_smithy_types::body::SdkBody::from(
  879    939   
                    "{\n    \"contents\": {\n        \"intEnumValue\": 1\n    }\n}",
  880    940   
                ))
  881    941   
                .unwrap(),
  882    942   
        )
  883    943   
        .unwrap();
  884    944   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  885    945   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  886    946   
  887    947   
        let op = crate::operation::json_unions::JsonUnions::new();
  888    948   
        let config = op.config().expect("the operation has config");
  889    949   
        let de = config
  890    950   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  891    951   
            .expect("the config must have a deserializer");
  892    952   
  893    953   
        let parsed = de.deserialize_streaming(&mut http_response);
  894    954   
        let parsed = parsed.unwrap_or_else(|| {
  895    955   
            let http_response = http_response.map(|body| {
  896    956   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  897    957   
                    body.bytes().unwrap(),
  898    958   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  899    959   
                )))
  900    960   
            });
  901         -
            de.deserialize_nonstreaming(&http_response)
         961  +
            // Build a config bag with the protocol for schema-based deserialization
         962  +
            #[allow(unused_mut)]
         963  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         964  +
            {
         965  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         966  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         967  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
         968  +
                ));
         969  +
                test_cfg.push_shared_layer(layer.freeze());
         970  +
            }
         971  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  902    972   
        });
  903    973   
        let parsed = parsed
  904    974   
            .expect("should be successful response")
  905    975   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  906    976   
            .unwrap();
  907    977   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  908    978   
    }
  909    979   
  910    980   
    /// Deserializes a list union value
  911    981   
    /// Test ID: AwsJson10DeserializeListUnionValue
  912    982   
    #[::tokio::test]
  913    983   
    #[::tracing_test::traced_test]
  914    984   
    async fn aws_json10_deserialize_list_union_value_response() {
  915    985   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  916    986   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::ListValue(vec![
  917    987   
                "foo".to_owned(),
  918    988   
                "bar".to_owned(),
  919    989   
            ])))
  920    990   
            .build();
  921    991   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  922    992   
            ::http_1x::response::Builder::new()
  923    993   
                .header("Content-Type", "application/x-amz-json-1.0")
  924    994   
                .status(200)
  925    995   
                .body(::aws_smithy_types::body::SdkBody::from(
  926    996   
                    "{\n    \"contents\": {\n        \"listValue\": [\"foo\", \"bar\"]\n    }\n}",
  927    997   
                ))
  928    998   
                .unwrap(),
  929    999   
        )
  930   1000   
        .unwrap();
  931   1001   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  932   1002   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  933   1003   
  934   1004   
        let op = crate::operation::json_unions::JsonUnions::new();
  935   1005   
        let config = op.config().expect("the operation has config");
  936   1006   
        let de = config
  937   1007   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  938   1008   
            .expect("the config must have a deserializer");
  939   1009   
  940   1010   
        let parsed = de.deserialize_streaming(&mut http_response);
  941   1011   
        let parsed = parsed.unwrap_or_else(|| {
  942   1012   
            let http_response = http_response.map(|body| {
  943   1013   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  944   1014   
                    body.bytes().unwrap(),
  945   1015   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  946   1016   
                )))
  947   1017   
            });
  948         -
            de.deserialize_nonstreaming(&http_response)
        1018  +
            // Build a config bag with the protocol for schema-based deserialization
        1019  +
            #[allow(unused_mut)]
        1020  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1021  +
            {
        1022  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1023  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1024  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
        1025  +
                ));
        1026  +
                test_cfg.push_shared_layer(layer.freeze());
        1027  +
            }
        1028  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  949   1029   
        });
  950   1030   
        let parsed = parsed
  951   1031   
            .expect("should be successful response")
  952   1032   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  953   1033   
            .unwrap();
  954   1034   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  955   1035   
    }
  956   1036   
  957   1037   
    /// Deserializes a map union value
  958   1038   
    /// Test ID: AwsJson10DeserializeMapUnionValue
  959   1039   
    #[::tokio::test]
  960   1040   
    #[::tracing_test::traced_test]
  961   1041   
    async fn aws_json10_deserialize_map_union_value_response() {
  962   1042   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  963   1043   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::MapValue({
  964   1044   
                let mut ret = ::std::collections::HashMap::new();
  965   1045   
                ret.insert("foo".to_owned(), "bar".to_owned());
  966   1046   
                ret.insert("spam".to_owned(), "eggs".to_owned());
  967   1047   
                ret
  968   1048   
            })))
  969   1049   
            .build();
  970   1050   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(::http_1x::response::Builder::new()
  971   1051   
        .header("Content-Type", "application/x-amz-json-1.0")
  972   1052   
        .status(200)
  973   1053   
                    .body(::aws_smithy_types::body::SdkBody::from("{\n    \"contents\": {\n        \"mapValue\": {\n            \"foo\": \"bar\",\n            \"spam\": \"eggs\"\n        }\n    }\n}"))
  974   1054   
                    .unwrap()
  975   1055   
                    ).unwrap();
  976   1056   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  977   1057   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  978   1058   
  979   1059   
        let op = crate::operation::json_unions::JsonUnions::new();
  980   1060   
        let config = op.config().expect("the operation has config");
  981   1061   
        let de = config
  982   1062   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  983   1063   
            .expect("the config must have a deserializer");
  984   1064   
  985   1065   
        let parsed = de.deserialize_streaming(&mut http_response);
  986   1066   
        let parsed = parsed.unwrap_or_else(|| {
  987   1067   
            let http_response = http_response.map(|body| {
  988   1068   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  989   1069   
                    body.bytes().unwrap(),
  990   1070   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  991   1071   
                )))
  992   1072   
            });
  993         -
            de.deserialize_nonstreaming(&http_response)
        1073  +
            // Build a config bag with the protocol for schema-based deserialization
        1074  +
            #[allow(unused_mut)]
        1075  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1076  +
            {
        1077  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1078  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1079  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
        1080  +
                ));
        1081  +
                test_cfg.push_shared_layer(layer.freeze());
        1082  +
            }
        1083  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  994   1084   
        });
  995   1085   
        let parsed = parsed
  996   1086   
            .expect("should be successful response")
  997   1087   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  998   1088   
            .unwrap();
  999   1089   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
 1000   1090   
    }
 1001   1091   
 1002   1092   
    /// Deserializes a structure union value
 1003   1093   
    /// Test ID: AwsJson10DeserializeStructureUnionValue
 1004   1094   
    #[::tokio::test]
 1005   1095   
    #[::tracing_test::traced_test]
 1006   1096   
    async fn aws_json10_deserialize_structure_union_value_response() {
 1007   1097   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
 1008   1098   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::StructureValue(
 1009   1099   
                crate::types::GreetingStruct::builder()
 1010   1100   
                    .set_hi(::std::option::Option::Some("hello".to_owned()))
 1011   1101   
                    .build(),
 1012   1102   
            )))
 1013   1103   
            .build();
 1014   1104   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
 1015   1105   
            ::http_1x::response::Builder::new()
 1016   1106   
                .header("Content-Type", "application/x-amz-json-1.0")
 1017   1107   
                .status(200)
 1018   1108   
                .body(::aws_smithy_types::body::SdkBody::from(
 1019   1109   
                    "{\n    \"contents\": {\n        \"structureValue\": {\n            \"hi\": \"hello\"\n        }\n    }\n}",
 1020   1110   
                ))
 1021   1111   
                .unwrap(),
 1022   1112   
        )
 1023   1113   
        .unwrap();
 1024   1114   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
 1025   1115   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
 1026   1116   
 1027   1117   
        let op = crate::operation::json_unions::JsonUnions::new();
 1028   1118   
        let config = op.config().expect("the operation has config");
 1029   1119   
        let de = config
 1030   1120   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
 1031   1121   
            .expect("the config must have a deserializer");
 1032   1122   
 1033   1123   
        let parsed = de.deserialize_streaming(&mut http_response);
 1034   1124   
        let parsed = parsed.unwrap_or_else(|| {
 1035   1125   
            let http_response = http_response.map(|body| {
 1036   1126   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
 1037   1127   
                    body.bytes().unwrap(),
 1038   1128   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
 1039   1129   
                )))
 1040   1130   
            });
 1041         -
            de.deserialize_nonstreaming(&http_response)
        1131  +
            // Build a config bag with the protocol for schema-based deserialization
        1132  +
            #[allow(unused_mut)]
        1133  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1134  +
            {
        1135  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1136  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1137  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
        1138  +
                ));
        1139  +
                test_cfg.push_shared_layer(layer.freeze());
        1140  +
            }
        1141  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
 1042   1142   
        });
 1043   1143   
        let parsed = parsed
 1044   1144   
            .expect("should be successful response")
 1045   1145   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
 1046   1146   
            .unwrap();
 1047   1147   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
 1048   1148   
    }
 1049   1149   
 1050   1150   
    /// Ignores an unrecognized __type property
 1051   1151   
    /// Test ID: AwsJson10DeserializeIgnoreType
 1052   1152   
    #[::tokio::test]
 1053   1153   
    #[::tracing_test::traced_test]
 1054   1154   
    async fn aws_json10_deserialize_ignore_type_response() {
 1055   1155   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
 1056   1156   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::StructureValue(
 1057   1157   
                crate::types::GreetingStruct::builder()
 1058   1158   
                    .set_hi(::std::option::Option::Some("hello".to_owned()))
 1059   1159   
                    .build(),
 1060   1160   
            )))
 1061   1161   
            .build();
 1062   1162   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(::http_1x::response::Builder::new()
 1063   1163   
        .header("Content-Type", "application/x-amz-json-1.0")
 1064   1164   
        .status(200)
 1065   1165   
                    .body(::aws_smithy_types::body::SdkBody::from("{\n    \"contents\": {\n        \"__type\": \"aws.protocoltests.json10#MyUnion\",\n        \"structureValue\": {\n            \"hi\": \"hello\"\n        }\n    }\n}"))
 1066   1166   
                    .unwrap()
 1067   1167   
                    ).unwrap();
 1068   1168   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
 1069   1169   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
 1070   1170   
 1071   1171   
        let op = crate::operation::json_unions::JsonUnions::new();
 1072   1172   
        let config = op.config().expect("the operation has config");
 1073   1173   
        let de = config
 1074   1174   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
 1075   1175   
            .expect("the config must have a deserializer");
 1076   1176   
 1077   1177   
        let parsed = de.deserialize_streaming(&mut http_response);
 1078   1178   
        let parsed = parsed.unwrap_or_else(|| {
 1079   1179   
            let http_response = http_response.map(|body| {
 1080   1180   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
 1081   1181   
                    body.bytes().unwrap(),
 1082   1182   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
 1083   1183   
                )))
 1084   1184   
            });
 1085         -
            de.deserialize_nonstreaming(&http_response)
        1185  +
            // Build a config bag with the protocol for schema-based deserialization
        1186  +
            #[allow(unused_mut)]
        1187  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1188  +
            {
        1189  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1190  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1191  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
        1192  +
                ));
        1193  +
                test_cfg.push_shared_layer(layer.freeze());
        1194  +
            }
        1195  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
 1086   1196   
        });
 1087   1197   
        let parsed = parsed
 1088   1198   
            .expect("should be successful response")
 1089   1199   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
 1090   1200   
            .unwrap();
 1091   1201   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
 1092   1202   
    }
 1093   1203   
 1094   1204   
    /// Allows for `: null` to be set for all unset fields
 1095   1205   
    /// Test ID: AwsJson10DeserializeAllowNulls
 1096   1206   
    #[::tokio::test]
 1097   1207   
    #[::tracing_test::traced_test]
 1098   1208   
    async fn aws_json10_deserialize_allow_nulls_response() {
 1099   1209   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
 1100   1210   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::StructureValue(
 1101   1211   
                crate::types::GreetingStruct::builder()
 1102   1212   
                    .set_hi(::std::option::Option::Some("hello".to_owned()))
 1103   1213   
                    .build(),
 1104   1214   
            )))
 1105   1215   
            .build();
 1106   1216   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(::http_1x::response::Builder::new()
 1107   1217   
        .header("Content-Type", "application/x-amz-json-1.0")
 1108   1218   
        .status(200)
 1109   1219   
                    .body(::aws_smithy_types::body::SdkBody::from("{\n    \"contents\": {\n      \"stringValue\": null,\n      \"booleanValue\": null,\n      \"numberValue\": null,\n      \"blobValue\": null,\n      \"timestampValue\": null,\n      \"enumValue\": null,\n      \"intEnumValue\": null,\n      \"listValue\": null,\n      \"mapValue\": null,\n      \"structureValue\": {\n          \"hi\": \"hello\"\n      }\n    }\n}"))
 1110   1220   
                    .unwrap()
 1111   1221   
                    ).unwrap();
 1112   1222   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
 1113   1223   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
 1114   1224   
 1115   1225   
        let op = crate::operation::json_unions::JsonUnions::new();
 1116   1226   
        let config = op.config().expect("the operation has config");
 1117   1227   
        let de = config
 1118   1228   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
 1119   1229   
            .expect("the config must have a deserializer");
 1120   1230   
 1121   1231   
        let parsed = de.deserialize_streaming(&mut http_response);
 1122   1232   
        let parsed = parsed.unwrap_or_else(|| {
 1123   1233   
            let http_response = http_response.map(|body| {
 1124   1234   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
 1125   1235   
                    body.bytes().unwrap(),
 1126   1236   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
 1127   1237   
                )))
 1128   1238   
            });
 1129         -
            de.deserialize_nonstreaming(&http_response)
        1239  +
            // Build a config bag with the protocol for schema-based deserialization
        1240  +
            #[allow(unused_mut)]
        1241  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1242  +
            {
        1243  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1244  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1245  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0("JsonRpc10"),
        1246  +
                ));
        1247  +
                test_cfg.push_shared_layer(layer.freeze());
        1248  +
            }
        1249  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
 1130   1250   
        });
 1131   1251   
        let parsed = parsed
 1132   1252   
            .expect("should be successful response")
 1133   1253   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
 1134   1254   
            .unwrap();
 1135   1255   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
 1136   1256   
    }
 1137   1257   
}
 1138   1258   
 1139   1259   
/// Error type for the `JsonUnionsError` operation.