Client Test

Client Test

rev. bbca34fa2eddb4be623fbbc6b6df1a2401de0029

Files changed:

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

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

@@ -1,1 +44,122 @@
    5      5   
pub struct JsonUnionsInput {
    6      6   
    /// A union with a representative set of types for members.
    7      7   
    pub contents: ::std::option::Option<crate::types::MyUnion>,
    8      8   
}
    9      9   
impl JsonUnionsInput {
   10     10   
    /// A union with a representative set of types for members.
   11     11   
    pub fn contents(&self) -> ::std::option::Option<&crate::types::MyUnion> {
   12     12   
        self.contents.as_ref()
   13     13   
    }
   14     14   
}
          15  +
static JSONUNIONSINPUT_MEMBER_CONTENTS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          16  +
    ::aws_smithy_schema::ShapeId::from_parts(
          17  +
        "aws.protocoltests.json10.synthetic#JsonUnionsInput$contents",
          18  +
        "aws.protocoltests.json10.synthetic",
          19  +
        "JsonUnionsInput",
          20  +
    ),
          21  +
    ::aws_smithy_schema::ShapeType::Union,
          22  +
    "contents",
          23  +
    0,
          24  +
);
          25  +
static JSONUNIONSINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          26  +
    ::aws_smithy_schema::ShapeId::from_parts(
          27  +
        "aws.protocoltests.json10.synthetic#JsonUnionsInput",
          28  +
        "aws.protocoltests.json10.synthetic",
          29  +
        "JsonUnionsInput",
          30  +
    ),
          31  +
    ::aws_smithy_schema::ShapeType::Structure,
          32  +
    &[&JSONUNIONSINPUT_MEMBER_CONTENTS],
          33  +
)
          34  +
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
          35  +
.with_original_name("JsonUnionsInput");
          36  +
impl JsonUnionsInput {
          37  +
    /// The schema for this shape.
          38  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &JSONUNIONSINPUT_SCHEMA;
          39  +
}
          40  +
impl ::aws_smithy_schema::serde::SerializableStruct for JsonUnionsInput {
          41  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          42  +
    fn serialize_members(
          43  +
        &self,
          44  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          45  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          46  +
        if let Some(ref val) = self.contents {
          47  +
            ser.write_struct(&JSONUNIONSINPUT_MEMBER_CONTENTS, val)?;
          48  +
        }
          49  +
        Ok(())
          50  +
    }
          51  +
}
          52  +
impl JsonUnionsInput {
          53  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          56  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          57  +
        #[allow(unused_variables, unused_mut)]
          58  +
        let mut builder = Self::builder();
          59  +
        #[allow(
          60  +
            unused_variables,
          61  +
            unreachable_code,
          62  +
            clippy::single_match,
          63  +
            clippy::match_single_binding,
          64  +
            clippy::diverging_sub_expression
          65  +
        )]
          66  +
        deserializer.read_struct(&JSONUNIONSINPUT_SCHEMA, &mut |member, deser| {
          67  +
            match member.member_index() {
          68  +
                Some(0) => {
          69  +
                    if deser.is_null() {
          70  +
                        deser.read_null()?;
          71  +
                    } else {
          72  +
                        builder.contents = Some(crate::types::MyUnion::deserialize(deser)?);
          73  +
                    }
          74  +
                }
          75  +
                _ => {}
          76  +
            }
          77  +
            Ok(())
          78  +
        })?;
          79  +
        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
          80  +
    }
          81  +
}
          82  +
impl JsonUnionsInput {
          83  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          84  +
    pub fn deserialize_with_response(
          85  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          86  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          87  +
        _status: u16,
          88  +
        _body: &[u8],
          89  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          90  +
        Self::deserialize(deserializer)
          91  +
    }
          92  +
}
   15     93   
impl JsonUnionsInput {
   16     94   
    /// Creates a new builder-style object to manufacture [`JsonUnionsInput`](crate::operation::json_unions::JsonUnionsInput).
   17     95   
    pub fn builder() -> crate::operation::json_unions::builders::JsonUnionsInputBuilder {
   18     96   
        crate::operation::json_unions::builders::JsonUnionsInputBuilder::default()
   19     97   
    }
   20     98   
}
   21     99   
   22    100   
/// A builder for [`JsonUnionsInput`](crate::operation::json_unions::JsonUnionsInput).
   23    101   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   24    102   
#[non_exhaustive]

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

@@ -1,1 +44,121 @@
    5      5   
pub struct JsonUnionsOutput {
    6      6   
    /// A union with a representative set of types for members.
    7      7   
    pub contents: ::std::option::Option<crate::types::MyUnion>,
    8      8   
}
    9      9   
impl JsonUnionsOutput {
   10     10   
    /// A union with a representative set of types for members.
   11     11   
    pub fn contents(&self) -> ::std::option::Option<&crate::types::MyUnion> {
   12     12   
        self.contents.as_ref()
   13     13   
    }
   14     14   
}
          15  +
static JSONUNIONSOUTPUT_MEMBER_CONTENTS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          16  +
    ::aws_smithy_schema::ShapeId::from_parts(
          17  +
        "aws.protocoltests.json10.synthetic#JsonUnionsOutput$contents",
          18  +
        "aws.protocoltests.json10.synthetic",
          19  +
        "JsonUnionsOutput",
          20  +
    ),
          21  +
    ::aws_smithy_schema::ShapeType::Union,
          22  +
    "contents",
          23  +
    0,
          24  +
);
          25  +
static JSONUNIONSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          26  +
    ::aws_smithy_schema::ShapeId::from_parts(
          27  +
        "aws.protocoltests.json10.synthetic#JsonUnionsOutput",
          28  +
        "aws.protocoltests.json10.synthetic",
          29  +
        "JsonUnionsOutput",
          30  +
    ),
          31  +
    ::aws_smithy_schema::ShapeType::Structure,
          32  +
    &[&JSONUNIONSOUTPUT_MEMBER_CONTENTS],
          33  +
)
          34  +
.with_original_name("JsonUnionsOutput");
          35  +
impl JsonUnionsOutput {
          36  +
    /// The schema for this shape.
          37  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &JSONUNIONSOUTPUT_SCHEMA;
          38  +
}
          39  +
impl ::aws_smithy_schema::serde::SerializableStruct for JsonUnionsOutput {
          40  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          41  +
    fn serialize_members(
          42  +
        &self,
          43  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          44  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          45  +
        if let Some(ref val) = self.contents {
          46  +
            ser.write_struct(&JSONUNIONSOUTPUT_MEMBER_CONTENTS, val)?;
          47  +
        }
          48  +
        Ok(())
          49  +
    }
          50  +
}
          51  +
impl JsonUnionsOutput {
          52  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          53  +
    pub fn deserialize(
          54  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          55  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          56  +
        #[allow(unused_variables, unused_mut)]
          57  +
        let mut builder = Self::builder();
          58  +
        #[allow(
          59  +
            unused_variables,
          60  +
            unreachable_code,
          61  +
            clippy::single_match,
          62  +
            clippy::match_single_binding,
          63  +
            clippy::diverging_sub_expression
          64  +
        )]
          65  +
        deserializer.read_struct(&JSONUNIONSOUTPUT_SCHEMA, &mut |member, deser| {
          66  +
            match member.member_index() {
          67  +
                Some(0) => {
          68  +
                    if deser.is_null() {
          69  +
                        deser.read_null()?;
          70  +
                    } else {
          71  +
                        builder.contents = Some(crate::types::MyUnion::deserialize(deser)?);
          72  +
                    }
          73  +
                }
          74  +
                _ => {}
          75  +
            }
          76  +
            Ok(())
          77  +
        })?;
          78  +
        Ok(builder.build())
          79  +
    }
          80  +
}
          81  +
impl JsonUnionsOutput {
          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  +
}
   15     92   
impl JsonUnionsOutput {
   16     93   
    /// Creates a new builder-style object to manufacture [`JsonUnionsOutput`](crate::operation::json_unions::JsonUnionsOutput).
   17     94   
    pub fn builder() -> crate::operation::json_unions::builders::JsonUnionsOutputBuilder {
   18     95   
        crate::operation::json_unions::builders::JsonUnionsOutputBuilder::default()
   19     96   
    }
   20     97   
}
   21     98   
   22     99   
/// A builder for [`JsonUnionsOutput`](crate::operation::json_unions::JsonUnionsOutput).
   23    100   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   24    101   
#[non_exhaustive]

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

@@ -1,1 +40,45 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `NoInputAndNoOutput`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct NoInputAndNoOutput;
    6      6   
impl NoInputAndNoOutput {
    7      7   
    /// Creates a new `NoInputAndNoOutput`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::no_input_and_no_output::NoInputAndNoOutputInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
          15  +
        crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput::SCHEMA;
   11     16   
    pub(crate) async fn orchestrate(
   12     17   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     18   
        input: crate::operation::no_input_and_no_output::NoInputAndNoOutputInput,
   14     19   
    ) -> ::std::result::Result<
   15     20   
        crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput,
   16     21   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     22   
            crate::operation::no_input_and_no_output::NoInputAndNoOutputError,
   18     23   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     24   
        >,
   20     25   
    > {
@@ -114,119 +235,251 @@
  134    139   
  135    140   
#[derive(Debug)]
  136    141   
struct NoInputAndNoOutputResponseDeserializer;
  137    142   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for NoInputAndNoOutputResponseDeserializer {
  138    143   
    fn deserialize_nonstreaming_with_config(
  139    144   
        &self,
  140    145   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
  141    146   
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  142    147   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  143    148   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  144         -
        let headers = response.headers();
         149  +
        // Load body and headers BEFORE BeforeParseResponse so customizations
         150  +
        // (e.g., S3's `body_is_error` check that detects errors returned with
         151  +
        // HTTP 200) can inspect them. The legacy non-streaming path also
         152  +
        // loads `body` before firing this hook.
  145    153   
        let body = response.body().bytes().expect("body loaded");
         154  +
        let headers = response.headers();
  146    155   
        #[allow(unused_mut)]
  147    156   
        let mut force_error = false;
  148    157   
  149         -
        let parse_result = if !success && status != 200 || force_error {
  150         -
            crate::protocol_serde::shape_no_input_and_no_output::de_no_input_and_no_output_http_error(status, headers, body)
         158  +
        if !success && status != 200 || force_error {
         159  +
            let protocol = _cfg
         160  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         161  +
                .expect("a SharedClientProtocol is required");
         162  +
            #[allow(unused_mut)]
         163  +
            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
         164  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         165  +
            })?;
         166  +
         167  +
            let generic = generic_builder.build();
         168  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         169  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         170  +
                    crate::operation::no_input_and_no_output::NoInputAndNoOutputError::generic(generic),
         171  +
                ),
         172  +
            ))
  151    173   
        } else {
  152         -
            crate::protocol_serde::shape_no_input_and_no_output::de_no_input_and_no_output_http_response(status, headers, body)
  153         -
        };
  154         -
        crate::protocol_serde::type_erase_result(parse_result)
         174  +
            let protocol = _cfg
         175  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         176  +
                .expect("a SharedClientProtocol is required");
         177  +
            let mut deser = protocol
         178  +
                .deserialize_response(response, NoInputAndNoOutput::OUTPUT_SCHEMA, _cfg)
         179  +
                .map_err(|e| {
         180  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         181  +
                })?;
         182  +
            // body and headers are already in scope from the top of the function;
         183  +
            // alias `headers` as `_response_headers` so MutateOutput
         184  +
            // customizations have a stable name to read from.
         185  +
            let _response_headers = headers;
         186  +
            #[allow(unused_mut)]
         187  +
            let mut output = crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput::deserialize_with_response(
         188  +
                &mut *deser,
         189  +
                _response_headers,
         190  +
                response.status().into(),
         191  +
                body,
         192  +
            )
         193  +
            .map_err(|e| {
         194  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         195  +
            })?;
         196  +
         197  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         198  +
        }
  155    199   
    }
  156    200   
}
  157    201   
#[derive(Debug)]
  158    202   
struct NoInputAndNoOutputRequestSerializer;
  159    203   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for NoInputAndNoOutputRequestSerializer {
  160    204   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  161    205   
    fn serialize_input(
  162    206   
        &self,
  163    207   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  164    208   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  165    209   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  166    210   
        let input = input
  167    211   
            .downcast::<crate::operation::no_input_and_no_output::NoInputAndNoOutputInput>()
  168    212   
            .expect("correct type");
  169         -
        let _header_serialization_settings = _cfg
  170         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  171         -
            .cloned()
  172         -
            .unwrap_or_default();
  173         -
        let mut request_builder = {
  174         -
            #[allow(clippy::uninlined_format_args)]
  175         -
            fn uri_base(
  176         -
                _input: &crate::operation::no_input_and_no_output::NoInputAndNoOutputInput,
  177         -
                output: &mut ::std::string::String,
  178         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  179         -
                use ::std::fmt::Write as _;
  180         -
                ::std::write!(output, "/").expect("formatting should succeed");
  181         -
                ::std::result::Result::Ok(())
  182         -
            }
  183         -
            #[allow(clippy::unnecessary_wraps)]
  184         -
            fn update_http_builder(
  185         -
                input: &crate::operation::no_input_and_no_output::NoInputAndNoOutputInput,
  186         -
                builder: ::http_1x::request::Builder,
  187         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  188         -
                let mut uri = ::std::string::String::new();
  189         -
                uri_base(input, &mut uri)?;
  190         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  191         -
            }
  192         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  193         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
  194         -
            builder = _header_serialization_settings.set_default_header(
  195         -
                builder,
  196         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  197         -
                "JsonRpc10.NoInputAndNoOutput",
  198         -
            );
  199         -
            builder
  200         -
        };
  201         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_no_input_and_no_output::ser_no_input_and_no_output_input(
  202         -
            &input,
  203         -
        )?);
  204    213   
  205         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         214  +
        let protocol = _cfg
         215  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         216  +
            .expect("a SharedClientProtocol is required");
         217  +
        let mut request = protocol
         218  +
            .serialize_request(&input, NoInputAndNoOutput::INPUT_SCHEMA, "/", _cfg)
         219  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         220  +
         221  +
        return ::std::result::Result::Ok(request);
  206    222   
    }
  207    223   
}
  208    224   
#[derive(Debug)]
  209    225   
struct NoInputAndNoOutputEndpointParamsInterceptor;
  210    226   
  211    227   
#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
  212    228   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NoInputAndNoOutputEndpointParamsInterceptor {
  213    229   
    fn name(&self) -> &'static str {
  214    230   
        "NoInputAndNoOutputEndpointParamsInterceptor"
  215    231   
    }
@@ -285,301 +437,474 @@
  305    321   
  306    322   
        let op = crate::operation::no_input_and_no_output::NoInputAndNoOutput::new();
  307    323   
        let config = op.config().expect("the operation has config");
  308    324   
        let de = config
  309    325   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  310    326   
            .expect("the config must have a deserializer");
  311    327   
  312    328   
        // Build a config bag with the protocol for schema-based deserialization
  313    329   
        #[allow(unused_mut)]
  314    330   
        let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         331  +
        {
         332  +
            let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         333  +
            layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         334  +
                ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0().with_target_prefix("JsonRpc10"),
         335  +
            ));
         336  +
            test_cfg.push_shared_layer(layer.freeze());
         337  +
        }
  315    338   
  316    339   
        let parsed = de.deserialize_streaming(&mut http_response);
  317    340   
        let parsed = parsed.unwrap_or_else(|| {
  318    341   
            let http_response = http_response.map(|body| {
  319    342   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  320    343   
                    body.bytes().unwrap(),
  321    344   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  322    345   
                )))
  323    346   
            });
  324    347   
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  325    348   
        });
  326    349   
        let parsed = parsed
  327    350   
            .expect("should be successful response")
  328    351   
            .downcast::<crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput>()
  329    352   
            .unwrap();
  330    353   
    }
  331    354   
  332    355   
    /// This client-only test builds on handles_empty_output_shape,
  333    356   
    /// by including unexpected fields in the JSON. A client
  334    357   
    /// needs to ignore JSON output that is empty or that contains
  335    358   
    /// JSON object data.
  336    359   
    /// Test ID: AwsJson10HandlesUnexpectedJsonOutput
  337    360   
    #[::tokio::test]
  338    361   
    #[::tracing_test::traced_test]
  339    362   
    async fn aws_json10_handles_unexpected_json_output_response() {
  340    363   
        let expected_output = crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput::builder().build();
  341    364   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  342    365   
            ::http_1x::response::Builder::new()
  343    366   
                .header("Content-Type", "application/x-amz-json-1.0")
  344    367   
                .status(200)
  345    368   
                .body(::aws_smithy_types::body::SdkBody::from("{\n    \"foo\": true\n}"))
  346    369   
                .unwrap(),
  347    370   
        )
  348    371   
        .unwrap();
  349    372   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  350    373   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  351    374   
  352    375   
        let op = crate::operation::no_input_and_no_output::NoInputAndNoOutput::new();
  353    376   
        let config = op.config().expect("the operation has config");
  354    377   
        let de = config
  355    378   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  356    379   
            .expect("the config must have a deserializer");
  357    380   
  358    381   
        // Build a config bag with the protocol for schema-based deserialization
  359    382   
        #[allow(unused_mut)]
  360    383   
        let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         384  +
        {
         385  +
            let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         386  +
            layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         387  +
                ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0().with_target_prefix("JsonRpc10"),
         388  +
            ));
         389  +
            test_cfg.push_shared_layer(layer.freeze());
         390  +
        }
  361    391   
  362    392   
        let parsed = de.deserialize_streaming(&mut http_response);
  363    393   
        let parsed = parsed.unwrap_or_else(|| {
  364    394   
            let http_response = http_response.map(|body| {
  365    395   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  366    396   
                    body.bytes().unwrap(),
  367    397   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  368    398   
                )))
  369    399   
            });
  370    400   
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  371    401   
        });
  372    402   
        let parsed = parsed
  373    403   
            .expect("should be successful response")
  374    404   
            .downcast::<crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput>()
  375    405   
            .unwrap();
  376    406   
    }
  377    407   
  378    408   
    /// When no output is defined, the service is expected to return
  379    409   
    /// an empty payload. Despite the lack of a payload, the service
  380    410   
    /// is expected to always send a Content-Type header. Clients must
  381    411   
    /// handle cases where a service returns a JSON object and where
  382    412   
    /// a service returns no JSON at all.
  383    413   
    /// Test ID: AwsJson10ServiceRespondsWithNoPayload
  384    414   
    #[::tokio::test]
  385    415   
    #[::tracing_test::traced_test]
  386    416   
    async fn aws_json10_service_responds_with_no_payload_response() {
  387    417   
        let expected_output = crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput::builder().build();
  388    418   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  389    419   
            ::http_1x::response::Builder::new()
  390    420   
                .header("Content-Type", "application/x-amz-json-1.0")
  391    421   
                .status(200)
  392    422   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  393    423   
                .unwrap(),
  394    424   
        )
  395    425   
        .unwrap();
  396    426   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  397    427   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  398    428   
  399    429   
        let op = crate::operation::no_input_and_no_output::NoInputAndNoOutput::new();
  400    430   
        let config = op.config().expect("the operation has config");
  401    431   
        let de = config
  402    432   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  403    433   
            .expect("the config must have a deserializer");
  404    434   
  405    435   
        // Build a config bag with the protocol for schema-based deserialization
  406    436   
        #[allow(unused_mut)]
  407    437   
        let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         438  +
        {
         439  +
            let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         440  +
            layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         441  +
                ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0().with_target_prefix("JsonRpc10"),
         442  +
            ));
         443  +
            test_cfg.push_shared_layer(layer.freeze());
         444  +
        }
  408    445   
  409    446   
        let parsed = de.deserialize_streaming(&mut http_response);
  410    447   
        let parsed = parsed.unwrap_or_else(|| {
  411    448   
            let http_response = http_response.map(|body| {
  412    449   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  413    450   
                    body.bytes().unwrap(),
  414    451   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  415    452   
                )))
  416    453   
            });
  417    454   
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)

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

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

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

@@ -1,1 +22,78 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct NoInputAndNoOutputOutput {}
           6  +
static NOINPUTANDNOOUTPUTOUTPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
           7  +
    ::aws_smithy_schema::ShapeId::from_parts(
           8  +
        "aws.protocoltests.json10.synthetic#NoInputAndNoOutputOutput",
           9  +
        "aws.protocoltests.json10.synthetic",
          10  +
        "NoInputAndNoOutputOutput",
          11  +
    ),
          12  +
    ::aws_smithy_schema::ShapeType::Structure,
          13  +
    &[],
          14  +
);
          15  +
impl NoInputAndNoOutputOutput {
          16  +
    /// The schema for this shape.
          17  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &NOINPUTANDNOOUTPUTOUTPUT_SCHEMA;
          18  +
}
          19  +
impl ::aws_smithy_schema::serde::SerializableStruct for NoInputAndNoOutputOutput {
          20  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          21  +
    fn serialize_members(
          22  +
        &self,
          23  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          24  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          25  +
        Ok(())
          26  +
    }
          27  +
}
          28  +
impl NoInputAndNoOutputOutput {
          29  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          30  +
    pub fn deserialize(
          31  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          32  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          33  +
        #[allow(unused_variables, unused_mut)]
          34  +
        let mut builder = Self::builder();
          35  +
        #[allow(
          36  +
            unused_variables,
          37  +
            unreachable_code,
          38  +
            clippy::single_match,
          39  +
            clippy::match_single_binding,
          40  +
            clippy::diverging_sub_expression
          41  +
        )]
          42  +
        deserializer.read_struct(&NOINPUTANDNOOUTPUTOUTPUT_SCHEMA, &mut |member, deser| {
          43  +
            match member.member_index() {
          44  +
                _ => {}
          45  +
            }
          46  +
            Ok(())
          47  +
        })?;
          48  +
        Ok(builder.build())
          49  +
    }
          50  +
}
          51  +
impl NoInputAndNoOutputOutput {
          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  +
        Ok(Self::builder().build())
          60  +
    }
          61  +
}
    6     62   
impl NoInputAndNoOutputOutput {
    7     63   
    /// Creates a new builder-style object to manufacture [`NoInputAndNoOutputOutput`](crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput).
    8     64   
    pub fn builder() -> crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputOutputBuilder {
    9     65   
        crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputOutputBuilder::default()
   10     66   
    }
   11     67   
}
   12     68   
   13     69   
/// A builder for [`NoInputAndNoOutputOutput`](crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput).
   14     70   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   15     71   
#[non_exhaustive]

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

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `NoInputAndOutput`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct NoInputAndOutput;
    6      6   
impl NoInputAndOutput {
    7      7   
    /// Creates a new `NoInputAndOutput`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::no_input_and_output::NoInputAndOutputInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::no_input_and_output::NoInputAndOutputOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::no_input_and_output::NoInputAndOutputInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::no_input_and_output::NoInputAndOutputOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::no_input_and_output::NoInputAndOutputError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -114,118 +233,250 @@
  134    138   
  135    139   
#[derive(Debug)]
  136    140   
struct NoInputAndOutputResponseDeserializer;
  137    141   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for NoInputAndOutputResponseDeserializer {
  138    142   
    fn deserialize_nonstreaming_with_config(
  139    143   
        &self,
  140    144   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
  141    145   
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  142    146   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  143    147   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  144         -
        let headers = response.headers();
         148  +
        // Load body and headers BEFORE BeforeParseResponse so customizations
         149  +
        // (e.g., S3's `body_is_error` check that detects errors returned with
         150  +
        // HTTP 200) can inspect them. The legacy non-streaming path also
         151  +
        // loads `body` before firing this hook.
  145    152   
        let body = response.body().bytes().expect("body loaded");
         153  +
        let headers = response.headers();
  146    154   
        #[allow(unused_mut)]
  147    155   
        let mut force_error = false;
  148    156   
  149         -
        let parse_result = if !success && status != 200 || force_error {
  150         -
            crate::protocol_serde::shape_no_input_and_output::de_no_input_and_output_http_error(status, headers, body)
         157  +
        if !success && status != 200 || force_error {
         158  +
            let protocol = _cfg
         159  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         160  +
                .expect("a SharedClientProtocol is required");
         161  +
            #[allow(unused_mut)]
         162  +
            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
         163  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         164  +
            })?;
         165  +
         166  +
            let generic = generic_builder.build();
         167  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         168  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         169  +
                    crate::operation::no_input_and_output::NoInputAndOutputError::generic(generic),
         170  +
                ),
         171  +
            ))
  151    172   
        } else {
  152         -
            crate::protocol_serde::shape_no_input_and_output::de_no_input_and_output_http_response(status, headers, body)
  153         -
        };
  154         -
        crate::protocol_serde::type_erase_result(parse_result)
         173  +
            let protocol = _cfg
         174  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         175  +
                .expect("a SharedClientProtocol is required");
         176  +
            let mut deser = protocol
         177  +
                .deserialize_response(response, NoInputAndOutput::OUTPUT_SCHEMA, _cfg)
         178  +
                .map_err(|e| {
         179  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         180  +
                })?;
         181  +
            // body and headers are already in scope from the top of the function;
         182  +
            // alias `headers` as `_response_headers` so MutateOutput
         183  +
            // customizations have a stable name to read from.
         184  +
            let _response_headers = headers;
         185  +
            #[allow(unused_mut)]
         186  +
            let mut output = crate::operation::no_input_and_output::NoInputAndOutputOutput::deserialize_with_response(
         187  +
                &mut *deser,
         188  +
                _response_headers,
         189  +
                response.status().into(),
         190  +
                body,
         191  +
            )
         192  +
            .map_err(|e| {
         193  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         194  +
            })?;
         195  +
         196  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         197  +
        }
  155    198   
    }
  156    199   
}
  157    200   
#[derive(Debug)]
  158    201   
struct NoInputAndOutputRequestSerializer;
  159    202   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for NoInputAndOutputRequestSerializer {
  160    203   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  161    204   
    fn serialize_input(
  162    205   
        &self,
  163    206   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  164    207   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  165    208   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  166    209   
        let input = input
  167    210   
            .downcast::<crate::operation::no_input_and_output::NoInputAndOutputInput>()
  168    211   
            .expect("correct type");
  169         -
        let _header_serialization_settings = _cfg
  170         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  171         -
            .cloned()
  172         -
            .unwrap_or_default();
  173         -
        let mut request_builder = {
  174         -
            #[allow(clippy::uninlined_format_args)]
  175         -
            fn uri_base(
  176         -
                _input: &crate::operation::no_input_and_output::NoInputAndOutputInput,
  177         -
                output: &mut ::std::string::String,
  178         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  179         -
                use ::std::fmt::Write as _;
  180         -
                ::std::write!(output, "/").expect("formatting should succeed");
  181         -
                ::std::result::Result::Ok(())
  182         -
            }
  183         -
            #[allow(clippy::unnecessary_wraps)]
  184         -
            fn update_http_builder(
  185         -
                input: &crate::operation::no_input_and_output::NoInputAndOutputInput,
  186         -
                builder: ::http_1x::request::Builder,
  187         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  188         -
                let mut uri = ::std::string::String::new();
  189         -
                uri_base(input, &mut uri)?;
  190         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  191         -
            }
  192         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  193         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
  194         -
            builder = _header_serialization_settings.set_default_header(
  195         -
                builder,
  196         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  197         -
                "JsonRpc10.NoInputAndOutput",
  198         -
            );
  199         -
            builder
  200         -
        };
  201         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_no_input_and_output::ser_no_input_and_output_input(&input)?);
  202    212   
  203         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         213  +
        let protocol = _cfg
         214  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         215  +
            .expect("a SharedClientProtocol is required");
         216  +
        let mut request = protocol
         217  +
            .serialize_request(&input, NoInputAndOutput::INPUT_SCHEMA, "/", _cfg)
         218  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         219  +
         220  +
        return ::std::result::Result::Ok(request);
  204    221   
    }
  205    222   
}
  206    223   
#[derive(Debug)]
  207    224   
struct NoInputAndOutputEndpointParamsInterceptor;
  208    225   
  209    226   
#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
  210    227   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NoInputAndOutputEndpointParamsInterceptor {
  211    228   
    fn name(&self) -> &'static str {
  212    229   
        "NoInputAndOutputEndpointParamsInterceptor"
  213    230   
    }
@@ -275,292 +334,358 @@
  295    312   
  296    313   
        let op = crate::operation::no_input_and_output::NoInputAndOutput::new();
  297    314   
        let config = op.config().expect("the operation has config");
  298    315   
        let de = config
  299    316   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  300    317   
            .expect("the config must have a deserializer");
  301    318   
  302    319   
        // Build a config bag with the protocol for schema-based deserialization
  303    320   
        #[allow(unused_mut)]
  304    321   
        let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         322  +
        {
         323  +
            let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         324  +
            layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         325  +
                ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0().with_target_prefix("JsonRpc10"),
         326  +
            ));
         327  +
            test_cfg.push_shared_layer(layer.freeze());
         328  +
        }
  305    329   
  306    330   
        let parsed = de.deserialize_streaming(&mut http_response);
  307    331   
        let parsed = parsed.unwrap_or_else(|| {
  308    332   
            let http_response = http_response.map(|body| {
  309    333   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  310    334   
                    body.bytes().unwrap(),
  311    335   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  312    336   
                )))
  313    337   
            });
  314    338   
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)

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

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

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

@@ -1,1 +22,79 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct NoInputAndOutputOutput {}
           6  +
static NOINPUTANDOUTPUTOUTPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
           7  +
    ::aws_smithy_schema::ShapeId::from_parts(
           8  +
        "aws.protocoltests.json10.synthetic#NoInputAndOutputOutput",
           9  +
        "aws.protocoltests.json10.synthetic",
          10  +
        "NoInputAndOutputOutput",
          11  +
    ),
          12  +
    ::aws_smithy_schema::ShapeType::Structure,
          13  +
    &[],
          14  +
)
          15  +
.with_original_name("NoInputAndOutputOutput");
          16  +
impl NoInputAndOutputOutput {
          17  +
    /// The schema for this shape.
          18  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &NOINPUTANDOUTPUTOUTPUT_SCHEMA;
          19  +
}
          20  +
impl ::aws_smithy_schema::serde::SerializableStruct for NoInputAndOutputOutput {
          21  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          22  +
    fn serialize_members(
          23  +
        &self,
          24  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          25  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          26  +
        Ok(())
          27  +
    }
          28  +
}
          29  +
impl NoInputAndOutputOutput {
          30  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          31  +
    pub fn deserialize(
          32  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          33  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          34  +
        #[allow(unused_variables, unused_mut)]
          35  +
        let mut builder = Self::builder();
          36  +
        #[allow(
          37  +
            unused_variables,
          38  +
            unreachable_code,
          39  +
            clippy::single_match,
          40  +
            clippy::match_single_binding,
          41  +
            clippy::diverging_sub_expression
          42  +
        )]
          43  +
        deserializer.read_struct(&NOINPUTANDOUTPUTOUTPUT_SCHEMA, &mut |member, deser| {
          44  +
            match member.member_index() {
          45  +
                _ => {}
          46  +
            }
          47  +
            Ok(())
          48  +
        })?;
          49  +
        Ok(builder.build())
          50  +
    }
          51  +
}
          52  +
impl NoInputAndOutputOutput {
          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  +
}
    6     63   
impl NoInputAndOutputOutput {
    7     64   
    /// Creates a new builder-style object to manufacture [`NoInputAndOutputOutput`](crate::operation::no_input_and_output::NoInputAndOutputOutput).
    8     65   
    pub fn builder() -> crate::operation::no_input_and_output::builders::NoInputAndOutputOutputBuilder {
    9     66   
        crate::operation::no_input_and_output::builders::NoInputAndOutputOutputBuilder::default()
   10     67   
    }
   11     68   
}
   12     69   
   13     70   
/// A builder for [`NoInputAndOutputOutput`](crate::operation::no_input_and_output::NoInputAndOutputOutput).
   14     71   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   15     72   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/operation/operation_with_defaults.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 `OperationWithDefaults`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct OperationWithDefaults;
    6      6   
impl OperationWithDefaults {
    7      7   
    /// Creates a new `OperationWithDefaults`
    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<'static> =
          13  +
        crate::operation::operation_with_defaults::OperationWithDefaultsInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
          16  +
        crate::operation::operation_with_defaults::OperationWithDefaultsOutput::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::operation_with_defaults::OperationWithDefaultsInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::operation_with_defaults::OperationWithDefaultsOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::operation_with_defaults::OperationWithDefaultsError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -160,166 +284,298 @@
  180    186   
}
  181    187   
#[derive(Debug)]
  182    188   
struct OperationWithDefaultsResponseDeserializer;
  183    189   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OperationWithDefaultsResponseDeserializer {
  184    190   
    fn deserialize_nonstreaming_with_config(
  185    191   
        &self,
  186    192   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
  187    193   
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  188    194   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  189    195   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  190         -
        let headers = response.headers();
         196  +
        // Load body and headers BEFORE BeforeParseResponse so customizations
         197  +
        // (e.g., S3's `body_is_error` check that detects errors returned with
         198  +
        // HTTP 200) can inspect them. The legacy non-streaming path also
         199  +
        // loads `body` before firing this hook.
  191    200   
        let body = response.body().bytes().expect("body loaded");
         201  +
        let headers = response.headers();
  192    202   
        #[allow(unused_mut)]
  193    203   
        let mut force_error = false;
  194    204   
  195         -
        let parse_result = if !success && status != 200 || force_error {
  196         -
            crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults_http_error(status, headers, body)
         205  +
        if !success && status != 200 || force_error {
         206  +
            let protocol = _cfg
         207  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         208  +
                .expect("a SharedClientProtocol is required");
         209  +
            #[allow(unused_mut)]
         210  +
            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
         211  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         212  +
            })?;
         213  +
         214  +
            let generic = generic_builder.build();
         215  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         216  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         217  +
                    crate::operation::operation_with_defaults::OperationWithDefaultsError::generic(generic),
         218  +
                ),
         219  +
            ))
  197    220   
        } else {
  198         -
            crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults_http_response(status, headers, body)
  199         -
        };
  200         -
        crate::protocol_serde::type_erase_result(parse_result)
         221  +
            let protocol = _cfg
         222  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         223  +
                .expect("a SharedClientProtocol is required");
         224  +
            let mut deser = protocol
         225  +
                .deserialize_response(response, OperationWithDefaults::OUTPUT_SCHEMA, _cfg)
         226  +
                .map_err(|e| {
         227  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         228  +
                })?;
         229  +
            // body and headers are already in scope from the top of the function;
         230  +
            // alias `headers` as `_response_headers` so MutateOutput
         231  +
            // customizations have a stable name to read from.
         232  +
            let _response_headers = headers;
         233  +
            #[allow(unused_mut)]
         234  +
            let mut output = crate::operation::operation_with_defaults::OperationWithDefaultsOutput::deserialize_with_response(
         235  +
                &mut *deser,
         236  +
                _response_headers,
         237  +
                response.status().into(),
         238  +
                body,
         239  +
            )
         240  +
            .map_err(|e| {
         241  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         242  +
            })?;
         243  +
         244  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         245  +
        }
  201    246   
    }
  202    247   
}
  203    248   
#[derive(Debug)]
  204    249   
struct OperationWithDefaultsRequestSerializer;
  205    250   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OperationWithDefaultsRequestSerializer {
  206    251   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  207    252   
    fn serialize_input(
  208    253   
        &self,
  209    254   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  210    255   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  211    256   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  212    257   
        let input = input
  213    258   
            .downcast::<crate::operation::operation_with_defaults::OperationWithDefaultsInput>()
  214    259   
            .expect("correct type");
  215         -
        let _header_serialization_settings = _cfg
  216         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  217         -
            .cloned()
  218         -
            .unwrap_or_default();
  219         -
        let mut request_builder = {
  220         -
            #[allow(clippy::uninlined_format_args)]
  221         -
            fn uri_base(
  222         -
                _input: &crate::operation::operation_with_defaults::OperationWithDefaultsInput,
  223         -
                output: &mut ::std::string::String,
  224         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  225         -
                use ::std::fmt::Write as _;
  226         -
                ::std::write!(output, "/").expect("formatting should succeed");
  227         -
                ::std::result::Result::Ok(())
  228         -
            }
  229         -
            #[allow(clippy::unnecessary_wraps)]
  230         -
            fn update_http_builder(
  231         -
                input: &crate::operation::operation_with_defaults::OperationWithDefaultsInput,
  232         -
                builder: ::http_1x::request::Builder,
  233         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  234         -
                let mut uri = ::std::string::String::new();
  235         -
                uri_base(input, &mut uri)?;
  236         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  237         -
            }
  238         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  239         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
  240         -
            builder = _header_serialization_settings.set_default_header(
  241         -
                builder,
  242         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  243         -
                "JsonRpc10.OperationWithDefaults",
  244         -
            );
  245         -
            builder
  246         -
        };
  247         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation_with_defaults::ser_operation_with_defaults_input(
  248         -
            &input,
  249         -
        )?);
  250         -
        if let Some(content_length) = body.content_length() {
  251         -
            let content_length = content_length.to_string();
  252         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  253         -
        }
  254         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         260  +
         261  +
        let protocol = _cfg
         262  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         263  +
            .expect("a SharedClientProtocol is required");
         264  +
        let mut request = protocol
         265  +
            .serialize_request(&input, OperationWithDefaults::INPUT_SCHEMA, "/", _cfg)
         266  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         267  +
         268  +
        return ::std::result::Result::Ok(request);
  255    269   
    }
  256    270   
}
  257    271   
#[derive(Debug)]
  258    272   
struct OperationWithDefaultsEndpointParamsInterceptor;
  259    273   
  260    274   
#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
  261    275   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OperationWithDefaultsEndpointParamsInterceptor {
  262    276   
    fn name(&self) -> &'static str {
  263    277   
        "OperationWithDefaultsEndpointParamsInterceptor"
  264    278   
    }
@@ -567,581 +626,647 @@
  587    601   
  588    602   
        let op = crate::operation::operation_with_defaults::OperationWithDefaults::new();
  589    603   
        let config = op.config().expect("the operation has config");
  590    604   
        let de = config
  591    605   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  592    606   
            .expect("the config must have a deserializer");
  593    607   
  594    608   
        // Build a config bag with the protocol for schema-based deserialization
  595    609   
        #[allow(unused_mut)]
  596    610   
        let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         611  +
        {
         612  +
            let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         613  +
            layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         614  +
                ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0().with_target_prefix("JsonRpc10"),
         615  +
            ));
         616  +
            test_cfg.push_shared_layer(layer.freeze());
         617  +
        }
  597    618   
  598    619   
        let parsed = de.deserialize_streaming(&mut http_response);
  599    620   
        let parsed = parsed.unwrap_or_else(|| {
  600    621   
            let http_response = http_response.map(|body| {
  601    622   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  602    623   
                    body.bytes().unwrap(),
  603    624   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  604    625   
                )))
  605    626   
            });
  606    627   
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
@@ -763,784 +822,850 @@
  783    804   
  784    805   
        let op = crate::operation::operation_with_defaults::OperationWithDefaults::new();
  785    806   
        let config = op.config().expect("the operation has config");
  786    807   
        let de = config
  787    808   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  788    809   
            .expect("the config must have a deserializer");
  789    810   
  790    811   
        // Build a config bag with the protocol for schema-based deserialization
  791    812   
        #[allow(unused_mut)]
  792    813   
        let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         814  +
        {
         815  +
            let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         816  +
            layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         817  +
                ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_0().with_target_prefix("JsonRpc10"),
         818  +
            ));
         819  +
            test_cfg.push_shared_layer(layer.freeze());
         820  +
        }
  793    821   
  794    822   
        let parsed = de.deserialize_streaming(&mut http_response);
  795    823   
        let parsed = parsed.unwrap_or_else(|| {
  796    824   
            let http_response = http_response.map(|body| {
  797    825   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  798    826   
                    body.bytes().unwrap(),
  799    827   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  800    828   
                )))
  801    829   
            });
  802    830   
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)

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

@@ -3,3 +62,205 @@
   23     23   
    }
   24     24   
    #[allow(missing_docs)] // documentation missing in model
   25     25   
    pub fn top_level_default(&self) -> ::std::option::Option<&str> {
   26     26   
        self.top_level_default.as_deref()
   27     27   
    }
   28     28   
    #[allow(missing_docs)] // documentation missing in model
   29     29   
    pub fn other_top_level_default(&self) -> ::std::option::Option<i32> {
   30     30   
        self.other_top_level_default
   31     31   
    }
   32     32   
}
          33  +
static OPERATIONWITHDEFAULTSINPUT_MEMBER_DEFAULTS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          34  +
    ::aws_smithy_schema::ShapeId::from_parts(
          35  +
        "aws.protocoltests.json10.synthetic#OperationWithDefaultsInput$defaults",
          36  +
        "aws.protocoltests.json10.synthetic",
          37  +
        "OperationWithDefaultsInput",
          38  +
    ),
          39  +
    ::aws_smithy_schema::ShapeType::Structure,
          40  +
    "defaults",
          41  +
    0,
          42  +
);
          43  +
static OPERATIONWITHDEFAULTSINPUT_MEMBER_CLIENT_OPTIONAL_DEFAULTS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          44  +
    ::aws_smithy_schema::ShapeId::from_parts(
          45  +
        "aws.protocoltests.json10.synthetic#OperationWithDefaultsInput$clientOptionalDefaults",
          46  +
        "aws.protocoltests.json10.synthetic",
          47  +
        "OperationWithDefaultsInput",
          48  +
    ),
          49  +
    ::aws_smithy_schema::ShapeType::Structure,
          50  +
    "clientOptionalDefaults",
          51  +
    1,
          52  +
);
          53  +
static OPERATIONWITHDEFAULTSINPUT_MEMBER_TOP_LEVEL_DEFAULT: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          54  +
    ::aws_smithy_schema::ShapeId::from_parts(
          55  +
        "aws.protocoltests.json10.synthetic#OperationWithDefaultsInput$topLevelDefault",
          56  +
        "aws.protocoltests.json10.synthetic",
          57  +
        "OperationWithDefaultsInput",
          58  +
    ),
          59  +
    ::aws_smithy_schema::ShapeType::String,
          60  +
    "topLevelDefault",
          61  +
    2,
          62  +
);
          63  +
static OPERATIONWITHDEFAULTSINPUT_MEMBER_OTHER_TOP_LEVEL_DEFAULT: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          64  +
    ::aws_smithy_schema::ShapeId::from_parts(
          65  +
        "aws.protocoltests.json10.synthetic#OperationWithDefaultsInput$otherTopLevelDefault",
          66  +
        "aws.protocoltests.json10.synthetic",
          67  +
        "OperationWithDefaultsInput",
          68  +
    ),
          69  +
    ::aws_smithy_schema::ShapeType::Integer,
          70  +
    "otherTopLevelDefault",
          71  +
    3,
          72  +
);
          73  +
static OPERATIONWITHDEFAULTSINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          74  +
    ::aws_smithy_schema::ShapeId::from_parts(
          75  +
        "aws.protocoltests.json10.synthetic#OperationWithDefaultsInput",
          76  +
        "aws.protocoltests.json10.synthetic",
          77  +
        "OperationWithDefaultsInput",
          78  +
    ),
          79  +
    ::aws_smithy_schema::ShapeType::Structure,
          80  +
    &[
          81  +
        &OPERATIONWITHDEFAULTSINPUT_MEMBER_DEFAULTS,
          82  +
        &OPERATIONWITHDEFAULTSINPUT_MEMBER_CLIENT_OPTIONAL_DEFAULTS,
          83  +
        &OPERATIONWITHDEFAULTSINPUT_MEMBER_TOP_LEVEL_DEFAULT,
          84  +
        &OPERATIONWITHDEFAULTSINPUT_MEMBER_OTHER_TOP_LEVEL_DEFAULT,
          85  +
    ],
          86  +
)
          87  +
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
          88  +
.with_original_name("OperationWithDefaultsInput");
          89  +
impl OperationWithDefaultsInput {
          90  +
    /// The schema for this shape.
          91  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &OPERATIONWITHDEFAULTSINPUT_SCHEMA;
          92  +
}
          93  +
impl ::aws_smithy_schema::serde::SerializableStruct for OperationWithDefaultsInput {
          94  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          95  +
    fn serialize_members(
          96  +
        &self,
          97  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          98  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          99  +
        if let Some(ref val) = self.defaults {
         100  +
            ser.write_struct(&OPERATIONWITHDEFAULTSINPUT_MEMBER_DEFAULTS, val)?;
         101  +
        }
         102  +
        if let Some(ref val) = self.client_optional_defaults {
         103  +
            ser.write_struct(&OPERATIONWITHDEFAULTSINPUT_MEMBER_CLIENT_OPTIONAL_DEFAULTS, val)?;
         104  +
        }
         105  +
        if let Some(ref val) = self.top_level_default {
         106  +
            ser.write_string(&OPERATIONWITHDEFAULTSINPUT_MEMBER_TOP_LEVEL_DEFAULT, val)?;
         107  +
        }
         108  +
        if let Some(ref val) = self.other_top_level_default {
         109  +
            ser.write_integer(&OPERATIONWITHDEFAULTSINPUT_MEMBER_OTHER_TOP_LEVEL_DEFAULT, *val)?;
         110  +
        }
         111  +
        Ok(())
         112  +
    }
         113  +
}
         114  +
impl OperationWithDefaultsInput {
         115  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
         116  +
    pub fn deserialize(
         117  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         118  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         119  +
        #[allow(unused_variables, unused_mut)]
         120  +
        let mut builder = Self::builder();
         121  +
        #[allow(
         122  +
            unused_variables,
         123  +
            unreachable_code,
         124  +
            clippy::single_match,
         125  +
            clippy::match_single_binding,
         126  +
            clippy::diverging_sub_expression
         127  +
        )]
         128  +
        deserializer.read_struct(&OPERATIONWITHDEFAULTSINPUT_SCHEMA, &mut |member, deser| {
         129  +
            match member.member_index() {
         130  +
                Some(0) => {
         131  +
                    if deser.is_null() {
         132  +
                        deser.read_null()?;
         133  +
                    } else {
         134  +
                        builder.defaults = Some(crate::types::Defaults::deserialize(deser)?);
         135  +
                    }
         136  +
                }
         137  +
                Some(1) => {
         138  +
                    if deser.is_null() {
         139  +
                        deser.read_null()?;
         140  +
                    } else {
         141  +
                        builder.client_optional_defaults = Some(crate::types::ClientOptionalDefaults::deserialize(deser)?);
         142  +
                    }
         143  +
                }
         144  +
                Some(2) => {
         145  +
                    if deser.is_null() {
         146  +
                        deser.read_null()?;
         147  +
                    } else {
         148  +
                        builder.top_level_default = Some(deser.read_string(member)?);
         149  +
                    }
         150  +
                }
         151  +
                Some(3) => {
         152  +
                    if deser.is_null() {
         153  +
                        deser.read_null()?;
         154  +
                    } else {
         155  +
                        builder.other_top_level_default = Some(deser.read_integer(member)?);
         156  +
                    }
         157  +
                }
         158  +
                _ => {}
         159  +
            }
         160  +
            Ok(())
         161  +
        })?;
         162  +
        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
         163  +
    }
         164  +
}
         165  +
impl OperationWithDefaultsInput {
         166  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         167  +
    pub fn deserialize_with_response(
         168  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         169  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         170  +
        _status: u16,
         171  +
        _body: &[u8],
         172  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         173  +
        Self::deserialize(deserializer)
         174  +
    }
         175  +
}
   33    176   
impl OperationWithDefaultsInput {
   34    177   
    /// Creates a new builder-style object to manufacture [`OperationWithDefaultsInput`](crate::operation::operation_with_defaults::OperationWithDefaultsInput).
   35    178   
    pub fn builder() -> crate::operation::operation_with_defaults::builders::OperationWithDefaultsInputBuilder {
   36    179   
        crate::operation::operation_with_defaults::builders::OperationWithDefaultsInputBuilder::default()
   37    180   
    }
   38    181   
}
   39    182   
   40    183   
/// A builder for [`OperationWithDefaultsInput`](crate::operation::operation_with_defaults::OperationWithDefaultsInput).
   41    184   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   42    185   
#[non_exhaustive]