Client Test

Client Test

rev. ec7b2441254af868911fccffe8d8dca83aff0045

Files changed:

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/float16.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 `Float16`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct Float16;
    6      6   
impl Float16 {
    7      7   
    /// Creates a new `Float16`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::float16::Float16Input::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::float16::Float16Output::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::float16::Float16Input,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::float16::Float16Output,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::float16::Float16Error,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -97,101 +159,164 @@
  117    121   
                crate::operation::float16::Float16Error,
  118    122   
            >::new());
  119    123   
  120    124   
        ::std::borrow::Cow::Owned(rcb)
  121    125   
    }
  122    126   
}
  123    127   
  124    128   
#[derive(Debug)]
  125    129   
struct Float16ResponseDeserializer;
  126    130   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for Float16ResponseDeserializer {
  127         -
    fn deserialize_nonstreaming(
         131  +
    fn deserialize_nonstreaming_with_config(
  128    132   
        &self,
  129    133   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         134  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  130    135   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  131    136   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  132    137   
        let headers = response.headers();
  133    138   
        let body = response.body().bytes().expect("body loaded");
  134    139   
        #[allow(unused_mut)]
  135    140   
        let mut force_error = false;
  136    141   
  137    142   
        let parse_result = if !success && status != 200 || force_error {
  138    143   
            crate::protocol_serde::shape_float16::de_float16_http_error(status, headers, body)
  139    144   
        } else {
@@ -242,247 +500,525 @@
  262    267   
            .expect("the config must have a deserializer");
  263    268   
  264    269   
        let parsed = de.deserialize_streaming(&mut http_response);
  265    270   
        let parsed = parsed.unwrap_or_else(|| {
  266    271   
            let http_response = http_response.map(|body| {
  267    272   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  268    273   
                    body.bytes().unwrap(),
  269    274   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  270    275   
                )))
  271    276   
            });
  272         -
            de.deserialize_nonstreaming(&http_response)
         277  +
            // Build a config bag with the protocol for schema-based deserialization
         278  +
            #[allow(unused_mut)]
         279  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         280  +
         281  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  273    282   
        });
  274    283   
        let parsed = parsed
  275    284   
            .expect("should be successful response")
  276    285   
            .downcast::<crate::operation::float16::Float16Output>()
  277    286   
            .unwrap();
  278    287   
        assert!(
  279    288   
            parsed.value.float_equals(&expected_output.value),
  280    289   
            "Unexpected value for `value` {:?} vs. {:?}",
  281    290   
            expected_output.value,
  282    291   
            parsed.value
  283    292   
        );
  284    293   
    }
  285    294   
  286    295   
    /// Ensures that clients can correctly parse float16 -Inf.
  287    296   
    /// Test ID: RpcV2CborFloat16NegInf
  288    297   
    #[::tokio::test]
  289    298   
    #[::tracing_test::traced_test]
  290    299   
    async fn rpc_v2_cbor_float16_neg_inf_response() {
  291    300   
        let expected_output = crate::operation::float16::Float16Output::builder()
  292    301   
            .set_value(::std::option::Option::Some(
  293    302   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
  294    303   
            ))
  295    304   
            .build();
  296    305   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  297    306   
            ::http_1x::response::Builder::new()
  298    307   
                .header("Content-Type", "application/cbor")
  299    308   
                .header("smithy-protocol", "rpc-v2-cbor")
  300    309   
                .status(200)
  301    310   
                .body(::aws_smithy_types::body::SdkBody::from("oWV2YWx1Zfn8AA=="))
  302    311   
                .unwrap(),
  303    312   
        )
  304    313   
        .unwrap();
  305    314   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  306    315   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  307    316   
  308    317   
        let op = crate::operation::float16::Float16::new();
  309    318   
        let config = op.config().expect("the operation has config");
  310    319   
        let de = config
  311    320   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  312    321   
            .expect("the config must have a deserializer");
  313    322   
  314    323   
        let parsed = de.deserialize_streaming(&mut http_response);
  315    324   
        let parsed = parsed.unwrap_or_else(|| {
  316    325   
            let http_response = http_response.map(|body| {
  317    326   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  318    327   
                    body.bytes().unwrap(),
  319    328   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  320    329   
                )))
  321    330   
            });
  322         -
            de.deserialize_nonstreaming(&http_response)
         331  +
            // Build a config bag with the protocol for schema-based deserialization
         332  +
            #[allow(unused_mut)]
         333  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         334  +
         335  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  323    336   
        });
  324    337   
        let parsed = parsed
  325    338   
            .expect("should be successful response")
  326    339   
            .downcast::<crate::operation::float16::Float16Output>()
  327    340   
            .unwrap();
  328    341   
        assert!(
  329    342   
            parsed.value.float_equals(&expected_output.value),
  330    343   
            "Unexpected value for `value` {:?} vs. {:?}",
  331    344   
            expected_output.value,
  332    345   
            parsed.value
  333    346   
        );
  334    347   
    }
  335    348   
  336    349   
    /// Ensures that clients can correctly parse float16 NaN with high LSB.
  337    350   
    /// Test ID: RpcV2CborFloat16LSBNaN
  338    351   
    #[::tokio::test]
  339    352   
    #[::tracing_test::traced_test]
  340    353   
    async fn rpc_v2_cbor_float16_lsb_na_n_response() {
  341    354   
        let expected_output = crate::operation::float16::Float16Output::builder()
  342    355   
            .set_value(::std::option::Option::Some(
  343    356   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
  344    357   
            ))
  345    358   
            .build();
  346    359   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  347    360   
            ::http_1x::response::Builder::new()
  348    361   
                .header("Content-Type", "application/cbor")
  349    362   
                .header("smithy-protocol", "rpc-v2-cbor")
  350    363   
                .status(200)
  351    364   
                .body(::aws_smithy_types::body::SdkBody::from("oWV2YWx1Zfl8AQ=="))
  352    365   
                .unwrap(),
  353    366   
        )
  354    367   
        .unwrap();
  355    368   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  356    369   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  357    370   
  358    371   
        let op = crate::operation::float16::Float16::new();
  359    372   
        let config = op.config().expect("the operation has config");
  360    373   
        let de = config
  361    374   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  362    375   
            .expect("the config must have a deserializer");
  363    376   
  364    377   
        let parsed = de.deserialize_streaming(&mut http_response);
  365    378   
        let parsed = parsed.unwrap_or_else(|| {
  366    379   
            let http_response = http_response.map(|body| {
  367    380   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  368    381   
                    body.bytes().unwrap(),
  369    382   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  370    383   
                )))
  371    384   
            });
  372         -
            de.deserialize_nonstreaming(&http_response)
         385  +
            // Build a config bag with the protocol for schema-based deserialization
         386  +
            #[allow(unused_mut)]
         387  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         388  +
         389  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  373    390   
        });
  374    391   
        let parsed = parsed
  375    392   
            .expect("should be successful response")
  376    393   
            .downcast::<crate::operation::float16::Float16Output>()
  377    394   
            .unwrap();
  378    395   
        assert!(
  379    396   
            parsed.value.float_equals(&expected_output.value),
  380    397   
            "Unexpected value for `value` {:?} vs. {:?}",
  381    398   
            expected_output.value,
  382    399   
            parsed.value
  383    400   
        );
  384    401   
    }
  385    402   
  386    403   
    /// Ensures that clients can correctly parse float16 NaN with high MSB.
  387    404   
    /// Test ID: RpcV2CborFloat16MSBNaN
  388    405   
    #[::tokio::test]
  389    406   
    #[::tracing_test::traced_test]
  390    407   
    async fn rpc_v2_cbor_float16_msb_na_n_response() {
  391    408   
        let expected_output = crate::operation::float16::Float16Output::builder()
  392    409   
            .set_value(::std::option::Option::Some(
  393    410   
                <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
  394    411   
            ))
  395    412   
            .build();
  396    413   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  397    414   
            ::http_1x::response::Builder::new()
  398    415   
                .header("Content-Type", "application/cbor")
  399    416   
                .header("smithy-protocol", "rpc-v2-cbor")
  400    417   
                .status(200)
  401    418   
                .body(::aws_smithy_types::body::SdkBody::from("oWV2YWx1Zfl+AA=="))
  402    419   
                .unwrap(),
  403    420   
        )
  404    421   
        .unwrap();
  405    422   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  406    423   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  407    424   
  408    425   
        let op = crate::operation::float16::Float16::new();
  409    426   
        let config = op.config().expect("the operation has config");
  410    427   
        let de = config
  411    428   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  412    429   
            .expect("the config must have a deserializer");
  413    430   
  414    431   
        let parsed = de.deserialize_streaming(&mut http_response);
  415    432   
        let parsed = parsed.unwrap_or_else(|| {
  416    433   
            let http_response = http_response.map(|body| {
  417    434   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  418    435   
                    body.bytes().unwrap(),
  419    436   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  420    437   
                )))
  421    438   
            });
  422         -
            de.deserialize_nonstreaming(&http_response)
         439  +
            // Build a config bag with the protocol for schema-based deserialization
         440  +
            #[allow(unused_mut)]
         441  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         442  +
         443  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  423    444   
        });
  424    445   
        let parsed = parsed
  425    446   
            .expect("should be successful response")
  426    447   
            .downcast::<crate::operation::float16::Float16Output>()
  427    448   
            .unwrap();
  428    449   
        assert!(
  429    450   
            parsed.value.float_equals(&expected_output.value),
  430    451   
            "Unexpected value for `value` {:?} vs. {:?}",
  431    452   
            expected_output.value,
  432    453   
            parsed.value
  433    454   
        );
  434    455   
    }
  435    456   
  436    457   
    /// Ensures that clients can correctly parse a subnormal float16.
  437    458   
    /// Test ID: RpcV2CborFloat16Subnormal
  438    459   
    #[::tokio::test]
  439    460   
    #[::tracing_test::traced_test]
  440    461   
    async fn rpc_v2_cbor_float16_subnormal_response() {
  441    462   
        let expected_output = crate::operation::float16::Float16Output::builder()
  442    463   
            .set_value(::std::option::Option::Some(4.76837158203125E-6_f64))
  443    464   
            .build();
  444    465   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  445    466   
            ::http_1x::response::Builder::new()
  446    467   
                .header("Content-Type", "application/cbor")
  447    468   
                .header("smithy-protocol", "rpc-v2-cbor")
  448    469   
                .status(200)
  449    470   
                .body(::aws_smithy_types::body::SdkBody::from("oWV2YWx1ZfkAUA=="))
  450    471   
                .unwrap(),
  451    472   
        )
  452    473   
        .unwrap();
  453    474   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  454    475   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  455    476   
  456    477   
        let op = crate::operation::float16::Float16::new();
  457    478   
        let config = op.config().expect("the operation has config");
  458    479   
        let de = config
  459    480   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  460    481   
            .expect("the config must have a deserializer");
  461    482   
  462    483   
        let parsed = de.deserialize_streaming(&mut http_response);
  463    484   
        let parsed = parsed.unwrap_or_else(|| {
  464    485   
            let http_response = http_response.map(|body| {
  465    486   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  466    487   
                    body.bytes().unwrap(),
  467    488   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  468    489   
                )))
  469    490   
            });
  470         -
            de.deserialize_nonstreaming(&http_response)
         491  +
            // Build a config bag with the protocol for schema-based deserialization
         492  +
            #[allow(unused_mut)]
         493  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         494  +
         495  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  471    496   
        });
  472    497   
        let parsed = parsed
  473    498   
            .expect("should be successful response")
  474    499   
            .downcast::<crate::operation::float16::Float16Output>()
  475    500   
            .unwrap();
  476    501   
        assert!(
  477    502   
            parsed.value.float_equals(&expected_output.value),
  478    503   
            "Unexpected value for `value` {:?} vs. {:?}",
  479    504   
            expected_output.value,
  480    505   
            parsed.value

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/float16/_float16_input.rs

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

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/float16/_float16_output.rs

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

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

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `FractionalSeconds`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct FractionalSeconds;
    6      6   
impl FractionalSeconds {
    7      7   
    /// Creates a new `FractionalSeconds`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::fractional_seconds::FractionalSecondsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::fractional_seconds::FractionalSecondsOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::fractional_seconds::FractionalSecondsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::fractional_seconds::FractionalSecondsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::fractional_seconds::FractionalSecondsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +166,171 @@
  124    128   
                crate::operation::fractional_seconds::FractionalSecondsError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct FractionalSecondsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for FractionalSecondsResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139    144   
        let headers = response.headers();
  140    145   
        let body = response.body().bytes().expect("body loaded");
  141    146   
        #[allow(unused_mut)]
  142    147   
        let mut force_error = false;
  143    148   
  144    149   
        let parse_result = if !success && status != 200 || force_error {
  145    150   
            crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_error(status, headers, body)
  146    151   
        } else {
@@ -250,255 +310,319 @@
  270    275   
            .expect("the config must have a deserializer");
  271    276   
  272    277   
        let parsed = de.deserialize_streaming(&mut http_response);
  273    278   
        let parsed = parsed.unwrap_or_else(|| {
  274    279   
            let http_response = http_response.map(|body| {
  275    280   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  276    281   
                    body.bytes().unwrap(),
  277    282   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  278    283   
                )))
  279    284   
            });
  280         -
            de.deserialize_nonstreaming(&http_response)
         285  +
            // Build a config bag with the protocol for schema-based deserialization
         286  +
            #[allow(unused_mut)]
         287  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         288  +
         289  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  281    290   
        });
  282    291   
        let parsed = parsed
  283    292   
            .expect("should be successful response")
  284    293   
            .downcast::<crate::operation::fractional_seconds::FractionalSecondsOutput>()
  285    294   
            .unwrap();
  286    295   
        ::pretty_assertions::assert_eq!(parsed.datetime, expected_output.datetime, "Unexpected value for `datetime`");
  287    296   
    }
  288    297   
}
  289    298   
  290    299   
/// Error type for the `FractionalSecondsError` operation.

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

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

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/fractional_seconds/_fractional_seconds_output.rs

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

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

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `GreetingWithErrors`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct GreetingWithErrors;
    6      6   
impl GreetingWithErrors {
    7      7   
    /// Creates a new `GreetingWithErrors`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::greeting_with_errors::GreetingWithErrorsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::greeting_with_errors::GreetingWithErrorsOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::greeting_with_errors::GreetingWithErrorsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::greeting_with_errors::GreetingWithErrorsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +166,171 @@
  124    128   
                crate::operation::greeting_with_errors::GreetingWithErrorsError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct GreetingWithErrorsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GreetingWithErrorsResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139    144   
        let headers = response.headers();
  140    145   
        let body = response.body().bytes().expect("body loaded");
  141    146   
        #[allow(unused_mut)]
  142    147   
        let mut force_error = false;
  143    148   
  144    149   
        let parse_result = if !success && status != 200 || force_error {
  145    150   
            crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_error(status, headers, body)
  146    151   
        } else {
@@ -250,255 +409,426 @@
  270    275   
            .expect("the config must have a deserializer");
  271    276   
  272    277   
        let parsed = de.deserialize_streaming(&mut http_response);
  273    278   
        let parsed = parsed.unwrap_or_else(|| {
  274    279   
            let http_response = http_response.map(|body| {
  275    280   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  276    281   
                    body.bytes().unwrap(),
  277    282   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  278    283   
                )))
  279    284   
            });
  280         -
            de.deserialize_nonstreaming(&http_response)
         285  +
            // Build a config bag with the protocol for schema-based deserialization
         286  +
            #[allow(unused_mut)]
         287  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         288  +
         289  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  281    290   
        });
  282    291   
        let parsed = parsed.expect_err("should be error response");
  283    292   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  284    293   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  285    294   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting(parsed) = parsed {
  286    295   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  287    296   
        } else {
  288    297   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  289    298   
        }
  290    299   
    }
  291    300   
  292    301   
    /// Parses a complex error with no message member
  293    302   
    /// Test ID: RpcV2CborComplexError
  294    303   
    #[::tokio::test]
  295    304   
    #[::tracing_test::traced_test]
  296    305   
    async fn rpc_v2_cbor_complex_error_response() {
  297    306   
        let expected_output = crate::types::error::ComplexError::builder()
  298    307   
            .set_top_level(::std::option::Option::Some("Top level".to_owned()))
  299    308   
            .set_nested(::std::option::Option::Some(
  300    309   
                crate::types::ComplexNestedErrorData::builder()
  301    310   
                    .set_foo(::std::option::Option::Some("bar".to_owned()))
  302    311   
                    .build(),
  303    312   
            ))
  304    313   
            .build();
  305    314   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  306    315   
            ::http_1x::response::Builder::new()
  307    316   
                .header("Content-Type", "application/cbor")
  308    317   
                .header("smithy-protocol", "rpc-v2-cbor")
  309    318   
                .status(400)
  310    319   
                .body(::aws_smithy_types::body::SdkBody::from(
  311    320   
                    "v2ZfX3R5cGV4K3NtaXRoeS5wcm90b2NvbHRlc3RzLnJwY3YyQ2JvciNDb21wbGV4RXJyb3JoVG9wTGV2ZWxpVG9wIGxldmVsZk5lc3RlZL9jRm9vY2Jhcv//",
  312    321   
                ))
  313    322   
                .unwrap(),
  314    323   
        )
  315    324   
        .unwrap();
  316    325   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  317    326   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  318    327   
  319    328   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  320    329   
        let config = op.config().expect("the operation has config");
  321    330   
        let de = config
  322    331   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  323    332   
            .expect("the config must have a deserializer");
  324    333   
  325    334   
        let parsed = de.deserialize_streaming(&mut http_response);
  326    335   
        let parsed = parsed.unwrap_or_else(|| {
  327    336   
            let http_response = http_response.map(|body| {
  328    337   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  329    338   
                    body.bytes().unwrap(),
  330    339   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  331    340   
                )))
  332    341   
            });
  333         -
            de.deserialize_nonstreaming(&http_response)
         342  +
            // Build a config bag with the protocol for schema-based deserialization
         343  +
            #[allow(unused_mut)]
         344  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         345  +
         346  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  334    347   
        });
  335    348   
        let parsed = parsed.expect_err("should be error response");
  336    349   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  337    350   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  338    351   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError(parsed) = parsed {
  339    352   
            ::pretty_assertions::assert_eq!(parsed.top_level, expected_output.top_level, "Unexpected value for `top_level`");
  340    353   
            ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  341    354   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  342    355   
        } else {
  343    356   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  344    357   
        }
  345    358   
    }
  346    359   
    /// Test ID: RpcV2CborEmptyComplexError
  347    360   
    #[::tokio::test]
  348    361   
    #[::tracing_test::traced_test]
  349    362   
    async fn rpc_v2_cbor_empty_complex_error_response() {
  350    363   
        let expected_output = crate::types::error::ComplexError::builder().build();
  351    364   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  352    365   
            ::http_1x::response::Builder::new()
  353    366   
                .header("Content-Type", "application/cbor")
  354    367   
                .header("smithy-protocol", "rpc-v2-cbor")
  355    368   
                .status(400)
  356    369   
                .body(::aws_smithy_types::body::SdkBody::from(
  357    370   
                    "v2ZfX3R5cGV4K3NtaXRoeS5wcm90b2NvbHRlc3RzLnJwY3YyQ2JvciNDb21wbGV4RXJyb3L/",
  358    371   
                ))
  359    372   
                .unwrap(),
  360    373   
        )
  361    374   
        .unwrap();
  362    375   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  363    376   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  364    377   
  365    378   
        let op = crate::operation::greeting_with_errors::GreetingWithErrors::new();
  366    379   
        let config = op.config().expect("the operation has config");
  367    380   
        let de = config
  368    381   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  369    382   
            .expect("the config must have a deserializer");
  370    383   
  371    384   
        let parsed = de.deserialize_streaming(&mut http_response);
  372    385   
        let parsed = parsed.unwrap_or_else(|| {
  373    386   
            let http_response = http_response.map(|body| {
  374    387   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  375    388   
                    body.bytes().unwrap(),
  376    389   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  377    390   
                )))
  378    391   
            });
  379         -
            de.deserialize_nonstreaming(&http_response)
         392  +
            // Build a config bag with the protocol for schema-based deserialization
         393  +
            #[allow(unused_mut)]
         394  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         395  +
         396  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  380    397   
        });
  381    398   
        let parsed = parsed.expect_err("should be error response");
  382    399   
        let parsed: &crate::operation::greeting_with_errors::GreetingWithErrorsError =
  383    400   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  384    401   
        if let crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError(parsed) = parsed {
  385    402   
            ::pretty_assertions::assert_eq!(parsed.top_level, expected_output.top_level, "Unexpected value for `top_level`");
  386    403   
            ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  387    404   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  388    405   
        } else {
  389    406   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);

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

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

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

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

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/no_input_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 `NoInputOutput`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct NoInputOutput;
    6      6   
impl NoInputOutput {
    7      7   
    /// Creates a new `NoInputOutput`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::no_input_output::NoInputOutputInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::no_input_output::NoInputOutputOutput::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_output::NoInputOutputInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::no_input_output::NoInputOutputOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::no_input_output::NoInputOutputError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +166,171 @@
  124    128   
                crate::operation::no_input_output::NoInputOutputError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct NoInputOutputResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for NoInputOutputResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139    144   
        let headers = response.headers();
  140    145   
        let body = response.body().bytes().expect("body loaded");
  141    146   
        #[allow(unused_mut)]
  142    147   
        let mut force_error = false;
  143    148   
  144    149   
        let parse_result = if !success && status != 200 || force_error {
  145    150   
            crate::protocol_serde::shape_no_input_output::de_no_input_output_http_error(status, headers, body)
  146    151   
        } else {
@@ -274,279 +415,432 @@
  294    299   
            .expect("the config must have a deserializer");
  295    300   
  296    301   
        let parsed = de.deserialize_streaming(&mut http_response);
  297    302   
        let parsed = parsed.unwrap_or_else(|| {
  298    303   
            let http_response = http_response.map(|body| {
  299    304   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  300    305   
                    body.bytes().unwrap(),
  301    306   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  302    307   
                )))
  303    308   
            });
  304         -
            de.deserialize_nonstreaming(&http_response)
         309  +
            // Build a config bag with the protocol for schema-based deserialization
         310  +
            #[allow(unused_mut)]
         311  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         312  +
         313  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  305    314   
        });
  306    315   
        let parsed = parsed
  307    316   
            .expect("should be successful response")
  308    317   
            .downcast::<crate::operation::no_input_output::NoInputOutputOutput>()
  309    318   
            .unwrap();
  310    319   
    }
  311    320   
  312    321   
    /// Clients should accept a CBOR empty struct if there is no output.
  313    322   
    /// Test ID: NoOutputClientAllowsEmptyCbor
  314    323   
    #[::tokio::test]
  315    324   
    #[::tracing_test::traced_test]
  316    325   
    async fn no_output_client_allows_empty_cbor_response() {
  317    326   
        let expected_output = crate::operation::no_input_output::NoInputOutputOutput::builder().build();
  318    327   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  319    328   
            ::http_1x::response::Builder::new()
  320    329   
                .header("Content-Type", "application/cbor")
  321    330   
                .header("smithy-protocol", "rpc-v2-cbor")
  322    331   
                .status(200)
  323    332   
                .body(::aws_smithy_types::body::SdkBody::from("v/8="))
  324    333   
                .unwrap(),
  325    334   
        )
  326    335   
        .unwrap();
  327    336   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  328    337   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  329    338   
  330    339   
        let op = crate::operation::no_input_output::NoInputOutput::new();
  331    340   
        let config = op.config().expect("the operation has config");
  332    341   
        let de = config
  333    342   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  334    343   
            .expect("the config must have a deserializer");
  335    344   
  336    345   
        let parsed = de.deserialize_streaming(&mut http_response);
  337    346   
        let parsed = parsed.unwrap_or_else(|| {
  338    347   
            let http_response = http_response.map(|body| {
  339    348   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  340    349   
                    body.bytes().unwrap(),
  341    350   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  342    351   
                )))
  343    352   
            });
  344         -
            de.deserialize_nonstreaming(&http_response)
         353  +
            // Build a config bag with the protocol for schema-based deserialization
         354  +
            #[allow(unused_mut)]
         355  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         356  +
         357  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  345    358   
        });
  346    359   
        let parsed = parsed
  347    360   
            .expect("should be successful response")
  348    361   
            .downcast::<crate::operation::no_input_output::NoInputOutputOutput>()
  349    362   
            .unwrap();
  350    363   
    }
  351    364   
  352    365   
    /// Clients should accept an empty body if there is no output and
  353    366   
    /// should not raise an error if the `Content-Type` header is set.
  354    367   
    /// Test ID: NoOutputClientAllowsEmptyBody
  355    368   
    #[::tokio::test]
  356    369   
    #[::tracing_test::traced_test]
  357    370   
    async fn no_output_client_allows_empty_body_response() {
  358    371   
        let expected_output = crate::operation::no_input_output::NoInputOutputOutput::builder().build();
  359    372   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  360    373   
            ::http_1x::response::Builder::new()
  361    374   
                .header("Content-Type", "application/cbor")
  362    375   
                .header("smithy-protocol", "rpc-v2-cbor")
  363    376   
                .status(200)
  364    377   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  365    378   
                .unwrap(),
  366    379   
        )
  367    380   
        .unwrap();
  368    381   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  369    382   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  370    383   
  371    384   
        let op = crate::operation::no_input_output::NoInputOutput::new();
  372    385   
        let config = op.config().expect("the operation has config");
  373    386   
        let de = config
  374    387   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  375    388   
            .expect("the config must have a deserializer");
  376    389   
  377    390   
        let parsed = de.deserialize_streaming(&mut http_response);
  378    391   
        let parsed = parsed.unwrap_or_else(|| {
  379    392   
            let http_response = http_response.map(|body| {
  380    393   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  381    394   
                    body.bytes().unwrap(),
  382    395   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  383    396   
                )))
  384    397   
            });
  385         -
            de.deserialize_nonstreaming(&http_response)
         398  +
            // Build a config bag with the protocol for schema-based deserialization
         399  +
            #[allow(unused_mut)]
         400  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         401  +
         402  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  386    403   
        });
  387    404   
        let parsed = parsed
  388    405   
            .expect("should be successful response")
  389    406   
            .downcast::<crate::operation::no_input_output::NoInputOutputOutput>()
  390    407   
            .unwrap();
  391    408   
    }
  392    409   
}
  393    410   
  394    411   
/// Error type for the `NoInputOutputError` operation.
  395    412   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/no_input_output/_no_input_output_input.rs

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

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/no_input_output/_no_input_output_output.rs

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

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/operation_with_defaults.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 `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 = crate::operation::operation_with_defaults::OperationWithDefaultsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::operation_with_defaults::OperationWithDefaultsOutput::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::operation_with_defaults::OperationWithDefaultsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::operation_with_defaults::OperationWithDefaultsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::operation_with_defaults::OperationWithDefaultsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +172,177 @@
  130    134   
                crate::operation::operation_with_defaults::OperationWithDefaultsError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct OperationWithDefaultsResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OperationWithDefaultsResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145    150   
        let headers = response.headers();
  146    151   
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150    155   
        let parse_result = if !success && status != 200 || force_error {
  151    156   
            crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults_http_error(status, headers, body)
  152    157   
        } else {
@@ -510,515 +570,579 @@
  530    535   
            .expect("the config must have a deserializer");
  531    536   
  532    537   
        let parsed = de.deserialize_streaming(&mut http_response);
  533    538   
        let parsed = parsed.unwrap_or_else(|| {
  534    539   
            let http_response = http_response.map(|body| {
  535    540   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  536    541   
                    body.bytes().unwrap(),
  537    542   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  538    543   
                )))
  539    544   
            });
  540         -
            de.deserialize_nonstreaming(&http_response)
         545  +
            // Build a config bag with the protocol for schema-based deserialization
         546  +
            #[allow(unused_mut)]
         547  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         548  +
         549  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  541    550   
        });
  542    551   
        let parsed = parsed
  543    552   
            .expect("should be successful response")
  544    553   
            .downcast::<crate::operation::operation_with_defaults::OperationWithDefaultsOutput>()
  545    554   
            .unwrap();
  546    555   
        ::pretty_assertions::assert_eq!(
  547    556   
            parsed.default_string,
  548    557   
            expected_output.default_string,
  549    558   
            "Unexpected value for `default_string`"
  550    559   
        );
@@ -649,658 +709,722 @@
  669    678   
            .expect("the config must have a deserializer");
  670    679   
  671    680   
        let parsed = de.deserialize_streaming(&mut http_response);
  672    681   
        let parsed = parsed.unwrap_or_else(|| {
  673    682   
            let http_response = http_response.map(|body| {
  674    683   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  675    684   
                    body.bytes().unwrap(),
  676    685   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  677    686   
                )))
  678    687   
            });
  679         -
            de.deserialize_nonstreaming(&http_response)
         688  +
            // Build a config bag with the protocol for schema-based deserialization
         689  +
            #[allow(unused_mut)]
         690  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         691  +
         692  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  680    693   
        });
  681    694   
        let parsed = parsed
  682    695   
            .expect("should be successful response")
  683    696   
            .downcast::<crate::operation::operation_with_defaults::OperationWithDefaultsOutput>()
  684    697   
            .unwrap();
  685    698   
        ::pretty_assertions::assert_eq!(
  686    699   
            parsed.default_string,
  687    700   
            expected_output.default_string,
  688    701   
            "Unexpected value for `default_string`"
  689    702   
        );

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

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

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/operation_with_defaults/_operation_with_defaults_output.rs

@@ -132,132 +412,412 @@
  152    152   
    "smithy.protocoltests.rpcv2Cbor.synthetic",
  153    153   
    "OperationWithDefaultsOutput",
  154    154   
);
  155    155   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_STRING: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  156    156   
    ::aws_smithy_schema::ShapeId::from_static(
  157    157   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultString",
  158    158   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  159    159   
        "OperationWithDefaultsOutput",
  160    160   
    ),
  161    161   
    ::aws_smithy_schema::ShapeType::String,
  162         -
    "default_string",
         162  +
    "defaultString",
  163    163   
    0,
  164    164   
);
  165    165   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_BOOLEAN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  166    166   
    ::aws_smithy_schema::ShapeId::from_static(
  167    167   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultBoolean",
  168    168   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  169    169   
        "OperationWithDefaultsOutput",
  170    170   
    ),
  171    171   
    ::aws_smithy_schema::ShapeType::Boolean,
  172         -
    "default_boolean",
         172  +
    "defaultBoolean",
  173    173   
    1,
  174    174   
);
  175    175   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  176    176   
    ::aws_smithy_schema::ShapeId::from_static(
  177    177   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultList",
  178    178   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  179    179   
        "OperationWithDefaultsOutput",
  180    180   
    ),
  181    181   
    ::aws_smithy_schema::ShapeType::List,
  182         -
    "default_list",
         182  +
    "defaultList",
  183    183   
    2,
  184    184   
);
  185    185   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_TIMESTAMP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  186    186   
    ::aws_smithy_schema::ShapeId::from_static(
  187    187   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultTimestamp",
  188    188   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  189    189   
        "OperationWithDefaultsOutput",
  190    190   
    ),
  191    191   
    ::aws_smithy_schema::ShapeType::Timestamp,
  192         -
    "default_timestamp",
         192  +
    "defaultTimestamp",
  193    193   
    3,
  194    194   
);
  195    195   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_BLOB: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  196    196   
    ::aws_smithy_schema::ShapeId::from_static(
  197    197   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultBlob",
  198    198   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  199    199   
        "OperationWithDefaultsOutput",
  200    200   
    ),
  201    201   
    ::aws_smithy_schema::ShapeType::Blob,
  202         -
    "default_blob",
         202  +
    "defaultBlob",
  203    203   
    4,
  204    204   
);
  205    205   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_BYTE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  206    206   
    ::aws_smithy_schema::ShapeId::from_static(
  207    207   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultByte",
  208    208   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  209    209   
        "OperationWithDefaultsOutput",
  210    210   
    ),
  211    211   
    ::aws_smithy_schema::ShapeType::Byte,
  212         -
    "default_byte",
         212  +
    "defaultByte",
  213    213   
    5,
  214    214   
);
  215    215   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_SHORT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  216    216   
    ::aws_smithy_schema::ShapeId::from_static(
  217    217   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultShort",
  218    218   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  219    219   
        "OperationWithDefaultsOutput",
  220    220   
    ),
  221    221   
    ::aws_smithy_schema::ShapeType::Short,
  222         -
    "default_short",
         222  +
    "defaultShort",
  223    223   
    6,
  224    224   
);
  225    225   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_INTEGER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  226    226   
    ::aws_smithy_schema::ShapeId::from_static(
  227    227   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultInteger",
  228    228   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  229    229   
        "OperationWithDefaultsOutput",
  230    230   
    ),
  231    231   
    ::aws_smithy_schema::ShapeType::Integer,
  232         -
    "default_integer",
         232  +
    "defaultInteger",
  233    233   
    7,
  234    234   
);
  235    235   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_LONG: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  236    236   
    ::aws_smithy_schema::ShapeId::from_static(
  237    237   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultLong",
  238    238   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  239    239   
        "OperationWithDefaultsOutput",
  240    240   
    ),
  241    241   
    ::aws_smithy_schema::ShapeType::Long,
  242         -
    "default_long",
         242  +
    "defaultLong",
  243    243   
    8,
  244    244   
);
  245    245   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_FLOAT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  246    246   
    ::aws_smithy_schema::ShapeId::from_static(
  247    247   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultFloat",
  248    248   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  249    249   
        "OperationWithDefaultsOutput",
  250    250   
    ),
  251    251   
    ::aws_smithy_schema::ShapeType::Float,
  252         -
    "default_float",
         252  +
    "defaultFloat",
  253    253   
    9,
  254    254   
);
  255    255   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_DOUBLE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  256    256   
    ::aws_smithy_schema::ShapeId::from_static(
  257    257   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultDouble",
  258    258   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  259    259   
        "OperationWithDefaultsOutput",
  260    260   
    ),
  261    261   
    ::aws_smithy_schema::ShapeType::Double,
  262         -
    "default_double",
         262  +
    "defaultDouble",
  263    263   
    10,
  264    264   
);
  265    265   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  266    266   
    ::aws_smithy_schema::ShapeId::from_static(
  267    267   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultMap",
  268    268   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  269    269   
        "OperationWithDefaultsOutput",
  270    270   
    ),
  271    271   
    ::aws_smithy_schema::ShapeType::Map,
  272         -
    "default_map",
         272  +
    "defaultMap",
  273    273   
    11,
  274    274   
);
  275    275   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_ENUM: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  276    276   
    ::aws_smithy_schema::ShapeId::from_static(
  277    277   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultEnum",
  278    278   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  279    279   
        "OperationWithDefaultsOutput",
  280    280   
    ),
  281    281   
    ::aws_smithy_schema::ShapeType::String,
  282         -
    "default_enum",
         282  +
    "defaultEnum",
  283    283   
    12,
  284    284   
);
  285    285   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_INT_ENUM: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  286    286   
    ::aws_smithy_schema::ShapeId::from_static(
  287    287   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$defaultIntEnum",
  288    288   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  289    289   
        "OperationWithDefaultsOutput",
  290    290   
    ),
  291    291   
    ::aws_smithy_schema::ShapeType::Integer,
  292         -
    "default_int_enum",
         292  +
    "defaultIntEnum",
  293    293   
    13,
  294    294   
);
  295    295   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_EMPTY_STRING: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  296    296   
    ::aws_smithy_schema::ShapeId::from_static(
  297    297   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$emptyString",
  298    298   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  299    299   
        "OperationWithDefaultsOutput",
  300    300   
    ),
  301    301   
    ::aws_smithy_schema::ShapeType::String,
  302         -
    "empty_string",
         302  +
    "emptyString",
  303    303   
    14,
  304    304   
);
  305    305   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_FALSE_BOOLEAN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  306    306   
    ::aws_smithy_schema::ShapeId::from_static(
  307    307   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$falseBoolean",
  308    308   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  309    309   
        "OperationWithDefaultsOutput",
  310    310   
    ),
  311    311   
    ::aws_smithy_schema::ShapeType::Boolean,
  312         -
    "false_boolean",
         312  +
    "falseBoolean",
  313    313   
    15,
  314    314   
);
  315    315   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_EMPTY_BLOB: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  316    316   
    ::aws_smithy_schema::ShapeId::from_static(
  317    317   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$emptyBlob",
  318    318   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  319    319   
        "OperationWithDefaultsOutput",
  320    320   
    ),
  321    321   
    ::aws_smithy_schema::ShapeType::Blob,
  322         -
    "empty_blob",
         322  +
    "emptyBlob",
  323    323   
    16,
  324    324   
);
  325    325   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_ZERO_BYTE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  326    326   
    ::aws_smithy_schema::ShapeId::from_static(
  327    327   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$zeroByte",
  328    328   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  329    329   
        "OperationWithDefaultsOutput",
  330    330   
    ),
  331    331   
    ::aws_smithy_schema::ShapeType::Byte,
  332         -
    "zero_byte",
         332  +
    "zeroByte",
  333    333   
    17,
  334    334   
);
  335    335   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_ZERO_SHORT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  336    336   
    ::aws_smithy_schema::ShapeId::from_static(
  337    337   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$zeroShort",
  338    338   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  339    339   
        "OperationWithDefaultsOutput",
  340    340   
    ),
  341    341   
    ::aws_smithy_schema::ShapeType::Short,
  342         -
    "zero_short",
         342  +
    "zeroShort",
  343    343   
    18,
  344    344   
);
  345    345   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_ZERO_INTEGER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  346    346   
    ::aws_smithy_schema::ShapeId::from_static(
  347    347   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$zeroInteger",
  348    348   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  349    349   
        "OperationWithDefaultsOutput",
  350    350   
    ),
  351    351   
    ::aws_smithy_schema::ShapeType::Integer,
  352         -
    "zero_integer",
         352  +
    "zeroInteger",
  353    353   
    19,
  354    354   
);
  355    355   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_ZERO_LONG: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  356    356   
    ::aws_smithy_schema::ShapeId::from_static(
  357    357   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$zeroLong",
  358    358   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  359    359   
        "OperationWithDefaultsOutput",
  360    360   
    ),
  361    361   
    ::aws_smithy_schema::ShapeType::Long,
  362         -
    "zero_long",
         362  +
    "zeroLong",
  363    363   
    20,
  364    364   
);
  365    365   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_ZERO_FLOAT: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  366    366   
    ::aws_smithy_schema::ShapeId::from_static(
  367    367   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$zeroFloat",
  368    368   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  369    369   
        "OperationWithDefaultsOutput",
  370    370   
    ),
  371    371   
    ::aws_smithy_schema::ShapeType::Float,
  372         -
    "zero_float",
         372  +
    "zeroFloat",
  373    373   
    21,
  374    374   
);
  375    375   
static OPERATIONWITHDEFAULTSOUTPUT_MEMBER_ZERO_DOUBLE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  376    376   
    ::aws_smithy_schema::ShapeId::from_static(
  377    377   
        "smithy.protocoltests.rpcv2Cbor.synthetic#OperationWithDefaultsOutput$zeroDouble",
  378    378   
        "smithy.protocoltests.rpcv2Cbor.synthetic",
  379    379   
        "OperationWithDefaultsOutput",
  380    380   
    ),
  381    381   
    ::aws_smithy_schema::ShapeType::Double,
  382         -
    "zero_double",
         382  +
    "zeroDouble",
  383    383   
    22,
  384    384   
);
  385    385   
static OPERATIONWITHDEFAULTSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  386    386   
    OPERATIONWITHDEFAULTSOUTPUT_SCHEMA_ID,
  387    387   
    ::aws_smithy_schema::ShapeType::Structure,
  388    388   
    &[
  389    389   
        &OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_STRING,
  390    390   
        &OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_BOOLEAN,
  391    391   
        &OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_LIST,
  392    392   
        &OPERATIONWITHDEFAULTSOUTPUT_MEMBER_DEFAULT_TIMESTAMP,
@@ -510,510 +679,670 @@
  530    530   
        }
  531    531   
        {
  532    532   
            let val = &self.zero_double;
  533    533   
            ser.write_double(&OPERATIONWITHDEFAULTSOUTPUT_MEMBER_ZERO_DOUBLE, *val)?;
  534    534   
        }
  535    535   
        Ok(())
  536    536   
    }
  537    537   
}
  538    538   
impl OperationWithDefaultsOutput {
  539    539   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  540         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  541         -
        deserializer: &mut D,
         540  +
    pub fn deserialize(
         541  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  542    542   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  543    543   
        #[allow(unused_variables, unused_mut)]
  544    544   
        let mut builder = Self::builder();
  545    545   
        #[allow(
  546    546   
            unused_variables,
  547    547   
            unreachable_code,
  548    548   
            clippy::single_match,
  549    549   
            clippy::match_single_binding,
  550    550   
            clippy::diverging_sub_expression
  551    551   
        )]
  552         -
        deserializer.read_struct(&OPERATIONWITHDEFAULTSOUTPUT_SCHEMA, (), |_, member, deser| {
         552  +
        deserializer.read_struct(&OPERATIONWITHDEFAULTSOUTPUT_SCHEMA, &mut |member, deser| {
  553    553   
            match member.member_index() {
  554    554   
                Some(0) => {
  555    555   
                    builder.default_string = Some(deser.read_string(member)?);
  556    556   
                }
  557    557   
                Some(1) => {
  558    558   
                    builder.default_boolean = Some(deser.read_boolean(member)?);
  559    559   
                }
  560    560   
                Some(2) => {
  561         -
                    builder.default_list = Some({
  562         -
                        let container = if let Some(cap) = deser.container_size() {
  563         -
                            Vec::with_capacity(cap)
  564         -
                        } else {
  565         -
                            Vec::new()
  566         -
                        };
  567         -
                        deser.read_list(member, container, |mut list, deser| {
  568         -
                            list.push(deser.read_string(member)?);
  569         -
                            Ok(list)
  570         -
                        })?
  571         -
                    });
         561  +
                    builder.default_list = Some(deser.read_string_list(member)?);
  572    562   
                }
  573    563   
                Some(3) => {
  574    564   
                    builder.default_timestamp = Some(deser.read_timestamp(member)?);
  575    565   
                }
  576    566   
                Some(4) => {
  577    567   
                    builder.default_blob = Some(deser.read_blob(member)?);
  578    568   
                }
  579    569   
                Some(5) => {
  580    570   
                    builder.default_byte = Some(deser.read_byte(member)?);
  581    571   
                }
  582    572   
                Some(6) => {
  583    573   
                    builder.default_short = Some(deser.read_short(member)?);
  584    574   
                }
  585    575   
                Some(7) => {
  586    576   
                    builder.default_integer = Some(deser.read_integer(member)?);
  587    577   
                }
  588    578   
                Some(8) => {
  589    579   
                    builder.default_long = Some(deser.read_long(member)?);
  590    580   
                }
  591    581   
                Some(9) => {
  592    582   
                    builder.default_float = Some(deser.read_float(member)?);
  593    583   
                }
  594    584   
                Some(10) => {
  595    585   
                    builder.default_double = Some(deser.read_double(member)?);
  596    586   
                }
  597    587   
                Some(11) => {
  598         -
                    builder.default_map = Some({
  599         -
                        let container = if let Some(cap) = deser.container_size() {
  600         -
                            std::collections::HashMap::with_capacity(cap)
  601         -
                        } else {
  602         -
                            std::collections::HashMap::new()
  603         -
                        };
  604         -
                        deser.read_map(member, container, |mut map, key, deser| {
  605         -
                            map.insert(key, deser.read_string(member)?);
  606         -
                            Ok(map)
  607         -
                        })?
  608         -
                    });
         588  +
                    builder.default_map = Some(deser.read_string_string_map(member)?);
  609    589   
                }
  610    590   
                Some(12) => {
  611    591   
                    builder.default_enum = Some(crate::types::TestEnum::from(deser.read_string(member)?.as_str()));
  612    592   
                }
  613    593   
                Some(13) => {
  614    594   
                    builder.default_int_enum = Some(deser.read_integer(member)?);
  615    595   
                }
  616    596   
                Some(14) => {
  617    597   
                    builder.empty_string = Some(deser.read_string(member)?);
  618    598   
                }
  619    599   
                Some(15) => {
  620    600   
                    builder.false_boolean = Some(deser.read_boolean(member)?);
  621    601   
                }
  622    602   
                Some(16) => {
  623    603   
                    builder.empty_blob = Some(deser.read_blob(member)?);
  624    604   
                }
  625    605   
                Some(17) => {
  626    606   
                    builder.zero_byte = Some(deser.read_byte(member)?);
  627    607   
                }
  628    608   
                Some(18) => {
  629    609   
                    builder.zero_short = Some(deser.read_short(member)?);
  630    610   
                }
  631    611   
                Some(19) => {
  632    612   
                    builder.zero_integer = Some(deser.read_integer(member)?);
  633    613   
                }
  634    614   
                Some(20) => {
  635    615   
                    builder.zero_long = Some(deser.read_long(member)?);
  636    616   
                }
  637    617   
                Some(21) => {
  638    618   
                    builder.zero_float = Some(deser.read_float(member)?);
  639    619   
                }
  640    620   
                Some(22) => {
  641    621   
                    builder.zero_double = Some(deser.read_double(member)?);
  642    622   
                }
  643    623   
                _ => {}
  644    624   
            }
  645    625   
            Ok(())
  646    626   
        })?;
  647    627   
        Ok(builder.build())
  648    628   
    }
  649    629   
}
         630  +
impl OperationWithDefaultsOutput {
         631  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         632  +
    pub fn deserialize_with_response(
         633  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         634  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         635  +
        _status: u16,
         636  +
        _body: &[u8],
         637  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         638  +
        Self::deserialize(deserializer)
         639  +
    }
         640  +
}
  650    641   
impl OperationWithDefaultsOutput {
  651    642   
    /// Creates a new builder-style object to manufacture [`OperationWithDefaultsOutput`](crate::operation::operation_with_defaults::OperationWithDefaultsOutput).
  652    643   
    pub fn builder() -> crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder {
  653    644   
        crate::operation::operation_with_defaults::builders::OperationWithDefaultsOutputBuilder::default()
  654    645   
    }
  655    646   
}
  656    647   
  657    648   
/// A builder for [`OperationWithDefaultsOutput`](crate::operation::operation_with_defaults::OperationWithDefaultsOutput).
  658    649   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  659    650   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/optional_input_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 `OptionalInputOutput`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct OptionalInputOutput;
    6      6   
impl OptionalInputOutput {
    7      7   
    /// Creates a new `OptionalInputOutput`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::optional_input_output::OptionalInputOutputInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::optional_input_output::OptionalInputOutputOutput::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::optional_input_output::OptionalInputOutputInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::optional_input_output::OptionalInputOutputOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::optional_input_output::OptionalInputOutputError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +166,171 @@
  124    128   
                crate::operation::optional_input_output::OptionalInputOutputError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct OptionalInputOutputResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OptionalInputOutputResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139    144   
        let headers = response.headers();
  140    145   
        let body = response.body().bytes().expect("body loaded");
  141    146   
        #[allow(unused_mut)]
  142    147   
        let mut force_error = false;
  143    148   
  144    149   
        let parse_result = if !success && status != 200 || force_error {
  145    150   
            crate::protocol_serde::shape_optional_input_output::de_optional_input_output_http_error(status, headers, body)
  146    151   
        } else {
@@ -285,290 +345,354 @@
  305    310   
            .expect("the config must have a deserializer");
  306    311   
  307    312   
        let parsed = de.deserialize_streaming(&mut http_response);
  308    313   
        let parsed = parsed.unwrap_or_else(|| {
  309    314   
            let http_response = http_response.map(|body| {
  310    315   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  311    316   
                    body.bytes().unwrap(),
  312    317   
                    ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  313    318   
                )))
  314    319   
            });
  315         -
            de.deserialize_nonstreaming(&http_response)
         320  +
            // Build a config bag with the protocol for schema-based deserialization
         321  +
            #[allow(unused_mut)]
         322  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         323  +
         324  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  316    325   
        });
  317    326   
        let parsed = parsed
  318    327   
            .expect("should be successful response")
  319    328   
            .downcast::<crate::operation::optional_input_output::OptionalInputOutputOutput>()
  320    329   
            .unwrap();
  321    330   
        ::pretty_assertions::assert_eq!(parsed.value, expected_output.value, "Unexpected value for `value`");
  322    331   
    }
  323    332   
}
  324    333   
  325    334   
/// Error type for the `OptionalInputOutputError` operation.