Client Test

Client Test

rev. 32b1b3c3761061baed26023be3219639e42d7d12

Files changed:

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

@@ -1,1 +69,83 @@
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct NoInputAndOutputInput {}
    6      6   
static NOINPUTANDOUTPUTINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#NoInputAndOutputInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "NoInputAndOutputInput",
   10     10   
);
   11     11   
static NOINPUTANDOUTPUTINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(NOINPUTANDOUTPUTINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(NOINPUTANDOUTPUTINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/NoInputAndOutputOutput", None));
   13     14   
impl NoInputAndOutputInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &NOINPUTANDOUTPUTINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for NoInputAndOutputInput {
   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 NoInputAndOutputInput {
   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(&NOINPUTANDOUTPUTINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&NOINPUTANDOUTPUTINPUT_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 NoInputAndOutputInput {
          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 NoInputAndOutputInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`NoInputAndOutputInput`](crate::operation::no_input_and_output::NoInputAndOutputInput).
   53     67   
    pub fn builder() -> crate::operation::no_input_and_output::builders::NoInputAndOutputInputBuilder {
   54     68   
        crate::operation::no_input_and_output::builders::NoInputAndOutputInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`NoInputAndOutputInput`](crate::operation::no_input_and_output::NoInputAndOutputInput).
   59     73   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   60     74   
#[non_exhaustive]

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

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/null_and_empty_headers_client.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 `NullAndEmptyHeadersClient`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct NullAndEmptyHeadersClient;
    6      6   
impl NullAndEmptyHeadersClient {
    7      7   
    /// Creates a new `NullAndEmptyHeadersClient`
    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::null_and_empty_headers_client::NullAndEmptyHeadersClientInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput::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::null_and_empty_headers_client::NullAndEmptyHeadersClientInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +229,289 @@
  130    136   
                crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
  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 NullAndEmptyHeadersClientResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for NullAndEmptyHeadersClientResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_null_and_empty_headers_client::de_null_and_empty_headers_client_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_null_and_empty_headers_client::de_null_and_empty_headers_client_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, NullAndEmptyHeadersClient::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
         184  +
            )
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  156    190   
    }
  157    191   
}
  158    192   
#[derive(Debug)]
  159    193   
struct NullAndEmptyHeadersClientRequestSerializer;
  160    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for NullAndEmptyHeadersClientRequestSerializer {
  161    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    196   
    fn serialize_input(
  163    197   
        &self,
  164    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    201   
        let input = input
  168    202   
            .downcast::<crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput>()
  169    203   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/NullAndEmptyHeadersClient").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                let builder = crate::protocol_serde::shape_null_and_empty_headers_client::ser_null_and_empty_headers_client_headers(input, builder)?;
  192         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        if protocol.supports_http_bindings() {
         208  +
            let mut request = protocol
         209  +
                .serialize_body(&input, NullAndEmptyHeadersClient::INPUT_SCHEMA, "", _cfg)
         210  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         211  +
            {
         212  +
                let mut uri = "/NullAndEmptyHeadersClient".to_string();
         213  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         214  +
                if let Some(ref val) = input.a {
         215  +
                    request.headers_mut().insert("X-A", val.to_string());
         216  +
                }
         217  +
                if let Some(ref val) = input.b {
         218  +
                    request.headers_mut().insert("X-B", val.to_string());
         219  +
                }
         220  +
                if let Some(ref val) = input.c {
         221  +
                    let header_val = val
         222  +
                        .iter()
         223  +
                        .map(|item| {
         224  +
                            let s = item.to_string();
         225  +
                            if s.contains(',') || s.contains('"') {
         226  +
                                format!("\"{}\"", s.replace('\\', "\\\\").replace('"', "\\\""))
         227  +
                            } else {
         228  +
                                s
         229  +
                            }
         230  +
                        })
         231  +
                        .collect::<Vec<_>>()
         232  +
                        .join(", ");
         233  +
                    request.headers_mut().insert("X-C", header_val);
         234  +
                }
         235  +
                if !query_params.is_empty() {
         236  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         237  +
                    let pairs: Vec<String> = query_params
         238  +
                        .iter()
         239  +
                        .map(|(k, v)| {
         240  +
                            format!(
         241  +
                                "{}={}",
         242  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         243  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         244  +
                            )
         245  +
                        })
         246  +
                        .collect();
         247  +
                    uri.push_str(&pairs.join("&"));
         248  +
                }
         249  +
                request.set_uri(uri.as_str()).expect("valid URI");
  193    250   
            }
  194         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  198    251   
  199         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         252  +
            return ::std::result::Result::Ok(request);
         253  +
        } else {
         254  +
            let mut request = protocol
         255  +
                .serialize_request(&input, NullAndEmptyHeadersClient::INPUT_SCHEMA, "", _cfg)
         256  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         257  +
         258  +
            return ::std::result::Result::Ok(request);
         259  +
        }
  200    260   
    }
  201    261   
}
  202    262   
#[derive(Debug)]
  203    263   
struct NullAndEmptyHeadersClientEndpointParamsInterceptor;
  204    264   
  205    265   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NullAndEmptyHeadersClientEndpointParamsInterceptor {
  206    266   
    fn name(&self) -> &'static str {
  207    267   
        "NullAndEmptyHeadersClientEndpointParamsInterceptor"
  208    268   
    }
  209    269   

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

@@ -45,45 +179,235 @@
   65     65   
)
   66     66   
.with_http_header("X-C");
   67     67   
static NULLANDEMPTYHEADERSCLIENTINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   68     68   
    NULLANDEMPTYHEADERSCLIENTINPUT_SCHEMA_ID,
   69     69   
    ::aws_smithy_schema::ShapeType::Structure,
   70     70   
    &[
   71     71   
        &NULLANDEMPTYHEADERSCLIENTINPUT_MEMBER_A,
   72     72   
        &NULLANDEMPTYHEADERSCLIENTINPUT_MEMBER_B,
   73     73   
        &NULLANDEMPTYHEADERSCLIENTINPUT_MEMBER_C,
   74     74   
    ],
   75         -
);
          75  +
)
          76  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/NullAndEmptyHeadersClient", None));
   76     77   
impl NullAndEmptyHeadersClientInput {
   77     78   
    /// The schema for this shape.
   78     79   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &NULLANDEMPTYHEADERSCLIENTINPUT_SCHEMA;
   79     80   
}
   80     81   
impl ::aws_smithy_schema::serde::SerializableStruct for NullAndEmptyHeadersClientInput {
   81     82   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   82     83   
    fn serialize_members(
   83     84   
        &self,
   84     85   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   85     86   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   86     87   
        if let Some(ref val) = self.a {
   87     88   
            ser.write_string(&NULLANDEMPTYHEADERSCLIENTINPUT_MEMBER_A, val)?;
   88     89   
        }
   89     90   
        if let Some(ref val) = self.b {
   90     91   
            ser.write_string(&NULLANDEMPTYHEADERSCLIENTINPUT_MEMBER_B, val)?;
   91     92   
        }
   92     93   
        if let Some(ref val) = self.c {
   93     94   
            ser.write_list(
   94     95   
                &NULLANDEMPTYHEADERSCLIENTINPUT_MEMBER_C,
   95     96   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   96     97   
                    for item in val {
   97     98   
                        ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
   98     99   
                    }
   99    100   
                    Ok(())
  100    101   
                },
  101    102   
            )?;
  102    103   
        }
  103    104   
        Ok(())
  104    105   
    }
  105    106   
}
  106    107   
impl NullAndEmptyHeadersClientInput {
  107    108   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  108         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  109         -
        deserializer: &mut D,
         109  +
    pub fn deserialize(
         110  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  110    111   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  111    112   
        #[allow(unused_variables, unused_mut)]
  112    113   
        let mut builder = Self::builder();
  113    114   
        #[allow(
  114    115   
            unused_variables,
  115    116   
            unreachable_code,
  116    117   
            clippy::single_match,
  117    118   
            clippy::match_single_binding,
  118    119   
            clippy::diverging_sub_expression
  119    120   
        )]
  120         -
        deserializer.read_struct(&NULLANDEMPTYHEADERSCLIENTINPUT_SCHEMA, (), |_, member, deser| {
         121  +
        deserializer.read_struct(&NULLANDEMPTYHEADERSCLIENTINPUT_SCHEMA, &mut |member, deser| {
  121    122   
            match member.member_index() {
  122    123   
                Some(0) => {
  123    124   
                    builder.a = Some(deser.read_string(member)?);
  124    125   
                }
  125    126   
                Some(1) => {
  126    127   
                    builder.b = Some(deser.read_string(member)?);
  127    128   
                }
  128    129   
                Some(2) => {
  129         -
                    builder.c = Some({
  130         -
                        let container = if let Some(cap) = deser.container_size() {
  131         -
                            Vec::with_capacity(cap)
  132         -
                        } else {
  133         -
                            Vec::new()
  134         -
                        };
  135         -
                        deser.read_list(member, container, |mut list, deser| {
  136         -
                            list.push(deser.read_string(member)?);
  137         -
                            Ok(list)
  138         -
                        })?
  139         -
                    });
         130  +
                    builder.c = Some(deser.read_string_list(member)?);
  140    131   
                }
  141    132   
                _ => {}
  142    133   
            }
  143    134   
            Ok(())
  144    135   
        })?;
  145    136   
        builder
  146    137   
            .build()
  147    138   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  148    139   
    }
  149    140   
}
         141  +
impl NullAndEmptyHeadersClientInput {
         142  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         143  +
    /// Header-bound members are read directly from headers, avoiding runtime
         144  +
    /// member iteration overhead. Body members are read via the deserializer.
         145  +
    pub fn deserialize_with_response(
         146  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         147  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         148  +
        _status: u16,
         149  +
        _body: &[u8],
         150  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         151  +
        #[allow(unused_variables, unused_mut)]
         152  +
        let mut builder = Self::builder();
         153  +
        if let Some(val) = headers.get("X-A") {
         154  +
            builder.a = Some(val.to_string());
         155  +
        }
         156  +
        if let Some(val) = headers.get("X-B") {
         157  +
            builder.b = Some(val.to_string());
         158  +
        }
         159  +
        if let Some(val) = headers.get("X-C") {
         160  +
            builder.c = {
         161  +
                let mut items = Vec::new();
         162  +
                let mut chars = val.chars().peekable();
         163  +
                while chars.peek().is_some() {
         164  +
                    // Skip whitespace
         165  +
                    while chars.peek() == Some(&' ') {
         166  +
                        chars.next();
         167  +
                    }
         168  +
                    if chars.peek() == Some(&'"') {
         169  +
                        chars.next(); // skip opening quote
         170  +
                        let mut s = String::new();
         171  +
                        while let Some(&c) = chars.peek() {
         172  +
                            if c == '\\' {
         173  +
                                chars.next();
         174  +
                                if let Some(escaped) = chars.next() {
         175  +
                                    s.push(escaped);
         176  +
                                }
         177  +
                            } else if c == '"' {
         178  +
                                chars.next();
         179  +
                                break;
         180  +
                            } else {
         181  +
                                s.push(c);
         182  +
                                chars.next();
         183  +
                            }
         184  +
                        }
         185  +
                        items.push(s);
         186  +
                    } else {
         187  +
                        let s: String = chars.by_ref().take_while(|&c| c != ',').collect();
         188  +
                        let trimmed = s.trim();
         189  +
                        if !trimmed.is_empty() {
         190  +
                            items.push(trimmed.to_string());
         191  +
                        }
         192  +
                    }
         193  +
                    // Skip comma separator
         194  +
                    while chars.peek() == Some(&',') || chars.peek() == Some(&' ') {
         195  +
                        chars.next();
         196  +
                    }
         197  +
                }
         198  +
                Some(items)
         199  +
            };
         200  +
        }
         201  +
        builder
         202  +
            .build()
         203  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         204  +
    }
         205  +
}
  150    206   
impl NullAndEmptyHeadersClientInput {
  151    207   
    /// Creates a new builder-style object to manufacture [`NullAndEmptyHeadersClientInput`](crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput).
  152    208   
    pub fn builder() -> crate::operation::null_and_empty_headers_client::builders::NullAndEmptyHeadersClientInputBuilder {
  153    209   
        crate::operation::null_and_empty_headers_client::builders::NullAndEmptyHeadersClientInputBuilder::default()
  154    210   
    }
  155    211   
}
  156    212   
  157    213   
/// A builder for [`NullAndEmptyHeadersClientInput`](crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput).
  158    214   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  159    215   
#[non_exhaustive]

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

@@ -78,78 +177,230 @@
   98     98   
                    }
   99     99   
                    Ok(())
  100    100   
                },
  101    101   
            )?;
  102    102   
        }
  103    103   
        Ok(())
  104    104   
    }
  105    105   
}
  106    106   
impl NullAndEmptyHeadersClientOutput {
  107    107   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  108         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  109         -
        deserializer: &mut D,
         108  +
    pub fn deserialize(
         109  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  110    110   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  111    111   
        #[allow(unused_variables, unused_mut)]
  112    112   
        let mut builder = Self::builder();
  113    113   
        #[allow(
  114    114   
            unused_variables,
  115    115   
            unreachable_code,
  116    116   
            clippy::single_match,
  117    117   
            clippy::match_single_binding,
  118    118   
            clippy::diverging_sub_expression
  119    119   
        )]
  120         -
        deserializer.read_struct(&NULLANDEMPTYHEADERSCLIENTOUTPUT_SCHEMA, (), |_, member, deser| {
         120  +
        deserializer.read_struct(&NULLANDEMPTYHEADERSCLIENTOUTPUT_SCHEMA, &mut |member, deser| {
  121    121   
            match member.member_index() {
  122    122   
                Some(0) => {
  123    123   
                    builder.a = Some(deser.read_string(member)?);
  124    124   
                }
  125    125   
                Some(1) => {
  126    126   
                    builder.b = Some(deser.read_string(member)?);
  127    127   
                }
  128    128   
                Some(2) => {
  129         -
                    builder.c = Some({
  130         -
                        let container = if let Some(cap) = deser.container_size() {
  131         -
                            Vec::with_capacity(cap)
  132         -
                        } else {
  133         -
                            Vec::new()
  134         -
                        };
  135         -
                        deser.read_list(member, container, |mut list, deser| {
  136         -
                            list.push(deser.read_string(member)?);
  137         -
                            Ok(list)
  138         -
                        })?
  139         -
                    });
         129  +
                    builder.c = Some(deser.read_string_list(member)?);
  140    130   
                }
  141    131   
                _ => {}
  142    132   
            }
  143    133   
            Ok(())
  144    134   
        })?;
  145    135   
        Ok(builder.build())
  146    136   
    }
  147    137   
}
         138  +
impl NullAndEmptyHeadersClientOutput {
         139  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         140  +
    /// Header-bound members are read directly from headers, avoiding runtime
         141  +
    /// member iteration overhead. Body members are read via the deserializer.
         142  +
    pub fn deserialize_with_response(
         143  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         144  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         145  +
        _status: u16,
         146  +
        _body: &[u8],
         147  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         148  +
        #[allow(unused_variables, unused_mut)]
         149  +
        let mut builder = Self::builder();
         150  +
        if let Some(val) = headers.get("X-A") {
         151  +
            builder.a = Some(val.to_string());
         152  +
        }
         153  +
        if let Some(val) = headers.get("X-B") {
         154  +
            builder.b = Some(val.to_string());
         155  +
        }
         156  +
        if let Some(val) = headers.get("X-C") {
         157  +
            builder.c = {
         158  +
                let mut items = Vec::new();
         159  +
                let mut chars = val.chars().peekable();
         160  +
                while chars.peek().is_some() {
         161  +
                    // Skip whitespace
         162  +
                    while chars.peek() == Some(&' ') {
         163  +
                        chars.next();
         164  +
                    }
         165  +
                    if chars.peek() == Some(&'"') {
         166  +
                        chars.next(); // skip opening quote
         167  +
                        let mut s = String::new();
         168  +
                        while let Some(&c) = chars.peek() {
         169  +
                            if c == '\\' {
         170  +
                                chars.next();
         171  +
                                if let Some(escaped) = chars.next() {
         172  +
                                    s.push(escaped);
         173  +
                                }
         174  +
                            } else if c == '"' {
         175  +
                                chars.next();
         176  +
                                break;
         177  +
                            } else {
         178  +
                                s.push(c);
         179  +
                                chars.next();
         180  +
                            }
         181  +
                        }
         182  +
                        items.push(s);
         183  +
                    } else {
         184  +
                        let s: String = chars.by_ref().take_while(|&c| c != ',').collect();
         185  +
                        let trimmed = s.trim();
         186  +
                        if !trimmed.is_empty() {
         187  +
                            items.push(trimmed.to_string());
         188  +
                        }
         189  +
                    }
         190  +
                    // Skip comma separator
         191  +
                    while chars.peek() == Some(&',') || chars.peek() == Some(&' ') {
         192  +
                        chars.next();
         193  +
                    }
         194  +
                }
         195  +
                Some(items)
         196  +
            };
         197  +
        }
         198  +
        Ok(builder.build())
         199  +
    }
         200  +
}
  148    201   
impl NullAndEmptyHeadersClientOutput {
  149    202   
    /// Creates a new builder-style object to manufacture [`NullAndEmptyHeadersClientOutput`](crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput).
  150    203   
    pub fn builder() -> crate::operation::null_and_empty_headers_client::builders::NullAndEmptyHeadersClientOutputBuilder {
  151    204   
        crate::operation::null_and_empty_headers_client::builders::NullAndEmptyHeadersClientOutputBuilder::default()
  152    205   
    }
  153    206   
}
  154    207   
  155    208   
/// A builder for [`NullAndEmptyHeadersClientOutput`](crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientOutput).
  156    209   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  157    210   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/null_and_empty_headers_server.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 `NullAndEmptyHeadersServer`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct NullAndEmptyHeadersServer;
    6      6   
impl NullAndEmptyHeadersServer {
    7      7   
    /// Creates a new `NullAndEmptyHeadersServer`
    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::null_and_empty_headers_server::NullAndEmptyHeadersServerInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput::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::null_and_empty_headers_server::NullAndEmptyHeadersServerInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +229,289 @@
  130    136   
                crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError,
  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 NullAndEmptyHeadersServerResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for NullAndEmptyHeadersServerResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_null_and_empty_headers_server::de_null_and_empty_headers_server_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_null_and_empty_headers_server::de_null_and_empty_headers_server_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, NullAndEmptyHeadersServer::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
         184  +
            )
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  156    190   
    }
  157    191   
}
  158    192   
#[derive(Debug)]
  159    193   
struct NullAndEmptyHeadersServerRequestSerializer;
  160    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for NullAndEmptyHeadersServerRequestSerializer {
  161    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    196   
    fn serialize_input(
  163    197   
        &self,
  164    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    201   
        let input = input
  168    202   
            .downcast::<crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerInput>()
  169    203   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/NullAndEmptyHeadersServer").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                let builder = crate::protocol_serde::shape_null_and_empty_headers_server::ser_null_and_empty_headers_server_headers(input, builder)?;
  192         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        if protocol.supports_http_bindings() {
         208  +
            let mut request = protocol
         209  +
                .serialize_body(&input, NullAndEmptyHeadersServer::INPUT_SCHEMA, "", _cfg)
         210  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         211  +
            {
         212  +
                let mut uri = "/NullAndEmptyHeadersServer".to_string();
         213  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         214  +
                if let Some(ref val) = input.a {
         215  +
                    request.headers_mut().insert("X-A", val.to_string());
         216  +
                }
         217  +
                if let Some(ref val) = input.b {
         218  +
                    request.headers_mut().insert("X-B", val.to_string());
         219  +
                }
         220  +
                if let Some(ref val) = input.c {
         221  +
                    let header_val = val
         222  +
                        .iter()
         223  +
                        .map(|item| {
         224  +
                            let s = item.to_string();
         225  +
                            if s.contains(',') || s.contains('"') {
         226  +
                                format!("\"{}\"", s.replace('\\', "\\\\").replace('"', "\\\""))
         227  +
                            } else {
         228  +
                                s
         229  +
                            }
         230  +
                        })
         231  +
                        .collect::<Vec<_>>()
         232  +
                        .join(", ");
         233  +
                    request.headers_mut().insert("X-C", header_val);
         234  +
                }
         235  +
                if !query_params.is_empty() {
         236  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         237  +
                    let pairs: Vec<String> = query_params
         238  +
                        .iter()
         239  +
                        .map(|(k, v)| {
         240  +
                            format!(
         241  +
                                "{}={}",
         242  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         243  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         244  +
                            )
         245  +
                        })
         246  +
                        .collect();
         247  +
                    uri.push_str(&pairs.join("&"));
         248  +
                }
         249  +
                request.set_uri(uri.as_str()).expect("valid URI");
  193    250   
            }
  194         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  198    251   
  199         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         252  +
            return ::std::result::Result::Ok(request);
         253  +
        } else {
         254  +
            let mut request = protocol
         255  +
                .serialize_request(&input, NullAndEmptyHeadersServer::INPUT_SCHEMA, "", _cfg)
         256  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         257  +
         258  +
            return ::std::result::Result::Ok(request);
         259  +
        }
  200    260   
    }
  201    261   
}
  202    262   
#[derive(Debug)]
  203    263   
struct NullAndEmptyHeadersServerEndpointParamsInterceptor;
  204    264   
  205    265   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NullAndEmptyHeadersServerEndpointParamsInterceptor {
  206    266   
    fn name(&self) -> &'static str {
  207    267   
        "NullAndEmptyHeadersServerEndpointParamsInterceptor"
  208    268   
    }
  209    269   

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

@@ -45,45 +179,235 @@
   65     65   
)
   66     66   
.with_http_header("X-C");
   67     67   
static NULLANDEMPTYHEADERSSERVERINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   68     68   
    NULLANDEMPTYHEADERSSERVERINPUT_SCHEMA_ID,
   69     69   
    ::aws_smithy_schema::ShapeType::Structure,
   70     70   
    &[
   71     71   
        &NULLANDEMPTYHEADERSSERVERINPUT_MEMBER_A,
   72     72   
        &NULLANDEMPTYHEADERSSERVERINPUT_MEMBER_B,
   73     73   
        &NULLANDEMPTYHEADERSSERVERINPUT_MEMBER_C,
   74     74   
    ],
   75         -
);
          75  +
)
          76  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/NullAndEmptyHeadersServer", None));
   76     77   
impl NullAndEmptyHeadersServerInput {
   77     78   
    /// The schema for this shape.
   78     79   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &NULLANDEMPTYHEADERSSERVERINPUT_SCHEMA;
   79     80   
}
   80     81   
impl ::aws_smithy_schema::serde::SerializableStruct for NullAndEmptyHeadersServerInput {
   81     82   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   82     83   
    fn serialize_members(
   83     84   
        &self,
   84     85   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   85     86   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   86     87   
        if let Some(ref val) = self.a {
   87     88   
            ser.write_string(&NULLANDEMPTYHEADERSSERVERINPUT_MEMBER_A, val)?;
   88     89   
        }
   89     90   
        if let Some(ref val) = self.b {
   90     91   
            ser.write_string(&NULLANDEMPTYHEADERSSERVERINPUT_MEMBER_B, val)?;
   91     92   
        }
   92     93   
        if let Some(ref val) = self.c {
   93     94   
            ser.write_list(
   94     95   
                &NULLANDEMPTYHEADERSSERVERINPUT_MEMBER_C,
   95     96   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   96     97   
                    for item in val {
   97     98   
                        ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
   98     99   
                    }
   99    100   
                    Ok(())
  100    101   
                },
  101    102   
            )?;
  102    103   
        }
  103    104   
        Ok(())
  104    105   
    }
  105    106   
}
  106    107   
impl NullAndEmptyHeadersServerInput {
  107    108   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  108         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  109         -
        deserializer: &mut D,
         109  +
    pub fn deserialize(
         110  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  110    111   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  111    112   
        #[allow(unused_variables, unused_mut)]
  112    113   
        let mut builder = Self::builder();
  113    114   
        #[allow(
  114    115   
            unused_variables,
  115    116   
            unreachable_code,
  116    117   
            clippy::single_match,
  117    118   
            clippy::match_single_binding,
  118    119   
            clippy::diverging_sub_expression
  119    120   
        )]
  120         -
        deserializer.read_struct(&NULLANDEMPTYHEADERSSERVERINPUT_SCHEMA, (), |_, member, deser| {
         121  +
        deserializer.read_struct(&NULLANDEMPTYHEADERSSERVERINPUT_SCHEMA, &mut |member, deser| {
  121    122   
            match member.member_index() {
  122    123   
                Some(0) => {
  123    124   
                    builder.a = Some(deser.read_string(member)?);
  124    125   
                }
  125    126   
                Some(1) => {
  126    127   
                    builder.b = Some(deser.read_string(member)?);
  127    128   
                }
  128    129   
                Some(2) => {
  129         -
                    builder.c = Some({
  130         -
                        let container = if let Some(cap) = deser.container_size() {
  131         -
                            Vec::with_capacity(cap)
  132         -
                        } else {
  133         -
                            Vec::new()
  134         -
                        };
  135         -
                        deser.read_list(member, container, |mut list, deser| {
  136         -
                            list.push(deser.read_string(member)?);
  137         -
                            Ok(list)
  138         -
                        })?
  139         -
                    });
         130  +
                    builder.c = Some(deser.read_string_list(member)?);
  140    131   
                }
  141    132   
                _ => {}
  142    133   
            }
  143    134   
            Ok(())
  144    135   
        })?;
  145    136   
        builder
  146    137   
            .build()
  147    138   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  148    139   
    }
  149    140   
}
         141  +
impl NullAndEmptyHeadersServerInput {
         142  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         143  +
    /// Header-bound members are read directly from headers, avoiding runtime
         144  +
    /// member iteration overhead. Body members are read via the deserializer.
         145  +
    pub fn deserialize_with_response(
         146  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         147  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         148  +
        _status: u16,
         149  +
        _body: &[u8],
         150  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         151  +
        #[allow(unused_variables, unused_mut)]
         152  +
        let mut builder = Self::builder();
         153  +
        if let Some(val) = headers.get("X-A") {
         154  +
            builder.a = Some(val.to_string());
         155  +
        }
         156  +
        if let Some(val) = headers.get("X-B") {
         157  +
            builder.b = Some(val.to_string());
         158  +
        }
         159  +
        if let Some(val) = headers.get("X-C") {
         160  +
            builder.c = {
         161  +
                let mut items = Vec::new();
         162  +
                let mut chars = val.chars().peekable();
         163  +
                while chars.peek().is_some() {
         164  +
                    // Skip whitespace
         165  +
                    while chars.peek() == Some(&' ') {
         166  +
                        chars.next();
         167  +
                    }
         168  +
                    if chars.peek() == Some(&'"') {
         169  +
                        chars.next(); // skip opening quote
         170  +
                        let mut s = String::new();
         171  +
                        while let Some(&c) = chars.peek() {
         172  +
                            if c == '\\' {
         173  +
                                chars.next();
         174  +
                                if let Some(escaped) = chars.next() {
         175  +
                                    s.push(escaped);
         176  +
                                }
         177  +
                            } else if c == '"' {
         178  +
                                chars.next();
         179  +
                                break;
         180  +
                            } else {
         181  +
                                s.push(c);
         182  +
                                chars.next();
         183  +
                            }
         184  +
                        }
         185  +
                        items.push(s);
         186  +
                    } else {
         187  +
                        let s: String = chars.by_ref().take_while(|&c| c != ',').collect();
         188  +
                        let trimmed = s.trim();
         189  +
                        if !trimmed.is_empty() {
         190  +
                            items.push(trimmed.to_string());
         191  +
                        }
         192  +
                    }
         193  +
                    // Skip comma separator
         194  +
                    while chars.peek() == Some(&',') || chars.peek() == Some(&' ') {
         195  +
                        chars.next();
         196  +
                    }
         197  +
                }
         198  +
                Some(items)
         199  +
            };
         200  +
        }
         201  +
        builder
         202  +
            .build()
         203  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         204  +
    }
         205  +
}
  150    206   
impl NullAndEmptyHeadersServerInput {
  151    207   
    /// Creates a new builder-style object to manufacture [`NullAndEmptyHeadersServerInput`](crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerInput).
  152    208   
    pub fn builder() -> crate::operation::null_and_empty_headers_server::builders::NullAndEmptyHeadersServerInputBuilder {
  153    209   
        crate::operation::null_and_empty_headers_server::builders::NullAndEmptyHeadersServerInputBuilder::default()
  154    210   
    }
  155    211   
}
  156    212   
  157    213   
/// A builder for [`NullAndEmptyHeadersServerInput`](crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerInput).
  158    214   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  159    215   
#[non_exhaustive]

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

@@ -78,78 +177,230 @@
   98     98   
                    }
   99     99   
                    Ok(())
  100    100   
                },
  101    101   
            )?;
  102    102   
        }
  103    103   
        Ok(())
  104    104   
    }
  105    105   
}
  106    106   
impl NullAndEmptyHeadersServerOutput {
  107    107   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  108         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  109         -
        deserializer: &mut D,
         108  +
    pub fn deserialize(
         109  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  110    110   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  111    111   
        #[allow(unused_variables, unused_mut)]
  112    112   
        let mut builder = Self::builder();
  113    113   
        #[allow(
  114    114   
            unused_variables,
  115    115   
            unreachable_code,
  116    116   
            clippy::single_match,
  117    117   
            clippy::match_single_binding,
  118    118   
            clippy::diverging_sub_expression
  119    119   
        )]
  120         -
        deserializer.read_struct(&NULLANDEMPTYHEADERSSERVEROUTPUT_SCHEMA, (), |_, member, deser| {
         120  +
        deserializer.read_struct(&NULLANDEMPTYHEADERSSERVEROUTPUT_SCHEMA, &mut |member, deser| {
  121    121   
            match member.member_index() {
  122    122   
                Some(0) => {
  123    123   
                    builder.a = Some(deser.read_string(member)?);
  124    124   
                }
  125    125   
                Some(1) => {
  126    126   
                    builder.b = Some(deser.read_string(member)?);
  127    127   
                }
  128    128   
                Some(2) => {
  129         -
                    builder.c = Some({
  130         -
                        let container = if let Some(cap) = deser.container_size() {
  131         -
                            Vec::with_capacity(cap)
  132         -
                        } else {
  133         -
                            Vec::new()
  134         -
                        };
  135         -
                        deser.read_list(member, container, |mut list, deser| {
  136         -
                            list.push(deser.read_string(member)?);
  137         -
                            Ok(list)
  138         -
                        })?
  139         -
                    });
         129  +
                    builder.c = Some(deser.read_string_list(member)?);
  140    130   
                }
  141    131   
                _ => {}
  142    132   
            }
  143    133   
            Ok(())
  144    134   
        })?;
  145    135   
        Ok(builder.build())
  146    136   
    }
  147    137   
}
         138  +
impl NullAndEmptyHeadersServerOutput {
         139  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         140  +
    /// Header-bound members are read directly from headers, avoiding runtime
         141  +
    /// member iteration overhead. Body members are read via the deserializer.
         142  +
    pub fn deserialize_with_response(
         143  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         144  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         145  +
        _status: u16,
         146  +
        _body: &[u8],
         147  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         148  +
        #[allow(unused_variables, unused_mut)]
         149  +
        let mut builder = Self::builder();
         150  +
        if let Some(val) = headers.get("X-A") {
         151  +
            builder.a = Some(val.to_string());
         152  +
        }
         153  +
        if let Some(val) = headers.get("X-B") {
         154  +
            builder.b = Some(val.to_string());
         155  +
        }
         156  +
        if let Some(val) = headers.get("X-C") {
         157  +
            builder.c = {
         158  +
                let mut items = Vec::new();
         159  +
                let mut chars = val.chars().peekable();
         160  +
                while chars.peek().is_some() {
         161  +
                    // Skip whitespace
         162  +
                    while chars.peek() == Some(&' ') {
         163  +
                        chars.next();
         164  +
                    }
         165  +
                    if chars.peek() == Some(&'"') {
         166  +
                        chars.next(); // skip opening quote
         167  +
                        let mut s = String::new();
         168  +
                        while let Some(&c) = chars.peek() {
         169  +
                            if c == '\\' {
         170  +
                                chars.next();
         171  +
                                if let Some(escaped) = chars.next() {
         172  +
                                    s.push(escaped);
         173  +
                                }
         174  +
                            } else if c == '"' {
         175  +
                                chars.next();
         176  +
                                break;
         177  +
                            } else {
         178  +
                                s.push(c);
         179  +
                                chars.next();
         180  +
                            }
         181  +
                        }
         182  +
                        items.push(s);
         183  +
                    } else {
         184  +
                        let s: String = chars.by_ref().take_while(|&c| c != ',').collect();
         185  +
                        let trimmed = s.trim();
         186  +
                        if !trimmed.is_empty() {
         187  +
                            items.push(trimmed.to_string());
         188  +
                        }
         189  +
                    }
         190  +
                    // Skip comma separator
         191  +
                    while chars.peek() == Some(&',') || chars.peek() == Some(&' ') {
         192  +
                        chars.next();
         193  +
                    }
         194  +
                }
         195  +
                Some(items)
         196  +
            };
         197  +
        }
         198  +
        Ok(builder.build())
         199  +
    }
         200  +
}
  148    201   
impl NullAndEmptyHeadersServerOutput {
  149    202   
    /// Creates a new builder-style object to manufacture [`NullAndEmptyHeadersServerOutput`](crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput).
  150    203   
    pub fn builder() -> crate::operation::null_and_empty_headers_server::builders::NullAndEmptyHeadersServerOutputBuilder {
  151    204   
        crate::operation::null_and_empty_headers_server::builders::NullAndEmptyHeadersServerOutputBuilder::default()
  152    205   
    }
  153    206   
}
  154    207   
  155    208   
/// A builder for [`NullAndEmptyHeadersServerOutput`](crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerOutput).
  156    209   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  157    210   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/omits_null_serializes_empty_string.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 `OmitsNullSerializesEmptyString`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct OmitsNullSerializesEmptyString;
    6      6   
impl OmitsNullSerializesEmptyString {
    7      7   
    /// Creates a new `OmitsNullSerializesEmptyString`
    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::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringOutput::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::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +248,274 @@
  130    136   
                crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError,
  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 OmitsNullSerializesEmptyStringResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OmitsNullSerializesEmptyStringResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_omits_null_serializes_empty_string::de_omits_null_serializes_empty_string_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_omits_null_serializes_empty_string::de_omits_null_serializes_empty_string_http_response(
  154         -
                status, headers, body,
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, OmitsNullSerializesEmptyString::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
  155    184   
            )
  156         -
        };
  157         -
        crate::protocol_serde::type_erase_result(parse_result)
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  158    190   
    }
  159    191   
}
  160    192   
#[derive(Debug)]
  161    193   
struct OmitsNullSerializesEmptyStringRequestSerializer;
  162    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OmitsNullSerializesEmptyStringRequestSerializer {
  163    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  164    196   
    fn serialize_input(
  165    197   
        &self,
  166    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  167    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  168    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  169    201   
        let input = input
  170    202   
            .downcast::<crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringInput>()
  171    203   
            .expect("correct type");
  172         -
        let _header_serialization_settings = _cfg
  173         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  174         -
            .cloned()
  175         -
            .unwrap_or_default();
  176         -
        let mut request_builder = {
  177         -
            #[allow(clippy::uninlined_format_args)]
  178         -
            fn uri_base(
  179         -
                _input: &crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringInput,
  180         -
                output: &mut ::std::string::String,
  181         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  182         -
                use ::std::fmt::Write as _;
  183         -
                ::std::write!(output, "/OmitsNullSerializesEmptyString").expect("formatting should succeed");
  184         -
                ::std::result::Result::Ok(())
  185         -
            }
  186         -
            fn uri_query(
  187         -
                _input: &crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringInput,
  188         -
                mut output: &mut ::std::string::String,
  189         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  190         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  191         -
                if let ::std::option::Option::Some(inner_1) = &_input.null_value {
  192         -
                    {
  193         -
                        query.push_kv("Null", &::aws_smithy_http::query::fmt_string(inner_1));
  194         -
                    }
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        if protocol.supports_http_bindings() {
         208  +
            let mut request = protocol
         209  +
                .serialize_body(&input, OmitsNullSerializesEmptyString::INPUT_SCHEMA, "", _cfg)
         210  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         211  +
            {
         212  +
                let mut uri = "/OmitsNullSerializesEmptyString".to_string();
         213  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         214  +
                if let Some(ref val) = input.null_value {
         215  +
                    query_params.push(("Null".to_string(), val.to_string()));
  195    216   
                }
  196         -
                if let ::std::option::Option::Some(inner_2) = &_input.empty_string {
  197         -
                    {
  198         -
                        query.push_kv("Empty", &::aws_smithy_http::query::fmt_string(inner_2));
  199         -
                    }
         217  +
                if let Some(ref val) = input.empty_string {
         218  +
                    query_params.push(("Empty".to_string(), val.to_string()));
  200    219   
                }
  201         -
                ::std::result::Result::Ok(())
  202         -
            }
  203         -
            #[allow(clippy::unnecessary_wraps)]
  204         -
            fn update_http_builder(
  205         -
                input: &crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringInput,
  206         -
                builder: ::http_1x::request::Builder,
  207         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  208         -
                let mut uri = ::std::string::String::new();
  209         -
                uri_base(input, &mut uri)?;
  210         -
                uri_query(input, &mut uri)?;
  211         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
         220  +
                if !query_params.is_empty() {
         221  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         222  +
                    let pairs: Vec<String> = query_params
         223  +
                        .iter()
         224  +
                        .map(|(k, v)| {
         225  +
                            format!(
         226  +
                                "{}={}",
         227  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         228  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         229  +
                            )
         230  +
                        })
         231  +
                        .collect();
         232  +
                    uri.push_str(&pairs.join("&"));
         233  +
                }
         234  +
                request.set_uri(uri.as_str()).expect("valid URI");
  212    235   
            }
  213         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  214         -
            builder
  215         -
        };
  216         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  217    236   
  218         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         237  +
            return ::std::result::Result::Ok(request);
         238  +
        } else {
         239  +
            let mut request = protocol
         240  +
                .serialize_request(&input, OmitsNullSerializesEmptyString::INPUT_SCHEMA, "", _cfg)
         241  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         242  +
         243  +
            return ::std::result::Result::Ok(request);
         244  +
        }
  219    245   
    }
  220    246   
}
  221    247   
#[derive(Debug)]
  222    248   
struct OmitsNullSerializesEmptyStringEndpointParamsInterceptor;
  223    249   
  224    250   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OmitsNullSerializesEmptyStringEndpointParamsInterceptor {
  225    251   
    fn name(&self) -> &'static str {
  226    252   
        "OmitsNullSerializesEmptyStringEndpointParamsInterceptor"
  227    253   
    }
  228    254   

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

@@ -3,3 +135,147 @@
   23     23   
    "aws.protocoltests.restjson.synthetic",
   24     24   
    "OmitsNullSerializesEmptyStringInput",
   25     25   
);
   26     26   
static OMITSNULLSERIALIZESEMPTYSTRINGINPUT_MEMBER_NULL_VALUE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   27     27   
    ::aws_smithy_schema::ShapeId::from_static(
   28     28   
        "aws.protocoltests.restjson.synthetic#OmitsNullSerializesEmptyStringInput$nullValue",
   29     29   
        "aws.protocoltests.restjson.synthetic",
   30     30   
        "OmitsNullSerializesEmptyStringInput",
   31     31   
    ),
   32     32   
    ::aws_smithy_schema::ShapeType::String,
   33         -
    "null_value",
          33  +
    "nullValue",
   34     34   
    0,
   35     35   
)
   36     36   
.with_http_query("Null");
   37     37   
static OMITSNULLSERIALIZESEMPTYSTRINGINPUT_MEMBER_EMPTY_STRING: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restjson.synthetic#OmitsNullSerializesEmptyStringInput$emptyString",
   40     40   
        "aws.protocoltests.restjson.synthetic",
   41     41   
        "OmitsNullSerializesEmptyStringInput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::String,
   44         -
    "empty_string",
          44  +
    "emptyString",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_query("Empty");
   48     48   
static OMITSNULLSERIALIZESEMPTYSTRINGINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    OMITSNULLSERIALIZESEMPTYSTRINGINPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[
   52     52   
        &OMITSNULLSERIALIZESEMPTYSTRINGINPUT_MEMBER_NULL_VALUE,
   53     53   
        &OMITSNULLSERIALIZESEMPTYSTRINGINPUT_MEMBER_EMPTY_STRING,
   54     54   
    ],
   55         -
);
          55  +
)
          56  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/OmitsNullSerializesEmptyString", None));
   56     57   
impl OmitsNullSerializesEmptyStringInput {
   57     58   
    /// The schema for this shape.
   58     59   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &OMITSNULLSERIALIZESEMPTYSTRINGINPUT_SCHEMA;
   59     60   
}
   60     61   
impl ::aws_smithy_schema::serde::SerializableStruct for OmitsNullSerializesEmptyStringInput {
   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.null_value {
   67     68   
            ser.write_string(&OMITSNULLSERIALIZESEMPTYSTRINGINPUT_MEMBER_NULL_VALUE, val)?;
   68     69   
        }
   69     70   
        if let Some(ref val) = self.empty_string {
   70     71   
            ser.write_string(&OMITSNULLSERIALIZESEMPTYSTRINGINPUT_MEMBER_EMPTY_STRING, val)?;
   71     72   
        }
   72     73   
        Ok(())
   73     74   
    }
   74     75   
}
   75     76   
impl OmitsNullSerializesEmptyStringInput {
   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(&OMITSNULLSERIALIZESEMPTYSTRINGINPUT_SCHEMA, (), |_, member, deser| {
          90  +
        deserializer.read_struct(&OMITSNULLSERIALIZESEMPTYSTRINGINPUT_SCHEMA, &mut |member, deser| {
   90     91   
            match member.member_index() {
   91     92   
                Some(0) => {
   92     93   
                    builder.null_value = Some(deser.read_string(member)?);
   93     94   
                }
   94     95   
                Some(1) => {
   95     96   
                    builder.empty_string = Some(deser.read_string(member)?);
   96     97   
                }
   97     98   
                _ => {}
   98     99   
            }
   99    100   
            Ok(())
  100    101   
        })?;
  101    102   
        builder
  102    103   
            .build()
  103    104   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  104    105   
    }
  105    106   
}
         107  +
impl OmitsNullSerializesEmptyStringInput {
         108  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         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  +
        Self::deserialize(deserializer)
         116  +
    }
         117  +
}
  106    118   
impl OmitsNullSerializesEmptyStringInput {
  107    119   
    /// Creates a new builder-style object to manufacture [`OmitsNullSerializesEmptyStringInput`](crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringInput).
  108    120   
    pub fn builder() -> crate::operation::omits_null_serializes_empty_string::builders::OmitsNullSerializesEmptyStringInputBuilder {
  109    121   
        crate::operation::omits_null_serializes_empty_string::builders::OmitsNullSerializesEmptyStringInputBuilder::default()
  110    122   
    }
  111    123   
}
  112    124   
  113    125   
/// A builder for [`OmitsNullSerializesEmptyStringInput`](crate::operation::omits_null_serializes_empty_string::OmitsNullSerializesEmptyStringInput).
  114    126   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  115    127   
#[non_exhaustive]

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

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/omits_serializing_empty_lists.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 `OmitsSerializingEmptyLists`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct OmitsSerializingEmptyLists;
    6      6   
impl OmitsSerializingEmptyLists {
    7      7   
    /// Creates a new `OmitsSerializingEmptyLists`
    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::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsOutput::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::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -110,116 +288,313 @@
  130    136   
                crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError,
  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 OmitsSerializingEmptyListsResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OmitsSerializingEmptyListsResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         146  +
    fn deserialize_nonstreaming_with_config(
  141    147   
        &self,
  142    148   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         149  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    150   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    151   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    152   
        #[allow(unused_mut)]
  148    153   
        let mut force_error = false;
  149    154   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_omits_serializing_empty_lists::de_omits_serializing_empty_lists_http_error(status, headers, body)
         155  +
        if !success && status != 200 || force_error {
         156  +
            let headers = response.headers();
         157  +
            let body = response.body().bytes().expect("body loaded");
         158  +
            #[allow(unused_mut)]
         159  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
         163  +
            let generic = generic_builder.build();
         164  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         165  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         166  +
                    crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_omits_serializing_empty_lists::de_omits_serializing_empty_lists_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, OmitsSerializingEmptyLists::OUTPUT_SCHEMA, _cfg)
         175  +
                .map_err(|e| {
         176  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
                })?;
         178  +
            let body = response.body().bytes().expect("body loaded");
         179  +
            let output = crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
         184  +
            )
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  156    190   
    }
  157    191   
}
  158    192   
#[derive(Debug)]
  159    193   
struct OmitsSerializingEmptyListsRequestSerializer;
  160    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OmitsSerializingEmptyListsRequestSerializer {
  161    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    196   
    fn serialize_input(
  163    197   
        &self,
  164    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    201   
        let input = input
  168    202   
            .downcast::<crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput>()
  169    203   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/OmitsSerializingEmptyLists").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            fn uri_query(
  185         -
                _input: &crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput,
  186         -
                mut output: &mut ::std::string::String,
  187         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  188         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  189         -
                if let ::std::option::Option::Some(inner_1) = &_input.query_string_list {
  190         -
                    {
  191         -
                        for inner_2 in inner_1 {
  192         -
                            query.push_kv("StringList", &::aws_smithy_http::query::fmt_string(inner_2));
  193         -
                        }
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        if protocol.supports_http_bindings() {
         208  +
            let mut request = protocol
         209  +
                .serialize_body(&input, OmitsSerializingEmptyLists::INPUT_SCHEMA, "", _cfg)
         210  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         211  +
            {
         212  +
                let mut uri = "/OmitsSerializingEmptyLists".to_string();
         213  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         214  +
                if let Some(ref val) = input.query_string_list {
         215  +
                    for item in val {
         216  +
                        query_params.push(("StringList".to_string(), item.to_string()));
  194    217   
                    }
  195    218   
                }
  196         -
                if let ::std::option::Option::Some(inner_3) = &_input.query_integer_list {
  197         -
                    {
  198         -
                        for inner_4 in inner_3 {
  199         -
                            query.push_kv("IntegerList", ::aws_smithy_types::primitive::Encoder::from(*inner_4).encode());
  200         -
                        }
         219  +
                if let Some(ref val) = input.query_integer_list {
         220  +
                    for item in val {
         221  +
                        query_params.push(("IntegerList".to_string(), item.to_string()));
  201    222   
                    }
  202    223   
                }
  203         -
                if let ::std::option::Option::Some(inner_5) = &_input.query_double_list {
  204         -
                    {
  205         -
                        for inner_6 in inner_5 {
  206         -
                            query.push_kv("DoubleList", ::aws_smithy_types::primitive::Encoder::from(*inner_6).encode());
  207         -
                        }
         224  +
                if let Some(ref val) = input.query_double_list {
         225  +
                    for item in val {
         226  +
                        query_params.push(("DoubleList".to_string(), {
         227  +
                            let s = item.to_string();
         228  +
                            match s.as_str() {
         229  +
                                "inf" => "Infinity".to_string(),
         230  +
                                "-inf" => "-Infinity".to_string(),
         231  +
                                _ => s,
         232  +
                            }
         233  +
                        }));
  208    234   
                    }
  209    235   
                }
  210         -
                if let ::std::option::Option::Some(inner_7) = &_input.query_boolean_list {
  211         -
                    {
  212         -
                        for inner_8 in inner_7 {
  213         -
                            query.push_kv("BooleanList", ::aws_smithy_types::primitive::Encoder::from(*inner_8).encode());
  214         -
                        }
         236  +
                if let Some(ref val) = input.query_boolean_list {
         237  +
                    for item in val {
         238  +
                        query_params.push(("BooleanList".to_string(), item.to_string()));
  215    239   
                    }
  216    240   
                }
  217         -
                if let ::std::option::Option::Some(inner_9) = &_input.query_timestamp_list {
  218         -
                    {
  219         -
                        for inner_10 in inner_9 {
  220         -
                            query.push_kv(
  221         -
                                "TimestampList",
  222         -
                                &::aws_smithy_http::query::fmt_timestamp(inner_10, ::aws_smithy_types::date_time::Format::DateTime)?,
  223         -
                            );
  224         -
                        }
         241  +
                if let Some(ref val) = input.query_timestamp_list {
         242  +
                    for item in val {
         243  +
                        query_params.push((
         244  +
                            "TimestampList".to_string(),
         245  +
                            item.fmt(::aws_smithy_types::date_time::Format::DateTime).expect("valid timestamp"),
         246  +
                        ));
  225    247   
                    }
  226    248   
                }
  227         -
                if let ::std::option::Option::Some(inner_11) = &_input.query_enum_list {
  228         -
                    {
  229         -
                        for inner_12 in inner_11 {
  230         -
                            query.push_kv("EnumList", &::aws_smithy_http::query::fmt_string(inner_12.as_str()));
  231         -
                        }
         249  +
                if let Some(ref val) = input.query_enum_list {
         250  +
                    for item in val {
         251  +
                        query_params.push(("EnumList".to_string(), item.as_str().to_string()));
  232    252   
                    }
  233    253   
                }
  234         -
                if let ::std::option::Option::Some(inner_13) = &_input.query_integer_enum_list {
  235         -
                    {
  236         -
                        for inner_14 in inner_13 {
  237         -
                            query.push_kv("IntegerEnumList", ::aws_smithy_types::primitive::Encoder::from(*inner_14).encode());
  238         -
                        }
         254  +
                if let Some(ref val) = input.query_integer_enum_list {
         255  +
                    for item in val {
         256  +
                        query_params.push(("IntegerEnumList".to_string(), item.to_string()));
  239    257   
                    }
  240    258   
                }
  241         -
                ::std::result::Result::Ok(())
  242         -
            }
  243         -
            #[allow(clippy::unnecessary_wraps)]
  244         -
            fn update_http_builder(
  245         -
                input: &crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput,
  246         -
                builder: ::http_1x::request::Builder,
  247         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  248         -
                let mut uri = ::std::string::String::new();
  249         -
                uri_base(input, &mut uri)?;
  250         -
                uri_query(input, &mut uri)?;
  251         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         259  +
                if !query_params.is_empty() {
         260  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         261  +
                    let pairs: Vec<String> = query_params
         262  +
                        .iter()
         263  +
                        .map(|(k, v)| {
         264  +
                            format!(
         265  +
                                "{}={}",
         266  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         267  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         268  +
                            )
         269  +
                        })
         270  +
                        .collect();
         271  +
                    uri.push_str(&pairs.join("&"));
         272  +
                }
         273  +
                request.set_uri(uri.as_str()).expect("valid URI");
  252    274   
            }
  253         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  254         -
            builder
  255         -
        };
  256         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  257    275   
  258         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         276  +
            return ::std::result::Result::Ok(request);
         277  +
        } else {
         278  +
            let mut request = protocol
         279  +
                .serialize_request(&input, OmitsSerializingEmptyLists::INPUT_SCHEMA, "", _cfg)
         280  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         281  +
         282  +
            return ::std::result::Result::Ok(request);
         283  +
        }
  259    284   
    }
  260    285   
}
  261    286   
#[derive(Debug)]
  262    287   
struct OmitsSerializingEmptyListsEndpointParamsInterceptor;
  263    288   
  264    289   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OmitsSerializingEmptyListsEndpointParamsInterceptor {
  265    290   
    fn name(&self) -> &'static str {
  266    291   
        "OmitsSerializingEmptyListsEndpointParamsInterceptor"
  267    292   
    }
  268    293   

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

@@ -47,47 +189,190 @@
   67     67   
    "aws.protocoltests.restjson.synthetic",
   68     68   
    "OmitsSerializingEmptyListsInput",
   69     69   
);
   70     70   
static OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_STRING_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   71     71   
    ::aws_smithy_schema::ShapeId::from_static(
   72     72   
        "aws.protocoltests.restjson.synthetic#OmitsSerializingEmptyListsInput$queryStringList",
   73     73   
        "aws.protocoltests.restjson.synthetic",
   74     74   
        "OmitsSerializingEmptyListsInput",
   75     75   
    ),
   76     76   
    ::aws_smithy_schema::ShapeType::List,
   77         -
    "query_string_list",
          77  +
    "queryStringList",
   78     78   
    0,
   79     79   
)
   80     80   
.with_http_query("StringList");
   81     81   
static OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_INTEGER_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   82     82   
    ::aws_smithy_schema::ShapeId::from_static(
   83     83   
        "aws.protocoltests.restjson.synthetic#OmitsSerializingEmptyListsInput$queryIntegerList",
   84     84   
        "aws.protocoltests.restjson.synthetic",
   85     85   
        "OmitsSerializingEmptyListsInput",
   86     86   
    ),
   87     87   
    ::aws_smithy_schema::ShapeType::List,
   88         -
    "query_integer_list",
          88  +
    "queryIntegerList",
   89     89   
    1,
   90     90   
)
   91     91   
.with_http_query("IntegerList");
   92     92   
static OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_DOUBLE_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   93     93   
    ::aws_smithy_schema::ShapeId::from_static(
   94     94   
        "aws.protocoltests.restjson.synthetic#OmitsSerializingEmptyListsInput$queryDoubleList",
   95     95   
        "aws.protocoltests.restjson.synthetic",
   96     96   
        "OmitsSerializingEmptyListsInput",
   97     97   
    ),
   98     98   
    ::aws_smithy_schema::ShapeType::List,
   99         -
    "query_double_list",
          99  +
    "queryDoubleList",
  100    100   
    2,
  101    101   
)
  102    102   
.with_http_query("DoubleList");
  103    103   
static OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_BOOLEAN_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  104    104   
    ::aws_smithy_schema::ShapeId::from_static(
  105    105   
        "aws.protocoltests.restjson.synthetic#OmitsSerializingEmptyListsInput$queryBooleanList",
  106    106   
        "aws.protocoltests.restjson.synthetic",
  107    107   
        "OmitsSerializingEmptyListsInput",
  108    108   
    ),
  109    109   
    ::aws_smithy_schema::ShapeType::List,
  110         -
    "query_boolean_list",
         110  +
    "queryBooleanList",
  111    111   
    3,
  112    112   
)
  113    113   
.with_http_query("BooleanList");
  114    114   
static OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_TIMESTAMP_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  115    115   
    ::aws_smithy_schema::ShapeId::from_static(
  116    116   
        "aws.protocoltests.restjson.synthetic#OmitsSerializingEmptyListsInput$queryTimestampList",
  117    117   
        "aws.protocoltests.restjson.synthetic",
  118    118   
        "OmitsSerializingEmptyListsInput",
  119    119   
    ),
  120    120   
    ::aws_smithy_schema::ShapeType::List,
  121         -
    "query_timestamp_list",
         121  +
    "queryTimestampList",
  122    122   
    4,
  123    123   
)
  124    124   
.with_http_query("TimestampList");
  125    125   
static OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  126    126   
    ::aws_smithy_schema::ShapeId::from_static(
  127    127   
        "aws.protocoltests.restjson.synthetic#OmitsSerializingEmptyListsInput$queryEnumList",
  128    128   
        "aws.protocoltests.restjson.synthetic",
  129    129   
        "OmitsSerializingEmptyListsInput",
  130    130   
    ),
  131    131   
    ::aws_smithy_schema::ShapeType::List,
  132         -
    "query_enum_list",
         132  +
    "queryEnumList",
  133    133   
    5,
  134    134   
)
  135    135   
.with_http_query("EnumList");
  136    136   
static OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_INTEGER_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  137    137   
    ::aws_smithy_schema::ShapeId::from_static(
  138    138   
        "aws.protocoltests.restjson.synthetic#OmitsSerializingEmptyListsInput$queryIntegerEnumList",
  139    139   
        "aws.protocoltests.restjson.synthetic",
  140    140   
        "OmitsSerializingEmptyListsInput",
  141    141   
    ),
  142    142   
    ::aws_smithy_schema::ShapeType::List,
  143         -
    "query_integer_enum_list",
         143  +
    "queryIntegerEnumList",
  144    144   
    6,
  145    145   
)
  146    146   
.with_http_query("IntegerEnumList");
  147    147   
static OMITSSERIALIZINGEMPTYLISTSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  148    148   
    OMITSSERIALIZINGEMPTYLISTSINPUT_SCHEMA_ID,
  149    149   
    ::aws_smithy_schema::ShapeType::Structure,
  150    150   
    &[
  151    151   
        &OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_STRING_LIST,
  152    152   
        &OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_INTEGER_LIST,
  153    153   
        &OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_DOUBLE_LIST,
  154    154   
        &OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_BOOLEAN_LIST,
  155    155   
        &OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_TIMESTAMP_LIST,
  156    156   
        &OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_ENUM_LIST,
  157    157   
        &OMITSSERIALIZINGEMPTYLISTSINPUT_MEMBER_QUERY_INTEGER_ENUM_LIST,
  158    158   
    ],
  159         -
);
         159  +
)
         160  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/OmitsSerializingEmptyLists", None));
  160    161   
impl OmitsSerializingEmptyListsInput {
  161    162   
    /// The schema for this shape.
  162    163   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &OMITSSERIALIZINGEMPTYLISTSINPUT_SCHEMA;
  163    164   
}
  164    165   
impl ::aws_smithy_schema::serde::SerializableStruct for OmitsSerializingEmptyListsInput {
  165    166   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  166    167   
    fn serialize_members(
  167    168   
        &self,
  168    169   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  169    170   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
@@ -222,223 +395,365 @@
  242    243   
                    }
  243    244   
                    Ok(())
  244    245   
                },
  245    246   
            )?;
  246    247   
        }
  247    248   
        Ok(())
  248    249   
    }
  249    250   
}
  250    251   
impl OmitsSerializingEmptyListsInput {
  251    252   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  252         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  253         -
        deserializer: &mut D,
         253  +
    pub fn deserialize(
         254  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  254    255   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  255    256   
        #[allow(unused_variables, unused_mut)]
  256    257   
        let mut builder = Self::builder();
  257    258   
        #[allow(
  258    259   
            unused_variables,
  259    260   
            unreachable_code,
  260    261   
            clippy::single_match,
  261    262   
            clippy::match_single_binding,
  262    263   
            clippy::diverging_sub_expression
  263    264   
        )]
  264         -
        deserializer.read_struct(&OMITSSERIALIZINGEMPTYLISTSINPUT_SCHEMA, (), |_, member, deser| {
         265  +
        deserializer.read_struct(&OMITSSERIALIZINGEMPTYLISTSINPUT_SCHEMA, &mut |member, deser| {
  265    266   
            match member.member_index() {
  266    267   
                Some(0) => {
  267         -
                    builder.query_string_list = Some({
  268         -
                        let container = if let Some(cap) = deser.container_size() {
  269         -
                            Vec::with_capacity(cap)
  270         -
                        } else {
  271         -
                            Vec::new()
  272         -
                        };
  273         -
                        deser.read_list(member, container, |mut list, deser| {
  274         -
                            list.push(deser.read_string(member)?);
  275         -
                            Ok(list)
  276         -
                        })?
  277         -
                    });
         268  +
                    builder.query_string_list = Some(deser.read_string_list(member)?);
  278    269   
                }
  279    270   
                Some(1) => {
  280         -
                    builder.query_integer_list = Some({
  281         -
                        let container = if let Some(cap) = deser.container_size() {
  282         -
                            Vec::with_capacity(cap)
  283         -
                        } else {
  284         -
                            Vec::new()
  285         -
                        };
  286         -
                        deser.read_list(member, container, |mut list, deser| {
  287         -
                            list.push(deser.read_integer(member)?);
  288         -
                            Ok(list)
  289         -
                        })?
  290         -
                    });
         271  +
                    builder.query_integer_list = Some(deser.read_integer_list(member)?);
  291    272   
                }
  292    273   
                Some(2) => {
  293    274   
                    builder.query_double_list = Some({
  294         -
                        let container = if let Some(cap) = deser.container_size() {
  295         -
                            Vec::with_capacity(cap)
  296         -
                        } else {
  297         -
                            Vec::new()
  298         -
                        };
  299         -
                        deser.read_list(member, container, |mut list, deser| {
  300         -
                            list.push(deser.read_double(member)?);
  301         -
                            Ok(list)
  302         -
                        })?
         275  +
                        let mut container = Vec::new();
         276  +
                        deser.read_list(member, &mut |deser| {
         277  +
                            container.push(deser.read_double(member)?);
         278  +
                            Ok(())
         279  +
                        })?;
         280  +
                        container
  303    281   
                    });
  304    282   
                }
  305    283   
                Some(3) => {
  306    284   
                    builder.query_boolean_list = Some({
  307         -
                        let container = if let Some(cap) = deser.container_size() {
  308         -
                            Vec::with_capacity(cap)
  309         -
                        } else {
  310         -
                            Vec::new()
  311         -
                        };
  312         -
                        deser.read_list(member, container, |mut list, deser| {
  313         -
                            list.push(deser.read_boolean(member)?);
  314         -
                            Ok(list)
  315         -
                        })?
         285  +
                        let mut container = Vec::new();
         286  +
                        deser.read_list(member, &mut |deser| {
         287  +
                            container.push(deser.read_boolean(member)?);
         288  +
                            Ok(())
         289  +
                        })?;
         290  +
                        container
  316    291   
                    });
  317    292   
                }
  318    293   
                Some(4) => {
  319    294   
                    builder.query_timestamp_list = Some({
  320         -
                        let container = if let Some(cap) = deser.container_size() {
  321         -
                            Vec::with_capacity(cap)
  322         -
                        } else {
  323         -
                            Vec::new()
  324         -
                        };
  325         -
                        deser.read_list(member, container, |mut list, deser| {
  326         -
                            list.push(deser.read_timestamp(member)?);
  327         -
                            Ok(list)
  328         -
                        })?
         295  +
                        let mut container = Vec::new();
         296  +
                        deser.read_list(member, &mut |deser| {
         297  +
                            container.push(deser.read_timestamp(member)?);
         298  +
                            Ok(())
         299  +
                        })?;
         300  +
                        container
  329    301   
                    });
  330    302   
                }
  331    303   
                Some(5) => {
  332    304   
                    builder.query_enum_list = Some({
  333         -
                        let container = if let Some(cap) = deser.container_size() {
  334         -
                            Vec::with_capacity(cap)
  335         -
                        } else {
  336         -
                            Vec::new()
  337         -
                        };
  338         -
                        deser.read_list(member, container, |mut list, deser| {
  339         -
                            list.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  340         -
                            Ok(list)
  341         -
                        })?
         305  +
                        let mut container = Vec::new();
         306  +
                        deser.read_list(member, &mut |deser| {
         307  +
                            container.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         308  +
                            Ok(())
         309  +
                        })?;
         310  +
                        container
  342    311   
                    });
  343    312   
                }
  344    313   
                Some(6) => {
  345         -
                    builder.query_integer_enum_list = Some({
  346         -
                        let container = if let Some(cap) = deser.container_size() {
  347         -
                            Vec::with_capacity(cap)
  348         -
                        } else {
  349         -
                            Vec::new()
  350         -
                        };
  351         -
                        deser.read_list(member, container, |mut list, deser| {
  352         -
                            list.push(deser.read_integer(member)?);
  353         -
                            Ok(list)
  354         -
                        })?
  355         -
                    });
         314  +
                    builder.query_integer_enum_list = Some(deser.read_integer_list(member)?);
  356    315   
                }
  357    316   
                _ => {}
  358    317   
            }
  359    318   
            Ok(())
  360    319   
        })?;
  361    320   
        builder
  362    321   
            .build()
  363    322   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  364    323   
    }
  365    324   
}
         325  +
impl OmitsSerializingEmptyListsInput {
         326  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         327  +
    pub fn deserialize_with_response(
         328  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         329  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         330  +
        _status: u16,
         331  +
        _body: &[u8],
         332  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         333  +
        Self::deserialize(deserializer)
         334  +
    }
         335  +
}
  366    336   
impl OmitsSerializingEmptyListsInput {
  367    337   
    /// Creates a new builder-style object to manufacture [`OmitsSerializingEmptyListsInput`](crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput).
  368    338   
    pub fn builder() -> crate::operation::omits_serializing_empty_lists::builders::OmitsSerializingEmptyListsInputBuilder {
  369    339   
        crate::operation::omits_serializing_empty_lists::builders::OmitsSerializingEmptyListsInputBuilder::default()
  370    340   
    }
  371    341   
}
  372    342   
  373    343   
/// A builder for [`OmitsSerializingEmptyListsInput`](crate::operation::omits_serializing_empty_lists::OmitsSerializingEmptyListsInput).
  374    344   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  375    345   
#[non_exhaustive]