Client Test

Client Test

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c (ignoring whitespace)

Files changed:

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

@@ -1,1 +70,84 @@
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct GreetingWithErrorsInput {}
    6      6   
static GREETINGWITHERRORSINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restxml.synthetic#GreetingWithErrorsInput",
    8      8   
    "aws.protocoltests.restxml.synthetic",
    9      9   
    "GreetingWithErrorsInput",
   10     10   
);
   11     11   
static GREETINGWITHERRORSINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(GREETINGWITHERRORSINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(GREETINGWITHERRORSINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("PUT", "/GreetingWithErrors", None));
   13     14   
impl GreetingWithErrorsInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &GREETINGWITHERRORSINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for GreetingWithErrorsInput {
   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 GreetingWithErrorsInput {
   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(&GREETINGWITHERRORSINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&GREETINGWITHERRORSINPUT_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 GreetingWithErrorsInput {
          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 GreetingWithErrorsInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`GreetingWithErrorsInput`](crate::operation::greeting_with_errors::GreetingWithErrorsInput).
   53     67   
    pub fn builder() -> crate::operation::greeting_with_errors::builders::GreetingWithErrorsInputBuilder {
   54     68   
        crate::operation::greeting_with_errors::builders::GreetingWithErrorsInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`GreetingWithErrorsInput`](crate::operation::greeting_with_errors::GreetingWithErrorsInput).
   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_xml/rust-client-codegen/src/operation/greeting_with_errors/_greeting_with_errors_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.greeting {
   47     47   
            ser.write_string(&GREETINGWITHERRORSOUTPUT_MEMBER_GREETING, val)?;
   48     48   
        }
   49     49   
        Ok(())
   50     50   
    }
   51     51   
}
   52     52   
impl GreetingWithErrorsOutput {
   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(&GREETINGWITHERRORSOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&GREETINGWITHERRORSOUTPUT_SCHEMA, &mut |member, deser| {
   67     67   
            match member.member_index() {
   68     68   
                Some(0) => {
   69     69   
                    builder.greeting = Some(deser.read_string(member)?);
   70     70   
                }
   71     71   
                _ => {}
   72     72   
            }
   73     73   
            Ok(())
   74     74   
        })?;
   75     75   
        Ok(builder.build())
   76     76   
    }
   77     77   
}
          78  +
impl GreetingWithErrorsOutput {
          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 let Some(val) = headers.get("X-Greeting") {
          91  +
            builder.greeting = Some(val.to_string());
          92  +
        }
          93  +
        Ok(builder.build())
          94  +
    }
          95  +
}
   78     96   
impl GreetingWithErrorsOutput {
   79     97   
    /// Creates a new builder-style object to manufacture [`GreetingWithErrorsOutput`](crate::operation::greeting_with_errors::GreetingWithErrorsOutput).
   80     98   
    pub fn builder() -> crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder {
   81     99   
        crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder::default()
   82    100   
    }
   83    101   
}
   84    102   
   85    103   
/// A builder for [`GreetingWithErrorsOutput`](crate::operation::greeting_with_errors::GreetingWithErrorsOutput).
   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_xml/rust-client-codegen/src/operation/http_empty_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 `HttpEmptyPrefixHeaders`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpEmptyPrefixHeaders;
    6      6   
impl HttpEmptyPrefixHeaders {
    7      7   
    /// Creates a new `HttpEmptyPrefixHeaders`
    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_empty_prefix_headers::HttpEmptyPrefixHeadersInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersOutput::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_empty_prefix_headers::HttpEmptyPrefixHeadersInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +172,177 @@
  130    134   
                crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersError,
  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 HttpEmptyPrefixHeadersResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpEmptyPrefixHeadersResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145    150   
        let headers = response.headers();
  146    151   
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150    155   
        let parse_result = if !success && status != 200 || force_error {
  151    156   
            crate::protocol_serde::shape_http_empty_prefix_headers::de_http_empty_prefix_headers_http_error(status, headers, body)
  152    157   
        } else {
@@ -289,294 +349,358 @@
  309    314   
            .expect("the config must have a deserializer");
  310    315   
  311    316   
        let parsed = de.deserialize_streaming(&mut http_response);
  312    317   
        let parsed = parsed.unwrap_or_else(|| {
  313    318   
            let http_response = http_response.map(|body| {
  314    319   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  315    320   
                    body.bytes().unwrap(),
  316    321   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  317    322   
                )))
  318    323   
            });
  319         -
            de.deserialize_nonstreaming(&http_response)
         324  +
            // Build a config bag with the protocol for schema-based deserialization
         325  +
            #[allow(unused_mut)]
         326  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         327  +
         328  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  320    329   
        });
  321    330   
        let parsed = parsed
  322    331   
            .expect("should be successful response")
  323    332   
            .downcast::<crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersOutput>()
  324    333   
            .unwrap();
  325    334   
        ::pretty_assertions::assert_eq!(
  326    335   
            parsed.prefix_headers,
  327    336   
            expected_output.prefix_headers,
  328    337   
            "Unexpected value for `prefix_headers`"
  329    338   
        );

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_empty_prefix_headers/_http_empty_prefix_headers_input.rs

@@ -3,3 +154,176 @@
   23     23   
    "aws.protocoltests.restxml.synthetic",
   24     24   
    "HttpEmptyPrefixHeadersInput",
   25     25   
);
   26     26   
static HTTPEMPTYPREFIXHEADERSINPUT_MEMBER_PREFIX_HEADERS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   27     27   
    ::aws_smithy_schema::ShapeId::from_static(
   28     28   
        "aws.protocoltests.restxml.synthetic#HttpEmptyPrefixHeadersInput$prefixHeaders",
   29     29   
        "aws.protocoltests.restxml.synthetic",
   30     30   
        "HttpEmptyPrefixHeadersInput",
   31     31   
    ),
   32     32   
    ::aws_smithy_schema::ShapeType::Map,
   33         -
    "prefix_headers",
          33  +
    "prefixHeaders",
   34     34   
    0,
   35     35   
)
   36     36   
.with_http_prefix_headers("");
   37     37   
static HTTPEMPTYPREFIXHEADERSINPUT_MEMBER_SPECIFIC_HEADER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restxml.synthetic#HttpEmptyPrefixHeadersInput$specificHeader",
   40     40   
        "aws.protocoltests.restxml.synthetic",
   41     41   
        "HttpEmptyPrefixHeadersInput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::String,
   44         -
    "specific_header",
          44  +
    "specificHeader",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_header("hello");
   48     48   
static HTTPEMPTYPREFIXHEADERSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    HTTPEMPTYPREFIXHEADERSINPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[
   52     52   
        &HTTPEMPTYPREFIXHEADERSINPUT_MEMBER_PREFIX_HEADERS,
   53     53   
        &HTTPEMPTYPREFIXHEADERSINPUT_MEMBER_SPECIFIC_HEADER,
   54     54   
    ],
   55         -
);
          55  +
)
          56  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/HttpEmptyPrefixHeaders", None));
   56     57   
impl HttpEmptyPrefixHeadersInput {
   57     58   
    /// The schema for this shape.
   58     59   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPEMPTYPREFIXHEADERSINPUT_SCHEMA;
   59     60   
}
   60     61   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpEmptyPrefixHeadersInput {
   61     62   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   62     63   
    fn serialize_members(
   63     64   
        &self,
   64     65   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   65     66   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   66     67   
        if let Some(ref val) = self.prefix_headers {
   67     68   
            ser.write_map(
   68     69   
                &HTTPEMPTYPREFIXHEADERSINPUT_MEMBER_PREFIX_HEADERS,
   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   
        if let Some(ref val) = self.specific_header {
   79     80   
            ser.write_string(&HTTPEMPTYPREFIXHEADERSINPUT_MEMBER_SPECIFIC_HEADER, val)?;
   80     81   
        }
   81     82   
        Ok(())
   82     83   
    }
   83     84   
}
   84     85   
impl HttpEmptyPrefixHeadersInput {
   85     86   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   86         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   87         -
        deserializer: &mut D,
          87  +
    pub fn deserialize(
          88  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   88     89   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   89     90   
        #[allow(unused_variables, unused_mut)]
   90     91   
        let mut builder = Self::builder();
   91     92   
        #[allow(
   92     93   
            unused_variables,
   93     94   
            unreachable_code,
   94     95   
            clippy::single_match,
   95     96   
            clippy::match_single_binding,
   96     97   
            clippy::diverging_sub_expression
   97     98   
        )]
   98         -
        deserializer.read_struct(&HTTPEMPTYPREFIXHEADERSINPUT_SCHEMA, (), |_, member, deser| {
          99  +
        deserializer.read_struct(&HTTPEMPTYPREFIXHEADERSINPUT_SCHEMA, &mut |member, deser| {
   99    100   
            match member.member_index() {
  100    101   
                Some(0) => {
  101         -
                    builder.prefix_headers = 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.prefix_headers = Some(deser.read_string_string_map(member)?);
  112    103   
                }
  113    104   
                Some(1) => {
  114    105   
                    builder.specific_header = Some(deser.read_string(member)?);
  115    106   
                }
  116    107   
                _ => {}
  117    108   
            }
  118    109   
            Ok(())
  119    110   
        })?;
  120    111   
        builder
  121    112   
            .build()
  122    113   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  123    114   
    }
  124    115   
}
         116  +
impl HttpEmptyPrefixHeadersInput {
         117  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         118  +
    /// Header-bound members are read directly from headers, avoiding runtime
         119  +
    /// member iteration overhead. Body members are read via the deserializer.
         120  +
    pub fn deserialize_with_response(
         121  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         122  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         123  +
        _status: u16,
         124  +
        _body: &[u8],
         125  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         126  +
        #[allow(unused_variables, unused_mut)]
         127  +
        let mut builder = Self::builder();
         128  +
        if let Some(val) = headers.get("hello") {
         129  +
            builder.specific_header = Some(val.to_string());
         130  +
        }
         131  +
        {
         132  +
            let mut map = ::std::collections::HashMap::new();
         133  +
            for (key, val) in headers.iter() {
         134  +
                if let Some(suffix) = key.strip_prefix("") {
         135  +
                    map.insert(suffix.to_string(), val.to_string());
         136  +
                }
         137  +
            }
         138  +
            if !map.is_empty() {
         139  +
                builder.prefix_headers = Some(map);
         140  +
            }
         141  +
        }
         142  +
        builder
         143  +
            .build()
         144  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         145  +
    }
         146  +
}
  125    147   
impl HttpEmptyPrefixHeadersInput {
  126    148   
    /// Creates a new builder-style object to manufacture [`HttpEmptyPrefixHeadersInput`](crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersInput).
  127    149   
    pub fn builder() -> crate::operation::http_empty_prefix_headers::builders::HttpEmptyPrefixHeadersInputBuilder {
  128    150   
        crate::operation::http_empty_prefix_headers::builders::HttpEmptyPrefixHeadersInputBuilder::default()
  129    151   
    }
  130    152   
}
  131    153   
  132    154   
/// A builder for [`HttpEmptyPrefixHeadersInput`](crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersInput).
  133    155   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  134    156   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_empty_prefix_headers/_http_empty_prefix_headers_output.rs

@@ -3,3 +152,171 @@
   23     23   
    "aws.protocoltests.restxml.synthetic",
   24     24   
    "HttpEmptyPrefixHeadersOutput",
   25     25   
);
   26     26   
static HTTPEMPTYPREFIXHEADERSOUTPUT_MEMBER_PREFIX_HEADERS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   27     27   
    ::aws_smithy_schema::ShapeId::from_static(
   28     28   
        "aws.protocoltests.restxml.synthetic#HttpEmptyPrefixHeadersOutput$prefixHeaders",
   29     29   
        "aws.protocoltests.restxml.synthetic",
   30     30   
        "HttpEmptyPrefixHeadersOutput",
   31     31   
    ),
   32     32   
    ::aws_smithy_schema::ShapeType::Map,
   33         -
    "prefix_headers",
          33  +
    "prefixHeaders",
   34     34   
    0,
   35     35   
)
   36     36   
.with_http_prefix_headers("");
   37     37   
static HTTPEMPTYPREFIXHEADERSOUTPUT_MEMBER_SPECIFIC_HEADER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restxml.synthetic#HttpEmptyPrefixHeadersOutput$specificHeader",
   40     40   
        "aws.protocoltests.restxml.synthetic",
   41     41   
        "HttpEmptyPrefixHeadersOutput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::String,
   44         -
    "specific_header",
          44  +
    "specificHeader",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_header("hello");
   48     48   
static HTTPEMPTYPREFIXHEADERSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    HTTPEMPTYPREFIXHEADERSOUTPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[
   52     52   
        &HTTPEMPTYPREFIXHEADERSOUTPUT_MEMBER_PREFIX_HEADERS,
   53     53   
        &HTTPEMPTYPREFIXHEADERSOUTPUT_MEMBER_SPECIFIC_HEADER,
   54     54   
    ],
   55     55   
);
   56     56   
impl HttpEmptyPrefixHeadersOutput {
   57     57   
    /// The schema for this shape.
   58     58   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPEMPTYPREFIXHEADERSOUTPUT_SCHEMA;
   59     59   
}
   60     60   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpEmptyPrefixHeadersOutput {
   61     61   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   62     62   
    fn serialize_members(
   63     63   
        &self,
   64     64   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   65     65   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   66     66   
        if let Some(ref val) = self.prefix_headers {
   67     67   
            ser.write_map(
   68     68   
                &HTTPEMPTYPREFIXHEADERSOUTPUT_MEMBER_PREFIX_HEADERS,
   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   
        if let Some(ref val) = self.specific_header {
   79     79   
            ser.write_string(&HTTPEMPTYPREFIXHEADERSOUTPUT_MEMBER_SPECIFIC_HEADER, val)?;
   80     80   
        }
   81     81   
        Ok(())
   82     82   
    }
   83     83   
}
   84     84   
impl HttpEmptyPrefixHeadersOutput {
   85     85   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   86         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   87         -
        deserializer: &mut D,
          86  +
    pub fn deserialize(
          87  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   88     88   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   89     89   
        #[allow(unused_variables, unused_mut)]
   90     90   
        let mut builder = Self::builder();
   91     91   
        #[allow(
   92     92   
            unused_variables,
   93     93   
            unreachable_code,
   94     94   
            clippy::single_match,
   95     95   
            clippy::match_single_binding,
   96     96   
            clippy::diverging_sub_expression
   97     97   
        )]
   98         -
        deserializer.read_struct(&HTTPEMPTYPREFIXHEADERSOUTPUT_SCHEMA, (), |_, member, deser| {
          98  +
        deserializer.read_struct(&HTTPEMPTYPREFIXHEADERSOUTPUT_SCHEMA, &mut |member, deser| {
   99     99   
            match member.member_index() {
  100    100   
                Some(0) => {
  101         -
                    builder.prefix_headers = 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.prefix_headers = Some(deser.read_string_string_map(member)?);
  112    102   
                }
  113    103   
                Some(1) => {
  114    104   
                    builder.specific_header = Some(deser.read_string(member)?);
  115    105   
                }
  116    106   
                _ => {}
  117    107   
            }
  118    108   
            Ok(())
  119    109   
        })?;
  120    110   
        Ok(builder.build())
  121    111   
    }
  122    112   
}
         113  +
impl HttpEmptyPrefixHeadersOutput {
         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("hello") {
         126  +
            builder.specific_header = 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("") {
         132  +
                    map.insert(suffix.to_string(), val.to_string());
         133  +
                }
         134  +
            }
         135  +
            if !map.is_empty() {
         136  +
                builder.prefix_headers = Some(map);
         137  +
            }
         138  +
        }
         139  +
        Ok(builder.build())
         140  +
    }
         141  +
}
  123    142   
impl HttpEmptyPrefixHeadersOutput {
  124    143   
    /// Creates a new builder-style object to manufacture [`HttpEmptyPrefixHeadersOutput`](crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersOutput).
  125    144   
    pub fn builder() -> crate::operation::http_empty_prefix_headers::builders::HttpEmptyPrefixHeadersOutputBuilder {
  126    145   
        crate::operation::http_empty_prefix_headers::builders::HttpEmptyPrefixHeadersOutputBuilder::default()
  127    146   
    }
  128    147   
}
  129    148   
  130    149   
/// A builder for [`HttpEmptyPrefixHeadersOutput`](crate::operation::http_empty_prefix_headers::HttpEmptyPrefixHeadersOutput).
  131    150   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  132    151   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_enum_payload.rs

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `HttpEnumPayload`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpEnumPayload;
    6      6   
impl HttpEnumPayload {
    7      7   
    /// Creates a new `HttpEnumPayload`
    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_enum_payload::HttpEnumPayloadInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::http_enum_payload::HttpEnumPayloadOutput::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_enum_payload::HttpEnumPayloadInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::http_enum_payload::HttpEnumPayloadOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::http_enum_payload::HttpEnumPayloadError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +166,171 @@
  124    128   
                crate::operation::http_enum_payload::HttpEnumPayloadError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct HttpEnumPayloadResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpEnumPayloadResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139    144   
        let headers = response.headers();
  140    145   
        let body = response.body().bytes().expect("body loaded");
  141    146   
        #[allow(unused_mut)]
  142    147   
        let mut force_error = false;
  143    148   
  144    149   
        let parse_result = if !success && status != 200 || force_error {
  145    150   
            crate::protocol_serde::shape_http_enum_payload::de_http_enum_payload_http_error(status, headers, body)
  146    151   
        } else {
@@ -278,283 +338,347 @@
  298    303   
            .expect("the config must have a deserializer");
  299    304   
  300    305   
        let parsed = de.deserialize_streaming(&mut http_response);
  301    306   
        let parsed = parsed.unwrap_or_else(|| {
  302    307   
            let http_response = http_response.map(|body| {
  303    308   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  304    309   
                    body.bytes().unwrap(),
  305    310   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  306    311   
                )))
  307    312   
            });
  308         -
            de.deserialize_nonstreaming(&http_response)
         313  +
            // Build a config bag with the protocol for schema-based deserialization
         314  +
            #[allow(unused_mut)]
         315  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         316  +
         317  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  309    318   
        });
  310    319   
        let parsed = parsed
  311    320   
            .expect("should be successful response")
  312    321   
            .downcast::<crate::operation::http_enum_payload::HttpEnumPayloadOutput>()
  313    322   
            .unwrap();
  314    323   
        ::pretty_assertions::assert_eq!(parsed.payload, expected_output.payload, "Unexpected value for `payload`");
  315    324   
    }
  316    325   
}
  317    326   
  318    327   
/// Error type for the `HttpEnumPayloadError` operation.

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_enum_payload/_http_enum_payload_input.rs

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

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_enum_payload/_http_enum_payload_output.rs

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

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_payload_traits.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 `HttpPayloadTraits`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpPayloadTraits;
    6      6   
impl HttpPayloadTraits {
    7      7   
    /// Creates a new `HttpPayloadTraits`
    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_traits::HttpPayloadTraitsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::http_payload_traits::HttpPayloadTraitsOutput::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_traits::HttpPayloadTraitsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::http_payload_traits::HttpPayloadTraitsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::http_payload_traits::HttpPayloadTraitsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +172,177 @@
  130    134   
                crate::operation::http_payload_traits::HttpPayloadTraitsError,
  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 HttpPayloadTraitsResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpPayloadTraitsResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145    150   
        let headers = response.headers();
  146    151   
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150    155   
        let parse_result = if !success && status != 200 || force_error {
  151    156   
            crate::protocol_serde::shape_http_payload_traits::de_http_payload_traits_http_error(status, headers, body)
  152    157   
        } else {
@@ -318,323 +421,434 @@
  338    343   
            .expect("the config must have a deserializer");
  339    344   
  340    345   
        let parsed = de.deserialize_streaming(&mut http_response);
  341    346   
        let parsed = parsed.unwrap_or_else(|| {
  342    347   
            let http_response = http_response.map(|body| {
  343    348   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  344    349   
                    body.bytes().unwrap(),
  345    350   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  346    351   
                )))
  347    352   
            });
  348         -
            de.deserialize_nonstreaming(&http_response)
         353  +
            // Build a config bag with the protocol for schema-based deserialization
         354  +
            #[allow(unused_mut)]
         355  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         356  +
         357  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  349    358   
        });
  350    359   
        let parsed = parsed
  351    360   
            .expect("should be successful response")
  352    361   
            .downcast::<crate::operation::http_payload_traits::HttpPayloadTraitsOutput>()
  353    362   
            .unwrap();
  354    363   
        ::pretty_assertions::assert_eq!(parsed.foo, expected_output.foo, "Unexpected value for `foo`");
  355    364   
        ::pretty_assertions::assert_eq!(parsed.blob, expected_output.blob, "Unexpected value for `blob`");
  356    365   
    }
  357    366   
  358    367   
    /// Serializes an empty blob in the HTTP payload
  359    368   
    /// Test ID: HttpPayloadTraitsWithNoBlobBody
  360    369   
    #[::tokio::test]
  361    370   
    #[::tracing_test::traced_test]
  362    371   
    async fn http_payload_traits_with_no_blob_body_response() {
  363    372   
        let expected_output = crate::operation::http_payload_traits::HttpPayloadTraitsOutput::builder()
  364    373   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  365    374   
            .build();
  366    375   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  367    376   
            ::http_1x::response::Builder::new()
  368    377   
                .header("X-Foo", "Foo")
  369    378   
                .status(200)
  370    379   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  371    380   
                .unwrap(),
  372    381   
        )
  373    382   
        .unwrap();
  374    383   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  375    384   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  376    385   
  377    386   
        let op = crate::operation::http_payload_traits::HttpPayloadTraits::new();
  378    387   
        let config = op.config().expect("the operation has config");
  379    388   
        let de = config
  380    389   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  381    390   
            .expect("the config must have a deserializer");
  382    391   
  383    392   
        let parsed = de.deserialize_streaming(&mut http_response);
  384    393   
        let parsed = parsed.unwrap_or_else(|| {
  385    394   
            let http_response = http_response.map(|body| {
  386    395   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  387    396   
                    body.bytes().unwrap(),
  388    397   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  389    398   
                )))
  390    399   
            });
  391         -
            de.deserialize_nonstreaming(&http_response)
         400  +
            // Build a config bag with the protocol for schema-based deserialization
         401  +
            #[allow(unused_mut)]
         402  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         403  +
         404  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  392    405   
        });
  393    406   
        let parsed = parsed
  394    407   
            .expect("should be successful response")
  395    408   
            .downcast::<crate::operation::http_payload_traits::HttpPayloadTraitsOutput>()
  396    409   
            .unwrap();
  397    410   
        ::pretty_assertions::assert_eq!(parsed.foo, expected_output.foo, "Unexpected value for `foo`");
  398    411   
        ::pretty_assertions::assert_eq!(parsed.blob, expected_output.blob, "Unexpected value for `blob`");
  399    412   
    }
  400    413   
}
  401    414   

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_payload_traits/_http_payload_traits_input.rs

@@ -22,22 +132,156 @@
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::Blob,
   44     44   
    "blob",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_payload();
   48     48   
static HTTPPAYLOADTRAITSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    HTTPPAYLOADTRAITSINPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[&HTTPPAYLOADTRAITSINPUT_MEMBER_FOO, &HTTPPAYLOADTRAITSINPUT_MEMBER_BLOB],
   52         -
);
          52  +
)
          53  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/HttpPayloadTraits", None));
   53     54   
impl HttpPayloadTraitsInput {
   54     55   
    /// The schema for this shape.
   55     56   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPAYLOADTRAITSINPUT_SCHEMA;
   56     57   
}
   57     58   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPayloadTraitsInput {
   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(&HTTPPAYLOADTRAITSINPUT_MEMBER_FOO, val)?;
   65     66   
        }
   66     67   
        if let Some(ref val) = self.blob {
   67     68   
            ser.write_blob(&HTTPPAYLOADTRAITSINPUT_MEMBER_BLOB, val)?;
   68     69   
        }
   69     70   
        Ok(())
   70     71   
    }
   71     72   
}
   72     73   
impl HttpPayloadTraitsInput {
   73     74   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   74         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   75         -
        deserializer: &mut D,
          75  +
    pub fn deserialize(
          76  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   76     77   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   77     78   
        #[allow(unused_variables, unused_mut)]
   78     79   
        let mut builder = Self::builder();
   79     80   
        #[allow(
   80     81   
            unused_variables,
   81     82   
            unreachable_code,
   82     83   
            clippy::single_match,
   83     84   
            clippy::match_single_binding,
   84     85   
            clippy::diverging_sub_expression
   85     86   
        )]
   86         -
        deserializer.read_struct(&HTTPPAYLOADTRAITSINPUT_SCHEMA, (), |_, member, deser| {
          87  +
        deserializer.read_struct(&HTTPPAYLOADTRAITSINPUT_SCHEMA, &mut |member, deser| {
   87     88   
            match member.member_index() {
   88     89   
                Some(0) => {
   89     90   
                    builder.foo = Some(deser.read_string(member)?);
   90     91   
                }
   91     92   
                Some(1) => {
   92     93   
                    builder.blob = Some(deser.read_blob(member)?);
   93     94   
                }
   94     95   
                _ => {}
   95     96   
            }
   96     97   
            Ok(())
   97     98   
        })?;
   98     99   
        builder
   99    100   
            .build()
  100    101   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  101    102   
    }
  102    103   
}
         104  +
impl HttpPayloadTraitsInput {
         105  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         106  +
    /// Header-bound members are read directly from headers, avoiding runtime
         107  +
    /// member iteration overhead. Body members are read via the deserializer.
         108  +
    pub fn deserialize_with_response(
         109  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         110  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         111  +
        _status: u16,
         112  +
        body: &[u8],
         113  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         114  +
        #[allow(unused_variables, unused_mut)]
         115  +
        let mut builder = Self::builder();
         116  +
        if let Some(val) = headers.get("X-Foo") {
         117  +
            builder.foo = Some(val.to_string());
         118  +
        }
         119  +
        if !body.is_empty() {
         120  +
            builder.blob = Some(::aws_smithy_types::Blob::new(body.to_vec()));
         121  +
        }
         122  +
        builder
         123  +
            .build()
         124  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         125  +
    }
         126  +
}
  103    127   
impl HttpPayloadTraitsInput {
  104    128   
    /// Creates a new builder-style object to manufacture [`HttpPayloadTraitsInput`](crate::operation::http_payload_traits::HttpPayloadTraitsInput).
  105    129   
    pub fn builder() -> crate::operation::http_payload_traits::builders::HttpPayloadTraitsInputBuilder {
  106    130   
        crate::operation::http_payload_traits::builders::HttpPayloadTraitsInputBuilder::default()
  107    131   
    }
  108    132   
}
  109    133   
  110    134   
/// A builder for [`HttpPayloadTraitsInput`](crate::operation::http_payload_traits::HttpPayloadTraitsInput).
  111    135   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  112    136   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_payload_traits/_http_payload_traits_output.rs

@@ -44,44 +130,151 @@
   64     64   
            ser.write_string(&HTTPPAYLOADTRAITSOUTPUT_MEMBER_FOO, val)?;
   65     65   
        }
   66     66   
        if let Some(ref val) = self.blob {
   67     67   
            ser.write_blob(&HTTPPAYLOADTRAITSOUTPUT_MEMBER_BLOB, val)?;
   68     68   
        }
   69     69   
        Ok(())
   70     70   
    }
   71     71   
}
   72     72   
impl HttpPayloadTraitsOutput {
   73     73   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   74         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   75         -
        deserializer: &mut D,
          74  +
    pub fn deserialize(
          75  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   76     76   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   77     77   
        #[allow(unused_variables, unused_mut)]
   78     78   
        let mut builder = Self::builder();
   79     79   
        #[allow(
   80     80   
            unused_variables,
   81     81   
            unreachable_code,
   82     82   
            clippy::single_match,
   83     83   
            clippy::match_single_binding,
   84     84   
            clippy::diverging_sub_expression
   85     85   
        )]
   86         -
        deserializer.read_struct(&HTTPPAYLOADTRAITSOUTPUT_SCHEMA, (), |_, member, deser| {
          86  +
        deserializer.read_struct(&HTTPPAYLOADTRAITSOUTPUT_SCHEMA, &mut |member, deser| {
   87     87   
            match member.member_index() {
   88     88   
                Some(0) => {
   89     89   
                    builder.foo = Some(deser.read_string(member)?);
   90     90   
                }
   91     91   
                Some(1) => {
   92     92   
                    builder.blob = Some(deser.read_blob(member)?);
   93     93   
                }
   94     94   
                _ => {}
   95     95   
            }
   96     96   
            Ok(())
   97     97   
        })?;
   98     98   
        Ok(builder.build())
   99     99   
    }
  100    100   
}
         101  +
impl HttpPayloadTraitsOutput {
         102  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         103  +
    /// Header-bound members are read directly from headers, avoiding runtime
         104  +
    /// member iteration overhead. Body members are read via the deserializer.
         105  +
    pub fn deserialize_with_response(
         106  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         107  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         108  +
        _status: u16,
         109  +
        body: &[u8],
         110  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         111  +
        #[allow(unused_variables, unused_mut)]
         112  +
        let mut builder = Self::builder();
         113  +
        if let Some(val) = headers.get("X-Foo") {
         114  +
            builder.foo = Some(val.to_string());
         115  +
        }
         116  +
        if !body.is_empty() {
         117  +
            builder.blob = Some(::aws_smithy_types::Blob::new(body.to_vec()));
         118  +
        }
         119  +
        Ok(builder.build())
         120  +
    }
         121  +
}
  101    122   
impl HttpPayloadTraitsOutput {
  102    123   
    /// Creates a new builder-style object to manufacture [`HttpPayloadTraitsOutput`](crate::operation::http_payload_traits::HttpPayloadTraitsOutput).
  103    124   
    pub fn builder() -> crate::operation::http_payload_traits::builders::HttpPayloadTraitsOutputBuilder {
  104    125   
        crate::operation::http_payload_traits::builders::HttpPayloadTraitsOutputBuilder::default()
  105    126   
    }
  106    127   
}
  107    128   
  108    129   
/// A builder for [`HttpPayloadTraitsOutput`](crate::operation::http_payload_traits::HttpPayloadTraitsOutput).
  109    130   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  110    131   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_payload_traits_with_media_type.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 `HttpPayloadTraitsWithMediaType`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpPayloadTraitsWithMediaType;
    6      6   
impl HttpPayloadTraitsWithMediaType {
    7      7   
    /// Creates a new `HttpPayloadTraitsWithMediaType`
    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_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeOutput::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_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +172,179 @@
  130    136   
                crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeError,
  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 HttpPayloadTraitsWithMediaTypeResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpPayloadTraitsWithMediaTypeResponseDeserializer {
  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    152   
        let headers = response.headers();
  146    153   
        let body = response.body().bytes().expect("body loaded");
  147    154   
        #[allow(unused_mut)]
  148    155   
        let mut force_error = false;
  149    156   
  150    157   
        let parse_result = if !success && status != 200 || force_error {
  151    158   
            crate::protocol_serde::shape_http_payload_traits_with_media_type::de_http_payload_traits_with_media_type_http_error(status, headers, body)
  152    159   
        } else {
@@ -293,300 +353,364 @@
  313    320   
            .expect("the config must have a deserializer");
  314    321   
  315    322   
        let parsed = de.deserialize_streaming(&mut http_response);
  316    323   
        let parsed = parsed.unwrap_or_else(|| {
  317    324   
            let http_response = http_response.map(|body| {
  318    325   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  319    326   
                    body.bytes().unwrap(),
  320    327   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  321    328   
                )))
  322    329   
            });
  323         -
            de.deserialize_nonstreaming(&http_response)
         330  +
            // Build a config bag with the protocol for schema-based deserialization
         331  +
            #[allow(unused_mut)]
         332  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         333  +
         334  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  324    335   
        });
  325    336   
        let parsed = parsed
  326    337   
            .expect("should be successful response")
  327    338   
            .downcast::<crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeOutput>()
  328    339   
            .unwrap();
  329    340   
        ::pretty_assertions::assert_eq!(parsed.foo, expected_output.foo, "Unexpected value for `foo`");
  330    341   
        ::pretty_assertions::assert_eq!(parsed.blob, expected_output.blob, "Unexpected value for `blob`");
  331    342   
    }
  332    343   
}
  333    344   

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_payload_traits_with_media_type/_http_payload_traits_with_media_type_input.rs

@@ -17,17 +135,160 @@
   37     37   
static HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_MEMBER_BLOB: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restxml.synthetic#HttpPayloadTraitsWithMediaTypeInput$blob",
   40     40   
        "aws.protocoltests.restxml.synthetic",
   41     41   
        "HttpPayloadTraitsWithMediaTypeInput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::Blob,
   44     44   
    "blob",
   45     45   
    1,
   46     46   
)
   47         -
.with_http_payload();
          47  +
.with_http_payload()
          48  +
.with_media_type("text/plain");
   48     49   
static HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     50   
    HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_SCHEMA_ID,
   50     51   
    ::aws_smithy_schema::ShapeType::Structure,
   51     52   
    &[
   52     53   
        &HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_MEMBER_FOO,
   53     54   
        &HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_MEMBER_BLOB,
   54     55   
    ],
   55         -
);
          56  +
)
          57  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/HttpPayloadTraitsWithMediaType", None));
   56     58   
impl HttpPayloadTraitsWithMediaTypeInput {
   57     59   
    /// The schema for this shape.
   58     60   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_SCHEMA;
   59     61   
}
   60     62   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPayloadTraitsWithMediaTypeInput {
   61     63   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   62     64   
    fn serialize_members(
   63     65   
        &self,
   64     66   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   65     67   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   66     68   
        if let Some(ref val) = self.foo {
   67     69   
            ser.write_string(&HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_MEMBER_FOO, val)?;
   68     70   
        }
   69     71   
        if let Some(ref val) = self.blob {
   70     72   
            ser.write_blob(&HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_MEMBER_BLOB, val)?;
   71     73   
        }
   72     74   
        Ok(())
   73     75   
    }
   74     76   
}
   75     77   
impl HttpPayloadTraitsWithMediaTypeInput {
   76     78   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   77         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   78         -
        deserializer: &mut D,
          79  +
    pub fn deserialize(
          80  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   79     81   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   80     82   
        #[allow(unused_variables, unused_mut)]
   81     83   
        let mut builder = Self::builder();
   82     84   
        #[allow(
   83     85   
            unused_variables,
   84     86   
            unreachable_code,
   85     87   
            clippy::single_match,
   86     88   
            clippy::match_single_binding,
   87     89   
            clippy::diverging_sub_expression
   88     90   
        )]
   89         -
        deserializer.read_struct(&HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_SCHEMA, (), |_, member, deser| {
          91  +
        deserializer.read_struct(&HTTPPAYLOADTRAITSWITHMEDIATYPEINPUT_SCHEMA, &mut |member, deser| {
   90     92   
            match member.member_index() {
   91     93   
                Some(0) => {
   92     94   
                    builder.foo = Some(deser.read_string(member)?);
   93     95   
                }
   94     96   
                Some(1) => {
   95     97   
                    builder.blob = Some(deser.read_blob(member)?);
   96     98   
                }
   97     99   
                _ => {}
   98    100   
            }
   99    101   
            Ok(())
  100    102   
        })?;
  101    103   
        builder
  102    104   
            .build()
  103    105   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  104    106   
    }
  105    107   
}
         108  +
impl HttpPayloadTraitsWithMediaTypeInput {
         109  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         110  +
    /// Header-bound members are read directly from headers, avoiding runtime
         111  +
    /// member iteration overhead. Body members are read via the deserializer.
         112  +
    pub fn deserialize_with_response(
         113  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         114  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         115  +
        _status: u16,
         116  +
        body: &[u8],
         117  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         118  +
        #[allow(unused_variables, unused_mut)]
         119  +
        let mut builder = Self::builder();
         120  +
        if let Some(val) = headers.get("X-Foo") {
         121  +
            builder.foo = Some(val.to_string());
         122  +
        }
         123  +
        if !body.is_empty() {
         124  +
            builder.blob = Some(::aws_smithy_types::Blob::new(body.to_vec()));
         125  +
        }
         126  +
        builder
         127  +
            .build()
         128  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         129  +
    }
         130  +
}
  106    131   
impl HttpPayloadTraitsWithMediaTypeInput {
  107    132   
    /// Creates a new builder-style object to manufacture [`HttpPayloadTraitsWithMediaTypeInput`](crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeInput).
  108    133   
    pub fn builder() -> crate::operation::http_payload_traits_with_media_type::builders::HttpPayloadTraitsWithMediaTypeInputBuilder {
  109    134   
        crate::operation::http_payload_traits_with_media_type::builders::HttpPayloadTraitsWithMediaTypeInputBuilder::default()
  110    135   
    }
  111    136   
}
  112    137   
  113    138   
/// A builder for [`HttpPayloadTraitsWithMediaTypeInput`](crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeInput).
  114    139   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  115    140   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_payload_traits_with_media_type/_http_payload_traits_with_media_type_output.rs

@@ -17,17 +133,155 @@
   37     37   
static HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_MEMBER_BLOB: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restxml.synthetic#HttpPayloadTraitsWithMediaTypeOutput$blob",
   40     40   
        "aws.protocoltests.restxml.synthetic",
   41     41   
        "HttpPayloadTraitsWithMediaTypeOutput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::Blob,
   44     44   
    "blob",
   45     45   
    1,
   46     46   
)
   47         -
.with_http_payload();
          47  +
.with_http_payload()
          48  +
.with_media_type("text/plain");
   48     49   
static HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     50   
    HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_SCHEMA_ID,
   50     51   
    ::aws_smithy_schema::ShapeType::Structure,
   51     52   
    &[
   52     53   
        &HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_MEMBER_FOO,
   53     54   
        &HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_MEMBER_BLOB,
   54     55   
    ],
   55     56   
);
   56     57   
impl HttpPayloadTraitsWithMediaTypeOutput {
   57     58   
    /// The schema for this shape.
   58     59   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_SCHEMA;
   59     60   
}
   60     61   
impl ::aws_smithy_schema::serde::SerializableStruct for HttpPayloadTraitsWithMediaTypeOutput {
   61     62   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   62     63   
    fn serialize_members(
   63     64   
        &self,
   64     65   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   65     66   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   66     67   
        if let Some(ref val) = self.foo {
   67     68   
            ser.write_string(&HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_MEMBER_FOO, val)?;
   68     69   
        }
   69     70   
        if let Some(ref val) = self.blob {
   70     71   
            ser.write_blob(&HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_MEMBER_BLOB, val)?;
   71     72   
        }
   72     73   
        Ok(())
   73     74   
    }
   74     75   
}
   75     76   
impl HttpPayloadTraitsWithMediaTypeOutput {
   76     77   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   77         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   78         -
        deserializer: &mut D,
          78  +
    pub fn deserialize(
          79  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   79     80   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   80     81   
        #[allow(unused_variables, unused_mut)]
   81     82   
        let mut builder = Self::builder();
   82     83   
        #[allow(
   83     84   
            unused_variables,
   84     85   
            unreachable_code,
   85     86   
            clippy::single_match,
   86     87   
            clippy::match_single_binding,
   87     88   
            clippy::diverging_sub_expression
   88     89   
        )]
   89         -
        deserializer.read_struct(&HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_SCHEMA, (), |_, member, deser| {
          90  +
        deserializer.read_struct(&HTTPPAYLOADTRAITSWITHMEDIATYPEOUTPUT_SCHEMA, &mut |member, deser| {
   90     91   
            match member.member_index() {
   91     92   
                Some(0) => {
   92     93   
                    builder.foo = Some(deser.read_string(member)?);
   93     94   
                }
   94     95   
                Some(1) => {
   95     96   
                    builder.blob = Some(deser.read_blob(member)?);
   96     97   
                }
   97     98   
                _ => {}
   98     99   
            }
   99    100   
            Ok(())
  100    101   
        })?;
  101    102   
        Ok(builder.build())
  102    103   
    }
  103    104   
}
         105  +
impl HttpPayloadTraitsWithMediaTypeOutput {
         106  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         107  +
    /// Header-bound members are read directly from headers, avoiding runtime
         108  +
    /// member iteration overhead. Body members are read via the deserializer.
         109  +
    pub fn deserialize_with_response(
         110  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         111  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         112  +
        _status: u16,
         113  +
        body: &[u8],
         114  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         115  +
        #[allow(unused_variables, unused_mut)]
         116  +
        let mut builder = Self::builder();
         117  +
        if let Some(val) = headers.get("X-Foo") {
         118  +
            builder.foo = Some(val.to_string());
         119  +
        }
         120  +
        if !body.is_empty() {
         121  +
            builder.blob = Some(::aws_smithy_types::Blob::new(body.to_vec()));
         122  +
        }
         123  +
        Ok(builder.build())
         124  +
    }
         125  +
}
  104    126   
impl HttpPayloadTraitsWithMediaTypeOutput {
  105    127   
    /// Creates a new builder-style object to manufacture [`HttpPayloadTraitsWithMediaTypeOutput`](crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeOutput).
  106    128   
    pub fn builder() -> crate::operation::http_payload_traits_with_media_type::builders::HttpPayloadTraitsWithMediaTypeOutputBuilder {
  107    129   
        crate::operation::http_payload_traits_with_media_type::builders::HttpPayloadTraitsWithMediaTypeOutputBuilder::default()
  108    130   
    }
  109    131   
}
  110    132   
  111    133   
/// A builder for [`HttpPayloadTraitsWithMediaTypeOutput`](crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeOutput).
  112    134   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  113    135   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_payload_with_member_xml_name.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 `HttpPayloadWithMemberXmlName`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct HttpPayloadWithMemberXmlName;
    6      6   
impl HttpPayloadWithMemberXmlName {
    7      7   
    /// Creates a new `HttpPayloadWithMemberXmlName`
    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_payload_with_member_xml_name::HttpPayloadWithMemberXmlNameInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::http_payload_with_member_xml_name::HttpPayloadWithMemberXmlNameOutput::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_payload_with_member_xml_name::HttpPayloadWithMemberXmlNameInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::http_payload_with_member_xml_name::HttpPayloadWithMemberXmlNameOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::http_payload_with_member_xml_name::HttpPayloadWithMemberXmlNameError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +172,179 @@
  130    136   
                crate::operation::http_payload_with_member_xml_name::HttpPayloadWithMemberXmlNameError,
  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 HttpPayloadWithMemberXmlNameResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpPayloadWithMemberXmlNameResponseDeserializer {
  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    152   
        let headers = response.headers();
  146    153   
        let body = response.body().bytes().expect("body loaded");
  147    154   
        #[allow(unused_mut)]
  148    155   
        let mut force_error = false;
  149    156   
  150    157   
        let parse_result = if !success && status != 200 || force_error {
  151    158   
            crate::protocol_serde::shape_http_payload_with_member_xml_name::de_http_payload_with_member_xml_name_http_error(status, headers, body)
  152    159   
        } else {
@@ -293,300 +353,364 @@
  313    320   
            .expect("the config must have a deserializer");
  314    321   
  315    322   
        let parsed = de.deserialize_streaming(&mut http_response);
  316    323   
        let parsed = parsed.unwrap_or_else(|| {
  317    324   
            let http_response = http_response.map(|body| {
  318    325   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  319    326   
                    body.bytes().unwrap(),
  320    327   
                    ::aws_smithy_protocol_test::MediaType::from("application/xml"),
  321    328   
                )))
  322    329   
            });
  323         -
            de.deserialize_nonstreaming(&http_response)
         330  +
            // Build a config bag with the protocol for schema-based deserialization
         331  +
            #[allow(unused_mut)]
         332  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         333  +
         334  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  324    335   
        });
  325    336   
        let parsed = parsed
  326    337   
            .expect("should be successful response")
  327    338   
            .downcast::<crate::operation::http_payload_with_member_xml_name::HttpPayloadWithMemberXmlNameOutput>()
  328    339   
            .unwrap();
  329    340   
        ::pretty_assertions::assert_eq!(parsed.nested, expected_output.nested, "Unexpected value for `nested`");
  330    341   
    }
  331    342   
}
  332    343   
  333    344   
/// Error type for the `HttpPayloadWithMemberXmlNameError` operation.

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/operation/http_payload_with_member_xml_name/_http_payload_with_member_xml_name_input.rs

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