Client Test

Client Test

rev. 32b1b3c3761061baed26023be3219639e42d7d12

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/primitive_int_header/_primitive_int_header_input.rs

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

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/primitive_int_header/_primitive_int_header_output.rs

@@ -25,25 +108,126 @@
   45     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   46     46   
        {
   47     47   
            let val = &self.field;
   48     48   
            ser.write_integer(&PRIMITIVEINTHEADEROUTPUT_MEMBER_FIELD, *val)?;
   49     49   
        }
   50     50   
        Ok(())
   51     51   
    }
   52     52   
}
   53     53   
impl PrimitiveIntHeaderOutput {
   54     54   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   55         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   56         -
        deserializer: &mut D,
          55  +
    pub fn deserialize(
          56  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   57     57   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   58     58   
        #[allow(unused_variables, unused_mut)]
   59     59   
        let mut builder = Self::builder();
   60     60   
        #[allow(
   61     61   
            unused_variables,
   62     62   
            unreachable_code,
   63     63   
            clippy::single_match,
   64     64   
            clippy::match_single_binding,
   65     65   
            clippy::diverging_sub_expression
   66     66   
        )]
   67         -
        deserializer.read_struct(&PRIMITIVEINTHEADEROUTPUT_SCHEMA, (), |_, member, deser| {
          67  +
        deserializer.read_struct(&PRIMITIVEINTHEADEROUTPUT_SCHEMA, &mut |member, deser| {
   68     68   
            match member.member_index() {
   69     69   
                Some(0) => {
   70     70   
                    builder.field = Some(deser.read_integer(member)?);
   71     71   
                }
   72     72   
                _ => {}
   73     73   
            }
   74     74   
            Ok(())
   75     75   
        })?;
   76     76   
        Ok(builder.build())
   77     77   
    }
   78     78   
}
          79  +
impl PrimitiveIntHeaderOutput {
          80  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
          81  +
    /// Header-bound members are read directly from headers, avoiding runtime
          82  +
    /// member iteration overhead. Body members are read via the deserializer.
          83  +
    pub fn deserialize_with_response(
          84  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          85  +
        headers: &::aws_smithy_runtime_api::http::Headers,
          86  +
        _status: u16,
          87  +
        _body: &[u8],
          88  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          89  +
        #[allow(unused_variables, unused_mut)]
          90  +
        let mut builder = Self::builder();
          91  +
        if let Some(val) = headers.get("x-field") {
          92  +
            builder.field = val.parse::<i32>().ok();
          93  +
        }
          94  +
        Ok(builder.build())
          95  +
    }
          96  +
}
   79     97   
impl PrimitiveIntHeaderOutput {
   80     98   
    /// Creates a new builder-style object to manufacture [`PrimitiveIntHeaderOutput`](crate::operation::primitive_int_header::PrimitiveIntHeaderOutput).
   81     99   
    pub fn builder() -> crate::operation::primitive_int_header::builders::PrimitiveIntHeaderOutputBuilder {
   82    100   
        crate::operation::primitive_int_header::builders::PrimitiveIntHeaderOutputBuilder::default()
   83    101   
    }
   84    102   
}
   85    103   
   86    104   
/// A builder for [`PrimitiveIntHeaderOutput`](crate::operation::primitive_int_header::PrimitiveIntHeaderOutput).
   87    105   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   88    106   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/primitive_int_op.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 `PrimitiveIntOp`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct PrimitiveIntOp;
    6      6   
impl PrimitiveIntOp {
    7      7   
    /// Creates a new `PrimitiveIntOp`
    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::primitive_int_op::PrimitiveIntOpInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::primitive_int_op::PrimitiveIntOpOutput::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::primitive_int_op::PrimitiveIntOpInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::primitive_int_op::PrimitiveIntOpOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::primitive_int_op::PrimitiveIntOpError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +226,272 @@
  124    128   
                crate::operation::primitive_int_op::PrimitiveIntOpError,
  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 PrimitiveIntOpResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PrimitiveIntOpResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139         -
        let headers = response.headers();
  140         -
        let body = response.body().bytes().expect("body loaded");
  141    144   
        #[allow(unused_mut)]
  142    145   
        let mut force_error = false;
  143    146   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_primitive_int_op::de_primitive_int_op_http_error(status, headers, body)
         147  +
        if !success && status != 200 || force_error {
         148  +
            let headers = response.headers();
         149  +
            let body = response.body().bytes().expect("body loaded");
         150  +
            #[allow(unused_mut)]
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
         154  +
         155  +
            let generic = generic_builder.build();
         156  +
            let error_code = match generic.code() {
         157  +
                ::std::option::Option::Some(code) => code,
         158  +
                ::std::option::Option::None => {
         159  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         160  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::primitive_int_op::PrimitiveIntOpError::unhandled(
         161  +
                            generic,
         162  +
                        )),
         163  +
                    ))
         164  +
                }
         165  +
            };
         166  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         167  +
            let protocol = _cfg
         168  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         169  +
                .expect("a SharedClientProtocol is required");
         170  +
            let err = match error_code {
         171  +
                "ExtraError" => crate::operation::primitive_int_op::PrimitiveIntOpError::ExtraError({
         172  +
                    let mut tmp = match protocol
         173  +
                        .deserialize_response(response, crate::types::error::ExtraError::SCHEMA, _cfg)
         174  +
                        .and_then(|mut deser| {
         175  +
                            crate::types::error::ExtraError::deserialize_with_response(
         176  +
                                &mut *deser,
         177  +
                                response.headers(),
         178  +
                                response.status().into(),
         179  +
                                body,
         180  +
                            )
         181  +
                        }) {
         182  +
                        ::std::result::Result::Ok(val) => val,
         183  +
                        ::std::result::Result::Err(e) => {
         184  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         185  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         186  +
                            ))
         187  +
                        }
         188  +
                    };
         189  +
                    tmp.meta = generic;
         190  +
                    if tmp.message.is_none() {
         191  +
                        tmp.message = _error_message;
         192  +
                    }
         193  +
                    tmp
         194  +
                }),
         195  +
                _ => crate::operation::primitive_int_op::PrimitiveIntOpError::generic(generic),
         196  +
            };
         197  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         198  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         199  +
            ))
  146    200   
        } else {
  147         -
            crate::protocol_serde::shape_primitive_int_op::de_primitive_int_op_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         201  +
            let protocol = _cfg
         202  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         203  +
                .expect("a SharedClientProtocol is required");
         204  +
            let mut deser = protocol
         205  +
                .deserialize_response(response, PrimitiveIntOp::OUTPUT_SCHEMA, _cfg)
         206  +
                .map_err(|e| {
         207  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         208  +
                })?;
         209  +
            let body = response.body().bytes().expect("body loaded");
         210  +
            let output = crate::operation::primitive_int_op::PrimitiveIntOpOutput::deserialize_with_response(
         211  +
                &mut *deser,
         212  +
                response.headers(),
         213  +
                response.status().into(),
         214  +
                body,
         215  +
            )
         216  +
            .map_err(|e| {
         217  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         218  +
            })?;
         219  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         220  +
        }
  150    221   
    }
  151    222   
}
  152    223   
#[derive(Debug)]
  153    224   
struct PrimitiveIntOpRequestSerializer;
  154    225   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PrimitiveIntOpRequestSerializer {
  155    226   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    227   
    fn serialize_input(
  157    228   
        &self,
  158    229   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    230   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    231   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    232   
        let input = input
  162    233   
            .downcast::<crate::operation::primitive_int_op::PrimitiveIntOpInput>()
  163    234   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::primitive_int_op::PrimitiveIntOpInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/primitive-document").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::primitive_int_op::PrimitiveIntOpInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  189         -
            builder
  190         -
        };
  191         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_primitive_int_op::ser_primitive_int_op_input(&input)?);
  192         -
        if let Some(content_length) = body.content_length() {
  193         -
            let content_length = content_length.to_string();
  194         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  195         -
        }
  196         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         235  +
        let protocol = _cfg
         236  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         237  +
            .expect("a SharedClientProtocol is required");
         238  +
        let mut request = protocol
         239  +
            .serialize_request(&input, PrimitiveIntOp::INPUT_SCHEMA, "", _cfg)
         240  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         241  +
         242  +
        return ::std::result::Result::Ok(request);
  197    243   
    }
  198    244   
}
  199    245   
#[derive(Debug)]
  200    246   
struct PrimitiveIntOpEndpointParamsInterceptor;
  201    247   
  202    248   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PrimitiveIntOpEndpointParamsInterceptor {
  203    249   
    fn name(&self) -> &'static str {
  204    250   
        "PrimitiveIntOpEndpointParamsInterceptor"
  205    251   
    }
  206    252   
@@ -269,315 +329,385 @@
  289    335   
            .expect("the config must have a deserializer");
  290    336   
  291    337   
        let parsed = de.deserialize_streaming(&mut http_response);
  292    338   
        let parsed = parsed.unwrap_or_else(|| {
  293    339   
            let http_response = http_response.map(|body| {
  294    340   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  295    341   
                    body.bytes().unwrap(),
  296    342   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  297    343   
                )))
  298    344   
            });
  299         -
            de.deserialize_nonstreaming(&http_response)
         345  +
            // Build a config bag with the protocol for schema-based deserialization
         346  +
            #[allow(unused_mut)]
         347  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         348  +
            {
         349  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         350  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         351  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         352  +
                ));
         353  +
                test_cfg.push_shared_layer(layer.freeze());
         354  +
            }
         355  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  300    356   
        });
  301    357   
        let parsed = parsed.expect_err("should be error response");
  302    358   
        let parsed: &crate::operation::primitive_int_op::PrimitiveIntOpError =
  303    359   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  304    360   
        if let crate::operation::primitive_int_op::PrimitiveIntOpError::ExtraError(parsed) = parsed {
  305    361   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  306    362   
        } else {
  307    363   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  308    364   
        }
  309    365   
    }

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/primitive_int_op/_primitive_int_op_input.rs

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

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/primitive_int_op/_primitive_int_op_output.rs

@@ -24,24 +107,118 @@
   44     44   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     45   
        {
   46     46   
            let val = &self.value;
   47     47   
            ser.write_integer(&PRIMITIVEINTOPOUTPUT_MEMBER_VALUE, *val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl PrimitiveIntOpOutput {
   53     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   54         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   55         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   56     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   57     57   
        #[allow(unused_variables, unused_mut)]
   58     58   
        let mut builder = Self::builder();
   59     59   
        #[allow(
   60     60   
            unused_variables,
   61     61   
            unreachable_code,
   62     62   
            clippy::single_match,
   63     63   
            clippy::match_single_binding,
   64     64   
            clippy::diverging_sub_expression
   65     65   
        )]
   66         -
        deserializer.read_struct(&PRIMITIVEINTOPOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&PRIMITIVEINTOPOUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69     69   
                    builder.value = Some(deser.read_integer(member)?);
   70     70   
                }
   71     71   
                _ => {}
   72     72   
            }
   73     73   
            Ok(())
   74     74   
        })?;
   75     75   
        Ok(builder.build())
   76     76   
    }
   77     77   
}
          78  +
impl PrimitiveIntOpOutput {
          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  +
}
   78     89   
impl PrimitiveIntOpOutput {
   79     90   
    /// Creates a new builder-style object to manufacture [`PrimitiveIntOpOutput`](crate::operation::primitive_int_op::PrimitiveIntOpOutput).
   80     91   
    pub fn builder() -> crate::operation::primitive_int_op::builders::PrimitiveIntOpOutputBuilder {
   81     92   
        crate::operation::primitive_int_op::builders::PrimitiveIntOpOutputBuilder::default()
   82     93   
    }
   83     94   
}
   84     95   
   85     96   
/// A builder for [`PrimitiveIntOpOutput`](crate::operation::primitive_int_op::PrimitiveIntOpOutput).
   86     97   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   87     98   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/query_precedence.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 `QueryPrecedence`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct QueryPrecedence;
    6      6   
impl QueryPrecedence {
    7      7   
    /// Creates a new `QueryPrecedence`
    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::query_precedence::QueryPrecedenceInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::query_precedence::QueryPrecedenceOutput::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::query_precedence::QueryPrecedenceInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::query_precedence::QueryPrecedenceOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::query_precedence::QueryPrecedenceError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +251,316 @@
  130    134   
                crate::operation::query_precedence::QueryPrecedenceError,
  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 QueryPrecedenceResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for QueryPrecedenceResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    150   
        #[allow(unused_mut)]
  148    151   
        let mut force_error = false;
  149    152   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_query_precedence::de_query_precedence_http_error(status, headers, body)
         153  +
        if !success && status != 200 || force_error {
         154  +
            let headers = response.headers();
         155  +
            let body = response.body().bytes().expect("body loaded");
         156  +
            #[allow(unused_mut)]
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
         160  +
         161  +
            let generic = generic_builder.build();
         162  +
            let error_code = match generic.code() {
         163  +
                ::std::option::Option::Some(code) => code,
         164  +
                ::std::option::Option::None => {
         165  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         166  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::query_precedence::QueryPrecedenceError::unhandled(
         167  +
                            generic,
         168  +
                        )),
         169  +
                    ))
         170  +
                }
         171  +
            };
         172  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         173  +
            let protocol = _cfg
         174  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         175  +
                .expect("a SharedClientProtocol is required");
         176  +
            let err = match error_code {
         177  +
                "ExtraError" => crate::operation::query_precedence::QueryPrecedenceError::ExtraError({
         178  +
                    let mut tmp = match protocol
         179  +
                        .deserialize_response(response, crate::types::error::ExtraError::SCHEMA, _cfg)
         180  +
                        .and_then(|mut deser| {
         181  +
                            crate::types::error::ExtraError::deserialize_with_response(
         182  +
                                &mut *deser,
         183  +
                                response.headers(),
         184  +
                                response.status().into(),
         185  +
                                body,
         186  +
                            )
         187  +
                        }) {
         188  +
                        ::std::result::Result::Ok(val) => val,
         189  +
                        ::std::result::Result::Err(e) => {
         190  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         191  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         192  +
                            ))
         193  +
                        }
         194  +
                    };
         195  +
                    tmp.meta = generic;
         196  +
                    if tmp.message.is_none() {
         197  +
                        tmp.message = _error_message;
         198  +
                    }
         199  +
                    tmp
         200  +
                }),
         201  +
                _ => crate::operation::query_precedence::QueryPrecedenceError::generic(generic),
         202  +
            };
         203  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         204  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         205  +
            ))
  152    206   
        } else {
  153         -
            crate::protocol_serde::shape_query_precedence::de_query_precedence_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         207  +
            let protocol = _cfg
         208  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         209  +
                .expect("a SharedClientProtocol is required");
         210  +
            let mut deser = protocol
         211  +
                .deserialize_response(response, QueryPrecedence::OUTPUT_SCHEMA, _cfg)
         212  +
                .map_err(|e| {
         213  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         214  +
                })?;
         215  +
            let body = response.body().bytes().expect("body loaded");
         216  +
            let output = crate::operation::query_precedence::QueryPrecedenceOutput::deserialize_with_response(
         217  +
                &mut *deser,
         218  +
                response.headers(),
         219  +
                response.status().into(),
         220  +
                body,
         221  +
            )
         222  +
            .map_err(|e| {
         223  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         224  +
            })?;
         225  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         226  +
        }
  156    227   
    }
  157    228   
}
  158    229   
#[derive(Debug)]
  159    230   
struct QueryPrecedenceRequestSerializer;
  160    231   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for QueryPrecedenceRequestSerializer {
  161    232   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    233   
    fn serialize_input(
  163    234   
        &self,
  164    235   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    236   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    237   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    238   
        let input = input
  168    239   
            .downcast::<crate::operation::query_precedence::QueryPrecedenceInput>()
  169    240   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::query_precedence::QueryPrecedenceInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/Precedence").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            fn uri_query(
  185         -
                _input: &crate::operation::query_precedence::QueryPrecedenceInput,
  186         -
                mut output: &mut ::std::string::String,
  187         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  188         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  189         -
                let protected_params = ["bar"];
  190         -
                if let ::std::option::Option::Some(inner_1) = &_input.baz {
  191         -
                    {
  192         -
                        for (k, v) in inner_1 {
  193         -
                            if !protected_params.contains(&k.as_str()) {
  194         -
                                query.push_kv(&::aws_smithy_http::query::fmt_string(k), &::aws_smithy_http::query::fmt_string(v));
  195         -
                            }
         241  +
        let protocol = _cfg
         242  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         243  +
            .expect("a SharedClientProtocol is required");
         244  +
        if protocol.supports_http_bindings() {
         245  +
            let mut request = protocol
         246  +
                .serialize_body(&input, QueryPrecedence::INPUT_SCHEMA, "", _cfg)
         247  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         248  +
            {
         249  +
                let mut uri = "/Precedence".to_string();
         250  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         251  +
                if let Some(ref val) = input.foo {
         252  +
                    query_params.push(("bar".to_string(), val.to_string()));
         253  +
                }
         254  +
                if let Some(ref map) = input.baz {
         255  +
                    for (k, v) in map {
         256  +
                        if matches!(k.as_str(), "bar") {
         257  +
                            continue;
  196    258   
                        }
         259  +
                        query_params.push((k.clone(), v.clone()));
  197    260   
                    }
  198    261   
                }
  199         -
                if let ::std::option::Option::Some(inner_2) = &_input.foo {
  200         -
                    {
  201         -
                        query.push_kv("bar", &::aws_smithy_http::query::fmt_string(inner_2));
  202         -
                    }
         262  +
                if !query_params.is_empty() {
         263  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         264  +
                    let pairs: Vec<String> = query_params
         265  +
                        .iter()
         266  +
                        .map(|(k, v)| {
         267  +
                            format!(
         268  +
                                "{}={}",
         269  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         270  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         271  +
                            )
         272  +
                        })
         273  +
                        .collect();
         274  +
                    uri.push_str(&pairs.join("&"));
  203    275   
                }
  204         -
                ::std::result::Result::Ok(())
  205         -
            }
  206         -
            #[allow(clippy::unnecessary_wraps)]
  207         -
            fn update_http_builder(
  208         -
                input: &crate::operation::query_precedence::QueryPrecedenceInput,
  209         -
                builder: ::http_1x::request::Builder,
  210         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  211         -
                let mut uri = ::std::string::String::new();
  212         -
                uri_base(input, &mut uri)?;
  213         -
                uri_query(input, &mut uri)?;
  214         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         276  +
                request.set_uri(uri.as_str()).expect("valid URI");
  215    277   
            }
  216         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  217         -
            builder
  218         -
        };
  219         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  220    278   
  221         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         279  +
            return ::std::result::Result::Ok(request);
         280  +
        } else {
         281  +
            let mut request = protocol
         282  +
                .serialize_request(&input, QueryPrecedence::INPUT_SCHEMA, "", _cfg)
         283  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         284  +
         285  +
            return ::std::result::Result::Ok(request);
         286  +
        }
  222    287   
    }
  223    288   
}
  224    289   
#[derive(Debug)]
  225    290   
struct QueryPrecedenceEndpointParamsInterceptor;
  226    291   
  227    292   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for QueryPrecedenceEndpointParamsInterceptor {
  228    293   
    fn name(&self) -> &'static str {
  229    294   
        "QueryPrecedenceEndpointParamsInterceptor"
  230    295   
    }
  231    296   
@@ -381,446 +441,516 @@
  401    466   
            .expect("the config must have a deserializer");
  402    467   
  403    468   
        let parsed = de.deserialize_streaming(&mut http_response);
  404    469   
        let parsed = parsed.unwrap_or_else(|| {
  405    470   
            let http_response = http_response.map(|body| {
  406    471   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  407    472   
                    body.bytes().unwrap(),
  408    473   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  409    474   
                )))
  410    475   
            });
  411         -
            de.deserialize_nonstreaming(&http_response)
         476  +
            // Build a config bag with the protocol for schema-based deserialization
         477  +
            #[allow(unused_mut)]
         478  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         479  +
            {
         480  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         481  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         482  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         483  +
                ));
         484  +
                test_cfg.push_shared_layer(layer.freeze());
         485  +
            }
         486  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  412    487   
        });
  413    488   
        let parsed = parsed.expect_err("should be error response");
  414    489   
        let parsed: &crate::operation::query_precedence::QueryPrecedenceError =
  415    490   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  416    491   
        if let crate::operation::query_precedence::QueryPrecedenceError::ExtraError(parsed) = parsed {
  417    492   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  418    493   
        } else {
  419    494   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  420    495   
        }
  421    496   
    }

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/query_precedence/_query_precedence_input.rs

@@ -22,22 +151,153 @@
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::Map,
   44     44   
    "baz",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_query_params();
   48     48   
static QUERYPRECEDENCEINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    QUERYPRECEDENCEINPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[&QUERYPRECEDENCEINPUT_MEMBER_FOO, &QUERYPRECEDENCEINPUT_MEMBER_BAZ],
   52         -
);
          52  +
)
          53  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/Precedence", None));
   53     54   
impl QueryPrecedenceInput {
   54     55   
    /// The schema for this shape.
   55     56   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &QUERYPRECEDENCEINPUT_SCHEMA;
   56     57   
}
   57     58   
impl ::aws_smithy_schema::serde::SerializableStruct for QueryPrecedenceInput {
   58     59   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   59     60   
    fn serialize_members(
   60     61   
        &self,
   61     62   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   62     63   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   63     64   
        if let Some(ref val) = self.foo {
   64     65   
            ser.write_string(&QUERYPRECEDENCEINPUT_MEMBER_FOO, val)?;
   65     66   
        }
   66     67   
        if let Some(ref val) = self.baz {
   67     68   
            ser.write_map(
   68     69   
                &QUERYPRECEDENCEINPUT_MEMBER_BAZ,
   69     70   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   70     71   
                    for (key, value) in val {
   71     72   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
   72     73   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
   73     74   
                    }
   74     75   
                    Ok(())
   75     76   
                },
   76     77   
            )?;
   77     78   
        }
   78     79   
        Ok(())
   79     80   
    }
   80     81   
}
   81     82   
impl QueryPrecedenceInput {
   82     83   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   83         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   84         -
        deserializer: &mut D,
          84  +
    pub fn deserialize(
          85  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   85     86   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   86     87   
        #[allow(unused_variables, unused_mut)]
   87     88   
        let mut builder = Self::builder();
   88     89   
        #[allow(
   89     90   
            unused_variables,
   90     91   
            unreachable_code,
   91     92   
            clippy::single_match,
   92     93   
            clippy::match_single_binding,
   93     94   
            clippy::diverging_sub_expression
   94     95   
        )]
   95         -
        deserializer.read_struct(&QUERYPRECEDENCEINPUT_SCHEMA, (), |_, member, deser| {
          96  +
        deserializer.read_struct(&QUERYPRECEDENCEINPUT_SCHEMA, &mut |member, deser| {
   96     97   
            match member.member_index() {
   97     98   
                Some(0) => {
   98     99   
                    builder.foo = Some(deser.read_string(member)?);
   99    100   
                }
  100    101   
                Some(1) => {
  101         -
                    builder.baz = Some({
  102         -
                        let container = if let Some(cap) = deser.container_size() {
  103         -
                            std::collections::HashMap::with_capacity(cap)
  104         -
                        } else {
  105         -
                            std::collections::HashMap::new()
  106         -
                        };
  107         -
                        deser.read_map(member, container, |mut map, key, deser| {
  108         -
                            map.insert(key, deser.read_string(member)?);
  109         -
                            Ok(map)
  110         -
                        })?
  111         -
                    });
         102  +
                    builder.baz = Some(deser.read_string_string_map(member)?);
  112    103   
                }
  113    104   
                _ => {}
  114    105   
            }
  115    106   
            Ok(())
  116    107   
        })?;
  117    108   
        builder
  118    109   
            .build()
  119    110   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  120    111   
    }
  121    112   
}
         113  +
impl QueryPrecedenceInput {
         114  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         115  +
    pub fn deserialize_with_response(
         116  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         117  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         118  +
        _status: u16,
         119  +
        _body: &[u8],
         120  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         121  +
        Self::deserialize(deserializer)
         122  +
    }
         123  +
}
  122    124   
impl QueryPrecedenceInput {
  123    125   
    /// Creates a new builder-style object to manufacture [`QueryPrecedenceInput`](crate::operation::query_precedence::QueryPrecedenceInput).
  124    126   
    pub fn builder() -> crate::operation::query_precedence::builders::QueryPrecedenceInputBuilder {
  125    127   
        crate::operation::query_precedence::builders::QueryPrecedenceInputBuilder::default()
  126    128   
    }
  127    129   
}
  128    130   
  129    131   
/// A builder for [`QueryPrecedenceInput`](crate::operation::query_precedence::QueryPrecedenceInput).
  130    132   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  131    133   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/query_precedence/_query_precedence_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 QueryPrecedenceOutput {
   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(&QUERYPRECEDENCEOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&QUERYPRECEDENCEOUTPUT_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 QueryPrecedenceOutput {
          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 QueryPrecedenceOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`QueryPrecedenceOutput`](crate::operation::query_precedence::QueryPrecedenceOutput).
   51     62   
    pub fn builder() -> crate::operation::query_precedence::builders::QueryPrecedenceOutputBuilder {
   52     63   
        crate::operation::query_precedence::builders::QueryPrecedenceOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`QueryPrecedenceOutput`](crate::operation::query_precedence::QueryPrecedenceOutput).
   57     68   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   58     69   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/status_response.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 `StatusResponse`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct StatusResponse;
    6      6   
impl StatusResponse {
    7      7   
    /// Creates a new `StatusResponse`
    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::status_response::StatusResponseInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::status_response::StatusResponseOutput::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::status_response::StatusResponseInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::status_response::StatusResponseOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::status_response::StatusResponseError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +222,272 @@
  124    128   
                crate::operation::status_response::StatusResponseError,
  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 StatusResponseResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StatusResponseResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139         -
        let headers = response.headers();
  140         -
        let body = response.body().bytes().expect("body loaded");
  141    144   
        #[allow(unused_mut)]
  142    145   
        let mut force_error = false;
  143    146   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_status_response::de_status_response_http_error(status, headers, body)
         147  +
        if !success && status != 200 || force_error {
         148  +
            let headers = response.headers();
         149  +
            let body = response.body().bytes().expect("body loaded");
         150  +
            #[allow(unused_mut)]
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
         154  +
         155  +
            let generic = generic_builder.build();
         156  +
            let error_code = match generic.code() {
         157  +
                ::std::option::Option::Some(code) => code,
         158  +
                ::std::option::Option::None => {
         159  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         160  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::status_response::StatusResponseError::unhandled(
         161  +
                            generic,
         162  +
                        )),
         163  +
                    ))
         164  +
                }
         165  +
            };
         166  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         167  +
            let protocol = _cfg
         168  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         169  +
                .expect("a SharedClientProtocol is required");
         170  +
            let err = match error_code {
         171  +
                "ExtraError" => crate::operation::status_response::StatusResponseError::ExtraError({
         172  +
                    let mut tmp = match protocol
         173  +
                        .deserialize_response(response, crate::types::error::ExtraError::SCHEMA, _cfg)
         174  +
                        .and_then(|mut deser| {
         175  +
                            crate::types::error::ExtraError::deserialize_with_response(
         176  +
                                &mut *deser,
         177  +
                                response.headers(),
         178  +
                                response.status().into(),
         179  +
                                body,
         180  +
                            )
         181  +
                        }) {
         182  +
                        ::std::result::Result::Ok(val) => val,
         183  +
                        ::std::result::Result::Err(e) => {
         184  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         185  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         186  +
                            ))
         187  +
                        }
         188  +
                    };
         189  +
                    tmp.meta = generic;
         190  +
                    if tmp.message.is_none() {
         191  +
                        tmp.message = _error_message;
         192  +
                    }
         193  +
                    tmp
         194  +
                }),
         195  +
                _ => crate::operation::status_response::StatusResponseError::generic(generic),
         196  +
            };
         197  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         198  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         199  +
            ))
  146    200   
        } else {
  147         -
            crate::protocol_serde::shape_status_response::de_status_response_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         201  +
            let protocol = _cfg
         202  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         203  +
                .expect("a SharedClientProtocol is required");
         204  +
            let mut deser = protocol
         205  +
                .deserialize_response(response, StatusResponse::OUTPUT_SCHEMA, _cfg)
         206  +
                .map_err(|e| {
         207  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         208  +
                })?;
         209  +
            let body = response.body().bytes().expect("body loaded");
         210  +
            let output = crate::operation::status_response::StatusResponseOutput::deserialize_with_response(
         211  +
                &mut *deser,
         212  +
                response.headers(),
         213  +
                response.status().into(),
         214  +
                body,
         215  +
            )
         216  +
            .map_err(|e| {
         217  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         218  +
            })?;
         219  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         220  +
        }
  150    221   
    }
  151    222   
}
  152    223   
#[derive(Debug)]
  153    224   
struct StatusResponseRequestSerializer;
  154    225   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StatusResponseRequestSerializer {
  155    226   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    227   
    fn serialize_input(
  157    228   
        &self,
  158    229   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    230   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    231   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    232   
        let input = input
  162    233   
            .downcast::<crate::operation::status_response::StatusResponseInput>()
  163    234   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::status_response::StatusResponseInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::status_response::StatusResponseInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder
  189         -
        };
  190         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
         235  +
        let protocol = _cfg
         236  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         237  +
            .expect("a SharedClientProtocol is required");
         238  +
        let mut request = protocol
         239  +
            .serialize_request(&input, StatusResponse::INPUT_SCHEMA, "", _cfg)
         240  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  191    241   
  192         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         242  +
        return ::std::result::Result::Ok(request);
  193    243   
    }
  194    244   
}
  195    245   
#[derive(Debug)]
  196    246   
struct StatusResponseEndpointParamsInterceptor;
  197    247   
  198    248   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StatusResponseEndpointParamsInterceptor {
  199    249   
    fn name(&self) -> &'static str {
  200    250   
        "StatusResponseEndpointParamsInterceptor"
  201    251   
    }
  202    252   
@@ -235,285 +295,355 @@
  255    305   
            .expect("the config must have a deserializer");
  256    306   
  257    307   
        let parsed = de.deserialize_streaming(&mut http_response);
  258    308   
        let parsed = parsed.unwrap_or_else(|| {
  259    309   
            let http_response = http_response.map(|body| {
  260    310   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  261    311   
                    body.bytes().unwrap(),
  262    312   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  263    313   
                )))
  264    314   
            });
  265         -
            de.deserialize_nonstreaming(&http_response)
         315  +
            // Build a config bag with the protocol for schema-based deserialization
         316  +
            #[allow(unused_mut)]
         317  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         318  +
            {
         319  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         320  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         321  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         322  +
                ));
         323  +
                test_cfg.push_shared_layer(layer.freeze());
         324  +
            }
         325  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  266    326   
        });
  267    327   
        let parsed = parsed.expect_err("should be error response");
  268    328   
        let parsed: &crate::operation::status_response::StatusResponseError =
  269    329   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  270    330   
        if let crate::operation::status_response::StatusResponseError::ExtraError(parsed) = parsed {
  271    331   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  272    332   
        } else {
  273    333   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  274    334   
        }
  275    335   
    }

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/status_response/_status_response_input.rs

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

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/status_response/_status_response_output.rs

@@ -25,25 +108,124 @@
   45     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   46     46   
        {
   47     47   
            let val = &self.field;
   48     48   
            ser.write_integer(&STATUSRESPONSEOUTPUT_MEMBER_FIELD, *val)?;
   49     49   
        }
   50     50   
        Ok(())
   51     51   
    }
   52     52   
}
   53     53   
impl StatusResponseOutput {
   54     54   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   55         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   56         -
        deserializer: &mut D,
          55  +
    pub fn deserialize(
          56  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   57     57   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   58     58   
        #[allow(unused_variables, unused_mut)]
   59     59   
        let mut builder = Self::builder();
   60     60   
        #[allow(
   61     61   
            unused_variables,
   62     62   
            unreachable_code,
   63     63   
            clippy::single_match,
   64     64   
            clippy::match_single_binding,
   65     65   
            clippy::diverging_sub_expression
   66     66   
        )]
   67         -
        deserializer.read_struct(&STATUSRESPONSEOUTPUT_SCHEMA, (), |_, member, deser| {
          67  +
        deserializer.read_struct(&STATUSRESPONSEOUTPUT_SCHEMA, &mut |member, deser| {
   68     68   
            match member.member_index() {
   69     69   
                Some(0) => {
   70     70   
                    builder.field = Some(deser.read_integer(member)?);
   71     71   
                }
   72     72   
                _ => {}
   73     73   
            }
   74     74   
            Ok(())
   75     75   
        })?;
   76     76   
        Ok(builder.build())
   77     77   
    }
   78     78   
}
          79  +
impl StatusResponseOutput {
          80  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
          81  +
    /// Header-bound members are read directly from headers, avoiding runtime
          82  +
    /// member iteration overhead. Body members are read via the deserializer.
          83  +
    pub fn deserialize_with_response(
          84  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          85  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          86  +
        _status: u16,
          87  +
        _body: &[u8],
          88  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          89  +
        #[allow(unused_variables, unused_mut)]
          90  +
        let mut builder = Self::builder();
          91  +
        builder.field = Some(_status as i32);
          92  +
        Ok(builder.build())
          93  +
    }
          94  +
}
   79     95   
impl StatusResponseOutput {
   80     96   
    /// Creates a new builder-style object to manufacture [`StatusResponseOutput`](crate::operation::status_response::StatusResponseOutput).
   81     97   
    pub fn builder() -> crate::operation::status_response::builders::StatusResponseOutputBuilder {
   82     98   
        crate::operation::status_response::builders::StatusResponseOutputBuilder::default()
   83     99   
    }
   84    100   
}
   85    101   
   86    102   
/// A builder for [`StatusResponseOutput`](crate::operation::status_response::StatusResponseOutput).
   87    103   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   88    104   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/string_payload.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 `StringPayload`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct StringPayload;
    6      6   
impl StringPayload {
    7      7   
    /// Creates a new `StringPayload`
    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::string_payload::StringPayloadInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::string_payload::StringPayloadOutput::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::string_payload::StringPayloadInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::string_payload::StringPayloadOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::string_payload::StringPayloadError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +228,277 @@
  124    128   
                crate::operation::string_payload::StringPayloadError,
  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 StringPayloadResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StringPayloadResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139         -
        let headers = response.headers();
  140         -
        let body = response.body().bytes().expect("body loaded");
  141    144   
        #[allow(unused_mut)]
  142    145   
        let mut force_error = false;
  143    146   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_string_payload::de_string_payload_http_error(status, headers, body)
         147  +
        if !success && status != 200 || force_error {
         148  +
            let headers = response.headers();
         149  +
            let body = response.body().bytes().expect("body loaded");
         150  +
            #[allow(unused_mut)]
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
         154  +
         155  +
            let generic = generic_builder.build();
         156  +
            let error_code = match generic.code() {
         157  +
                ::std::option::Option::Some(code) => code,
         158  +
                ::std::option::Option::None => {
         159  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         160  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::string_payload::StringPayloadError::unhandled(generic)),
         161  +
                    ))
         162  +
                }
         163  +
            };
         164  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         165  +
            let protocol = _cfg
         166  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         167  +
                .expect("a SharedClientProtocol is required");
         168  +
            let err = match error_code {
         169  +
                "ExtraError" => crate::operation::string_payload::StringPayloadError::ExtraError({
         170  +
                    let mut tmp = match protocol
         171  +
                        .deserialize_response(response, crate::types::error::ExtraError::SCHEMA, _cfg)
         172  +
                        .and_then(|mut deser| {
         173  +
                            crate::types::error::ExtraError::deserialize_with_response(
         174  +
                                &mut *deser,
         175  +
                                response.headers(),
         176  +
                                response.status().into(),
         177  +
                                body,
         178  +
                            )
         179  +
                        }) {
         180  +
                        ::std::result::Result::Ok(val) => val,
         181  +
                        ::std::result::Result::Err(e) => {
         182  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         183  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         184  +
                            ))
         185  +
                        }
         186  +
                    };
         187  +
                    tmp.meta = generic;
         188  +
                    if tmp.message.is_none() {
         189  +
                        tmp.message = _error_message;
         190  +
                    }
         191  +
                    tmp
         192  +
                }),
         193  +
                _ => crate::operation::string_payload::StringPayloadError::generic(generic),
         194  +
            };
         195  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         196  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         197  +
            ))
  146    198   
        } else {
  147         -
            crate::protocol_serde::shape_string_payload::de_string_payload_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         199  +
            let protocol = _cfg
         200  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         201  +
                .expect("a SharedClientProtocol is required");
         202  +
            let mut deser = protocol.deserialize_response(response, StringPayload::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         203  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         204  +
            })?;
         205  +
            let body = response.body().bytes().expect("body loaded");
         206  +
            let output = crate::operation::string_payload::StringPayloadOutput::deserialize_with_response(
         207  +
                &mut *deser,
         208  +
                response.headers(),
         209  +
                response.status().into(),
         210  +
                body,
         211  +
            )
         212  +
            .map_err(|e| {
         213  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         214  +
            })?;
         215  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         216  +
        }
  150    217   
    }
  151    218   
}
  152    219   
#[derive(Debug)]
  153    220   
struct StringPayloadRequestSerializer;
  154    221   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StringPayloadRequestSerializer {
  155    222   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    223   
    fn serialize_input(
  157    224   
        &self,
  158    225   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    226   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    227   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    228   
        let input = input
  162    229   
            .downcast::<crate::operation::string_payload::StringPayloadInput>()
  163    230   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::string_payload::StringPayloadInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/StringPayload").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
         231  +
        let protocol = _cfg
         232  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         233  +
            .expect("a SharedClientProtocol is required");
         234  +
        let mut input = input;
         235  +
        let payload = input.payload.take();
         236  +
        let mut request = protocol
         237  +
            .serialize_request(&input, StringPayload::INPUT_SCHEMA, "", _cfg)
         238  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         239  +
        if let ::std::option::Option::Some(payload) = payload {
         240  +
            *request.body_mut() = ::aws_smithy_types::body::SdkBody::from(payload.into_bytes());
         241  +
            request.headers_mut().insert("Content-Type", "text/plain");
         242  +
            if let ::std::option::Option::Some(content_length) = request.body().content_length() {
         243  +
                request.headers_mut().insert("Content-Length", content_length.to_string());
  177    244   
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::string_payload::StringPayloadInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "text/plain");
  189         -
            builder
  190         -
        };
  191         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_string_payload_input::ser_payload_http_payload(
  192         -
            input.payload,
  193         -
        )?);
  194         -
        if let Some(content_length) = body.content_length() {
  195         -
            let content_length = content_length.to_string();
  196         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  197    245   
        }
  198         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         246  +
         247  +
        return ::std::result::Result::Ok(request);
  199    248   
    }
  200    249   
}
  201    250   
#[derive(Debug)]
  202    251   
struct StringPayloadEndpointParamsInterceptor;
  203    252   
  204    253   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StringPayloadEndpointParamsInterceptor {
  205    254   
    fn name(&self) -> &'static str {
  206    255   
        "StringPayloadEndpointParamsInterceptor"
  207    256   
    }
  208    257   
@@ -274,323 +334,393 @@
  294    343   
            .expect("the config must have a deserializer");
  295    344   
  296    345   
        let parsed = de.deserialize_streaming(&mut http_response);
  297    346   
        let parsed = parsed.unwrap_or_else(|| {
  298    347   
            let http_response = http_response.map(|body| {
  299    348   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  300    349   
                    body.bytes().unwrap(),
  301    350   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  302    351   
                )))
  303    352   
            });
  304         -
            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  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         358  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         359  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         360  +
                ));
         361  +
                test_cfg.push_shared_layer(layer.freeze());
         362  +
            }
         363  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  305    364   
        });
  306    365   
        let parsed = parsed.expect_err("should be error response");
  307    366   
        let parsed: &crate::operation::string_payload::StringPayloadError =
  308    367   
            parsed.as_operation_error().expect("operation error").downcast_ref().unwrap();
  309    368   
        if let crate::operation::string_payload::StringPayloadError::ExtraError(parsed) = parsed {
  310    369   
            ::pretty_assertions::assert_eq!(parsed.message, expected_output.message, "Unexpected value for `message`");
  311    370   
        } else {
  312    371   
            panic!("wrong variant: Got: {:?}. Expected: {:?}", parsed, expected_output);
  313    372   
        }
  314    373   
    }

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/string_payload/_string_payload_input.rs

@@ -5,5 +109,131 @@
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::String,
   27     27   
    "payload",
   28     28   
    0,
   29     29   
)
   30     30   
.with_http_payload();
   31     31   
static STRINGPAYLOADINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   32     32   
    STRINGPAYLOADINPUT_SCHEMA_ID,
   33     33   
    ::aws_smithy_schema::ShapeType::Structure,
   34     34   
    &[&STRINGPAYLOADINPUT_MEMBER_PAYLOAD],
   35         -
);
          35  +
)
          36  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/StringPayload", None));
   36     37   
impl StringPayloadInput {
   37     38   
    /// The schema for this shape.
   38     39   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &STRINGPAYLOADINPUT_SCHEMA;
   39     40   
}
   40     41   
impl ::aws_smithy_schema::serde::SerializableStruct for StringPayloadInput {
   41     42   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   42     43   
    fn serialize_members(
   43     44   
        &self,
   44     45   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   45     46   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   46     47   
        if let Some(ref val) = self.payload {
   47     48   
            ser.write_string(&STRINGPAYLOADINPUT_MEMBER_PAYLOAD, val)?;
   48     49   
        }
   49     50   
        Ok(())
   50     51   
    }
   51     52   
}
   52     53   
impl StringPayloadInput {
   53     54   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   54         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   55         -
        deserializer: &mut D,
          55  +
    pub fn deserialize(
          56  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   56     57   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   57     58   
        #[allow(unused_variables, unused_mut)]
   58     59   
        let mut builder = Self::builder();
   59     60   
        #[allow(
   60     61   
            unused_variables,
   61     62   
            unreachable_code,
   62     63   
            clippy::single_match,
   63     64   
            clippy::match_single_binding,
   64     65   
            clippy::diverging_sub_expression
   65     66   
        )]
   66         -
        deserializer.read_struct(&STRINGPAYLOADINPUT_SCHEMA, (), |_, member, deser| {
          67  +
        deserializer.read_struct(&STRINGPAYLOADINPUT_SCHEMA, &mut |member, deser| {
   67     68   
            match member.member_index() {
   68     69   
                Some(0) => {
   69     70   
                    builder.payload = Some(deser.read_string(member)?);
   70     71   
                }
   71     72   
                _ => {}
   72     73   
            }
   73     74   
            Ok(())
   74     75   
        })?;
   75     76   
        builder
   76     77   
            .build()
   77     78   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   78     79   
    }
   79     80   
}
          81  +
impl StringPayloadInput {
          82  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
          83  +
    /// Header-bound members are read directly from headers, avoiding runtime
          84  +
    /// member iteration overhead. Body members are read via the deserializer.
          85  +
    pub fn deserialize_with_response(
          86  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          87  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          88  +
        _status: u16,
          89  +
        body: &[u8],
          90  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          91  +
        #[allow(unused_variables, unused_mut)]
          92  +
        let mut builder = Self::builder();
          93  +
        if !body.is_empty() {
          94  +
            let s = ::std::string::String::from_utf8_lossy(body).into_owned();
          95  +
            builder.payload = Some(s);
          96  +
        }
          97  +
        builder
          98  +
            .build()
          99  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         100  +
    }
         101  +
}
   80    102   
impl StringPayloadInput {
   81    103   
    /// Creates a new builder-style object to manufacture [`StringPayloadInput`](crate::operation::string_payload::StringPayloadInput).
   82    104   
    pub fn builder() -> crate::operation::string_payload::builders::StringPayloadInputBuilder {
   83    105   
        crate::operation::string_payload::builders::StringPayloadInputBuilder::default()
   84    106   
    }
   85    107   
}
   86    108   
   87    109   
/// A builder for [`StringPayloadInput`](crate::operation::string_payload::StringPayloadInput).
   88    110   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   89    111   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/operation/string_payload/_string_payload_output.rs

@@ -24,24 +107,126 @@
   44     44   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   45     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   46     46   
        if let Some(ref val) = self.payload {
   47     47   
            ser.write_string(&STRINGPAYLOADOUTPUT_MEMBER_PAYLOAD, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl StringPayloadOutput {
   53     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   54         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   55         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   56     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   57     57   
        #[allow(unused_variables, unused_mut)]
   58     58   
        let mut builder = Self::builder();
   59     59   
        #[allow(
   60     60   
            unused_variables,
   61     61   
            unreachable_code,
   62     62   
            clippy::single_match,
   63     63   
            clippy::match_single_binding,
   64     64   
            clippy::diverging_sub_expression
   65     65   
        )]
   66         -
        deserializer.read_struct(&STRINGPAYLOADOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&STRINGPAYLOADOUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69     69   
                    builder.payload = Some(deser.read_string(member)?);
   70     70   
                }
   71     71   
                _ => {}
   72     72   
            }
   73     73   
            Ok(())
   74     74   
        })?;
   75     75   
        Ok(builder.build())
   76     76   
    }
   77     77   
}
          78  +
impl StringPayloadOutput {
          79  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
          80  +
    /// Header-bound members are read directly from headers, avoiding runtime
          81  +
    /// member iteration overhead. Body members are read via the deserializer.
          82  +
    pub fn deserialize_with_response(
          83  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        #[allow(unused_variables, unused_mut)]
          89  +
        let mut builder = Self::builder();
          90  +
        if !body.is_empty() {
          91  +
            let s = ::std::string::String::from_utf8_lossy(body).into_owned();
          92  +
            builder.payload = Some(s);
          93  +
        }
          94  +
        Ok(builder.build())
          95  +
    }
          96  +
}
   78     97   
impl StringPayloadOutput {
   79     98   
    /// Creates a new builder-style object to manufacture [`StringPayloadOutput`](crate::operation::string_payload::StringPayloadOutput).
   80     99   
    pub fn builder() -> crate::operation::string_payload::builders::StringPayloadOutputBuilder {
   81    100   
        crate::operation::string_payload::builders::StringPayloadOutputBuilder::default()
   82    101   
    }
   83    102   
}
   84    103   
   85    104   
/// A builder for [`StringPayloadOutput`](crate::operation::string_payload::StringPayloadOutput).
   86    105   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   87    106   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde.rs

@@ -1,1 +86,0 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn type_erase_result<O, E>(
    3         -
    result: ::std::result::Result<O, E>,
    4         -
) -> ::std::result::Result<
    5         -
    ::aws_smithy_runtime_api::client::interceptors::context::Output,
    6         -
    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError<::aws_smithy_runtime_api::client::interceptors::context::Error>,
    7         -
>
    8         -
where
    9         -
    O: ::std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
   10         -
    E: ::std::error::Error + std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
   11         -
{
   12         -
    result
   13         -
        .map(|output| ::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
   14         -
        .map_err(|error| ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(error))
   15         -
        .map_err(::std::convert::Into::into)
   16         -
}
   17         -
   18      2   
pub fn parse_http_error_metadata(
   19      3   
    _response_status: u16,
   20      4   
    response_headers: &::aws_smithy_runtime_api::http::Headers,
   21      5   
    response_body: &[u8],
   22      6   
) -> ::std::result::Result<::aws_smithy_types::error::metadata::Builder, ::aws_smithy_json::deserialize::error::DeserializeError> {
   23      7   
    crate::json_errors::parse_error_metadata(response_body, response_headers)
   24      8   
}
   25         -
   26         -
pub(crate) mod shape_case_insensitive_error_operation;
   27         -
   28         -
pub(crate) mod shape_empty_struct_with_content_on_wire_op;
   29         -
   30         -
pub(crate) mod shape_enum_query;
   31         -
   32         -
pub(crate) mod shape_escaped_string_values;
   33         -
   34         -
pub(crate) mod shape_map_with_enum_key_op;
   35         -
   36         -
pub(crate) mod shape_null_in_non_sparse;
   37         -
   38         -
pub(crate) mod shape_primitive_int_header;
   39         -
   40         -
pub(crate) mod shape_primitive_int_op;
   41         -
   42         -
pub(crate) mod shape_query_precedence;
   43         -
   44         -
pub(crate) mod shape_status_response;
   45         -
   46         -
pub(crate) mod shape_string_payload;
   47         -
   48         -
pub(crate) mod shape_string_payload_input;
   49         -
   50         -
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   51         -
    if data.is_empty() {
   52         -
        b"{}"
   53         -
    } else {
   54         -
        data
   55         -
    }
   56         -
}
   57         -
   58         -
pub(crate) mod shape_case_insensitive_error;
   59         -
   60         -
pub(crate) mod shape_escaped_string_values_input;
   61         -
   62         -
pub(crate) mod shape_extra_error;
   63         -
   64         -
pub(crate) mod shape_map_with_enum_key_op_input;
   65         -
   66         -
pub(crate) mod shape_primitive_int_header_output;
   67         -
   68         -
pub(crate) mod shape_primitive_int_op_input;
   69         -
   70         -
pub(crate) mod shape_string_payload_output;
   71         -
   72         -
pub(crate) mod shape_validation_exception;
   73         -
   74         -
pub(crate) mod shape_empty_struct;
   75         -
   76         -
pub(crate) mod shape_map_with_enum_key;
   77         -
   78         -
pub(crate) mod shape_non_sparse_list;
   79         -
   80         -
pub(crate) mod shape_non_sparse_map;
   81         -
   82         -
pub(crate) mod shape_single_element_union;
   83         -
   84         -
pub(crate) mod shape_validation_exception_field_list;
   85         -
   86         -
pub(crate) mod shape_validation_exception_field;

tmp-codegen-diff/codegen-client-test/rest_json_extras/rust-client-codegen/src/protocol_serde/shape_case_insensitive_error.rs

@@ -1,0 +35,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_case_insensitive_error_json_err(
    3         -
    _value: &[u8],
    4         -
    mut builder: crate::types::error::builders::CaseInsensitiveErrorBuilder,
    5         -
) -> ::std::result::Result<crate::types::error::builders::CaseInsensitiveErrorBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
    6         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
    7         -
    let tokens = &mut tokens_owned;
    8         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
    9         -
    loop {
   10         -
        match tokens.next().transpose()? {
   11         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   12         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   13         -
                "message" => {
   14         -
                    builder = builder.set_message(
   15         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   16         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   17         -
                            .transpose()?,
   18         -
                    );
   19         -
                }
   20         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   21         -
            },
   22         -
            other => {
   23         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   24         -
                    "expected object key or end object, found: {other:?}"
   25         -
                )))
   26         -
            }
   27         -
        }
   28         -
    }
   29         -
    if tokens.next().is_some() {
   30         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31         -
            "found more JSON tokens after completing parsing",
   32         -
        ));
   33         -
    }
   34         -
    Ok(builder)
   35         -
}