Client Test

Client Test

rev. 32b1b3c3761061baed26023be3219639e42d7d12

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_payload_with_structure/_http_payload_with_structure_output.rs

@@ -24,24 +107,125 @@
   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.nested {
   47     47   
            ser.write_struct(&HTTPPAYLOADWITHSTRUCTUREOUTPUT_MEMBER_NESTED, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl HttpPayloadWithStructureOutput {
   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(&HTTPPAYLOADWITHSTRUCTUREOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&HTTPPAYLOADWITHSTRUCTUREOUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69     69   
                    builder.nested = Some(crate::types::NestedPayload::deserialize(deser)?);
   70     70   
                }
   71     71   
                _ => {}
   72     72   
            }
   73     73   
            Ok(())
   74     74   
        })?;
   75     75   
        Ok(builder.build())
   76     76   
    }
   77     77   
}
          78  +
impl HttpPayloadWithStructureOutput {
          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  +
            builder.nested = Some(crate::types::NestedPayload::deserialize(deserializer)?);
          92  +
        }
          93  +
        Ok(builder.build())
          94  +
    }
          95  +
}
   78     96   
impl HttpPayloadWithStructureOutput {
   79     97   
    /// Creates a new builder-style object to manufacture [`HttpPayloadWithStructureOutput`](crate::operation::http_payload_with_structure::HttpPayloadWithStructureOutput).
   80     98   
    pub fn builder() -> crate::operation::http_payload_with_structure::builders::HttpPayloadWithStructureOutputBuilder {
   81     99   
        crate::operation::http_payload_with_structure::builders::HttpPayloadWithStructureOutputBuilder::default()
   82    100   
    }
   83    101   
}
   84    102   
   85    103   
/// A builder for [`HttpPayloadWithStructureOutput`](crate::operation::http_payload_with_structure::HttpPayloadWithStructureOutput).
   86    104   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   87    105   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_payload_with_union.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 `HttpPayloadWithUnion`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpPayloadWithUnion;
    6      6   
impl HttpPayloadWithUnion {
    7      7   
    /// Creates a new `HttpPayloadWithUnion`
    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::http_payload_with_union::HttpPayloadWithUnionInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput::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::http_payload_with_union::HttpPayloadWithUnionInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::http_payload_with_union::HttpPayloadWithUnionError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +234,239 @@
  130    134   
                crate::operation::http_payload_with_union::HttpPayloadWithUnionError,
  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 HttpPayloadWithUnionResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpPayloadWithUnionResponseDeserializer {
  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_http_payload_with_union::de_http_payload_with_union_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  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::http_payload_with_union::HttpPayloadWithUnionError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_http_payload_with_union::de_http_payload_with_union_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, HttpPayloadWithUnion::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct HttpPayloadWithUnionRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HttpPayloadWithUnionRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::http_payload_with_union::HttpPayloadWithUnionInput>()
  169    201   
            .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::http_payload_with_union::HttpPayloadWithUnionInput,
  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, "/HttpPayloadWithUnion").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::http_payload_with_union::HttpPayloadWithUnionInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_http_payload_with_union_input::ser_nested_http_payload(
  198         -
            &input.nested,
  199         -
        )?);
  200         -
        if let Some(content_length) = body.content_length() {
  201         -
            let content_length = content_length.to_string();
  202         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  203         -
        }
  204         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, HttpPayloadWithUnion::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  205    210   
    }
  206    211   
}
  207    212   
#[derive(Debug)]
  208    213   
struct HttpPayloadWithUnionEndpointParamsInterceptor;
  209    214   
  210    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HttpPayloadWithUnionEndpointParamsInterceptor {
  211    216   
    fn name(&self) -> &'static str {
  212    217   
        "HttpPayloadWithUnionEndpointParamsInterceptor"
  213    218   
    }
  214    219   
@@ -310,315 +410,435 @@
  330    335   
            .expect("the config must have a deserializer");
  331    336   
  332    337   
        let parsed = de.deserialize_streaming(&mut http_response);
  333    338   
        let parsed = parsed.unwrap_or_else(|| {
  334    339   
            let http_response = http_response.map(|body| {
  335    340   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  336    341   
                    body.bytes().unwrap(),
  337    342   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  338    343   
                )))
  339    344   
            });
  340         -
            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)
  341    356   
        });
  342    357   
        let parsed = parsed
  343    358   
            .expect("should be successful response")
  344    359   
            .downcast::<crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput>()
  345    360   
            .unwrap();
  346    361   
        ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  347    362   
    }
  348    363   
  349    364   
    /// No payload is sent if the union has no value.
  350    365   
    /// Test ID: RestJsonHttpPayloadWithUnsetUnion
  351    366   
    #[::tokio::test]
  352    367   
    #[::tracing_test::traced_test]
  353    368   
    async fn rest_json_http_payload_with_unset_union_response() {
  354    369   
        let expected_output = crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput::builder().build();
  355    370   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  356    371   
            ::http_1x::response::Builder::new()
  357    372   
                .header("Content-Length", "0")
  358    373   
                .status(200)
  359    374   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  360    375   
                .unwrap(),
  361    376   
        )
  362    377   
        .unwrap();
  363    378   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  364    379   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  365    380   
  366    381   
        let op = crate::operation::http_payload_with_union::HttpPayloadWithUnion::new();
  367    382   
        let config = op.config().expect("the operation has config");
  368    383   
        let de = config
  369    384   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  370    385   
            .expect("the config must have a deserializer");
  371    386   
  372    387   
        let parsed = de.deserialize_streaming(&mut http_response);
  373    388   
        let parsed = parsed.unwrap_or_else(|| {
  374    389   
            let http_response = http_response.map(|body| {
  375    390   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  376    391   
                    body.bytes().unwrap(),
  377    392   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  378    393   
                )))
  379    394   
            });
  380         -
            de.deserialize_nonstreaming(&http_response)
         395  +
            // Build a config bag with the protocol for schema-based deserialization
         396  +
            #[allow(unused_mut)]
         397  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         398  +
            {
         399  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         400  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         401  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         402  +
                ));
         403  +
                test_cfg.push_shared_layer(layer.freeze());
         404  +
            }
         405  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  381    406   
        });
  382    407   
        let parsed = parsed
  383    408   
            .expect("should be successful response")
  384    409   
            .downcast::<crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput>()
  385    410   
            .unwrap();
  386    411   
        ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  387    412   
    }
  388    413   
}
  389    414   
  390    415   
/// Error type for the `HttpPayloadWithUnionError` operation.

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_payload_with_union/_http_payload_with_union_input.rs

@@ -5,5 +112,130 @@
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Union,
   27     27   
    "nested",
   28     28   
    0,
   29     29   
)
   30     30   
.with_http_payload();
   31     31   
static HTTPPAYLOADWITHUNIONINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   32     32   
    HTTPPAYLOADWITHUNIONINPUT_SCHEMA_ID,
   33     33   
    ::aws_smithy_schema::ShapeType::Structure,
   34     34   
    &[&HTTPPAYLOADWITHUNIONINPUT_MEMBER_NESTED],
   35         -
);
          35  +
)
          36  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("PUT", "/HttpPayloadWithUnion", None));
   36     37   
impl HttpPayloadWithUnionInput {
   37     38   
    /// The schema for this shape.
   38     39   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPAYLOADWITHUNIONINPUT_SCHEMA;
   39     40   
}
   40     41   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPayloadWithUnionInput {
   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.nested {
   47         -
            ser.write_null(&HTTPPAYLOADWITHUNIONINPUT_MEMBER_NESTED)?;
          48  +
            ser.write_struct(&HTTPPAYLOADWITHUNIONINPUT_MEMBER_NESTED, val)?;
   48     49   
        }
   49     50   
        Ok(())
   50     51   
    }
   51     52   
}
   52     53   
impl HttpPayloadWithUnionInput {
   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(&HTTPPAYLOADWITHUNIONINPUT_SCHEMA, (), |_, member, deser| {
          67  +
        deserializer.read_struct(&HTTPPAYLOADWITHUNIONINPUT_SCHEMA, &mut |member, deser| {
   67     68   
            match member.member_index() {
   68     69   
                Some(0) => {
   69         -
                    builder.nested = Some({
   70         -
                        let _ = member;
   71         -
                        todo!("deserialize aggregate")
   72         -
                    });
          70  +
                    builder.nested = Some(crate::types::UnionPayload::deserialize(deser)?);
   73     71   
                }
   74     72   
                _ => {}
   75     73   
            }
   76     74   
            Ok(())
   77     75   
        })?;
   78     76   
        builder
   79     77   
            .build()
   80     78   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   81     79   
    }
   82     80   
}
          81  +
impl HttpPayloadWithUnionInput {
          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  +
            builder.nested = Some(crate::types::UnionPayload::deserialize(deserializer)?);
          95  +
        }
          96  +
        builder
          97  +
            .build()
          98  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          99  +
    }
         100  +
}
   83    101   
impl HttpPayloadWithUnionInput {
   84    102   
    /// Creates a new builder-style object to manufacture [`HttpPayloadWithUnionInput`](crate::operation::http_payload_with_union::HttpPayloadWithUnionInput).
   85    103   
    pub fn builder() -> crate::operation::http_payload_with_union::builders::HttpPayloadWithUnionInputBuilder {
   86    104   
        crate::operation::http_payload_with_union::builders::HttpPayloadWithUnionInputBuilder::default()
   87    105   
    }
   88    106   
}
   89    107   
   90    108   
/// A builder for [`HttpPayloadWithUnionInput`](crate::operation::http_payload_with_union::HttpPayloadWithUnionInput).
   91    109   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   92    110   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_payload_with_union/_http_payload_with_union_output.rs

@@ -17,17 +110,125 @@
   37     37   
    /// The schema for this shape.
   38     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPAYLOADWITHUNIONOUTPUT_SCHEMA;
   39     39   
}
   40     40   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPayloadWithUnionOutput {
   41     41   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   42     42   
    fn serialize_members(
   43     43   
        &self,
   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.nested {
   47         -
            ser.write_null(&HTTPPAYLOADWITHUNIONOUTPUT_MEMBER_NESTED)?;
          47  +
            ser.write_struct(&HTTPPAYLOADWITHUNIONOUTPUT_MEMBER_NESTED, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl HttpPayloadWithUnionOutput {
   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(&HTTPPAYLOADWITHUNIONOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&HTTPPAYLOADWITHUNIONOUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69         -
                    builder.nested = Some({
   70         -
                        let _ = member;
   71         -
                        todo!("deserialize aggregate")
   72         -
                    });
          69  +
                    builder.nested = Some(crate::types::UnionPayload::deserialize(deser)?);
   73     70   
                }
   74     71   
                _ => {}
   75     72   
            }
   76     73   
            Ok(())
   77     74   
        })?;
   78     75   
        Ok(builder.build())
   79     76   
    }
   80     77   
}
          78  +
impl HttpPayloadWithUnionOutput {
          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  +
            builder.nested = Some(crate::types::UnionPayload::deserialize(deserializer)?);
          92  +
        }
          93  +
        Ok(builder.build())
          94  +
    }
          95  +
}
   81     96   
impl HttpPayloadWithUnionOutput {
   82     97   
    /// Creates a new builder-style object to manufacture [`HttpPayloadWithUnionOutput`](crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput).
   83     98   
    pub fn builder() -> crate::operation::http_payload_with_union::builders::HttpPayloadWithUnionOutputBuilder {
   84     99   
        crate::operation::http_payload_with_union::builders::HttpPayloadWithUnionOutputBuilder::default()
   85    100   
    }
   86    101   
}
   87    102   
   88    103   
/// A builder for [`HttpPayloadWithUnionOutput`](crate::operation::http_payload_with_union::HttpPayloadWithUnionOutput).
   89    104   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   90    105   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_prefix_headers.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 `HttpPrefixHeaders`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpPrefixHeaders;
    6      6   
impl HttpPrefixHeaders {
    7      7   
    /// Creates a new `HttpPrefixHeaders`
    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::http_prefix_headers::HttpPrefixHeadersInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::http_prefix_headers::HttpPrefixHeadersOutput::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::http_prefix_headers::HttpPrefixHeadersInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::http_prefix_headers::HttpPrefixHeadersOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::http_prefix_headers::HttpPrefixHeadersError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +229,274 @@
  130    134   
                crate::operation::http_prefix_headers::HttpPrefixHeadersError,
  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 HttpPrefixHeadersResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpPrefixHeadersResponseDeserializer {
  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_http_prefix_headers::de_http_prefix_headers_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  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::http_prefix_headers::HttpPrefixHeadersError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_http_prefix_headers::de_http_prefix_headers_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, HttpPrefixHeaders::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::http_prefix_headers::HttpPrefixHeadersOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct HttpPrefixHeadersRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HttpPrefixHeadersRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::http_prefix_headers::HttpPrefixHeadersInput>()
  169    201   
            .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::http_prefix_headers::HttpPrefixHeadersInput,
  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, "/HttpPrefixHeaders").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::http_prefix_headers::HttpPrefixHeadersInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                let builder = crate::protocol_serde::shape_http_prefix_headers::ser_http_prefix_headers_headers(input, builder)?;
  192         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        if protocol.supports_http_bindings() {
         206  +
            let mut request = protocol
         207  +
                .serialize_body(&input, HttpPrefixHeaders::INPUT_SCHEMA, "", _cfg)
         208  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         209  +
            {
         210  +
                let mut uri = "/HttpPrefixHeaders".to_string();
         211  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         212  +
                if let Some(ref val) = input.foo {
         213  +
                    request.headers_mut().insert("x-foo", val.to_string());
         214  +
                }
         215  +
                if let Some(ref map) = input.foo_map {
         216  +
                    for (k, v) in map {
         217  +
                        request.headers_mut().insert(format!("x-foo-{k}"), v.to_string());
         218  +
                    }
         219  +
                }
         220  +
                if !query_params.is_empty() {
         221  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         222  +
                    let pairs: Vec<String> = query_params
         223  +
                        .iter()
         224  +
                        .map(|(k, v)| {
         225  +
                            format!(
         226  +
                                "{}={}",
         227  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         228  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         229  +
                            )
         230  +
                        })
         231  +
                        .collect();
         232  +
                    uri.push_str(&pairs.join("&"));
         233  +
                }
         234  +
                request.set_uri(uri.as_str()).expect("valid URI");
  193    235   
            }
  194         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  198    236   
  199         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         237  +
            return ::std::result::Result::Ok(request);
         238  +
        } else {
         239  +
            let mut request = protocol
         240  +
                .serialize_request(&input, HttpPrefixHeaders::INPUT_SCHEMA, "", _cfg)
         241  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         242  +
         243  +
            return ::std::result::Result::Ok(request);
         244  +
        }
  200    245   
    }
  201    246   
}
  202    247   
#[derive(Debug)]
  203    248   
struct HttpPrefixHeadersEndpointParamsInterceptor;
  204    249   
  205    250   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HttpPrefixHeadersEndpointParamsInterceptor {
  206    251   
    fn name(&self) -> &'static str {
  207    252   
        "HttpPrefixHeadersEndpointParamsInterceptor"
  208    253   
    }
  209    254   
@@ -356,401 +416,471 @@
  376    421   
            .expect("the config must have a deserializer");
  377    422   
  378    423   
        let parsed = de.deserialize_streaming(&mut http_response);
  379    424   
        let parsed = parsed.unwrap_or_else(|| {
  380    425   
            let http_response = http_response.map(|body| {
  381    426   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  382    427   
                    body.bytes().unwrap(),
  383    428   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  384    429   
                )))
  385    430   
            });
  386         -
            de.deserialize_nonstreaming(&http_response)
         431  +
            // Build a config bag with the protocol for schema-based deserialization
         432  +
            #[allow(unused_mut)]
         433  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         434  +
            {
         435  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         436  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         437  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         438  +
                ));
         439  +
                test_cfg.push_shared_layer(layer.freeze());
         440  +
            }
         441  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  387    442   
        });
  388    443   
        let parsed = parsed
  389    444   
            .expect("should be successful response")
  390    445   
            .downcast::<crate::operation::http_prefix_headers::HttpPrefixHeadersOutput>()
  391    446   
            .unwrap();
  392    447   
        ::pretty_assertions::assert_eq!(parsed.foo, expected_output.foo, "Unexpected value for `foo`");
  393    448   
        ::pretty_assertions::assert_eq!(parsed.foo_map, expected_output.foo_map, "Unexpected value for `foo_map`");
  394    449   
    }
  395    450   
}
  396    451   

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_prefix_headers/_http_prefix_headers_input.rs

@@ -14,14 +151,173 @@
   34     34   
    0,
   35     35   
)
   36     36   
.with_http_header("x-foo");
   37     37   
static HTTPPREFIXHEADERSINPUT_MEMBER_FOO_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restjson.synthetic#HttpPrefixHeadersInput$fooMap",
   40     40   
        "aws.protocoltests.restjson.synthetic",
   41     41   
        "HttpPrefixHeadersInput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::Map,
   44         -
    "foo_map",
          44  +
    "fooMap",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_prefix_headers("x-foo-");
   48     48   
static HTTPPREFIXHEADERSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    HTTPPREFIXHEADERSINPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[&HTTPPREFIXHEADERSINPUT_MEMBER_FOO, &HTTPPREFIXHEADERSINPUT_MEMBER_FOO_MAP],
   52         -
);
          52  +
)
          53  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/HttpPrefixHeaders", None));
   53     54   
impl HttpPrefixHeadersInput {
   54     55   
    /// The schema for this shape.
   55     56   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPREFIXHEADERSINPUT_SCHEMA;
   56     57   
}
   57     58   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPrefixHeadersInput {
   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(&HTTPPREFIXHEADERSINPUT_MEMBER_FOO, val)?;
   65     66   
        }
   66     67   
        if let Some(ref val) = self.foo_map {
   67     68   
            ser.write_map(
   68     69   
                &HTTPPREFIXHEADERSINPUT_MEMBER_FOO_MAP,
   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 HttpPrefixHeadersInput {
   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(&HTTPPREFIXHEADERSINPUT_SCHEMA, (), |_, member, deser| {
          96  +
        deserializer.read_struct(&HTTPPREFIXHEADERSINPUT_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.foo_map = 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.foo_map = 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 HttpPrefixHeadersInput {
         114  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         115  +
    /// Header-bound members are read directly from headers, avoiding runtime
         116  +
    /// member iteration overhead. Body members are read via the deserializer.
         117  +
    pub fn deserialize_with_response(
         118  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         119  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         120  +
        _status: u16,
         121  +
        _body: &[u8],
         122  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         123  +
        #[allow(unused_variables, unused_mut)]
         124  +
        let mut builder = Self::builder();
         125  +
        if let Some(val) = headers.get("x-foo") {
         126  +
            builder.foo = Some(val.to_string());
         127  +
        }
         128  +
        {
         129  +
            let mut map = ::std::collections::HashMap::new();
         130  +
            for (key, val) in headers.iter() {
         131  +
                if let Some(suffix) = key.strip_prefix("x-foo-") {
         132  +
                    map.insert(suffix.to_string(), val.to_string());
         133  +
                }
         134  +
            }
         135  +
            if !map.is_empty() {
         136  +
                builder.foo_map = Some(map);
         137  +
            }
         138  +
        }
         139  +
        builder
         140  +
            .build()
         141  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         142  +
    }
         143  +
}
  122    144   
impl HttpPrefixHeadersInput {
  123    145   
    /// Creates a new builder-style object to manufacture [`HttpPrefixHeadersInput`](crate::operation::http_prefix_headers::HttpPrefixHeadersInput).
  124    146   
    pub fn builder() -> crate::operation::http_prefix_headers::builders::HttpPrefixHeadersInputBuilder {
  125    147   
        crate::operation::http_prefix_headers::builders::HttpPrefixHeadersInputBuilder::default()
  126    148   
    }
  127    149   
}
  128    150   
  129    151   
/// A builder for [`HttpPrefixHeadersInput`](crate::operation::http_prefix_headers::HttpPrefixHeadersInput).
  130    152   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  131    153   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_prefix_headers/_http_prefix_headers_output.rs

@@ -14,14 +149,168 @@
   34     34   
    0,
   35     35   
)
   36     36   
.with_http_header("x-foo");
   37     37   
static HTTPPREFIXHEADERSOUTPUT_MEMBER_FOO_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restjson.synthetic#HttpPrefixHeadersOutput$fooMap",
   40     40   
        "aws.protocoltests.restjson.synthetic",
   41     41   
        "HttpPrefixHeadersOutput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::Map,
   44         -
    "foo_map",
          44  +
    "fooMap",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_prefix_headers("x-foo-");
   48     48   
static HTTPPREFIXHEADERSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    HTTPPREFIXHEADERSOUTPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[&HTTPPREFIXHEADERSOUTPUT_MEMBER_FOO, &HTTPPREFIXHEADERSOUTPUT_MEMBER_FOO_MAP],
   52     52   
);
   53     53   
impl HttpPrefixHeadersOutput {
   54     54   
    /// The schema for this shape.
   55     55   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPREFIXHEADERSOUTPUT_SCHEMA;
   56     56   
}
   57     57   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPrefixHeadersOutput {
   58     58   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   59     59   
    fn serialize_members(
   60     60   
        &self,
   61     61   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   62     62   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   63     63   
        if let Some(ref val) = self.foo {
   64     64   
            ser.write_string(&HTTPPREFIXHEADERSOUTPUT_MEMBER_FOO, val)?;
   65     65   
        }
   66     66   
        if let Some(ref val) = self.foo_map {
   67     67   
            ser.write_map(
   68     68   
                &HTTPPREFIXHEADERSOUTPUT_MEMBER_FOO_MAP,
   69     69   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   70     70   
                    for (key, value) in val {
   71     71   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
   72     72   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
   73     73   
                    }
   74     74   
                    Ok(())
   75     75   
                },
   76     76   
            )?;
   77     77   
        }
   78     78   
        Ok(())
   79     79   
    }
   80     80   
}
   81     81   
impl HttpPrefixHeadersOutput {
   82     82   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   83         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   84         -
        deserializer: &mut D,
          83  +
    pub fn deserialize(
          84  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   85     85   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   86     86   
        #[allow(unused_variables, unused_mut)]
   87     87   
        let mut builder = Self::builder();
   88     88   
        #[allow(
   89     89   
            unused_variables,
   90     90   
            unreachable_code,
   91     91   
            clippy::single_match,
   92     92   
            clippy::match_single_binding,
   93     93   
            clippy::diverging_sub_expression
   94     94   
        )]
   95         -
        deserializer.read_struct(&HTTPPREFIXHEADERSOUTPUT_SCHEMA, (), |_, member, deser| {
          95  +
        deserializer.read_struct(&HTTPPREFIXHEADERSOUTPUT_SCHEMA, &mut |member, deser| {
   96     96   
            match member.member_index() {
   97     97   
                Some(0) => {
   98     98   
                    builder.foo = Some(deser.read_string(member)?);
   99     99   
                }
  100    100   
                Some(1) => {
  101         -
                    builder.foo_map = 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         -
                    });
         101  +
                    builder.foo_map = Some(deser.read_string_string_map(member)?);
  112    102   
                }
  113    103   
                _ => {}
  114    104   
            }
  115    105   
            Ok(())
  116    106   
        })?;
  117    107   
        Ok(builder.build())
  118    108   
    }
  119    109   
}
         110  +
impl HttpPrefixHeadersOutput {
         111  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         112  +
    /// Header-bound members are read directly from headers, avoiding runtime
         113  +
    /// member iteration overhead. Body members are read via the deserializer.
         114  +
    pub fn deserialize_with_response(
         115  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         116  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         117  +
        _status: u16,
         118  +
        _body: &[u8],
         119  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         120  +
        #[allow(unused_variables, unused_mut)]
         121  +
        let mut builder = Self::builder();
         122  +
        if let Some(val) = headers.get("x-foo") {
         123  +
            builder.foo = Some(val.to_string());
         124  +
        }
         125  +
        {
         126  +
            let mut map = ::std::collections::HashMap::new();
         127  +
            for (key, val) in headers.iter() {
         128  +
                if let Some(suffix) = key.strip_prefix("x-foo-") {
         129  +
                    map.insert(suffix.to_string(), val.to_string());
         130  +
                }
         131  +
            }
         132  +
            if !map.is_empty() {
         133  +
                builder.foo_map = Some(map);
         134  +
            }
         135  +
        }
         136  +
        Ok(builder.build())
         137  +
    }
         138  +
}
  120    139   
impl HttpPrefixHeadersOutput {
  121    140   
    /// Creates a new builder-style object to manufacture [`HttpPrefixHeadersOutput`](crate::operation::http_prefix_headers::HttpPrefixHeadersOutput).
  122    141   
    pub fn builder() -> crate::operation::http_prefix_headers::builders::HttpPrefixHeadersOutputBuilder {
  123    142   
        crate::operation::http_prefix_headers::builders::HttpPrefixHeadersOutputBuilder::default()
  124    143   
    }
  125    144   
}
  126    145   
  127    146   
/// A builder for [`HttpPrefixHeadersOutput`](crate::operation::http_prefix_headers::HttpPrefixHeadersOutput).
  128    147   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  129    148   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_prefix_headers_in_response.rs

@@ -1,1 +40,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `HttpPrefixHeadersInResponse`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpPrefixHeadersInResponse;
    6      6   
impl HttpPrefixHeadersInResponse {
    7      7   
    /// Creates a new `HttpPrefixHeadersInResponse`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          13  +
        crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseOutput::SCHEMA;
   11     17   
    pub(crate) async fn orchestrate(
   12     18   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     19   
        input: crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +228,241 @@
  130    136   
                crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseError,
  131    137   
            >::new());
  132    138   
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct HttpPrefixHeadersInResponseResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpPrefixHeadersInResponseResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_http_prefix_headers_in_response::de_http_prefix_headers_in_response_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_http_prefix_headers_in_response::de_http_prefix_headers_in_response_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, HttpPrefixHeadersInResponse::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
         184  +
            )
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  156    190   
    }
  157    191   
}
  158    192   
#[derive(Debug)]
  159    193   
struct HttpPrefixHeadersInResponseRequestSerializer;
  160    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HttpPrefixHeadersInResponseRequestSerializer {
  161    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    196   
    fn serialize_input(
  163    197   
        &self,
  164    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    201   
        let input = input
  168    202   
            .downcast::<crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseInput>()
  169    203   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseInput,
  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, "/HttpPrefixHeadersResponse").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        let mut request = protocol
         208  +
            .serialize_request(&input, HttpPrefixHeadersInResponse::INPUT_SCHEMA, "", _cfg)
         209  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  197    210   
  198         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         211  +
        return ::std::result::Result::Ok(request);
  199    212   
    }
  200    213   
}
  201    214   
#[derive(Debug)]
  202    215   
struct HttpPrefixHeadersInResponseEndpointParamsInterceptor;
  203    216   
  204    217   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HttpPrefixHeadersInResponseEndpointParamsInterceptor {
  205    218   
    fn name(&self) -> &'static str {
  206    219   
        "HttpPrefixHeadersInResponseEndpointParamsInterceptor"
  207    220   
    }
  208    221   
@@ -249,262 +309,332 @@
  269    282   
            .expect("the config must have a deserializer");
  270    283   
  271    284   
        let parsed = de.deserialize_streaming(&mut http_response);
  272    285   
        let parsed = parsed.unwrap_or_else(|| {
  273    286   
            let http_response = http_response.map(|body| {
  274    287   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  275    288   
                    body.bytes().unwrap(),
  276    289   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  277    290   
                )))
  278    291   
            });
  279         -
            de.deserialize_nonstreaming(&http_response)
         292  +
            // Build a config bag with the protocol for schema-based deserialization
         293  +
            #[allow(unused_mut)]
         294  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         295  +
            {
         296  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         297  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         298  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         299  +
                ));
         300  +
                test_cfg.push_shared_layer(layer.freeze());
         301  +
            }
         302  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  280    303   
        });
  281    304   
        let parsed = parsed
  282    305   
            .expect("should be successful response")
  283    306   
            .downcast::<crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseOutput>()
  284    307   
            .unwrap();
  285    308   
        ::pretty_assertions::assert_eq!(
  286    309   
            parsed.prefix_headers,
  287    310   
            expected_output.prefix_headers,
  288    311   
            "Unexpected value for `prefix_headers`"
  289    312   
        );

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_prefix_headers_in_response/_http_prefix_headers_in_response_input.rs

@@ -1,1 +72,86 @@
    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 HttpPrefixHeadersInResponseInput {}
    6      6   
static HTTPPREFIXHEADERSINRESPONSEINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#HttpPrefixHeadersInResponseInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "HttpPrefixHeadersInResponseInput",
   10     10   
);
   11     11   
static HTTPPREFIXHEADERSINRESPONSEINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(HTTPPREFIXHEADERSINRESPONSEINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(HTTPPREFIXHEADERSINRESPONSEINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/HttpPrefixHeadersResponse", None));
   13     14   
impl HttpPrefixHeadersInResponseInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPREFIXHEADERSINRESPONSEINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPrefixHeadersInResponseInput {
   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 HttpPrefixHeadersInResponseInput {
   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(&HTTPPREFIXHEADERSINRESPONSEINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&HTTPPREFIXHEADERSINRESPONSEINPUT_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 HttpPrefixHeadersInResponseInput {
          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 HttpPrefixHeadersInResponseInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`HttpPrefixHeadersInResponseInput`](crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseInput).
   53     67   
    pub fn builder() -> crate::operation::http_prefix_headers_in_response::builders::HttpPrefixHeadersInResponseInputBuilder {
   54     68   
        crate::operation::http_prefix_headers_in_response::builders::HttpPrefixHeadersInResponseInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`HttpPrefixHeadersInResponseInput`](crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseInput).
   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/rust-client-codegen/src/operation/http_prefix_headers_in_response/_http_prefix_headers_in_response_output.rs

@@ -1,1 +126,142 @@
   17     17   
    "aws.protocoltests.restjson.synthetic",
   18     18   
    "HttpPrefixHeadersInResponseOutput",
   19     19   
);
   20     20   
static HTTPPREFIXHEADERSINRESPONSEOUTPUT_MEMBER_PREFIX_HEADERS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   21     21   
    ::aws_smithy_schema::ShapeId::from_static(
   22     22   
        "aws.protocoltests.restjson.synthetic#HttpPrefixHeadersInResponseOutput$prefixHeaders",
   23     23   
        "aws.protocoltests.restjson.synthetic",
   24     24   
        "HttpPrefixHeadersInResponseOutput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Map,
   27         -
    "prefix_headers",
          27  +
    "prefixHeaders",
   28     28   
    0,
   29     29   
)
   30     30   
.with_http_prefix_headers("");
   31     31   
static HTTPPREFIXHEADERSINRESPONSEOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   32     32   
    HTTPPREFIXHEADERSINRESPONSEOUTPUT_SCHEMA_ID,
   33     33   
    ::aws_smithy_schema::ShapeType::Structure,
   34     34   
    &[&HTTPPREFIXHEADERSINRESPONSEOUTPUT_MEMBER_PREFIX_HEADERS],
   35     35   
);
   36     36   
impl HttpPrefixHeadersInResponseOutput {
   37     37   
    /// The schema for this shape.
   38     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPREFIXHEADERSINRESPONSEOUTPUT_SCHEMA;
   39     39   
}
   40     40   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPrefixHeadersInResponseOutput {
   41     41   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   42     42   
    fn serialize_members(
   43     43   
        &self,
   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.prefix_headers {
   47     47   
            ser.write_map(
   48     48   
                &HTTPPREFIXHEADERSINRESPONSEOUTPUT_MEMBER_PREFIX_HEADERS,
   49     49   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   50     50   
                    for (key, value) in val {
   51     51   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
   52     52   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
   53     53   
                    }
   54     54   
                    Ok(())
   55     55   
                },
   56     56   
            )?;
   57     57   
        }
   58     58   
        Ok(())
   59     59   
    }
   60     60   
}
   61     61   
impl HttpPrefixHeadersInResponseOutput {
   62     62   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   63         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   64         -
        deserializer: &mut D,
          63  +
    pub fn deserialize(
          64  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   65     65   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   66     66   
        #[allow(unused_variables, unused_mut)]
   67     67   
        let mut builder = Self::builder();
   68     68   
        #[allow(
   69     69   
            unused_variables,
   70     70   
            unreachable_code,
   71     71   
            clippy::single_match,
   72     72   
            clippy::match_single_binding,
   73     73   
            clippy::diverging_sub_expression
   74     74   
        )]
   75         -
        deserializer.read_struct(&HTTPPREFIXHEADERSINRESPONSEOUTPUT_SCHEMA, (), |_, member, deser| {
          75  +
        deserializer.read_struct(&HTTPPREFIXHEADERSINRESPONSEOUTPUT_SCHEMA, &mut |member, deser| {
   76     76   
            match member.member_index() {
   77     77   
                Some(0) => {
   78         -
                    builder.prefix_headers = Some({
   79         -
                        let container = if let Some(cap) = deser.container_size() {
   80         -
                            std::collections::HashMap::with_capacity(cap)
   81         -
                        } else {
   82         -
                            std::collections::HashMap::new()
   83         -
                        };
   84         -
                        deser.read_map(member, container, |mut map, key, deser| {
   85         -
                            map.insert(key, deser.read_string(member)?);
   86         -
                            Ok(map)
   87         -
                        })?
   88         -
                    });
          78  +
                    builder.prefix_headers = Some(deser.read_string_string_map(member)?);
   89     79   
                }
   90     80   
                _ => {}
   91     81   
            }
   92     82   
            Ok(())
   93     83   
        })?;
   94     84   
        Ok(builder.build())
   95     85   
    }
   96     86   
}
          87  +
impl HttpPrefixHeadersInResponseOutput {
          88  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
          89  +
    /// Header-bound members are read directly from headers, avoiding runtime
          90  +
    /// member iteration overhead. Body members are read via the deserializer.
          91  +
    pub fn deserialize_with_response(
          92  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          93  +
        headers: &::aws_smithy_runtime_api::http::Headers,
          94  +
        _status: u16,
          95  +
        _body: &[u8],
          96  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          97  +
        #[allow(unused_variables, unused_mut)]
          98  +
        let mut builder = Self::builder();
          99  +
        {
         100  +
            let mut map = ::std::collections::HashMap::new();
         101  +
            for (key, val) in headers.iter() {
         102  +
                if let Some(suffix) = key.strip_prefix("") {
         103  +
                    map.insert(suffix.to_string(), val.to_string());
         104  +
                }
         105  +
            }
         106  +
            if !map.is_empty() {
         107  +
                builder.prefix_headers = Some(map);
         108  +
            }
         109  +
        }
         110  +
        Ok(builder.build())
         111  +
    }
         112  +
}
   97    113   
impl HttpPrefixHeadersInResponseOutput {
   98    114   
    /// Creates a new builder-style object to manufacture [`HttpPrefixHeadersInResponseOutput`](crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseOutput).
   99    115   
    pub fn builder() -> crate::operation::http_prefix_headers_in_response::builders::HttpPrefixHeadersInResponseOutputBuilder {
  100    116   
        crate::operation::http_prefix_headers_in_response::builders::HttpPrefixHeadersInResponseOutputBuilder::default()
  101    117   
    }
  102    118   
}
  103    119   
  104    120   
/// A builder for [`HttpPrefixHeadersInResponseOutput`](crate::operation::http_prefix_headers_in_response::HttpPrefixHeadersInResponseOutput).
  105    121   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  106    122   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_query_params_only_operation.rs

@@ -1,1 +40,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `HttpQueryParamsOnlyOperation`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpQueryParamsOnlyOperation;
    6      6   
impl HttpQueryParamsOnlyOperation {
    7      7   
    /// Creates a new `HttpQueryParamsOnlyOperation`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          13  +
        crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationOutput::SCHEMA;
   11     17   
    pub(crate) async fn orchestrate(
   12     18   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     19   
        input: crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +246,273 @@
  130    136   
                crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError,
  131    137   
            >::new());
  132    138   
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct HttpQueryParamsOnlyOperationResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpQueryParamsOnlyOperationResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_http_query_params_only_operation::de_http_query_params_only_operation_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_http_query_params_only_operation::de_http_query_params_only_operation_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, HttpQueryParamsOnlyOperation::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
         184  +
            )
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  156    190   
    }
  157    191   
}
  158    192   
#[derive(Debug)]
  159    193   
struct HttpQueryParamsOnlyOperationRequestSerializer;
  160    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HttpQueryParamsOnlyOperationRequestSerializer {
  161    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    196   
    fn serialize_input(
  163    197   
        &self,
  164    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    201   
        let input = input
  168    202   
            .downcast::<crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationInput>()
  169    203   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationInput,
  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, "/http-query-params-only").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            fn uri_query(
  185         -
                _input: &crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationInput,
  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 = [];
  190         -
                if let ::std::option::Option::Some(inner_1) = &_input.query_map {
  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         -
                            }
  196         -
                        }
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        if protocol.supports_http_bindings() {
         208  +
            let mut request = protocol
         209  +
                .serialize_body(&input, HttpQueryParamsOnlyOperation::INPUT_SCHEMA, "", _cfg)
         210  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         211  +
            {
         212  +
                let mut uri = "/http-query-params-only".to_string();
         213  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         214  +
                if let Some(ref map) = input.query_map {
         215  +
                    for (k, v) in map {
         216  +
                        query_params.push((k.clone(), v.clone()));
  197    217   
                    }
  198    218   
                }
  199         -
                ::std::result::Result::Ok(())
  200         -
            }
  201         -
            #[allow(clippy::unnecessary_wraps)]
  202         -
            fn update_http_builder(
  203         -
                input: &crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationInput,
  204         -
                builder: ::http_1x::request::Builder,
  205         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  206         -
                let mut uri = ::std::string::String::new();
  207         -
                uri_base(input, &mut uri)?;
  208         -
                uri_query(input, &mut uri)?;
  209         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
         219  +
                if !query_params.is_empty() {
         220  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         221  +
                    let pairs: Vec<String> = query_params
         222  +
                        .iter()
         223  +
                        .map(|(k, v)| {
         224  +
                            format!(
         225  +
                                "{}={}",
         226  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         227  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         228  +
                            )
         229  +
                        })
         230  +
                        .collect();
         231  +
                    uri.push_str(&pairs.join("&"));
         232  +
                }
         233  +
                request.set_uri(uri.as_str()).expect("valid URI");
  210    234   
            }
  211         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  212         -
            builder
  213         -
        };
  214         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  215    235   
  216         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         236  +
            return ::std::result::Result::Ok(request);
         237  +
        } else {
         238  +
            let mut request = protocol
         239  +
                .serialize_request(&input, HttpQueryParamsOnlyOperation::INPUT_SCHEMA, "", _cfg)
         240  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         241  +
         242  +
            return ::std::result::Result::Ok(request);
         243  +
        }
  217    244   
    }
  218    245   
}
  219    246   
#[derive(Debug)]
  220    247   
struct HttpQueryParamsOnlyOperationEndpointParamsInterceptor;
  221    248   
  222    249   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HttpQueryParamsOnlyOperationEndpointParamsInterceptor {
  223    250   
    fn name(&self) -> &'static str {
  224    251   
        "HttpQueryParamsOnlyOperationEndpointParamsInterceptor"
  225    252   
    }
  226    253   

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_query_params_only_operation/_http_query_params_only_operation_input.rs

@@ -1,1 +128,130 @@
   17     17   
    "aws.protocoltests.restjson.synthetic",
   18     18   
    "HttpQueryParamsOnlyOperationInput",
   19     19   
);
   20     20   
static HTTPQUERYPARAMSONLYOPERATIONINPUT_MEMBER_QUERY_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   21     21   
    ::aws_smithy_schema::ShapeId::from_static(
   22     22   
        "aws.protocoltests.restjson.synthetic#HttpQueryParamsOnlyOperationInput$queryMap",
   23     23   
        "aws.protocoltests.restjson.synthetic",
   24     24   
        "HttpQueryParamsOnlyOperationInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Map,
   27         -
    "query_map",
          27  +
    "queryMap",
   28     28   
    0,
   29     29   
)
   30     30   
.with_http_query_params();
   31     31   
static HTTPQUERYPARAMSONLYOPERATIONINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   32     32   
    HTTPQUERYPARAMSONLYOPERATIONINPUT_SCHEMA_ID,
   33     33   
    ::aws_smithy_schema::ShapeType::Structure,
   34     34   
    &[&HTTPQUERYPARAMSONLYOPERATIONINPUT_MEMBER_QUERY_MAP],
   35         -
);
          35  +
)
          36  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/http-query-params-only", None));
   36     37   
impl HttpQueryParamsOnlyOperationInput {
   37     38   
    /// The schema for this shape.
   38     39   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPQUERYPARAMSONLYOPERATIONINPUT_SCHEMA;
   39     40   
}
   40     41   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpQueryParamsOnlyOperationInput {
   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.query_map {
   47     48   
            ser.write_map(
   48     49   
                &HTTPQUERYPARAMSONLYOPERATIONINPUT_MEMBER_QUERY_MAP,
   49     50   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   50     51   
                    for (key, value) in val {
   51     52   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
   52     53   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
   53     54   
                    }
   54     55   
                    Ok(())
   55     56   
                },
   56     57   
            )?;
   57     58   
        }
   58     59   
        Ok(())
   59     60   
    }
   60     61   
}
   61     62   
impl HttpQueryParamsOnlyOperationInput {
   62     63   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   63         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   64         -
        deserializer: &mut D,
          64  +
    pub fn deserialize(
          65  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   65     66   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   66     67   
        #[allow(unused_variables, unused_mut)]
   67     68   
        let mut builder = Self::builder();
   68     69   
        #[allow(
   69     70   
            unused_variables,
   70     71   
            unreachable_code,
   71     72   
            clippy::single_match,
   72     73   
            clippy::match_single_binding,
   73     74   
            clippy::diverging_sub_expression
   74     75   
        )]
   75         -
        deserializer.read_struct(&HTTPQUERYPARAMSONLYOPERATIONINPUT_SCHEMA, (), |_, member, deser| {
          76  +
        deserializer.read_struct(&HTTPQUERYPARAMSONLYOPERATIONINPUT_SCHEMA, &mut |member, deser| {
   76     77   
            match member.member_index() {
   77     78   
                Some(0) => {
   78         -
                    builder.query_map = Some({
   79         -
                        let container = if let Some(cap) = deser.container_size() {
   80         -
                            std::collections::HashMap::with_capacity(cap)
   81         -
                        } else {
   82         -
                            std::collections::HashMap::new()
   83         -
                        };
   84         -
                        deser.read_map(member, container, |mut map, key, deser| {
   85         -
                            map.insert(key, deser.read_string(member)?);
   86         -
                            Ok(map)
   87         -
                        })?
   88         -
                    });
          79  +
                    builder.query_map = Some(deser.read_string_string_map(member)?);
   89     80   
                }
   90     81   
                _ => {}
   91     82   
            }
   92     83   
            Ok(())
   93     84   
        })?;
   94     85   
        builder
   95     86   
            .build()
   96     87   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   97     88   
    }
   98     89   
}
          90  +
impl HttpQueryParamsOnlyOperationInput {
          91  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          92  +
    pub fn deserialize_with_response(
          93  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          94  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          95  +
        _status: u16,
          96  +
        _body: &[u8],
          97  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          98  +
        Self::deserialize(deserializer)
          99  +
    }
         100  +
}
   99    101   
impl HttpQueryParamsOnlyOperationInput {
  100    102   
    /// Creates a new builder-style object to manufacture [`HttpQueryParamsOnlyOperationInput`](crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationInput).
  101    103   
    pub fn builder() -> crate::operation::http_query_params_only_operation::builders::HttpQueryParamsOnlyOperationInputBuilder {
  102    104   
        crate::operation::http_query_params_only_operation::builders::HttpQueryParamsOnlyOperationInputBuilder::default()
  103    105   
    }
  104    106   
}
  105    107   
  106    108   
/// A builder for [`HttpQueryParamsOnlyOperationInput`](crate::operation::http_query_params_only_operation::HttpQueryParamsOnlyOperationInput).
  107    109   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  108    110   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_query_params_only_operation/_http_query_params_only_operation_output.rs

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_request_with_float_labels.rs

@@ -1,1 +40,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `HttpRequestWithFloatLabels`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpRequestWithFloatLabels;
    6      6   
impl HttpRequestWithFloatLabels {
    7      7   
    /// Creates a new `HttpRequestWithFloatLabels`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          13  +
        crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsOutput::SCHEMA;
   11     17   
    pub(crate) async fn orchestrate(
   12     18   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     19   
        input: crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +252,294 @@
  130    136   
                crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsError,
  131    137   
            >::new());
  132    138   
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct HttpRequestWithFloatLabelsResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpRequestWithFloatLabelsResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_http_request_with_float_labels::de_http_request_with_float_labels_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_http_request_with_float_labels::de_http_request_with_float_labels_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, HttpRequestWithFloatLabels::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
         184  +
            )
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  156    190   
    }
  157    191   
}
  158    192   
#[derive(Debug)]
  159    193   
struct HttpRequestWithFloatLabelsRequestSerializer;
  160    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HttpRequestWithFloatLabelsRequestSerializer {
  161    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    196   
    fn serialize_input(
  163    197   
        &self,
  164    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    201   
        let input = input
  168    202   
            .downcast::<crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsInput>()
  169    203   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                let input_1 = &_input.float;
  182         -
                let input_1 = input_1
  183         -
                    .as_ref()
  184         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("float", "cannot be empty or unset"))?;
  185         -
                let mut float_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_1);
  186         -
                let float = float_encoder.encode();
  187         -
                if float.is_empty() {
  188         -
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
  189         -
                        "float",
  190         -
                        "cannot be empty or unset",
  191         -
                    ));
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        if protocol.supports_http_bindings() {
         208  +
            let mut request = protocol
         209  +
                .serialize_body(&input, HttpRequestWithFloatLabels::INPUT_SCHEMA, "", _cfg)
         210  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         211  +
            {
         212  +
                let mut uri = "/FloatHttpLabels/{float}/{double}".to_string();
         213  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         214  +
                if let Some(ref val) = input.float {
         215  +
                    uri = uri.replace(
         216  +
                        "{float}",
         217  +
                        &::aws_smithy_schema::http_protocol::percent_encode(&{
         218  +
                            let s = val.to_string();
         219  +
                            match s.as_str() {
         220  +
                                "inf" => "Infinity".to_string(),
         221  +
                                "-inf" => "-Infinity".to_string(),
         222  +
                                _ => s,
         223  +
                            }
         224  +
                        }),
         225  +
                    );
  192    226   
                }
  193         -
                let input_2 = &_input.double;
  194         -
                let input_2 = input_2
  195         -
                    .as_ref()
  196         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("double", "cannot be empty or unset"))?;
  197         -
                let mut double_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_2);
  198         -
                let double = double_encoder.encode();
  199         -
                if double.is_empty() {
  200         -
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
  201         -
                        "double",
  202         -
                        "cannot be empty or unset",
  203         -
                    ));
         227  +
                if let Some(ref val) = input.double {
         228  +
                    uri = uri.replace(
         229  +
                        "{double}",
         230  +
                        &::aws_smithy_schema::http_protocol::percent_encode(&{
         231  +
                            let s = val.to_string();
         232  +
                            match s.as_str() {
         233  +
                                "inf" => "Infinity".to_string(),
         234  +
                                "-inf" => "-Infinity".to_string(),
         235  +
                                _ => s,
         236  +
                            }
         237  +
                        }),
         238  +
                    );
  204    239   
                }
  205         -
                ::std::write!(output, "/FloatHttpLabels/{float}/{double}", float = float, double = double).expect("formatting should succeed");
  206         -
                ::std::result::Result::Ok(())
  207         -
            }
  208         -
            #[allow(clippy::unnecessary_wraps)]
  209         -
            fn update_http_builder(
  210         -
                input: &crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsInput,
  211         -
                builder: ::http_1x::request::Builder,
  212         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  213         -
                let mut uri = ::std::string::String::new();
  214         -
                uri_base(input, &mut uri)?;
  215         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
         240  +
                if !query_params.is_empty() {
         241  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         242  +
                    let pairs: Vec<String> = query_params
         243  +
                        .iter()
         244  +
                        .map(|(k, v)| {
         245  +
                            format!(
         246  +
                                "{}={}",
         247  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         248  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         249  +
                            )
         250  +
                        })
         251  +
                        .collect();
         252  +
                    uri.push_str(&pairs.join("&"));
         253  +
                }
         254  +
                request.set_uri(uri.as_str()).expect("valid URI");
  216    255   
            }
  217         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  218         -
            builder
  219         -
        };
  220         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  221    256   
  222         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         257  +
            return ::std::result::Result::Ok(request);
         258  +
        } else {
         259  +
            let mut request = protocol
         260  +
                .serialize_request(&input, HttpRequestWithFloatLabels::INPUT_SCHEMA, "", _cfg)
         261  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         262  +
         263  +
            return ::std::result::Result::Ok(request);
         264  +
        }
  223    265   
    }
  224    266   
}
  225    267   
#[derive(Debug)]
  226    268   
struct HttpRequestWithFloatLabelsEndpointParamsInterceptor;
  227    269   
  228    270   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HttpRequestWithFloatLabelsEndpointParamsInterceptor {
  229    271   
    fn name(&self) -> &'static str {
  230    272   
        "HttpRequestWithFloatLabelsEndpointParamsInterceptor"
  231    273   
    }
  232    274   

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_request_with_float_labels/_http_request_with_float_labels_input.rs

@@ -25,25 +135,153 @@
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_label();
   48     48   
static HTTPREQUESTWITHFLOATLABELSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    HTTPREQUESTWITHFLOATLABELSINPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[
   52     52   
        &HTTPREQUESTWITHFLOATLABELSINPUT_MEMBER_FLOAT,
   53     53   
        &HTTPREQUESTWITHFLOATLABELSINPUT_MEMBER_DOUBLE,
   54     54   
    ],
   55         -
);
          55  +
)
          56  +
.with_http(aws_smithy_schema::traits::HttpTrait::new(
          57  +
    "GET",
          58  +
    "/FloatHttpLabels/{float}/{double}",
          59  +
    None,
          60  +
));
   56     61   
impl HttpRequestWithFloatLabelsInput {
   57     62   
    /// The schema for this shape.
   58     63   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPREQUESTWITHFLOATLABELSINPUT_SCHEMA;
   59     64   
}
   60     65   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpRequestWithFloatLabelsInput {
   61     66   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   62     67   
    fn serialize_members(
   63     68   
        &self,
   64     69   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   65     70   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   66     71   
        if let Some(ref val) = self.float {
   67     72   
            ser.write_float(&HTTPREQUESTWITHFLOATLABELSINPUT_MEMBER_FLOAT, *val)?;
   68     73   
        }
   69     74   
        if let Some(ref val) = self.double {
   70     75   
            ser.write_double(&HTTPREQUESTWITHFLOATLABELSINPUT_MEMBER_DOUBLE, *val)?;
   71     76   
        }
   72     77   
        Ok(())
   73     78   
    }
   74     79   
}
   75     80   
impl HttpRequestWithFloatLabelsInput {
   76     81   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   77         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   78         -
        deserializer: &mut D,
          82  +
    pub fn deserialize(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   79     84   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   80     85   
        #[allow(unused_variables, unused_mut)]
   81     86   
        let mut builder = Self::builder();
   82     87   
        #[allow(
   83     88   
            unused_variables,
   84     89   
            unreachable_code,
   85     90   
            clippy::single_match,
   86     91   
            clippy::match_single_binding,
   87     92   
            clippy::diverging_sub_expression
   88     93   
        )]
   89         -
        deserializer.read_struct(&HTTPREQUESTWITHFLOATLABELSINPUT_SCHEMA, (), |_, member, deser| {
          94  +
        deserializer.read_struct(&HTTPREQUESTWITHFLOATLABELSINPUT_SCHEMA, &mut |member, deser| {
   90     95   
            match member.member_index() {
   91     96   
                Some(0) => {
   92     97   
                    builder.float = Some(deser.read_float(member)?);
   93     98   
                }
   94     99   
                Some(1) => {
   95    100   
                    builder.double = Some(deser.read_double(member)?);
   96    101   
                }
   97    102   
                _ => {}
   98    103   
            }
   99    104   
            Ok(())
  100    105   
        })?;
         106  +
        builder.float = builder.float.or(Some(0.0f32));
         107  +
        builder.double = builder.double.or(Some(0.0f64));
  101    108   
        builder
  102    109   
            .build()
  103    110   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  104    111   
    }
  105    112   
}
         113  +
impl HttpRequestWithFloatLabelsInput {
         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  +
}
  106    124   
impl HttpRequestWithFloatLabelsInput {
  107    125   
    /// Creates a new builder-style object to manufacture [`HttpRequestWithFloatLabelsInput`](crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsInput).
  108    126   
    pub fn builder() -> crate::operation::http_request_with_float_labels::builders::HttpRequestWithFloatLabelsInputBuilder {
  109    127   
        crate::operation::http_request_with_float_labels::builders::HttpRequestWithFloatLabelsInputBuilder::default()
  110    128   
    }
  111    129   
}
  112    130   
  113    131   
/// A builder for [`HttpRequestWithFloatLabelsInput`](crate::operation::http_request_with_float_labels::HttpRequestWithFloatLabelsInput).
  114    132   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  115    133   
#[non_exhaustive]

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