Client Test

Client Test

rev. ec7b2441254af868911fccffe8d8dca83aff0045 (ignoring whitespace)

Files changed:

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

@@ -14,14 +135,151 @@
   34     34   
    0,
   35     35   
)
   36     36   
.with_http_query("baz");
   37     37   
static CONSTANTANDVARIABLEQUERYSTRINGINPUT_MEMBER_MAYBE_SET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restjson.synthetic#ConstantAndVariableQueryStringInput$maybeSet",
   40     40   
        "aws.protocoltests.restjson.synthetic",
   41     41   
        "ConstantAndVariableQueryStringInput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::String,
   44         -
    "maybe_set",
          44  +
    "maybeSet",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_query("maybeSet");
   48     48   
static CONSTANTANDVARIABLEQUERYSTRINGINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    CONSTANTANDVARIABLEQUERYSTRINGINPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[
   52     52   
        &CONSTANTANDVARIABLEQUERYSTRINGINPUT_MEMBER_BAZ,
   53     53   
        &CONSTANTANDVARIABLEQUERYSTRINGINPUT_MEMBER_MAYBE_SET,
   54     54   
    ],
   55         -
);
          55  +
)
          56  +
.with_http(aws_smithy_schema::traits::HttpTrait::new(
          57  +
    "GET",
          58  +
    "/ConstantAndVariableQueryString?foo=bar",
          59  +
    None,
          60  +
));
   56     61   
impl ConstantAndVariableQueryStringInput {
   57     62   
    /// The schema for this shape.
   58     63   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CONSTANTANDVARIABLEQUERYSTRINGINPUT_SCHEMA;
   59     64   
}
   60     65   
impl ::aws_smithy_schema::serde::SerializableStruct for ConstantAndVariableQueryStringInput {
   61     66   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   62     67   
    fn serialize_members(
   63     68   
        &self,
   64     69   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   65     70   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   66     71   
        if let Some(ref val) = self.baz {
   67     72   
            ser.write_string(&CONSTANTANDVARIABLEQUERYSTRINGINPUT_MEMBER_BAZ, val)?;
   68     73   
        }
   69     74   
        if let Some(ref val) = self.maybe_set {
   70     75   
            ser.write_string(&CONSTANTANDVARIABLEQUERYSTRINGINPUT_MEMBER_MAYBE_SET, val)?;
   71     76   
        }
   72     77   
        Ok(())
   73     78   
    }
   74     79   
}
   75     80   
impl ConstantAndVariableQueryStringInput {
   76     81   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   77         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   78         -
        deserializer: &mut D,
          82  +
    pub fn deserialize(
          83  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   79     84   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   80     85   
        #[allow(unused_variables, unused_mut)]
   81     86   
        let mut builder = Self::builder();
   82     87   
        #[allow(
   83     88   
            unused_variables,
   84     89   
            unreachable_code,
   85     90   
            clippy::single_match,
   86     91   
            clippy::match_single_binding,
   87     92   
            clippy::diverging_sub_expression
   88     93   
        )]
   89         -
        deserializer.read_struct(&CONSTANTANDVARIABLEQUERYSTRINGINPUT_SCHEMA, (), |_, member, deser| {
          94  +
        deserializer.read_struct(&CONSTANTANDVARIABLEQUERYSTRINGINPUT_SCHEMA, &mut |member, deser| {
   90     95   
            match member.member_index() {
   91     96   
                Some(0) => {
   92     97   
                    builder.baz = Some(deser.read_string(member)?);
   93     98   
                }
   94     99   
                Some(1) => {
   95    100   
                    builder.maybe_set = Some(deser.read_string(member)?);
   96    101   
                }
   97    102   
                _ => {}
   98    103   
            }
   99    104   
            Ok(())
  100    105   
        })?;
  101    106   
        builder
  102    107   
            .build()
  103    108   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  104    109   
    }
  105    110   
}
         111  +
impl ConstantAndVariableQueryStringInput {
         112  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         113  +
    pub fn deserialize_with_response(
         114  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         115  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         116  +
        _status: u16,
         117  +
        _body: &[u8],
         118  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         119  +
        Self::deserialize(deserializer)
         120  +
    }
         121  +
}
  106    122   
impl ConstantAndVariableQueryStringInput {
  107    123   
    /// Creates a new builder-style object to manufacture [`ConstantAndVariableQueryStringInput`](crate::operation::constant_and_variable_query_string::ConstantAndVariableQueryStringInput).
  108    124   
    pub fn builder() -> crate::operation::constant_and_variable_query_string::builders::ConstantAndVariableQueryStringInputBuilder {
  109    125   
        crate::operation::constant_and_variable_query_string::builders::ConstantAndVariableQueryStringInputBuilder::default()
  110    126   
    }
  111    127   
}
  112    128   
  113    129   
/// A builder for [`ConstantAndVariableQueryStringInput`](crate::operation::constant_and_variable_query_string::ConstantAndVariableQueryStringInput).
  114    130   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  115    131   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/constant_and_variable_query_string/_constant_and_variable_query_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 ConstantAndVariableQueryStringOutput {
   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(&CONSTANTANDVARIABLEQUERYSTRINGOUTPUT_SCHEMA, (), |_, member, deser| {
          43  +
        deserializer.read_struct(&CONSTANTANDVARIABLEQUERYSTRINGOUTPUT_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 ConstantAndVariableQueryStringOutput {
          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 ConstantAndVariableQueryStringOutput {
   53     64   
    /// Creates a new builder-style object to manufacture [`ConstantAndVariableQueryStringOutput`](crate::operation::constant_and_variable_query_string::ConstantAndVariableQueryStringOutput).
   54     65   
    pub fn builder() -> crate::operation::constant_and_variable_query_string::builders::ConstantAndVariableQueryStringOutputBuilder {
   55     66   
        crate::operation::constant_and_variable_query_string::builders::ConstantAndVariableQueryStringOutputBuilder::default()
   56     67   
    }
   57     68   
}
   58     69   
   59     70   
/// A builder for [`ConstantAndVariableQueryStringOutput`](crate::operation::constant_and_variable_query_string::ConstantAndVariableQueryStringOutput).
   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/constant_query_string.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 `ConstantQueryString`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct ConstantQueryString;
    6      6   
impl ConstantQueryString {
    7      7   
    /// Creates a new `ConstantQueryString`
    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::constant_query_string::ConstantQueryStringInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::constant_query_string::ConstantQueryStringOutput::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::constant_query_string::ConstantQueryStringInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::constant_query_string::ConstantQueryStringOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::constant_query_string::ConstantQueryStringError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +249,269 @@
  130    134   
                crate::operation::constant_query_string::ConstantQueryStringError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct ConstantQueryStringResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ConstantQueryStringResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         150  +
        #[allow(unused_mut)]
         151  +
        let mut force_error = false;
         152  +
         153  +
        if !success && status != 200 || force_error {
  145    154   
            let headers = response.headers();
  146    155   
            let body = response.body().bytes().expect("body loaded");
  147    156   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
  149    160   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_constant_query_string::de_constant_query_string_http_error(status, headers, body)
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::constant_query_string::ConstantQueryStringError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_constant_query_string::de_constant_query_string_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, ConstantQueryString::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::constant_query_string::ConstantQueryStringOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct ConstantQueryStringRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ConstantQueryStringRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::constant_query_string::ConstantQueryStringInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::constant_query_string::ConstantQueryStringInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                let input_1 = &_input.hello;
  182         -
                let input_1 = input_1
  183         -
                    .as_ref()
  184         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("hello", "cannot be empty or unset"))?;
  185         -
                let hello = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
  186         -
                if hello.is_empty() {
  187         -
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
  188         -
                        "hello",
  189         -
                        "cannot be empty or unset",
  190         -
                    ));
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        if protocol.supports_http_bindings() {
         206  +
            let mut request = protocol
         207  +
                .serialize_body(&input, ConstantQueryString::INPUT_SCHEMA, "", _cfg)
         208  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         209  +
            {
         210  +
                let mut uri = "/ConstantQueryString/{hello}?foo=bar&hello".to_string();
         211  +
                let mut query_params: Vec<(String, String)> = Vec::new();
         212  +
                if let Some(ref val) = input.hello {
         213  +
                    uri = uri.replace("{hello}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
         214  +
                }
         215  +
                if !query_params.is_empty() {
         216  +
                    uri.push(if uri.contains('?') { '&' } else { '?' });
         217  +
                    let pairs: Vec<String> = query_params
         218  +
                        .iter()
         219  +
                        .map(|(k, v)| {
         220  +
                            format!(
         221  +
                                "{}={}",
         222  +
                                ::aws_smithy_schema::http_protocol::percent_encode(k),
         223  +
                                ::aws_smithy_schema::http_protocol::percent_encode(v)
         224  +
                            )
         225  +
                        })
         226  +
                        .collect();
         227  +
                    uri.push_str(&pairs.join("&"));
  191    228   
                }
  192         -
                ::std::write!(output, "/ConstantQueryString/{hello}", hello = hello).expect("formatting should succeed");
  193         -
                ::std::result::Result::Ok(())
         229  +
                request.set_uri(uri.as_str()).expect("valid URI");
  194    230   
            }
  195         -
            fn uri_query(
  196         -
                _input: &crate::operation::constant_query_string::ConstantQueryStringInput,
  197         -
                mut output: &mut ::std::string::String,
  198         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  199         -
                let mut query = ::aws_smithy_http::query::Writer::new(output);
  200         -
                query.push_kv("foo", "bar");
  201         -
                query.push_v("hello");
  202         -
                ::std::result::Result::Ok(())
  203         -
            }
  204         -
            #[allow(clippy::unnecessary_wraps)]
  205         -
            fn update_http_builder(
  206         -
                input: &crate::operation::constant_query_string::ConstantQueryStringInput,
  207         -
                builder: ::http_1x::request::Builder,
  208         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  209         -
                let mut uri = ::std::string::String::new();
  210         -
                uri_base(input, &mut uri)?;
  211         -
                uri_query(input, &mut uri)?;
  212         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  213         -
            }
  214         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  215         -
            builder
  216         -
        };
  217         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
  218    231   
  219         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         232  +
            return ::std::result::Result::Ok(request);
         233  +
        } else {
         234  +
            let mut request = protocol
         235  +
                .serialize_request(&input, ConstantQueryString::INPUT_SCHEMA, "", _cfg)
         236  +
                .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         237  +
         238  +
            return ::std::result::Result::Ok(request);
         239  +
        }
  220    240   
    }
  221    241   
}
  222    242   
#[derive(Debug)]
  223    243   
struct ConstantQueryStringEndpointParamsInterceptor;
  224    244   
  225    245   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ConstantQueryStringEndpointParamsInterceptor {
  226    246   
    fn name(&self) -> &'static str {
  227    247   
        "ConstantQueryStringEndpointParamsInterceptor"
  228    248   
    }
  229    249   

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

@@ -5,5 +109,126 @@
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::String,
   27     27   
    "hello",
   28     28   
    0,
   29     29   
)
   30     30   
.with_http_label();
   31     31   
static CONSTANTQUERYSTRINGINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   32     32   
    CONSTANTQUERYSTRINGINPUT_SCHEMA_ID,
   33     33   
    ::aws_smithy_schema::ShapeType::Structure,
   34     34   
    &[&CONSTANTQUERYSTRINGINPUT_MEMBER_HELLO],
   35         -
);
          35  +
)
          36  +
.with_http(aws_smithy_schema::traits::HttpTrait::new(
          37  +
    "GET",
          38  +
    "/ConstantQueryString/{hello}?foo=bar&hello",
          39  +
    None,
          40  +
));
   36     41   
impl ConstantQueryStringInput {
   37     42   
    /// The schema for this shape.
   38     43   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CONSTANTQUERYSTRINGINPUT_SCHEMA;
   39     44   
}
   40     45   
impl ::aws_smithy_schema::serde::SerializableStruct for ConstantQueryStringInput {
   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.hello {
   47     52   
            ser.write_string(&CONSTANTQUERYSTRINGINPUT_MEMBER_HELLO, val)?;
   48     53   
        }
   49     54   
        Ok(())
   50     55   
    }
   51     56   
}
   52     57   
impl ConstantQueryStringInput {
   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(&CONSTANTQUERYSTRINGINPUT_SCHEMA, (), |_, member, deser| {
          71  +
        deserializer.read_struct(&CONSTANTQUERYSTRINGINPUT_SCHEMA, &mut |member, deser| {
   67     72   
            match member.member_index() {
   68     73   
                Some(0) => {
   69     74   
                    builder.hello = Some(deser.read_string(member)?);
   70     75   
                }
   71     76   
                _ => {}
   72     77   
            }
   73     78   
            Ok(())
   74     79   
        })?;
          80  +
        builder.hello = builder.hello.or(Some(String::new()));
   75     81   
        builder
   76     82   
            .build()
   77     83   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   78     84   
    }
   79     85   
}
          86  +
impl ConstantQueryStringInput {
          87  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          88  +
    pub fn deserialize_with_response(
          89  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          90  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          91  +
        _status: u16,
          92  +
        _body: &[u8],
          93  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          94  +
        Self::deserialize(deserializer)
          95  +
    }
          96  +
}
   80     97   
impl ConstantQueryStringInput {
   81     98   
    /// Creates a new builder-style object to manufacture [`ConstantQueryStringInput`](crate::operation::constant_query_string::ConstantQueryStringInput).
   82     99   
    pub fn builder() -> crate::operation::constant_query_string::builders::ConstantQueryStringInputBuilder {
   83    100   
        crate::operation::constant_query_string::builders::ConstantQueryStringInputBuilder::default()
   84    101   
    }
   85    102   
}
   86    103   
   87    104   
/// A builder for [`ConstantQueryStringInput`](crate::operation::constant_query_string::ConstantQueryStringInput).
   88    105   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   89    106   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/constant_query_string/_constant_query_string_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 ConstantQueryStringOutput {
   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(&CONSTANTQUERYSTRINGOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&CONSTANTQUERYSTRINGOUTPUT_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 ConstantQueryStringOutput {
          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 ConstantQueryStringOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`ConstantQueryStringOutput`](crate::operation::constant_query_string::ConstantQueryStringOutput).
   51     62   
    pub fn builder() -> crate::operation::constant_query_string::builders::ConstantQueryStringOutputBuilder {
   52     63   
        crate::operation::constant_query_string::builders::ConstantQueryStringOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`ConstantQueryStringOutput`](crate::operation::constant_query_string::ConstantQueryStringOutput).
   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/content_type_parameters.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 `ContentTypeParameters`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct ContentTypeParameters;
    6      6   
impl ContentTypeParameters {
    7      7   
    /// Creates a new `ContentTypeParameters`
    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::content_type_parameters::ContentTypeParametersInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::content_type_parameters::ContentTypeParametersOutput::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::content_type_parameters::ContentTypeParametersInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::content_type_parameters::ContentTypeParametersOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::content_type_parameters::ContentTypeParametersError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +234,239 @@
  130    134   
                crate::operation::content_type_parameters::ContentTypeParametersError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct ContentTypeParametersResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ContentTypeParametersResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         150  +
        #[allow(unused_mut)]
         151  +
        let mut force_error = false;
         152  +
         153  +
        if !success && status != 200 || force_error {
  145    154   
            let headers = response.headers();
  146    155   
            let body = response.body().bytes().expect("body loaded");
  147    156   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
  149    160   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_error(status, headers, body)
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::content_type_parameters::ContentTypeParametersError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, ContentTypeParameters::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::content_type_parameters::ContentTypeParametersOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct ContentTypeParametersRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ContentTypeParametersRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::content_type_parameters::ContentTypeParametersInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::content_type_parameters::ContentTypeParametersInput,
  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, "/ContentTypeParameters").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::content_type_parameters::ContentTypeParametersInput,
  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(crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_input(
  198         -
            &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())
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, ContentTypeParameters::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  205    210   
    }
  206    211   
}
  207    212   
#[derive(Debug)]
  208    213   
struct ContentTypeParametersEndpointParamsInterceptor;
  209    214   
  210    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ContentTypeParametersEndpointParamsInterceptor {
  211    216   
    fn name(&self) -> &'static str {
  212    217   
        "ContentTypeParametersEndpointParamsInterceptor"
  213    218   
    }
  214    219   

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

@@ -4,4 +108,120 @@
   24     24   
        "ContentTypeParametersInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Integer,
   27     27   
    "value",
   28     28   
    0,
   29     29   
);
   30     30   
static CONTENTTYPEPARAMETERSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     31   
    CONTENTTYPEPARAMETERSINPUT_SCHEMA_ID,
   32     32   
    ::aws_smithy_schema::ShapeType::Structure,
   33     33   
    &[&CONTENTTYPEPARAMETERSINPUT_MEMBER_VALUE],
   34         -
);
          34  +
)
          35  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/ContentTypeParameters", None));
   35     36   
impl ContentTypeParametersInput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CONTENTTYPEPARAMETERSINPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for ContentTypeParametersInput {
   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.value {
   46     47   
            ser.write_integer(&CONTENTTYPEPARAMETERSINPUT_MEMBER_VALUE, *val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl ContentTypeParametersInput {
   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(&CONTENTTYPEPARAMETERSINPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&CONTENTTYPEPARAMETERSINPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68     69   
                    builder.value = Some(deser.read_integer(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 ContentTypeParametersInput {
          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 ContentTypeParametersInput {
   80     92   
    /// Creates a new builder-style object to manufacture [`ContentTypeParametersInput`](crate::operation::content_type_parameters::ContentTypeParametersInput).
   81     93   
    pub fn builder() -> crate::operation::content_type_parameters::builders::ContentTypeParametersInputBuilder {
   82     94   
        crate::operation::content_type_parameters::builders::ContentTypeParametersInputBuilder::default()
   83     95   
    }
   84     96   
}
   85     97   
   86     98   
/// A builder for [`ContentTypeParametersInput`](crate::operation::content_type_parameters::ContentTypeParametersInput).
   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/content_type_parameters/_content_type_parameters_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 ContentTypeParametersOutput {
   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(&CONTENTTYPEPARAMETERSOUTPUT_SCHEMA, (), |_, member, deser| {
          40  +
        deserializer.read_struct(&CONTENTTYPEPARAMETERSOUTPUT_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 ContentTypeParametersOutput {
          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 ContentTypeParametersOutput {
   50     61   
    /// Creates a new builder-style object to manufacture [`ContentTypeParametersOutput`](crate::operation::content_type_parameters::ContentTypeParametersOutput).
   51     62   
    pub fn builder() -> crate::operation::content_type_parameters::builders::ContentTypeParametersOutputBuilder {
   52     63   
        crate::operation::content_type_parameters::builders::ContentTypeParametersOutputBuilder::default()
   53     64   
    }
   54     65   
}
   55     66   
   56     67   
/// A builder for [`ContentTypeParametersOutput`](crate::operation::content_type_parameters::ContentTypeParametersOutput).
   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/datetime_offsets.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 `DatetimeOffsets`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct DatetimeOffsets;
    6      6   
impl DatetimeOffsets {
    7      7   
    /// Creates a new `DatetimeOffsets`
    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::datetime_offsets::DatetimeOffsetsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::datetime_offsets::DatetimeOffsetsOutput::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::datetime_offsets::DatetimeOffsetsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::datetime_offsets::DatetimeOffsetsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::datetime_offsets::DatetimeOffsetsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +228,239 @@
  130    134   
                crate::operation::datetime_offsets::DatetimeOffsetsError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct DatetimeOffsetsResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DatetimeOffsetsResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         150  +
        #[allow(unused_mut)]
         151  +
        let mut force_error = false;
         152  +
         153  +
        if !success && status != 200 || force_error {
  145    154   
            let headers = response.headers();
  146    155   
            let body = response.body().bytes().expect("body loaded");
  147    156   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
  149    160   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_error(status, headers, body)
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::datetime_offsets::DatetimeOffsetsError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, DatetimeOffsets::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::datetime_offsets::DatetimeOffsetsOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct DatetimeOffsetsRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DatetimeOffsetsRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::datetime_offsets::DatetimeOffsetsInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::datetime_offsets::DatetimeOffsetsInput,
  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, "/DatetimeOffsets").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::datetime_offsets::DatetimeOffsetsInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder
  195         -
        };
  196         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, DatetimeOffsets::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  197    208   
  198         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         209  +
        return ::std::result::Result::Ok(request);
  199    210   
    }
  200    211   
}
  201    212   
#[derive(Debug)]
  202    213   
struct DatetimeOffsetsEndpointParamsInterceptor;
  203    214   
  204    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DatetimeOffsetsEndpointParamsInterceptor {
  205    216   
    fn name(&self) -> &'static str {
  206    217   
        "DatetimeOffsetsEndpointParamsInterceptor"
  207    218   
    }
  208    219   
@@ -246,257 +351,382 @@
  266    277   
            .expect("the config must have a deserializer");
  267    278   
  268    279   
        let parsed = de.deserialize_streaming(&mut http_response);
  269    280   
        let parsed = parsed.unwrap_or_else(|| {
  270    281   
            let http_response = http_response.map(|body| {
  271    282   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  272    283   
                    body.bytes().unwrap(),
  273    284   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  274    285   
                )))
  275    286   
            });
  276         -
            de.deserialize_nonstreaming(&http_response)
         287  +
            // Build a config bag with the protocol for schema-based deserialization
         288  +
            #[allow(unused_mut)]
         289  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         290  +
            {
         291  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         292  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         293  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         294  +
                ));
         295  +
                test_cfg.push_shared_layer(layer.freeze());
         296  +
            }
         297  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  277    298   
        });
  278    299   
        let parsed = parsed
  279    300   
            .expect("should be successful response")
  280    301   
            .downcast::<crate::operation::datetime_offsets::DatetimeOffsetsOutput>()
  281    302   
            .unwrap();
  282    303   
        ::pretty_assertions::assert_eq!(parsed.datetime, expected_output.datetime, "Unexpected value for `datetime`");
  283    304   
    }
  284    305   
  285    306   
    /// Ensures that clients can correctly parse datetime (timestamps) with offsets
  286    307   
    /// Test ID: RestJsonDateTimeWithPositiveOffset
  287    308   
    #[::tokio::test]
  288    309   
    #[::tracing_test::traced_test]
  289    310   
    async fn rest_json_date_time_with_positive_offset_response() {
  290    311   
        let expected_output = crate::operation::datetime_offsets::DatetimeOffsetsOutput::builder()
  291    312   
            .set_datetime(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
  292    313   
                1576540098, 0_f64,
  293    314   
            )))
  294    315   
            .build();
  295    316   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  296    317   
            ::http_1x::response::Builder::new()
  297    318   
                .status(200)
  298    319   
                .body(::aws_smithy_types::body::SdkBody::from(
  299    320   
                    "      {\n          \"datetime\": \"2019-12-17T00:48:18+01:00\"\n      }\n",
  300    321   
                ))
  301    322   
                .unwrap(),
  302    323   
        )
  303    324   
        .unwrap();
  304    325   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  305    326   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  306    327   
  307    328   
        let op = crate::operation::datetime_offsets::DatetimeOffsets::new();
  308    329   
        let config = op.config().expect("the operation has config");
  309    330   
        let de = config
  310    331   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  311    332   
            .expect("the config must have a deserializer");
  312    333   
  313    334   
        let parsed = de.deserialize_streaming(&mut http_response);
  314    335   
        let parsed = parsed.unwrap_or_else(|| {
  315    336   
            let http_response = http_response.map(|body| {
  316    337   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  317    338   
                    body.bytes().unwrap(),
  318    339   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  319    340   
                )))
  320    341   
            });
  321         -
            de.deserialize_nonstreaming(&http_response)
         342  +
            // Build a config bag with the protocol for schema-based deserialization
         343  +
            #[allow(unused_mut)]
         344  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         345  +
            {
         346  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         347  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         348  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         349  +
                ));
         350  +
                test_cfg.push_shared_layer(layer.freeze());
         351  +
            }
         352  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  322    353   
        });
  323    354   
        let parsed = parsed
  324    355   
            .expect("should be successful response")
  325    356   
            .downcast::<crate::operation::datetime_offsets::DatetimeOffsetsOutput>()
  326    357   
            .unwrap();
  327    358   
        ::pretty_assertions::assert_eq!(parsed.datetime, expected_output.datetime, "Unexpected value for `datetime`");
  328    359   
    }
  329    360   
}
  330    361   
  331    362   
/// Error type for the `DatetimeOffsetsError` operation.

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

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

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

@@ -1,1 +106,118 @@
   19     19   
);
   20     20   
static DATETIMEOFFSETSOUTPUT_MEMBER_DATETIME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   21     21   
    ::aws_smithy_schema::ShapeId::from_static(
   22     22   
        "aws.protocoltests.restjson.synthetic#DatetimeOffsetsOutput$datetime",
   23     23   
        "aws.protocoltests.restjson.synthetic",
   24     24   
        "DatetimeOffsetsOutput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Timestamp,
   27     27   
    "datetime",
   28     28   
    0,
   29         -
);
          29  +
)
          30  +
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::DateTime);
   30     31   
static DATETIMEOFFSETSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     32   
    DATETIMEOFFSETSOUTPUT_SCHEMA_ID,
   32     33   
    ::aws_smithy_schema::ShapeType::Structure,
   33     34   
    &[&DATETIMEOFFSETSOUTPUT_MEMBER_DATETIME],
   34     35   
);
   35     36   
impl DatetimeOffsetsOutput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &DATETIMEOFFSETSOUTPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for DatetimeOffsetsOutput {
   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.datetime {
   46     47   
            ser.write_timestamp(&DATETIMEOFFSETSOUTPUT_MEMBER_DATETIME, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl DatetimeOffsetsOutput {
   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(&DATETIMEOFFSETSOUTPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&DATETIMEOFFSETSOUTPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68     69   
                    builder.datetime = Some(deser.read_timestamp(member)?);
   69     70   
                }
   70     71   
                _ => {}
   71     72   
            }
   72     73   
            Ok(())
   73     74   
        })?;
   74     75   
        Ok(builder.build())
   75     76   
    }
   76     77   
}
          78  +
impl DatetimeOffsetsOutput {
          79  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          80  +
    pub fn deserialize_with_response(
          81  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          82  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          83  +
        _status: u16,
          84  +
        _body: &[u8],
          85  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          86  +
        Self::deserialize(deserializer)
          87  +
    }
          88  +
}
   77     89   
impl DatetimeOffsetsOutput {
   78     90   
    /// Creates a new builder-style object to manufacture [`DatetimeOffsetsOutput`](crate::operation::datetime_offsets::DatetimeOffsetsOutput).
   79     91   
    pub fn builder() -> crate::operation::datetime_offsets::builders::DatetimeOffsetsOutputBuilder {
   80     92   
        crate::operation::datetime_offsets::builders::DatetimeOffsetsOutputBuilder::default()
   81     93   
    }
   82     94   
}
   83     95   
   84     96   
/// A builder for [`DatetimeOffsetsOutput`](crate::operation::datetime_offsets::DatetimeOffsetsOutput).
   85     97   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   86     98   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/document_type.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 `DocumentType`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct DocumentType;
    6      6   
impl DocumentType {
    7      7   
    /// Creates a new `DocumentType`
    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::document_type::DocumentTypeInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::document_type::DocumentTypeOutput::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::document_type::DocumentTypeInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::document_type::DocumentTypeOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::document_type::DocumentTypeError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +226,231 @@
  124    128   
                crate::operation::document_type::DocumentTypeError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct DocumentTypeResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DocumentTypeResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         144  +
        #[allow(unused_mut)]
         145  +
        let mut force_error = false;
         146  +
         147  +
        if !success && status != 200 || force_error {
  139    148   
            let headers = response.headers();
  140    149   
            let body = response.body().bytes().expect("body loaded");
  141    150   
            #[allow(unused_mut)]
  142         -
        let mut force_error = false;
         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  +
            })?;
  143    154   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_document_type::de_document_type_http_error(status, headers, body)
         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::document_type::DocumentTypeError::generic(
         158  +
                    generic,
         159  +
                )),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_document_type::de_document_type_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, DocumentType::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::document_type::DocumentTypeOutput::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 DocumentTypeRequestSerializer;
  154    184   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DocumentTypeRequestSerializer {
  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::document_type::DocumentTypeInput>()
  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::document_type::DocumentTypeInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/DocumentType").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::document_type::DocumentTypeInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  189         -
            builder
  190         -
        };
  191         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_document_type::ser_document_type_input(&input)?);
  192         -
        if let Some(content_length) = body.content_length() {
  193         -
            let content_length = content_length.to_string();
  194         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  195         -
        }
  196         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         194  +
        let protocol = _cfg
         195  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         196  +
            .expect("a SharedClientProtocol is required");
         197  +
        let mut request = protocol
         198  +
            .serialize_request(&input, DocumentType::INPUT_SCHEMA, "", _cfg)
         199  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         200  +
         201  +
        return ::std::result::Result::Ok(request);
  197    202   
    }
  198    203   
}
  199    204   
#[derive(Debug)]
  200    205   
struct DocumentTypeEndpointParamsInterceptor;
  201    206   
  202    207   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DocumentTypeEndpointParamsInterceptor {
  203    208   
    fn name(&self) -> &'static str {
  204    209   
        "DocumentTypeEndpointParamsInterceptor"
  205    210   
    }
  206    211   
@@ -460,465 +739,794 @@
  480    485   
            .expect("the config must have a deserializer");
  481    486   
  482    487   
        let parsed = de.deserialize_streaming(&mut http_response);
  483    488   
        let parsed = parsed.unwrap_or_else(|| {
  484    489   
            let http_response = http_response.map(|body| {
  485    490   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  486    491   
                    body.bytes().unwrap(),
  487    492   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  488    493   
                )))
  489    494   
            });
  490         -
            de.deserialize_nonstreaming(&http_response)
         495  +
            // Build a config bag with the protocol for schema-based deserialization
         496  +
            #[allow(unused_mut)]
         497  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         498  +
            {
         499  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         500  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         501  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         502  +
                ));
         503  +
                test_cfg.push_shared_layer(layer.freeze());
         504  +
            }
         505  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  491    506   
        });
  492    507   
        let parsed = parsed
  493    508   
            .expect("should be successful response")
  494    509   
            .downcast::<crate::operation::document_type::DocumentTypeOutput>()
  495    510   
            .unwrap();
  496    511   
        ::pretty_assertions::assert_eq!(parsed.string_value, expected_output.string_value, "Unexpected value for `string_value`");
  497    512   
        ::pretty_assertions::assert_eq!(
  498    513   
            parsed.document_value,
  499    514   
            expected_output.document_value,
  500    515   
            "Unexpected value for `document_value`"
  501    516   
        );
  502    517   
    }
  503    518   
  504    519   
    /// Document types can be JSON scalars too.
  505    520   
    /// Test ID: DocumentOutputString
  506    521   
    #[::tokio::test]
  507    522   
    #[::tracing_test::traced_test]
  508    523   
    async fn document_output_string_response() {
  509    524   
        let expected_output = crate::operation::document_type::DocumentTypeOutput::builder()
  510    525   
            .set_string_value(::std::option::Option::Some("string".to_owned()))
  511    526   
            .set_document_value(::std::option::Option::Some({
  512    527   
                let json_bytes = br#""hello""#;
  513    528   
                let mut tokens = ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
  514    529   
                ::aws_smithy_json::deserialize::token::expect_document(&mut tokens).expect("well formed json")
  515    530   
            }))
  516    531   
            .build();
  517    532   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  518    533   
            ::http_1x::response::Builder::new()
  519    534   
                .header("Content-Type", "application/json")
  520    535   
                .status(200)
  521    536   
                .body(::aws_smithy_types::body::SdkBody::from(
  522    537   
                    "{\n    \"stringValue\": \"string\",\n    \"documentValue\": \"hello\"\n}",
  523    538   
                ))
  524    539   
                .unwrap(),
  525    540   
        )
  526    541   
        .unwrap();
  527    542   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  528    543   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  529    544   
  530    545   
        let op = crate::operation::document_type::DocumentType::new();
  531    546   
        let config = op.config().expect("the operation has config");
  532    547   
        let de = config
  533    548   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  534    549   
            .expect("the config must have a deserializer");
  535    550   
  536    551   
        let parsed = de.deserialize_streaming(&mut http_response);
  537    552   
        let parsed = parsed.unwrap_or_else(|| {
  538    553   
            let http_response = http_response.map(|body| {
  539    554   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  540    555   
                    body.bytes().unwrap(),
  541    556   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  542    557   
                )))
  543    558   
            });
  544         -
            de.deserialize_nonstreaming(&http_response)
         559  +
            // Build a config bag with the protocol for schema-based deserialization
         560  +
            #[allow(unused_mut)]
         561  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         562  +
            {
         563  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         564  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         565  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         566  +
                ));
         567  +
                test_cfg.push_shared_layer(layer.freeze());
         568  +
            }
         569  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  545    570   
        });
  546    571   
        let parsed = parsed
  547    572   
            .expect("should be successful response")
  548    573   
            .downcast::<crate::operation::document_type::DocumentTypeOutput>()
  549    574   
            .unwrap();
  550    575   
        ::pretty_assertions::assert_eq!(parsed.string_value, expected_output.string_value, "Unexpected value for `string_value`");
  551    576   
        ::pretty_assertions::assert_eq!(
  552    577   
            parsed.document_value,
  553    578   
            expected_output.document_value,
  554    579   
            "Unexpected value for `document_value`"
  555    580   
        );
  556    581   
    }
  557    582   
  558    583   
    /// Document types can be JSON scalars too.
  559    584   
    /// Test ID: DocumentOutputNumber
  560    585   
    #[::tokio::test]
  561    586   
    #[::tracing_test::traced_test]
  562    587   
    async fn document_output_number_response() {
  563    588   
        let expected_output = crate::operation::document_type::DocumentTypeOutput::builder()
  564    589   
            .set_string_value(::std::option::Option::Some("string".to_owned()))
  565    590   
            .set_document_value(::std::option::Option::Some({
  566    591   
                let json_bytes = br#"10"#;
  567    592   
                let mut tokens = ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
  568    593   
                ::aws_smithy_json::deserialize::token::expect_document(&mut tokens).expect("well formed json")
  569    594   
            }))
  570    595   
            .build();
  571    596   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  572    597   
            ::http_1x::response::Builder::new()
  573    598   
                .header("Content-Type", "application/json")
  574    599   
                .status(200)
  575    600   
                .body(::aws_smithy_types::body::SdkBody::from(
  576    601   
                    "{\n    \"stringValue\": \"string\",\n    \"documentValue\": 10\n}",
  577    602   
                ))
  578    603   
                .unwrap(),
  579    604   
        )
  580    605   
        .unwrap();
  581    606   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  582    607   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  583    608   
  584    609   
        let op = crate::operation::document_type::DocumentType::new();
  585    610   
        let config = op.config().expect("the operation has config");
  586    611   
        let de = config
  587    612   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  588    613   
            .expect("the config must have a deserializer");
  589    614   
  590    615   
        let parsed = de.deserialize_streaming(&mut http_response);
  591    616   
        let parsed = parsed.unwrap_or_else(|| {
  592    617   
            let http_response = http_response.map(|body| {
  593    618   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  594    619   
                    body.bytes().unwrap(),
  595    620   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  596    621   
                )))
  597    622   
            });
  598         -
            de.deserialize_nonstreaming(&http_response)
         623  +
            // Build a config bag with the protocol for schema-based deserialization
         624  +
            #[allow(unused_mut)]
         625  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         626  +
            {
         627  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         628  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         629  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         630  +
                ));
         631  +
                test_cfg.push_shared_layer(layer.freeze());
         632  +
            }
         633  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  599    634   
        });
  600    635   
        let parsed = parsed
  601    636   
            .expect("should be successful response")
  602    637   
            .downcast::<crate::operation::document_type::DocumentTypeOutput>()
  603    638   
            .unwrap();
  604    639   
        ::pretty_assertions::assert_eq!(parsed.string_value, expected_output.string_value, "Unexpected value for `string_value`");
  605    640   
        ::pretty_assertions::assert_eq!(
  606    641   
            parsed.document_value,
  607    642   
            expected_output.document_value,
  608    643   
            "Unexpected value for `document_value`"
  609    644   
        );
  610    645   
    }
  611    646   
  612    647   
    /// Document types can be JSON scalars too.
  613    648   
    /// Test ID: DocumentOutputBoolean
  614    649   
    #[::tokio::test]
  615    650   
    #[::tracing_test::traced_test]
  616    651   
    async fn document_output_boolean_response() {
  617    652   
        let expected_output = crate::operation::document_type::DocumentTypeOutput::builder()
  618    653   
            .set_string_value(::std::option::Option::Some("string".to_owned()))
  619    654   
            .set_document_value(::std::option::Option::Some({
  620    655   
                let json_bytes = br#"false"#;
  621    656   
                let mut tokens = ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
  622    657   
                ::aws_smithy_json::deserialize::token::expect_document(&mut tokens).expect("well formed json")
  623    658   
            }))
  624    659   
            .build();
  625    660   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  626    661   
            ::http_1x::response::Builder::new()
  627    662   
                .header("Content-Type", "application/json")
  628    663   
                .status(200)
  629    664   
                .body(::aws_smithy_types::body::SdkBody::from(
  630    665   
                    "{\n    \"stringValue\": \"string\",\n    \"documentValue\": false\n}",
  631    666   
                ))
  632    667   
                .unwrap(),
  633    668   
        )
  634    669   
        .unwrap();
  635    670   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  636    671   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  637    672   
  638    673   
        let op = crate::operation::document_type::DocumentType::new();
  639    674   
        let config = op.config().expect("the operation has config");
  640    675   
        let de = config
  641    676   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  642    677   
            .expect("the config must have a deserializer");
  643    678   
  644    679   
        let parsed = de.deserialize_streaming(&mut http_response);
  645    680   
        let parsed = parsed.unwrap_or_else(|| {
  646    681   
            let http_response = http_response.map(|body| {
  647    682   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  648    683   
                    body.bytes().unwrap(),
  649    684   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  650    685   
                )))
  651    686   
            });
  652         -
            de.deserialize_nonstreaming(&http_response)
         687  +
            // Build a config bag with the protocol for schema-based deserialization
         688  +
            #[allow(unused_mut)]
         689  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         690  +
            {
         691  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         692  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         693  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         694  +
                ));
         695  +
                test_cfg.push_shared_layer(layer.freeze());
         696  +
            }
         697  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  653    698   
        });
  654    699   
        let parsed = parsed
  655    700   
            .expect("should be successful response")
  656    701   
            .downcast::<crate::operation::document_type::DocumentTypeOutput>()
  657    702   
            .unwrap();
  658    703   
        ::pretty_assertions::assert_eq!(parsed.string_value, expected_output.string_value, "Unexpected value for `string_value`");
  659    704   
        ::pretty_assertions::assert_eq!(
  660    705   
            parsed.document_value,
  661    706   
            expected_output.document_value,
  662    707   
            "Unexpected value for `document_value`"
  663    708   
        );
  664    709   
    }
  665    710   
  666    711   
    /// Document types can be JSON arrays.
  667    712   
    /// Test ID: DocumentOutputArray
  668    713   
    #[::tokio::test]
  669    714   
    #[::tracing_test::traced_test]
  670    715   
    async fn document_output_array_response() {
  671    716   
        let expected_output = crate::operation::document_type::DocumentTypeOutput::builder()
  672    717   
            .set_string_value(::std::option::Option::Some("string".to_owned()))
  673    718   
            .set_document_value(::std::option::Option::Some({
  674    719   
                let json_bytes = br#"[
  675    720   
                        true,
  676    721   
                        false
  677    722   
                    ]"#;
  678    723   
                let mut tokens = ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
  679    724   
                ::aws_smithy_json::deserialize::token::expect_document(&mut tokens).expect("well formed json")
  680    725   
            }))
  681    726   
            .build();
  682    727   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  683    728   
            ::http_1x::response::Builder::new()
  684    729   
                .header("Content-Type", "application/json")
  685    730   
                .status(200)
  686    731   
                .body(::aws_smithy_types::body::SdkBody::from(
  687    732   
                    "{\n    \"stringValue\": \"string\",\n    \"documentValue\": [\n        true,\n        false\n    ]\n}",
  688    733   
                ))
  689    734   
                .unwrap(),
  690    735   
        )
  691    736   
        .unwrap();
  692    737   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  693    738   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  694    739   
  695    740   
        let op = crate::operation::document_type::DocumentType::new();
  696    741   
        let config = op.config().expect("the operation has config");
  697    742   
        let de = config
  698    743   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  699    744   
            .expect("the config must have a deserializer");
  700    745   
  701    746   
        let parsed = de.deserialize_streaming(&mut http_response);
  702    747   
        let parsed = parsed.unwrap_or_else(|| {
  703    748   
            let http_response = http_response.map(|body| {
  704    749   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  705    750   
                    body.bytes().unwrap(),
  706    751   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  707    752   
                )))
  708    753   
            });
  709         -
            de.deserialize_nonstreaming(&http_response)
         754  +
            // Build a config bag with the protocol for schema-based deserialization
         755  +
            #[allow(unused_mut)]
         756  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         757  +
            {
         758  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         759  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         760  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         761  +
                ));
         762  +
                test_cfg.push_shared_layer(layer.freeze());
         763  +
            }
         764  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  710    765   
        });
  711    766   
        let parsed = parsed
  712    767   
            .expect("should be successful response")
  713    768   
            .downcast::<crate::operation::document_type::DocumentTypeOutput>()
  714    769   
            .unwrap();
  715    770   
        ::pretty_assertions::assert_eq!(parsed.string_value, expected_output.string_value, "Unexpected value for `string_value`");
  716    771   
        ::pretty_assertions::assert_eq!(
  717    772   
            parsed.document_value,
  718    773   
            expected_output.document_value,
  719    774   
            "Unexpected value for `document_value`"

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

@@ -3,3 +130,142 @@
   23     23   
    "aws.protocoltests.restjson.synthetic",
   24     24   
    "DocumentTypeInput",
   25     25   
);
   26     26   
static DOCUMENTTYPEINPUT_MEMBER_STRING_VALUE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   27     27   
    ::aws_smithy_schema::ShapeId::from_static(
   28     28   
        "aws.protocoltests.restjson.synthetic#DocumentTypeInput$stringValue",
   29     29   
        "aws.protocoltests.restjson.synthetic",
   30     30   
        "DocumentTypeInput",
   31     31   
    ),
   32     32   
    ::aws_smithy_schema::ShapeType::String,
   33         -
    "string_value",
          33  +
    "stringValue",
   34     34   
    0,
   35     35   
);
   36     36   
static DOCUMENTTYPEINPUT_MEMBER_DOCUMENT_VALUE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   37     37   
    ::aws_smithy_schema::ShapeId::from_static(
   38     38   
        "aws.protocoltests.restjson.synthetic#DocumentTypeInput$documentValue",
   39     39   
        "aws.protocoltests.restjson.synthetic",
   40     40   
        "DocumentTypeInput",
   41     41   
    ),
   42     42   
    ::aws_smithy_schema::ShapeType::Document,
   43         -
    "document_value",
          43  +
    "documentValue",
   44     44   
    1,
   45     45   
);
   46     46   
static DOCUMENTTYPEINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   47     47   
    DOCUMENTTYPEINPUT_SCHEMA_ID,
   48     48   
    ::aws_smithy_schema::ShapeType::Structure,
   49     49   
    &[&DOCUMENTTYPEINPUT_MEMBER_STRING_VALUE, &DOCUMENTTYPEINPUT_MEMBER_DOCUMENT_VALUE],
   50         -
);
          50  +
)
          51  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("PUT", "/DocumentType", None));
   51     52   
impl DocumentTypeInput {
   52     53   
    /// The schema for this shape.
   53     54   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &DOCUMENTTYPEINPUT_SCHEMA;
   54     55   
}
   55     56   
impl ::aws_smithy_schema::serde::SerializableStruct for DocumentTypeInput {
   56     57   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   57     58   
    fn serialize_members(
   58     59   
        &self,
   59     60   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   60     61   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   61     62   
        if let Some(ref val) = self.string_value {
   62     63   
            ser.write_string(&DOCUMENTTYPEINPUT_MEMBER_STRING_VALUE, val)?;
   63     64   
        }
   64     65   
        if let Some(ref val) = self.document_value {
   65     66   
            ser.write_document(&DOCUMENTTYPEINPUT_MEMBER_DOCUMENT_VALUE, val)?;
   66     67   
        }
   67     68   
        Ok(())
   68     69   
    }
   69     70   
}
   70     71   
impl DocumentTypeInput {
   71     72   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   72         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   73         -
        deserializer: &mut D,
          73  +
    pub fn deserialize(
          74  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   74     75   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   75     76   
        #[allow(unused_variables, unused_mut)]
   76     77   
        let mut builder = Self::builder();
   77     78   
        #[allow(
   78     79   
            unused_variables,
   79     80   
            unreachable_code,
   80     81   
            clippy::single_match,
   81     82   
            clippy::match_single_binding,
   82     83   
            clippy::diverging_sub_expression
   83     84   
        )]
   84         -
        deserializer.read_struct(&DOCUMENTTYPEINPUT_SCHEMA, (), |_, member, deser| {
          85  +
        deserializer.read_struct(&DOCUMENTTYPEINPUT_SCHEMA, &mut |member, deser| {
   85     86   
            match member.member_index() {
   86     87   
                Some(0) => {
   87     88   
                    builder.string_value = Some(deser.read_string(member)?);
   88     89   
                }
   89     90   
                Some(1) => {
   90     91   
                    builder.document_value = Some(deser.read_document(member)?);
   91     92   
                }
   92     93   
                _ => {}
   93     94   
            }
   94     95   
            Ok(())
   95     96   
        })?;
   96     97   
        builder
   97     98   
            .build()
   98     99   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   99    100   
    }
  100    101   
}
         102  +
impl DocumentTypeInput {
         103  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         104  +
    pub fn deserialize_with_response(
         105  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         106  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         107  +
        _status: u16,
         108  +
        _body: &[u8],
         109  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         110  +
        Self::deserialize(deserializer)
         111  +
    }
         112  +
}
  101    113   
impl DocumentTypeInput {
  102    114   
    /// Creates a new builder-style object to manufacture [`DocumentTypeInput`](crate::operation::document_type::DocumentTypeInput).
  103    115   
    pub fn builder() -> crate::operation::document_type::builders::DocumentTypeInputBuilder {
  104    116   
        crate::operation::document_type::builders::DocumentTypeInputBuilder::default()
  105    117   
    }
  106    118   
}
  107    119   
  108    120   
/// A builder for [`DocumentTypeInput`](crate::operation::document_type::DocumentTypeInput).
  109    121   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  110    122   
#[non_exhaustive]

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

@@ -3,3 +128,139 @@
   23     23   
    "aws.protocoltests.restjson.synthetic",
   24     24   
    "DocumentTypeOutput",
   25     25   
);
   26     26   
static DOCUMENTTYPEOUTPUT_MEMBER_STRING_VALUE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   27     27   
    ::aws_smithy_schema::ShapeId::from_static(
   28     28   
        "aws.protocoltests.restjson.synthetic#DocumentTypeOutput$stringValue",
   29     29   
        "aws.protocoltests.restjson.synthetic",
   30     30   
        "DocumentTypeOutput",
   31     31   
    ),
   32     32   
    ::aws_smithy_schema::ShapeType::String,
   33         -
    "string_value",
          33  +
    "stringValue",
   34     34   
    0,
   35     35   
);
   36     36   
static DOCUMENTTYPEOUTPUT_MEMBER_DOCUMENT_VALUE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   37     37   
    ::aws_smithy_schema::ShapeId::from_static(
   38     38   
        "aws.protocoltests.restjson.synthetic#DocumentTypeOutput$documentValue",
   39     39   
        "aws.protocoltests.restjson.synthetic",
   40     40   
        "DocumentTypeOutput",
   41     41   
    ),
   42     42   
    ::aws_smithy_schema::ShapeType::Document,
   43         -
    "document_value",
          43  +
    "documentValue",
   44     44   
    1,
   45     45   
);
   46     46   
static DOCUMENTTYPEOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   47     47   
    DOCUMENTTYPEOUTPUT_SCHEMA_ID,
   48     48   
    ::aws_smithy_schema::ShapeType::Structure,
   49     49   
    &[&DOCUMENTTYPEOUTPUT_MEMBER_STRING_VALUE, &DOCUMENTTYPEOUTPUT_MEMBER_DOCUMENT_VALUE],
   50     50   
);
   51     51   
impl DocumentTypeOutput {
   52     52   
    /// The schema for this shape.
   53     53   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &DOCUMENTTYPEOUTPUT_SCHEMA;
   54     54   
}
   55     55   
impl ::aws_smithy_schema::serde::SerializableStruct for DocumentTypeOutput {
   56     56   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   57     57   
    fn serialize_members(
   58     58   
        &self,
   59     59   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   60     60   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   61     61   
        if let Some(ref val) = self.string_value {
   62     62   
            ser.write_string(&DOCUMENTTYPEOUTPUT_MEMBER_STRING_VALUE, val)?;
   63     63   
        }
   64     64   
        if let Some(ref val) = self.document_value {
   65     65   
            ser.write_document(&DOCUMENTTYPEOUTPUT_MEMBER_DOCUMENT_VALUE, val)?;
   66     66   
        }
   67     67   
        Ok(())
   68     68   
    }
   69     69   
}
   70     70   
impl DocumentTypeOutput {
   71     71   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   72         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   73         -
        deserializer: &mut D,
          72  +
    pub fn deserialize(
          73  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   74     74   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   75     75   
        #[allow(unused_variables, unused_mut)]
   76     76   
        let mut builder = Self::builder();
   77     77   
        #[allow(
   78     78   
            unused_variables,
   79     79   
            unreachable_code,
   80     80   
            clippy::single_match,
   81     81   
            clippy::match_single_binding,
   82     82   
            clippy::diverging_sub_expression
   83     83   
        )]
   84         -
        deserializer.read_struct(&DOCUMENTTYPEOUTPUT_SCHEMA, (), |_, member, deser| {
          84  +
        deserializer.read_struct(&DOCUMENTTYPEOUTPUT_SCHEMA, &mut |member, deser| {
   85     85   
            match member.member_index() {
   86     86   
                Some(0) => {
   87     87   
                    builder.string_value = Some(deser.read_string(member)?);
   88     88   
                }
   89     89   
                Some(1) => {
   90     90   
                    builder.document_value = Some(deser.read_document(member)?);
   91     91   
                }
   92     92   
                _ => {}
   93     93   
            }
   94     94   
            Ok(())
   95     95   
        })?;
   96     96   
        Ok(builder.build())
   97     97   
    }
   98     98   
}
          99  +
impl DocumentTypeOutput {
         100  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         101  +
    pub fn deserialize_with_response(
         102  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         103  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         104  +
        _status: u16,
         105  +
        _body: &[u8],
         106  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         107  +
        Self::deserialize(deserializer)
         108  +
    }
         109  +
}
   99    110   
impl DocumentTypeOutput {
  100    111   
    /// Creates a new builder-style object to manufacture [`DocumentTypeOutput`](crate::operation::document_type::DocumentTypeOutput).
  101    112   
    pub fn builder() -> crate::operation::document_type::builders::DocumentTypeOutputBuilder {
  102    113   
        crate::operation::document_type::builders::DocumentTypeOutputBuilder::default()
  103    114   
    }
  104    115   
}
  105    116   
  106    117   
/// A builder for [`DocumentTypeOutput`](crate::operation::document_type::DocumentTypeOutput).
  107    118   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  108    119   
#[non_exhaustive]

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

@@ -1,1 +40,45 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `DocumentTypeAsMapValue`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct DocumentTypeAsMapValue;
    6      6   
impl DocumentTypeAsMapValue {
    7      7   
    /// Creates a new `DocumentTypeAsMapValue`
    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::document_type_as_map_value::DocumentTypeAsMapValueInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          15  +
        crate::operation::document_type_as_map_value::DocumentTypeAsMapValueOutput::SCHEMA;
   11     16   
    pub(crate) async fn orchestrate(
   12     17   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     18   
        input: crate::operation::document_type_as_map_value::DocumentTypeAsMapValueInput,
   14     19   
    ) -> ::std::result::Result<
   15     20   
        crate::operation::document_type_as_map_value::DocumentTypeAsMapValueOutput,
   16     21   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     22   
            crate::operation::document_type_as_map_value::DocumentTypeAsMapValueError,
   18     23   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     24   
        >,
   20     25   
    > {
@@ -110,115 +234,240 @@
  130    135   
                crate::operation::document_type_as_map_value::DocumentTypeAsMapValueError,
  131    136   
            >::new());
  132    137   
  133    138   
        ::std::borrow::Cow::Owned(rcb)
  134    139   
    }
  135    140   
}
  136    141   
  137    142   
#[derive(Debug)]
  138    143   
struct DocumentTypeAsMapValueResponseDeserializer;
  139    144   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DocumentTypeAsMapValueResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         145  +
    fn deserialize_nonstreaming_with_config(
  141    146   
        &self,
  142    147   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         148  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    149   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    150   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         151  +
        #[allow(unused_mut)]
         152  +
        let mut force_error = false;
         153  +
         154  +
        if !success && status != 200 || force_error {
  145    155   
            let headers = response.headers();
  146    156   
            let body = response.body().bytes().expect("body loaded");
  147    157   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         158  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         159  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         160  +
            })?;
  149    161   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_document_type_as_map_value::de_document_type_as_map_value_http_error(status, headers, body)
         162  +
            let generic = generic_builder.build();
         163  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         164  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         165  +
                    crate::operation::document_type_as_map_value::DocumentTypeAsMapValueError::generic(generic),
         166  +
                ),
         167  +
            ))
  152    168   
        } else {
  153         -
            crate::protocol_serde::shape_document_type_as_map_value::de_document_type_as_map_value_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         169  +
            let protocol = _cfg
         170  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         171  +
                .expect("a SharedClientProtocol is required");
         172  +
            let mut deser = protocol
         173  +
                .deserialize_response(response, DocumentTypeAsMapValue::OUTPUT_SCHEMA, _cfg)
         174  +
                .map_err(|e| {
         175  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         176  +
                })?;
         177  +
            let body = response.body().bytes().expect("body loaded");
         178  +
            let output = crate::operation::document_type_as_map_value::DocumentTypeAsMapValueOutput::deserialize_with_response(
         179  +
                &mut *deser,
         180  +
                response.headers(),
         181  +
                response.status().into(),
         182  +
                body,
         183  +
            )
         184  +
            .map_err(|e| {
         185  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         186  +
            })?;
         187  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         188  +
        }
  156    189   
    }
  157    190   
}
  158    191   
#[derive(Debug)]
  159    192   
struct DocumentTypeAsMapValueRequestSerializer;
  160    193   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DocumentTypeAsMapValueRequestSerializer {
  161    194   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    195   
    fn serialize_input(
  163    196   
        &self,
  164    197   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    198   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    199   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    200   
        let input = input
  168    201   
            .downcast::<crate::operation::document_type_as_map_value::DocumentTypeAsMapValueInput>()
  169    202   
            .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::document_type_as_map_value::DocumentTypeAsMapValueInput,
  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, "/DocumentTypeAsMapValue").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::document_type_as_map_value::DocumentTypeAsMapValueInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  198         -
            crate::protocol_serde::shape_document_type_as_map_value::ser_document_type_as_map_value_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())
         203  +
        let protocol = _cfg
         204  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         205  +
            .expect("a SharedClientProtocol is required");
         206  +
        let mut request = protocol
         207  +
            .serialize_request(&input, DocumentTypeAsMapValue::INPUT_SCHEMA, "", _cfg)
         208  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         209  +
         210  +
        return ::std::result::Result::Ok(request);
  205    211   
    }
  206    212   
}
  207    213   
#[derive(Debug)]
  208    214   
struct DocumentTypeAsMapValueEndpointParamsInterceptor;
  209    215   
  210    216   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DocumentTypeAsMapValueEndpointParamsInterceptor {
  211    217   
    fn name(&self) -> &'static str {
  212    218   
        "DocumentTypeAsMapValueEndpointParamsInterceptor"
  213    219   
    }
  214    220   
@@ -329,335 +389,405 @@
  349    355   
            .expect("the config must have a deserializer");
  350    356   
  351    357   
        let parsed = de.deserialize_streaming(&mut http_response);
  352    358   
        let parsed = parsed.unwrap_or_else(|| {
  353    359   
            let http_response = http_response.map(|body| {
  354    360   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  355    361   
                    body.bytes().unwrap(),
  356    362   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  357    363   
                )))
  358    364   
            });
  359         -
            de.deserialize_nonstreaming(&http_response)
         365  +
            // Build a config bag with the protocol for schema-based deserialization
         366  +
            #[allow(unused_mut)]
         367  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         368  +
            {
         369  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         370  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         371  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         372  +
                ));
         373  +
                test_cfg.push_shared_layer(layer.freeze());
         374  +
            }
         375  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  360    376   
        });
  361    377   
        let parsed = parsed
  362    378   
            .expect("should be successful response")
  363    379   
            .downcast::<crate::operation::document_type_as_map_value::DocumentTypeAsMapValueOutput>()
  364    380   
            .unwrap();
  365    381   
        ::pretty_assertions::assert_eq!(
  366    382   
            parsed.doc_valued_map,
  367    383   
            expected_output.doc_valued_map,
  368    384   
            "Unexpected value for `doc_valued_map`"
  369    385   
        );

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

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