Client Test

Client Test

rev. 163d4d6410694aaf071424777ecbecd050925f36

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_boolean/_malformed_boolean_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 MalformedBooleanOutput {
   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(&MALFORMEDBOOLEANOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDBOOLEANOUTPUT_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 MalformedBooleanOutput {
          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 MalformedBooleanOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedBooleanOutput`](crate::operation::malformed_boolean::MalformedBooleanOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_boolean::builders::MalformedBooleanOutputBuilder {
   52     63   
        crate::operation::malformed_boolean::builders::MalformedBooleanOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedBooleanOutput`](crate::operation::malformed_boolean::MalformedBooleanOutput).
   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/malformed_byte.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 `MalformedByte`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedByte;
    6      6   
impl MalformedByte {
    7      7   
    /// Creates a new `MalformedByte`
    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_byte::MalformedByteInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_byte::MalformedByteOutput::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_byte::MalformedByteInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::malformed_byte::MalformedByteOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::malformed_byte::MalformedByteError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -107,111 +252,267 @@
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct MalformedByteResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedByteResponseDeserializer {
  134    138   
    fn deserialize_nonstreaming(
  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_byte::de_malformed_byte_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(crate::operation::malformed_byte::MalformedByteError::generic(
         158  +
                    generic,
         159  +
                )),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_malformed_byte::de_malformed_byte_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.deserialize_response(response, MalformedByte::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         166  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         167  +
            })?;
         168  +
            let body = response.body().bytes().expect("body loaded");
         169  +
            let output = crate::operation::malformed_byte::MalformedByteOutput::deserialize_with_response(
         170  +
                &mut *deser,
         171  +
                response.headers(),
         172  +
                response.status().into(),
         173  +
                body,
         174  +
            )
         175  +
            .map_err(|e| {
         176  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
            })?;
         178  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         179  +
        }
  150    180   
    }
  151    181   
}
  152    182   
#[derive(Debug)]
  153    183   
struct MalformedByteRequestSerializer;
  154    184   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedByteRequestSerializer {
  155    185   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    186   
    fn serialize_input(
  157    187   
        &self,
  158    188   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    189   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    190   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    191   
        let input = input
  162    192   
            .downcast::<crate::operation::malformed_byte::MalformedByteInput>()
  163    193   
            .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_byte::MalformedByteInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                let input_1 = &_input.byte_in_path;
  176         -
                let input_1 = input_1
  177         -
                    .as_ref()
  178         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("byte_in_path", "cannot be empty or unset"))?;
  179         -
                let mut byte_in_path_encoder = ::aws_smithy_types::primitive::Encoder::from(*input_1);
  180         -
                let byte_in_path = byte_in_path_encoder.encode();
  181         -
                if byte_in_path.is_empty() {
  182         -
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
  183         -
                        "byte_in_path",
  184         -
                        "cannot be empty or unset",
  185         -
                    ));
         194  +
        let protocol = _cfg
         195  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         196  +
            .expect("a SharedClientProtocol is required");
         197  +
        if protocol.supports_http_bindings() {
         198  +
            let mut request = protocol
         199  +
                .serialize_body(&input, MalformedByte::INPUT_SCHEMA, "", _cfg)
         200  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         201  +
            {
         202  +
                let mut uri = "/MalformedByte/{byteInPath}".to_string();
         203  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         204  +
                if let Some(ref val) = input.byte_in_path {
         205  +
                    uri = uri.replace("{byteInPath}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
  186    206   
                }
  187         -
                ::std::write!(output, "/MalformedByte/{byteInPath}", byteInPath = byte_in_path).expect("formatting should succeed");
  188         -
                ::std::result::Result::Ok(())
  189         -
            }
  190         -
            fn uri_query(
  191         -
                _input: &crate::operation::malformed_byte::MalformedByteInput,
  192         -
                mut output: &mut ::std::string::String,
  193         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  194         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  195         -
                if let ::std::option::Option::Some(inner_2) = &_input.byte_in_query {
  196         -
                    {
  197         -
                        query.push_kv("byteInQuery", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode());
  198         -
                    }
         207  +
                if let Some(ref val) = input.byte_in_query {
         208  +
                    query_params.push(("byteInQuery".to_string(), val.to_string()));
  199    209   
                }
  200         -
                ::std::result::Result::Ok(())
  201         -
            }
  202         -
            #[allow(clippy::unnecessary_wraps)]
  203         -
            fn update_http_builder(
  204         -
                input: &crate::operation::malformed_byte::MalformedByteInput,
  205         -
                builder: ::http_1x::request::Builder,
  206         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  207         -
                let mut uri = ::std::string::String::new();
  208         -
                uri_base(input, &mut uri)?;
  209         -
                uri_query(input, &mut uri)?;
  210         -
                let builder = crate::protocol_serde::shape_malformed_byte::ser_malformed_byte_headers(input, builder)?;
  211         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
         210  +
                if let Some(ref val) = input.byte_in_header {
         211  +
                    request.headers_mut().insert("byteInHeader", val.to_string());
         212  +
                }
         213  +
                if !query_params.is_empty() {
         214  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         215  +
                    let pairs: Vec<String> = query_params
         216  +
                        .iter()
         217  +
                        .map(|(k, v)| {
         218  +
                            format!(
         219  +
                                "{}={}",
         220  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         221  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         222  +
                            )
         223  +
                        })
         224  +
                        .collect();
         225  +
                    uri.push_str(&pairs.join("&"));
         226  +
                }
         227  +
                request.set_uri(uri.as_str()).expect("valid URI");
  212    228   
            }
  213         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  214         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  215         -
            builder
  216         -
        };
  217         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_malformed_byte::ser_malformed_byte_input(&input)?);
  218         -
        if let Some(content_length) = body.content_length() {
  219         -
            let content_length = content_length.to_string();
  220         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
         229  +
         230  +
            return ::std::result::Result::Ok(request);
         231  +
        } else {
         232  +
            let mut request = protocol
         233  +
                .serialize_request(&input, MalformedByte::INPUT_SCHEMA, "", _cfg)
         234  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         235  +
         236  +
            return ::std::result::Result::Ok(request);
  221    237   
        }
  222         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  223    238   
    }
  224    239   
}
  225    240   
#[derive(Debug)]
  226    241   
struct MalformedByteEndpointParamsInterceptor;
  227    242   
  228    243   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedByteEndpointParamsInterceptor {
  229    244   
    fn name(&self) -> &'static str {
  230    245   
        "MalformedByteEndpointParamsInterceptor"
  231    246   
    }
  232    247   

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

@@ -15,15 +177,222 @@
   35     35   
    "aws.protocoltests.restjson.synthetic",
   36     36   
    "MalformedByteInput",
   37     37   
);
   38     38   
static MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_BODY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   39     39   
    ::aws_smithy_schema::ShapeId::from_static(
   40     40   
        "aws.protocoltests.restjson.synthetic#MalformedByteInput$byteInBody",
   41     41   
        "aws.protocoltests.restjson.synthetic",
   42     42   
        "MalformedByteInput",
   43     43   
    ),
   44     44   
    ::aws_smithy_schema::ShapeType::Byte,
   45         -
    "byte_in_body",
          45  +
    "byteInBody",
   46     46   
    0,
   47     47   
);
   48     48   
static MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_PATH: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   49     49   
    ::aws_smithy_schema::ShapeId::from_static(
   50     50   
        "aws.protocoltests.restjson.synthetic#MalformedByteInput$byteInPath",
   51     51   
        "aws.protocoltests.restjson.synthetic",
   52     52   
        "MalformedByteInput",
   53     53   
    ),
   54     54   
    ::aws_smithy_schema::ShapeType::Byte,
   55         -
    "byte_in_path",
          55  +
    "byteInPath",
   56     56   
    1,
   57     57   
)
   58     58   
.with_http_label();
   59     59   
static MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_QUERY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   60     60   
    ::aws_smithy_schema::ShapeId::from_static(
   61     61   
        "aws.protocoltests.restjson.synthetic#MalformedByteInput$byteInQuery",
   62     62   
        "aws.protocoltests.restjson.synthetic",
   63     63   
        "MalformedByteInput",
   64     64   
    ),
   65     65   
    ::aws_smithy_schema::ShapeType::Byte,
   66         -
    "byte_in_query",
          66  +
    "byteInQuery",
   67     67   
    2,
   68     68   
)
   69     69   
.with_http_query("byteInQuery");
   70     70   
static MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_HEADER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   71     71   
    ::aws_smithy_schema::ShapeId::from_static(
   72     72   
        "aws.protocoltests.restjson.synthetic#MalformedByteInput$byteInHeader",
   73     73   
        "aws.protocoltests.restjson.synthetic",
   74     74   
        "MalformedByteInput",
   75     75   
    ),
   76     76   
    ::aws_smithy_schema::ShapeType::Byte,
   77         -
    "byte_in_header",
          77  +
    "byteInHeader",
   78     78   
    3,
   79     79   
)
   80     80   
.with_http_header("byteInHeader");
   81     81   
static MALFORMEDBYTEINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   82     82   
    MALFORMEDBYTEINPUT_SCHEMA_ID,
   83     83   
    ::aws_smithy_schema::ShapeType::Structure,
   84     84   
    &[
   85     85   
        &MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_BODY,
   86     86   
        &MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_PATH,
   87     87   
        &MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_QUERY,
   88     88   
        &MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_HEADER,
   89     89   
    ],
   90         -
);
          90  +
)
          91  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/MalformedByte/{byteInPath}", None));
   91     92   
impl MalformedByteInput {
   92     93   
    /// The schema for this shape.
   93     94   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &MALFORMEDBYTEINPUT_SCHEMA;
   94     95   
}
   95     96   
impl ::aws_smithy_schema::serde::SerializableStruct for MalformedByteInput {
   96     97   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   97     98   
    fn serialize_members(
   98     99   
        &self,
   99    100   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  100    101   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  101    102   
        if let Some(ref val) = self.byte_in_body {
  102    103   
            ser.write_byte(&MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_BODY, *val)?;
  103    104   
        }
  104    105   
        if let Some(ref val) = self.byte_in_path {
  105    106   
            ser.write_byte(&MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_PATH, *val)?;
  106    107   
        }
  107    108   
        if let Some(ref val) = self.byte_in_query {
  108    109   
            ser.write_byte(&MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_QUERY, *val)?;
  109    110   
        }
  110    111   
        if let Some(ref val) = self.byte_in_header {
  111    112   
            ser.write_byte(&MALFORMEDBYTEINPUT_MEMBER_BYTE_IN_HEADER, *val)?;
  112    113   
        }
  113    114   
        Ok(())
  114    115   
    }
  115    116   
}
  116    117   
impl MalformedByteInput {
  117    118   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  118         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  119         -
        deserializer: &mut D,
         119  +
    pub fn deserialize(
         120  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  120    121   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  121    122   
        #[allow(unused_variables, unused_mut)]
  122    123   
        let mut builder = Self::builder();
  123    124   
        #[allow(
  124    125   
            unused_variables,
  125    126   
            unreachable_code,
  126    127   
            clippy::single_match,
  127    128   
            clippy::match_single_binding,
  128    129   
            clippy::diverging_sub_expression
  129    130   
        )]
  130         -
        deserializer.read_struct(&MALFORMEDBYTEINPUT_SCHEMA, (), |_, member, deser| {
         131  +
        deserializer.read_struct(&MALFORMEDBYTEINPUT_SCHEMA, &mut |member, deser| {
  131    132   
            match member.member_index() {
  132    133   
                Some(0) => {
  133    134   
                    builder.byte_in_body = Some(deser.read_byte(member)?);
  134    135   
                }
  135    136   
                Some(1) => {
  136    137   
                    builder.byte_in_path = Some(deser.read_byte(member)?);
  137    138   
                }
  138    139   
                Some(2) => {
  139    140   
                    builder.byte_in_query = Some(deser.read_byte(member)?);
  140    141   
                }
  141    142   
                Some(3) => {
  142    143   
                    builder.byte_in_header = Some(deser.read_byte(member)?);
  143    144   
                }
  144    145   
                _ => {}
  145    146   
            }
  146    147   
            Ok(())
  147    148   
        })?;
         149  +
        builder.byte_in_path = builder.byte_in_path.or(Some(0i8));
         150  +
        builder
         151  +
            .build()
         152  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         153  +
    }
         154  +
}
         155  +
impl MalformedByteInput {
         156  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         157  +
    /// Header-bound members are read directly from headers, avoiding runtime
         158  +
    /// member iteration overhead. Body members are read via the deserializer.
         159  +
    pub fn deserialize_with_response(
         160  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         161  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         162  +
        _status: u16,
         163  +
        _body: &[u8],
         164  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         165  +
        #[allow(unused_variables, unused_mut)]
         166  +
        let mut builder = Self::builder();
         167  +
        if let Some(val) = headers.get("byteInHeader") {
         168  +
            builder.byte_in_header = val.parse::<i8>().ok();
         169  +
        }
         170  +
        #[allow(
         171  +
            unused_variables,
         172  +
            unreachable_code,
         173  +
            clippy::single_match,
         174  +
            clippy::match_single_binding,
         175  +
            clippy::diverging_sub_expression
         176  +
        )]
         177  +
        deserializer.read_struct(&MALFORMEDBYTEINPUT_SCHEMA, &mut |member, deser| {
         178  +
            match member.member_index() {
         179  +
                Some(0) => {
         180  +
                    builder.byte_in_body = Some(deser.read_byte(member)?);
         181  +
                }
         182  +
                Some(1) => {
         183  +
                    builder.byte_in_path = Some(deser.read_byte(member)?);
         184  +
                }
         185  +
                Some(2) => {
         186  +
                    builder.byte_in_query = Some(deser.read_byte(member)?);
         187  +
                }
         188  +
                Some(3) => { /* read from headers above */ }
         189  +
                _ => {}
         190  +
            }
         191  +
            Ok(())
         192  +
        })?;
  148    193   
        builder
  149    194   
            .build()
  150    195   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  151    196   
    }
  152    197   
}
  153    198   
impl MalformedByteInput {
  154    199   
    /// Creates a new builder-style object to manufacture [`MalformedByteInput`](crate::operation::malformed_byte::MalformedByteInput).
  155    200   
    pub fn builder() -> crate::operation::malformed_byte::builders::MalformedByteInputBuilder {
  156    201   
        crate::operation::malformed_byte::builders::MalformedByteInputBuilder::default()
  157    202   
    }

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_byte/_malformed_byte_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 MalformedByteOutput {
   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(&MALFORMEDBYTEOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&MALFORMEDBYTEOUTPUT_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 MalformedByteOutput {
          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 MalformedByteOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`MalformedByteOutput`](crate::operation::malformed_byte::MalformedByteOutput).
   51     62   
    pub fn builder() -> crate::operation::malformed_byte::builders::MalformedByteOutputBuilder {
   52     63   
        crate::operation::malformed_byte::builders::MalformedByteOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`MalformedByteOutput`](crate::operation::malformed_byte::MalformedByteOutput).
   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/malformed_content_type_with_body.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 `MalformedContentTypeWithBody`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedContentTypeWithBody;
    6      6   
impl MalformedContentTypeWithBody {
    7      7   
    /// Creates a new `MalformedContentTypeWithBody`
    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::malformed_content_type_with_body::MalformedContentTypeWithBodyInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::malformed_content_type_with_body::MalformedContentTypeWithBodyOutput::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::malformed_content_type_with_body::MalformedContentTypeWithBodyInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::malformed_content_type_with_body::MalformedContentTypeWithBodyOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::malformed_content_type_with_body::MalformedContentTypeWithBodyError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -113,119 +234,241 @@
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct MalformedContentTypeWithBodyResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedContentTypeWithBodyResponseDeserializer {
  140    146   
    fn deserialize_nonstreaming(
  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_malformed_content_type_with_body::de_malformed_content_type_with_body_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::malformed_content_type_with_body::MalformedContentTypeWithBodyError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_malformed_content_type_with_body::de_malformed_content_type_with_body_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, MalformedContentTypeWithBody::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::malformed_content_type_with_body::MalformedContentTypeWithBodyOutput::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 MalformedContentTypeWithBodyRequestSerializer;
  160    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedContentTypeWithBodyRequestSerializer {
  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::malformed_content_type_with_body::MalformedContentTypeWithBodyInput>()
  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::malformed_content_type_with_body::MalformedContentTypeWithBodyInput,
  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, "/MalformedContentTypeWithBody").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::malformed_content_type_with_body::MalformedContentTypeWithBodyInput,
  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 = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  198         -
            crate::protocol_serde::shape_malformed_content_type_with_body::ser_malformed_content_type_with_body_input(&input)?,
  199         -
        );
  200         -
        if let Some(content_length) = body.content_length() {
  201         -
            let content_length = content_length.to_string();
  202         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  203         -
        }
  204         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         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, MalformedContentTypeWithBody::INPUT_SCHEMA, "", _cfg)
         209  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         210  +
         211  +
        return ::std::result::Result::Ok(request);
  205    212   
    }
  206    213   
}
  207    214   
#[derive(Debug)]
  208    215   
struct MalformedContentTypeWithBodyEndpointParamsInterceptor;
  209    216   
  210    217   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedContentTypeWithBodyEndpointParamsInterceptor {
  211    218   
    fn name(&self) -> &'static str {
  212    219   
        "MalformedContentTypeWithBodyEndpointParamsInterceptor"
  213    220   
    }
  214    221   

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

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

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

@@ -1,1 +40,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `MalformedContentTypeWithGenericString`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedContentTypeWithGenericString;
    6      6   
impl MalformedContentTypeWithGenericString {
    7      7   
    /// Creates a new `MalformedContentTypeWithGenericString`
    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::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringOutput::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::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -113,119 +238,251 @@
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct MalformedContentTypeWithGenericStringResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedContentTypeWithGenericStringResponseDeserializer {
  140    146   
    fn deserialize_nonstreaming(
  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_malformed_content_type_with_generic_string::de_malformed_content_type_with_generic_string_http_error(
  152         -
                status, headers, body,
  153         -
            )
         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::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringError::generic(generic),
         167  +
                ),
         168  +
            ))
  154    169   
        } else {
  155         -
            crate::protocol_serde::shape_malformed_content_type_with_generic_string::de_malformed_content_type_with_generic_string_http_response(
  156         -
                status, headers, body,
  157         -
            )
  158         -
        };
  159         -
        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, MalformedContentTypeWithGenericString::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 =
         180  +
                crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringOutput::deserialize_with_response(
         181  +
                    &mut *deser,
         182  +
                    response.headers(),
         183  +
                    response.status().into(),
         184  +
                    body,
         185  +
                )
         186  +
                .map_err(|e| {
         187  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         188  +
                })?;
         189  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         190  +
        }
  160    191   
    }
  161    192   
}
  162    193   
#[derive(Debug)]
  163    194   
struct MalformedContentTypeWithGenericStringRequestSerializer;
  164    195   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedContentTypeWithGenericStringRequestSerializer {
  165    196   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  166    197   
    fn serialize_input(
  167    198   
        &self,
  168    199   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  169    200   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  170    201   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  171    202   
        let input = input
  172    203   
            .downcast::<crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringInput>()
  173    204   
            .expect("correct type");
  174         -
        let _header_serialization_settings = _cfg
  175         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  176         -
            .cloned()
  177         -
            .unwrap_or_default();
  178         -
        let mut request_builder = {
  179         -
            #[allow(clippy::uninlined_format_args)]
  180         -
            fn uri_base(
  181         -
                _input: &crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringInput,
  182         -
                output: &mut ::std::string::String,
  183         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  184         -
                use ::std::fmt::Write as _;
  185         -
                ::std::write!(output, "/MalformedContentTypeWithGenericString").expect("formatting should succeed");
  186         -
                ::std::result::Result::Ok(())
         205  +
        let protocol = _cfg
         206  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         207  +
            .expect("a SharedClientProtocol is required");
         208  +
        let mut input = input;
         209  +
        let payload = input.payload.take();
         210  +
        let mut request = protocol
         211  +
            .serialize_request(&input, MalformedContentTypeWithGenericString::INPUT_SCHEMA, "", _cfg)
         212  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         213  +
        if let ::std::option::Option::Some(payload) = payload {
         214  +
            *request.body_mut() = ::aws_smithy_types::body::SdkBody::from(payload.into_bytes());
         215  +
            request.headers_mut().insert("Content-Type", "text/plain");
         216  +
            if let ::std::option::Option::Some(content_length) = request.body().content_length() {
         217  +
                request.headers_mut().insert("Content-Length", content_length.to_string());
  187    218   
            }
  188         -
            #[allow(clippy::unnecessary_wraps)]
  189         -
            fn update_http_builder(
  190         -
                input: &crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringInput,
  191         -
                builder: ::http_1x::request::Builder,
  192         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  193         -
                let mut uri = ::std::string::String::new();
  194         -
                uri_base(input, &mut uri)?;
  195         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  196         -
            }
  197         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  198         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "text/plain");
  199         -
            builder
  200         -
        };
  201         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  202         -
            crate::protocol_serde::shape_malformed_content_type_with_generic_string_input::ser_payload_http_payload(input.payload)?,
  203         -
        );
  204         -
        if let Some(content_length) = body.content_length() {
  205         -
            let content_length = content_length.to_string();
  206         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  207    219   
        }
  208         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         220  +
         221  +
        return ::std::result::Result::Ok(request);
  209    222   
    }
  210    223   
}
  211    224   
#[derive(Debug)]
  212    225   
struct MalformedContentTypeWithGenericStringEndpointParamsInterceptor;
  213    226   
  214    227   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedContentTypeWithGenericStringEndpointParamsInterceptor {
  215    228   
    fn name(&self) -> &'static str {
  216    229   
        "MalformedContentTypeWithGenericStringEndpointParamsInterceptor"
  217    230   
    }
  218    231   

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

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

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

@@ -1,1 +68,79 @@
   21     21   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   22     22   
    fn serialize_members(
   23     23   
        &self,
   24     24   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   25     25   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   26     26   
        Ok(())
   27     27   
    }
   28     28   
}
   29     29   
impl MalformedContentTypeWithGenericStringOutput {
   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(&MALFORMEDCONTENTTYPEWITHGENERICSTRINGOUTPUT_SCHEMA, (), |_, member, deser| {
          43  +
        deserializer.read_struct(&MALFORMEDCONTENTTYPEWITHGENERICSTRINGOUTPUT_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 MalformedContentTypeWithGenericStringOutput {
          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 MalformedContentTypeWithGenericStringOutput {
   53     64   
    /// Creates a new builder-style object to manufacture [`MalformedContentTypeWithGenericStringOutput`](crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringOutput).
   54     65   
    pub fn builder() -> crate::operation::malformed_content_type_with_generic_string::builders::MalformedContentTypeWithGenericStringOutputBuilder {
   55     66   
        crate::operation::malformed_content_type_with_generic_string::builders::MalformedContentTypeWithGenericStringOutputBuilder::default()
   56     67   
    }
   57     68   
}
   58     69   
   59     70   
/// A builder for [`MalformedContentTypeWithGenericStringOutput`](crate::operation::malformed_content_type_with_generic_string::MalformedContentTypeWithGenericStringOutput).
   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_content_type_with_payload.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 `MalformedContentTypeWithPayload`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedContentTypeWithPayload;
    6      6   
impl MalformedContentTypeWithPayload {
    7      7   
    /// Creates a new `MalformedContentTypeWithPayload`
    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::malformed_content_type_with_payload::MalformedContentTypeWithPayloadInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::malformed_content_type_with_payload::MalformedContentTypeWithPayloadOutput::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::malformed_content_type_with_payload::MalformedContentTypeWithPayloadInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::malformed_content_type_with_payload::MalformedContentTypeWithPayloadOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::malformed_content_type_with_payload::MalformedContentTypeWithPayloadError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -113,119 +236,250 @@
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct MalformedContentTypeWithPayloadResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedContentTypeWithPayloadResponseDeserializer {
  140    146   
    fn deserialize_nonstreaming(
  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_malformed_content_type_with_payload::de_malformed_content_type_with_payload_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::malformed_content_type_with_payload::MalformedContentTypeWithPayloadError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_malformed_content_type_with_payload::de_malformed_content_type_with_payload_http_response(
  154         -
                status, headers, body,
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, MalformedContentTypeWithPayload::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::malformed_content_type_with_payload::MalformedContentTypeWithPayloadOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
  155    184   
            )
  156         -
        };
  157         -
        crate::protocol_serde::type_erase_result(parse_result)
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  158    190   
    }
  159    191   
}
  160    192   
#[derive(Debug)]
  161    193   
struct MalformedContentTypeWithPayloadRequestSerializer;
  162    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedContentTypeWithPayloadRequestSerializer {
  163    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  164    196   
    fn serialize_input(
  165    197   
        &self,
  166    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  167    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  168    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  169    201   
        let input = input
  170    202   
            .downcast::<crate::operation::malformed_content_type_with_payload::MalformedContentTypeWithPayloadInput>()
  171    203   
            .expect("correct type");
  172         -
        let _header_serialization_settings = _cfg
  173         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  174         -
            .cloned()
  175         -
            .unwrap_or_default();
  176         -
        let mut request_builder = {
  177         -
            #[allow(clippy::uninlined_format_args)]
  178         -
            fn uri_base(
  179         -
                _input: &crate::operation::malformed_content_type_with_payload::MalformedContentTypeWithPayloadInput,
  180         -
                output: &mut ::std::string::String,
  181         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  182         -
                use ::std::fmt::Write as _;
  183         -
                ::std::write!(output, "/MalformedContentTypeWithPayload").expect("formatting should succeed");
  184         -
                ::std::result::Result::Ok(())
         204  +
        let protocol = _cfg
         205  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         206  +
            .expect("a SharedClientProtocol is required");
         207  +
        let mut input = input;
         208  +
        let payload = input.payload.take();
         209  +
        let mut request = protocol
         210  +
            .serialize_request(&input, MalformedContentTypeWithPayload::INPUT_SCHEMA, "", _cfg)
         211  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         212  +
        if let ::std::option::Option::Some(payload) = payload {
         213  +
            *request.body_mut() = ::aws_smithy_types::body::SdkBody::from(payload.into_inner());
         214  +
            request.headers_mut().insert("Content-Type", "image/jpeg");
         215  +
            if let ::std::option::Option::Some(content_length) = request.body().content_length() {
         216  +
                request.headers_mut().insert("Content-Length", content_length.to_string());
  185    217   
            }
  186         -
            #[allow(clippy::unnecessary_wraps)]
  187         -
            fn update_http_builder(
  188         -
                input: &crate::operation::malformed_content_type_with_payload::MalformedContentTypeWithPayloadInput,
  189         -
                builder: ::http_1x::request::Builder,
  190         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  191         -
                let mut uri = ::std::string::String::new();
  192         -
                uri_base(input, &mut uri)?;
  193         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  194         -
            }
  195         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  196         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "image/jpeg");
  197         -
            builder
  198         -
        };
  199         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  200         -
            crate::protocol_serde::shape_malformed_content_type_with_payload_input::ser_payload_http_payload(input.payload)?,
  201         -
        );
  202         -
        if let Some(content_length) = body.content_length() {
  203         -
            let content_length = content_length.to_string();
  204         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  205    218   
        }
  206         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         219  +
         220  +
        return ::std::result::Result::Ok(request);
  207    221   
    }
  208    222   
}
  209    223   
#[derive(Debug)]
  210    224   
struct MalformedContentTypeWithPayloadEndpointParamsInterceptor;
  211    225   
  212    226   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedContentTypeWithPayloadEndpointParamsInterceptor {
  213    227   
    fn name(&self) -> &'static str {
  214    228   
        "MalformedContentTypeWithPayloadEndpointParamsInterceptor"
  215    229   
    }
  216    230   

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

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_content_type_with_payload/_malformed_content_type_with_payload_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 MalformedContentTypeWithPayloadOutput {
   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(&MALFORMEDCONTENTTYPEWITHPAYLOADOUTPUT_SCHEMA, (), |_, member, deser| {
          43  +
        deserializer.read_struct(&MALFORMEDCONTENTTYPEWITHPAYLOADOUTPUT_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 MalformedContentTypeWithPayloadOutput {
          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 MalformedContentTypeWithPayloadOutput {
   53     64   
    /// Creates a new builder-style object to manufacture [`MalformedContentTypeWithPayloadOutput`](crate::operation::malformed_content_type_with_payload::MalformedContentTypeWithPayloadOutput).
   54     65   
    pub fn builder() -> crate::operation::malformed_content_type_with_payload::builders::MalformedContentTypeWithPayloadOutputBuilder {
   55     66   
        crate::operation::malformed_content_type_with_payload::builders::MalformedContentTypeWithPayloadOutputBuilder::default()
   56     67   
    }
   57     68   
}
   58     69   
   59     70   
/// A builder for [`MalformedContentTypeWithPayloadOutput`](crate::operation::malformed_content_type_with_payload::MalformedContentTypeWithPayloadOutput).
   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_content_type_without_body.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 `MalformedContentTypeWithoutBody`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct MalformedContentTypeWithoutBody;
    6      6   
impl MalformedContentTypeWithoutBody {
    7      7   
    /// Creates a new `MalformedContentTypeWithoutBody`
    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::malformed_content_type_without_body::MalformedContentTypeWithoutBodyInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::malformed_content_type_without_body::MalformedContentTypeWithoutBodyOutput::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::malformed_content_type_without_body::MalformedContentTypeWithoutBodyInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::malformed_content_type_without_body::MalformedContentTypeWithoutBodyOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::malformed_content_type_without_body::MalformedContentTypeWithoutBodyError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -113,119 +230,241 @@
  133    139   
        ::std::borrow::Cow::Owned(rcb)
  134    140   
    }
  135    141   
}
  136    142   
  137    143   
#[derive(Debug)]
  138    144   
struct MalformedContentTypeWithoutBodyResponseDeserializer;
  139    145   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedContentTypeWithoutBodyResponseDeserializer {
  140    146   
    fn deserialize_nonstreaming(
  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_malformed_content_type_without_body::de_malformed_content_type_without_body_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::malformed_content_type_without_body::MalformedContentTypeWithoutBodyError::generic(generic),
         167  +
                ),
         168  +
            ))
  152    169   
        } else {
  153         -
            crate::protocol_serde::shape_malformed_content_type_without_body::de_malformed_content_type_without_body_http_response(
  154         -
                status, headers, body,
         170  +
            let protocol = _cfg
         171  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         172  +
                .expect("a SharedClientProtocol is required");
         173  +
            let mut deser = protocol
         174  +
                .deserialize_response(response, MalformedContentTypeWithoutBody::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::malformed_content_type_without_body::MalformedContentTypeWithoutBodyOutput::deserialize_with_response(
         180  +
                &mut *deser,
         181  +
                response.headers(),
         182  +
                response.status().into(),
         183  +
                body,
  155    184   
            )
  156         -
        };
  157         -
        crate::protocol_serde::type_erase_result(parse_result)
         185  +
            .map_err(|e| {
         186  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         187  +
            })?;
         188  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         189  +
        }
  158    190   
    }
  159    191   
}
  160    192   
#[derive(Debug)]
  161    193   
struct MalformedContentTypeWithoutBodyRequestSerializer;
  162    194   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedContentTypeWithoutBodyRequestSerializer {
  163    195   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  164    196   
    fn serialize_input(
  165    197   
        &self,
  166    198   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  167    199   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  168    200   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  169    201   
        let input = input
  170    202   
            .downcast::<crate::operation::malformed_content_type_without_body::MalformedContentTypeWithoutBodyInput>()
  171    203   
            .expect("correct type");
  172         -
        let _header_serialization_settings = _cfg
  173         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  174         -
            .cloned()
  175         -
            .unwrap_or_default();
  176         -
        let mut request_builder = {
  177         -
            #[allow(clippy::uninlined_format_args)]
  178         -
            fn uri_base(
  179         -
                _input: &crate::operation::malformed_content_type_without_body::MalformedContentTypeWithoutBodyInput,
  180         -
                output: &mut ::std::string::String,
  181         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  182         -
                use ::std::fmt::Write as _;
  183         -
                ::std::write!(output, "/MalformedContentTypeWithoutBody").expect("formatting should succeed");
  184         -
                ::std::result::Result::Ok(())
  185         -
            }
  186         -
            #[allow(clippy::unnecessary_wraps)]
  187         -
            fn update_http_builder(
  188         -
                input: &crate::operation::malformed_content_type_without_body::MalformedContentTypeWithoutBodyInput,
  189         -
                builder: ::http_1x::request::Builder,
  190         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  191         -
                let mut uri = ::std::string::String::new();
  192         -
                uri_base(input, &mut uri)?;
  193         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  194         -
            }
  195         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  196         -
            builder
  197         -
        };
  198         -
        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, MalformedContentTypeWithoutBody::INPUT_SCHEMA, "", _cfg)
         209  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  199    210   
  200         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         211  +
        return ::std::result::Result::Ok(request);
  201    212   
    }
  202    213   
}
  203    214   
#[derive(Debug)]
  204    215   
struct MalformedContentTypeWithoutBodyEndpointParamsInterceptor;
  205    216   
  206    217   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedContentTypeWithoutBodyEndpointParamsInterceptor {
  207    218   
    fn name(&self) -> &'static str {
  208    219   
        "MalformedContentTypeWithoutBodyEndpointParamsInterceptor"
  209    220   
    }
  210    221   

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

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

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/malformed_content_type_without_body/_malformed_content_type_without_body_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 MalformedContentTypeWithoutBodyOutput {
   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(&MALFORMEDCONTENTTYPEWITHOUTBODYOUTPUT_SCHEMA, (), |_, member, deser| {
          43  +
        deserializer.read_struct(&MALFORMEDCONTENTTYPEWITHOUTBODYOUTPUT_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 MalformedContentTypeWithoutBodyOutput {
          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 MalformedContentTypeWithoutBodyOutput {
   53     64   
    /// Creates a new builder-style object to manufacture [`MalformedContentTypeWithoutBodyOutput`](crate::operation::malformed_content_type_without_body::MalformedContentTypeWithoutBodyOutput).
   54     65   
    pub fn builder() -> crate::operation::malformed_content_type_without_body::builders::MalformedContentTypeWithoutBodyOutputBuilder {
   55     66   
        crate::operation::malformed_content_type_without_body::builders::MalformedContentTypeWithoutBodyOutputBuilder::default()
   56     67   
    }
   57     68   
}
   58     69   
   59     70   
/// A builder for [`MalformedContentTypeWithoutBodyOutput`](crate::operation::malformed_content_type_without_body::MalformedContentTypeWithoutBodyOutput).
   60     71   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   61     72   
#[non_exhaustive]