Client Test

Client Test

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c

Files changed:

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

@@ -6,6 +110,127 @@
   26     26   
    ::aws_smithy_schema::ShapeType::Timestamp,
   27     27   
    "timestamp",
   28     28   
    0,
   29     29   
)
   30     30   
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::HttpDate)
   31     31   
.with_http_query("timestamp");
   32     32   
static MALFORMEDTIMESTAMPQUERYHTTPDATEINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   33     33   
    MALFORMEDTIMESTAMPQUERYHTTPDATEINPUT_SCHEMA_ID,
   34     34   
    ::aws_smithy_schema::ShapeType::Structure,
   35     35   
    &[&MALFORMEDTIMESTAMPQUERYHTTPDATEINPUT_MEMBER_TIMESTAMP],
   36         -
);
          36  +
)
          37  +
.with_http(aws_smithy_schema::traits::HttpTrait::new(
          38  +
    "POST",
          39  +
    "/MalformedTimestampQueryHttpDate",
          40  +
    None,
          41  +
));
   37     42   
impl MalformedTimestampQueryHttpDateInput {
   38     43   
    /// The schema for this shape.
   39     44   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MALFORMEDTIMESTAMPQUERYHTTPDATEINPUT_SCHEMA;
   40     45   
}
   41     46   
impl ::aws_smithy_schema::serde::SerializableStruct for MalformedTimestampQueryHttpDateInput {
   42     47   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   43     48   
    fn serialize_members(
   44     49   
        &self,
   45     50   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   46     51   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   47     52   
        if let Some(ref val) = self.timestamp {
   48     53   
            ser.write_timestamp(&MALFORMEDTIMESTAMPQUERYHTTPDATEINPUT_MEMBER_TIMESTAMP, val)?;
   49     54   
        }
   50     55   
        Ok(())
   51     56   
    }
   52     57   
}
   53     58   
impl MalformedTimestampQueryHttpDateInput {
   54     59   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   55         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   56         -
        deserializer: &mut D,
          60  +
    pub fn deserialize(
          61  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   57     62   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   58     63   
        #[allow(unused_variables, unused_mut)]
   59     64   
        let mut builder = Self::builder();
   60     65   
        #[allow(
   61     66   
            unused_variables,
   62     67   
            unreachable_code,
   63     68   
            clippy::single_match,
   64     69   
            clippy::match_single_binding,
   65     70   
            clippy::diverging_sub_expression
   66     71   
        )]
   67         -
        deserializer.read_struct(&MALFORMEDTIMESTAMPQUERYHTTPDATEINPUT_SCHEMA, (), |_, member, deser| {
          72  +
        deserializer.read_struct(&MALFORMEDTIMESTAMPQUERYHTTPDATEINPUT_SCHEMA, &mut |member, deser| {
   68     73   
            match member.member_index() {
   69     74   
                Some(0) => {
   70     75   
                    builder.timestamp = Some(deser.read_timestamp(member)?);
   71     76   
                }
   72     77   
                _ => {}
   73     78   
            }
   74     79   
            Ok(())
   75     80   
        })?;
          81  +
        builder.timestamp = builder.timestamp.or(Some(::aws_smithy_types::DateTime::from_secs(0)));
   76     82   
        builder
   77     83   
            .build()
   78     84   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   79     85   
    }
   80     86   
}
          87  +
impl MalformedTimestampQueryHttpDateInput {
          88  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          89  +
    pub fn deserialize_with_response(
          90  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          91  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          92  +
        _status: u16,
          93  +
        _body: &[u8],
          94  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          95  +
        Self::deserialize(deserializer)
          96  +
    }
          97  +
}
   81     98   
impl MalformedTimestampQueryHttpDateInput {
   82     99   
    /// Creates a new builder-style object to manufacture [`MalformedTimestampQueryHttpDateInput`](crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput).
   83    100   
    pub fn builder() -> crate::operation::malformed_timestamp_query_http_date::builders::MalformedTimestampQueryHttpDateInputBuilder {
   84    101   
        crate::operation::malformed_timestamp_query_http_date::builders::MalformedTimestampQueryHttpDateInputBuilder::default()
   85    102   
    }
   86    103   
}
   87    104   
   88    105   
/// A builder for [`MalformedTimestampQueryHttpDateInput`](crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput).
   89    106   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   90    107   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_timestamp_query_http_date/_malformed_timestamp_query_http_date_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 MalformedTimestampQueryHttpDateOutput {
   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(&MALFORMEDTIMESTAMPQUERYHTTPDATEOUTPUT_SCHEMA, (), |_, member, deser| {
          43  +
        deserializer.read_struct(&MALFORMEDTIMESTAMPQUERYHTTPDATEOUTPUT_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 MalformedTimestampQueryHttpDateOutput {
          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 MalformedTimestampQueryHttpDateOutput {
   53     64   
    /// Creates a new builder-style object to manufacture [`MalformedTimestampQueryHttpDateOutput`](crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput).
   54     65   
    pub fn builder() -> crate::operation::malformed_timestamp_query_http_date::builders::MalformedTimestampQueryHttpDateOutputBuilder {
   55     66   
        crate::operation::malformed_timestamp_query_http_date::builders::MalformedTimestampQueryHttpDateOutputBuilder::default()
   56     67   
    }
   57     68   
}
   58     69   
   59     70   
/// A builder for [`MalformedTimestampQueryHttpDateOutput`](crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput).
   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/malformed_union.rs

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `MalformedUnion`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedUnion;
    6      6   
impl MalformedUnion {
    7      7   
    /// Creates a new `MalformedUnion`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_union::MalformedUnionInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_union::MalformedUnionOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::malformed_union::MalformedUnionInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::malformed_union::MalformedUnionOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::malformed_union::MalformedUnionError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +226,233 @@
  124    128   
                crate::operation::malformed_union::MalformedUnionError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct MalformedUnionResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedUnionResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139         -
        let headers = response.headers();
  140         -
        let body = response.body().bytes().expect("body loaded");
  141    144   
        #[allow(unused_mut)]
  142    145   
        let mut force_error = false;
  143    146   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_malformed_union::de_malformed_union_http_error(status, headers, body)
         147  +
        if !success && status != 200 || force_error {
         148  +
            let headers = response.headers();
         149  +
            let body = response.body().bytes().expect("body loaded");
         150  +
            #[allow(unused_mut)]
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
         154  +
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         158  +
                    crate::operation::malformed_union::MalformedUnionError::generic(generic),
         159  +
                ),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_malformed_union::de_malformed_union_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let mut deser = protocol
         166  +
                .deserialize_response(response, MalformedUnion::OUTPUT_SCHEMA, _cfg)
         167  +
                .map_err(|e| {
         168  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         169  +
                })?;
         170  +
            let body = response.body().bytes().expect("body loaded");
         171  +
            let output = crate::operation::malformed_union::MalformedUnionOutput::deserialize_with_response(
         172  +
                &mut *deser,
         173  +
                response.headers(),
         174  +
                response.status().into(),
         175  +
                body,
         176  +
            )
         177  +
            .map_err(|e| {
         178  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         179  +
            })?;
         180  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         181  +
        }
  150    182   
    }
  151    183   
}
  152    184   
#[derive(Debug)]
  153    185   
struct MalformedUnionRequestSerializer;
  154    186   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedUnionRequestSerializer {
  155    187   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    188   
    fn serialize_input(
  157    189   
        &self,
  158    190   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    191   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    192   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    193   
        let input = input
  162    194   
            .downcast::<crate::operation::malformed_union::MalformedUnionInput>()
  163    195   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::malformed_union::MalformedUnionInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/MalformedUnion").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::malformed_union::MalformedUnionInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  189         -
            builder
  190         -
        };
  191         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_malformed_union::ser_malformed_union_input(&input)?);
  192         -
        if let Some(content_length) = body.content_length() {
  193         -
            let content_length = content_length.to_string();
  194         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  195         -
        }
  196         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         196  +
        let protocol = _cfg
         197  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         198  +
            .expect("a SharedClientProtocol is required");
         199  +
        let mut request = protocol
         200  +
            .serialize_request(&input, MalformedUnion::INPUT_SCHEMA, "", _cfg)
         201  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         202  +
         203  +
        return ::std::result::Result::Ok(request);
  197    204   
    }
  198    205   
}
  199    206   
#[derive(Debug)]
  200    207   
struct MalformedUnionEndpointParamsInterceptor;
  201    208   
  202    209   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedUnionEndpointParamsInterceptor {
  203    210   
    fn name(&self) -> &'static str {
  204    211   
        "MalformedUnionEndpointParamsInterceptor"
  205    212   
    }
  206    213   

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

@@ -4,4 +111,120 @@
   24     24   
        "MalformedUnionInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Union,
   27     27   
    "union",
   28     28   
    0,
   29     29   
);
   30     30   
static MALFORMEDUNIONINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     31   
    MALFORMEDUNIONINPUT_SCHEMA_ID,
   32     32   
    ::aws_smithy_schema::ShapeType::Structure,
   33     33   
    &[&MALFORMEDUNIONINPUT_MEMBER_UNION],
   34         -
);
          34  +
)
          35  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/MalformedUnion", None));
   35     36   
impl MalformedUnionInput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MALFORMEDUNIONINPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for MalformedUnionInput {
   40     41   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   41     42   
    fn serialize_members(
   42     43   
        &self,
   43     44   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     45   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     46   
        if let Some(ref val) = self.union {
   46         -
            ser.write_null(&MALFORMEDUNIONINPUT_MEMBER_UNION)?;
          47  +
            ser.write_struct(&MALFORMEDUNIONINPUT_MEMBER_UNION, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl MalformedUnionInput {
   52     53   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   53         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   54         -
        deserializer: &mut D,
          54  +
    pub fn deserialize(
          55  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   55     56   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   56     57   
        #[allow(unused_variables, unused_mut)]
   57     58   
        let mut builder = Self::builder();
   58     59   
        #[allow(
   59     60   
            unused_variables,
   60     61   
            unreachable_code,
   61     62   
            clippy::single_match,
   62     63   
            clippy::match_single_binding,
   63     64   
            clippy::diverging_sub_expression
   64     65   
        )]
   65         -
        deserializer.read_struct(&MALFORMEDUNIONINPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&MALFORMEDUNIONINPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68         -
                    builder.union = Some({
   69         -
                        let _ = member;
   70         -
                        todo!("deserialize aggregate")
   71         -
                    });
          69  +
                    builder.union = Some(crate::types::SimpleUnion::deserialize(deser)?);
   72     70   
                }
   73     71   
                _ => {}
   74     72   
            }
   75     73   
            Ok(())
   76     74   
        })?;
   77     75   
        builder
   78     76   
            .build()
   79     77   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   80     78   
    }
   81     79   
}
          80  +
impl MalformedUnionInput {
          81  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          82  +
    pub fn deserialize_with_response(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          84  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          85  +
        _status: u16,
          86  +
        _body: &[u8],
          87  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          88  +
        Self::deserialize(deserializer)
          89  +
    }
          90  +
}
   82     91   
impl MalformedUnionInput {
   83     92   
    /// Creates a new builder-style object to manufacture [`MalformedUnionInput`](crate::operation::malformed_union::MalformedUnionInput).
   84     93   
    pub fn builder() -> crate::operation::malformed_union::builders::MalformedUnionInputBuilder {
   85     94   
        crate::operation::malformed_union::builders::MalformedUnionInputBuilder::default()
   86     95   
    }
   87     96   
}
   88     97   
   89     98   
/// A builder for [`MalformedUnionInput`](crate::operation::malformed_union::MalformedUnionInput).
   90     99   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   91    100   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_union/_malformed_union_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 MalformedUnionOutput {
   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(&MALFORMEDUNIONOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDUNIONOUTPUT_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 MalformedUnionOutput {
          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 MalformedUnionOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedUnionOutput`](crate::operation::malformed_union::MalformedUnionOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_union::builders::MalformedUnionOutputBuilder {
   52     63   
        crate::operation::malformed_union::builders::MalformedUnionOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedUnionOutput`](crate::operation::malformed_union::MalformedUnionOutput).
   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/media_type_header.rs

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `MediaTypeHeader`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MediaTypeHeader;
    6      6   
impl MediaTypeHeader {
    7      7   
    /// Creates a new `MediaTypeHeader`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::media_type_header::MediaTypeHeaderInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::media_type_header::MediaTypeHeaderOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::media_type_header::MediaTypeHeaderInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::media_type_header::MediaTypeHeaderOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::media_type_header::MediaTypeHeaderError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +229,239 @@
  130    134   
                crate::operation::media_type_header::MediaTypeHeaderError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct MediaTypeHeaderResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MediaTypeHeaderResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    150   
        #[allow(unused_mut)]
  148    151   
        let mut force_error = false;
  149    152   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_media_type_header::de_media_type_header_http_error(status, headers, body)
         153  +
        if !success && status != 200 || force_error {
         154  +
            let headers = response.headers();
         155  +
            let body = response.body().bytes().expect("body loaded");
         156  +
            #[allow(unused_mut)]
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
         160  +
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::media_type_header::MediaTypeHeaderError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_media_type_header::de_media_type_header_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, MediaTypeHeader::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::media_type_header::MediaTypeHeaderOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct MediaTypeHeaderRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MediaTypeHeaderRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::media_type_header::MediaTypeHeaderInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::media_type_header::MediaTypeHeaderInput,
  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, "/MediaTypeHeader").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::media_type_header::MediaTypeHeaderInput,
  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_media_type_header::ser_media_type_header_headers(input, builder)?;
  192         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  193         -
            }
  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("");
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, MediaTypeHeader::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  198    208   
  199         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         209  +
        return ::std::result::Result::Ok(request);
  200    210   
    }
  201    211   
}
  202    212   
#[derive(Debug)]
  203    213   
struct MediaTypeHeaderEndpointParamsInterceptor;
  204    214   
  205    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MediaTypeHeaderEndpointParamsInterceptor {
  206    216   
    fn name(&self) -> &'static str {
  207    217   
        "MediaTypeHeaderEndpointParamsInterceptor"
  208    218   
    }
  209    219   
@@ -275,285 +335,355 @@
  295    305   
            .expect("the config must have a deserializer");
  296    306   
  297    307   
        let parsed = de.deserialize_streaming(&mut http_response);
  298    308   
        let parsed = parsed.unwrap_or_else(|| {
  299    309   
            let http_response = http_response.map(|body| {
  300    310   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  301    311   
                    body.bytes().unwrap(),
  302    312   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  303    313   
                )))
  304    314   
            });
  305         -
            de.deserialize_nonstreaming(&http_response)
         315  +
            // Build a config bag with the protocol for schema-based deserialization
         316  +
            #[allow(unused_mut)]
         317  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         318  +
            {
         319  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         320  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         321  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         322  +
                ));
         323  +
                test_cfg.push_shared_layer(layer.freeze());
         324  +
            }
         325  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  306    326   
        });
  307    327   
        let parsed = parsed
  308    328   
            .expect("should be successful response")
  309    329   
            .downcast::<crate::operation::media_type_header::MediaTypeHeaderOutput>()
  310    330   
            .unwrap();
  311    331   
        ::pretty_assertions::assert_eq!(parsed.json, expected_output.json, "Unexpected value for `json`");
  312    332   
    }
  313    333   
}
  314    334   
  315    335   
/// Error type for the `MediaTypeHeaderError` operation.

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

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

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

@@ -1,1 +107,126 @@
   20     20   
static MEDIATYPEHEADEROUTPUT_MEMBER_JSON: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   21     21   
    ::aws_smithy_schema::ShapeId::from_static(
   22     22   
        "aws.protocoltests.restjson.synthetic#MediaTypeHeaderOutput$json",
   23     23   
        "aws.protocoltests.restjson.synthetic",
   24     24   
        "MediaTypeHeaderOutput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::String,
   27     27   
    "json",
   28     28   
    0,
   29     29   
)
   30         -
.with_http_header("X-Json");
          30  +
.with_http_header("X-Json")
          31  +
.with_media_type("application/json");
   31     32   
static MEDIATYPEHEADEROUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   32     33   
    MEDIATYPEHEADEROUTPUT_SCHEMA_ID,
   33     34   
    ::aws_smithy_schema::ShapeType::Structure,
   34     35   
    &[&MEDIATYPEHEADEROUTPUT_MEMBER_JSON],
   35     36   
);
   36     37   
impl MediaTypeHeaderOutput {
   37     38   
    /// The schema for this shape.
   38     39   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MEDIATYPEHEADEROUTPUT_SCHEMA;
   39     40   
}
   40     41   
impl ::aws_smithy_schema::serde::SerializableStruct for MediaTypeHeaderOutput {
   41     42   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   42     43   
    fn serialize_members(
   43     44   
        &self,
   44     45   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   45     46   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   46     47   
        if let Some(ref val) = self.json {
   47     48   
            ser.write_string(&MEDIATYPEHEADEROUTPUT_MEMBER_JSON, val)?;
   48     49   
        }
   49     50   
        Ok(())
   50     51   
    }
   51     52   
}
   52     53   
impl MediaTypeHeaderOutput {
   53     54   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   54         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   55         -
        deserializer: &mut D,
          55  +
    pub fn deserialize(
          56  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   56     57   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   57     58   
        #[allow(unused_variables, unused_mut)]
   58     59   
        let mut builder = Self::builder();
   59     60   
        #[allow(
   60     61   
            unused_variables,
   61     62   
            unreachable_code,
   62     63   
            clippy::single_match,
   63     64   
            clippy::match_single_binding,
   64     65   
            clippy::diverging_sub_expression
   65     66   
        )]
   66         -
        deserializer.read_struct(&MEDIATYPEHEADEROUTPUT_SCHEMA, (), |_, member, deser| {
          67  +
        deserializer.read_struct(&MEDIATYPEHEADEROUTPUT_SCHEMA, &mut |member, deser| {
   67     68   
            match member.member_index() {
   68     69   
                Some(0) => {
   69     70   
                    builder.json = Some(deser.read_string(member)?);
   70     71   
                }
   71     72   
                _ => {}
   72     73   
            }
   73     74   
            Ok(())
   74     75   
        })?;
   75     76   
        Ok(builder.build())
   76     77   
    }
   77     78   
}
          79  +
impl MediaTypeHeaderOutput {
          80  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
          81  +
    /// Header-bound members are read directly from headers, avoiding runtime
          82  +
    /// member iteration overhead. Body members are read via the deserializer.
          83  +
    pub fn deserialize_with_response(
          84  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          85  +
        headers: &::aws_smithy_runtime_api::http::Headers,
          86  +
        _status: u16,
          87  +
        _body: &[u8],
          88  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          89  +
        #[allow(unused_variables, unused_mut)]
          90  +
        let mut builder = Self::builder();
          91  +
        if let Some(val) = headers.get("X-Json") {
          92  +
            builder.json = ::aws_smithy_types::base64::decode(val).ok().and_then(|b| String::from_utf8(b).ok());
          93  +
        }
          94  +
        Ok(builder.build())
          95  +
    }
          96  +
}
   78     97   
impl MediaTypeHeaderOutput {
   79     98   
    /// Creates a new builder-style object to manufacture [`MediaTypeHeaderOutput`](crate::operation::media_type_header::MediaTypeHeaderOutput).
   80     99   
    pub fn builder() -> crate::operation::media_type_header::builders::MediaTypeHeaderOutputBuilder {
   81    100   
        crate::operation::media_type_header::builders::MediaTypeHeaderOutputBuilder::default()
   82    101   
    }
   83    102   
}
   84    103   
   85    104   
/// A builder for [`MediaTypeHeaderOutput`](crate::operation::media_type_header::MediaTypeHeaderOutput).
   86    105   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   87    106   
#[non_exhaustive]

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

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

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

@@ -1,1 +70,84 @@
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct NoInputAndNoOutputInput {}
    6      6   
static NOINPUTANDNOOUTPUTINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "aws.protocoltests.restjson.synthetic#NoInputAndNoOutputInput",
    8      8   
    "aws.protocoltests.restjson.synthetic",
    9      9   
    "NoInputAndNoOutputInput",
   10     10   
);
   11     11   
static NOINPUTANDNOOUTPUTINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(NOINPUTANDNOOUTPUTINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(NOINPUTANDNOOUTPUTINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/NoInputAndNoOutput", None));
   13     14   
impl NoInputAndNoOutputInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &NOINPUTANDNOOUTPUTINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for NoInputAndNoOutputInput {
   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 NoInputAndNoOutputInput {
   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(&NOINPUTANDNOOUTPUTINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&NOINPUTANDNOOUTPUTINPUT_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 NoInputAndNoOutputInput {
          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 NoInputAndNoOutputInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`NoInputAndNoOutputInput`](crate::operation::no_input_and_no_output::NoInputAndNoOutputInput).
   53     67   
    pub fn builder() -> crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputInputBuilder {
   54     68   
        crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`NoInputAndNoOutputInput`](crate::operation::no_input_and_no_output::NoInputAndNoOutputInput).
   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_no_output/_no_input_and_no_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 NoInputAndNoOutputOutput {
   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(&NOINPUTANDNOOUTPUTOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&NOINPUTANDNOOUTPUTOUTPUT_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 NoInputAndNoOutputOutput {
          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 NoInputAndNoOutputOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`NoInputAndNoOutputOutput`](crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput).
   51     62   
    pub fn builder() -> crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputOutputBuilder {
   52     63   
        crate::operation::no_input_and_no_output::builders::NoInputAndNoOutputOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`NoInputAndNoOutputOutput`](crate::operation::no_input_and_no_output::NoInputAndNoOutputOutput).
   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/no_input_and_output.rs

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `NoInputAndOutput`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct NoInputAndOutput;
    6      6   
impl NoInputAndOutput {
    7      7   
    /// Creates a new `NoInputAndOutput`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::no_input_and_output::NoInputAndOutputInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::no_input_and_output::NoInputAndOutputOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::no_input_and_output::NoInputAndOutputInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::no_input_and_output::NoInputAndOutputOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::no_input_and_output::NoInputAndOutputError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +228,239 @@
  130    134   
                crate::operation::no_input_and_output::NoInputAndOutputError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct NoInputAndOutputResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for NoInputAndOutputResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  145         -
        let headers = response.headers();
  146         -
        let body = response.body().bytes().expect("body loaded");
  147    150   
        #[allow(unused_mut)]
  148    151   
        let mut force_error = false;
  149    152   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_no_input_and_output::de_no_input_and_output_http_error(status, headers, body)
         153  +
        if !success && status != 200 || force_error {
         154  +
            let headers = response.headers();
         155  +
            let body = response.body().bytes().expect("body loaded");
         156  +
            #[allow(unused_mut)]
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
         160  +
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::no_input_and_output::NoInputAndOutputError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_no_input_and_output::de_no_input_and_output_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, NoInputAndOutput::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::no_input_and_output::NoInputAndOutputOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct NoInputAndOutputRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for NoInputAndOutputRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::no_input_and_output::NoInputAndOutputInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::no_input_and_output::NoInputAndOutputInput,
  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, "/NoInputAndOutputOutput").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::no_input_and_output::NoInputAndOutputInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  197         -
  198         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, NoInputAndOutput::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  199    210   
    }
  200    211   
}
  201    212   
#[derive(Debug)]
  202    213   
struct NoInputAndOutputEndpointParamsInterceptor;
  203    214   
  204    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NoInputAndOutputEndpointParamsInterceptor {
  205    216   
    fn name(&self) -> &'static str {
  206    217   
        "NoInputAndOutputEndpointParamsInterceptor"
  207    218   
    }
  208    219   
@@ -269,280 +369,400 @@
  289    300   
            .expect("the config must have a deserializer");
  290    301   
  291    302   
        let parsed = de.deserialize_streaming(&mut http_response);
  292    303   
        let parsed = parsed.unwrap_or_else(|| {
  293    304   
            let http_response = http_response.map(|body| {
  294    305   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  295    306   
                    body.bytes().unwrap(),
  296    307   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  297    308   
                )))
  298    309   
            });
  299         -
            de.deserialize_nonstreaming(&http_response)
         310  +
            // Build a config bag with the protocol for schema-based deserialization
         311  +
            #[allow(unused_mut)]
         312  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         313  +
            {
         314  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         315  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         316  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         317  +
                ));
         318  +
                test_cfg.push_shared_layer(layer.freeze());
         319  +
            }
         320  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  300    321   
        });
  301    322   
        let parsed = parsed
  302    323   
            .expect("should be successful response")
  303    324   
            .downcast::<crate::operation::no_input_and_output::NoInputAndOutputOutput>()
  304    325   
            .unwrap();
  305    326   
    }
  306    327   
  307    328   
    /// This test is similar to RestJsonNoInputAndOutputWithJson, but
  308    329   
    /// it ensures that clients can gracefully handle responses that
  309    330   
    /// omit a JSON payload.
  310    331   
    /// Test ID: RestJsonNoInputAndOutputNoPayload
  311    332   
    #[::tokio::test]
  312    333   
    #[::tracing_test::traced_test]
  313    334   
    async fn rest_json_no_input_and_output_no_payload_response() {
  314    335   
        let expected_output = crate::operation::no_input_and_output::NoInputAndOutputOutput::builder().build();
  315    336   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  316    337   
            ::http_1x::response::Builder::new()
  317    338   
                .status(200)
  318    339   
                .body(::aws_smithy_types::body::SdkBody::from(""))
  319    340   
                .unwrap(),
  320    341   
        )
  321    342   
        .unwrap();
  322    343   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  323    344   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  324    345   
  325    346   
        let op = crate::operation::no_input_and_output::NoInputAndOutput::new();
  326    347   
        let config = op.config().expect("the operation has config");
  327    348   
        let de = config
  328    349   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  329    350   
            .expect("the config must have a deserializer");
  330    351   
  331    352   
        let parsed = de.deserialize_streaming(&mut http_response);
  332    353   
        let parsed = parsed.unwrap_or_else(|| {
  333    354   
            let http_response = http_response.map(|body| {
  334    355   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  335    356   
                    body.bytes().unwrap(),
  336    357   
                    ::aws_smithy_protocol_test::MediaType::from("unknown"),
  337    358   
                )))
  338    359   
            });
  339         -
            de.deserialize_nonstreaming(&http_response)
         360  +
            // Build a config bag with the protocol for schema-based deserialization
         361  +
            #[allow(unused_mut)]
         362  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         363  +
            {
         364  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         365  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         366  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         367  +
                ));
         368  +
                test_cfg.push_shared_layer(layer.freeze());
         369  +
            }
         370  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  340    371   
        });
  341    372   
        let parsed = parsed
  342    373   
            .expect("should be successful response")
  343    374   
            .downcast::<crate::operation::no_input_and_output::NoInputAndOutputOutput>()
  344    375   
            .unwrap();
  345    376   
    }
  346    377   
}
  347    378   
  348    379   
/// Error type for the `NoInputAndOutputError` operation.
  349    380   
#[non_exhaustive]

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,241 @@
  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))
  193         -
            }
  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("");
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        let mut request = protocol
         208  +
            .serialize_request(&input, NullAndEmptyHeadersClient::INPUT_SCHEMA, "", _cfg)
         209  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  198    210   
  199         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         211  +
        return ::std::result::Result::Ok(request);
  200    212   
    }
  201    213   
}
  202    214   
#[derive(Debug)]
  203    215   
struct NullAndEmptyHeadersClientEndpointParamsInterceptor;
  204    216   
  205    217   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for NullAndEmptyHeadersClientEndpointParamsInterceptor {
  206    218   
    fn name(&self) -> &'static str {
  207    219   
        "NullAndEmptyHeadersClientEndpointParamsInterceptor"
  208    220   
    }
  209    221   

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]