Client Test

Client Test

rev. 163d4d6410694aaf071424777ecbecd050925f36 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/input_stream.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 `InputStream`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct InputStream;
    6      6   
impl InputStream {
    7      7   
    /// Creates a new `InputStream`
    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::input_stream::InputStreamInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::input_stream::InputStreamOutput::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::input_stream::InputStreamInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::input_stream::InputStreamOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::input_stream::InputStreamError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -106,110 +236,282 @@
  126    130   
        ::std::borrow::Cow::Owned(rcb)
  127    131   
    }
  128    132   
}
  129    133   
  130    134   
#[derive(Debug)]
  131    135   
struct InputStreamResponseDeserializer;
  132    136   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for InputStreamResponseDeserializer {
  133    137   
    fn deserialize_nonstreaming(
  134    138   
        &self,
  135    139   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         140  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  136    141   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  137    142   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         143  +
        #[allow(unused_mut)]
         144  +
        let mut force_error = false;
         145  +
         146  +
        if !success && status != 200 || force_error {
  138    147   
            let headers = response.headers();
  139    148   
            let body = response.body().bytes().expect("body loaded");
  140    149   
            #[allow(unused_mut)]
  141         -
        let mut force_error = false;
         150  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         151  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         152  +
            })?;
  142    153   
  143         -
        let parse_result = if !success && status != 200 || force_error {
  144         -
            crate::protocol_serde::shape_input_stream::de_input_stream_http_error(status, headers, body)
  145         -
        } else {
  146         -
            crate::protocol_serde::shape_input_stream::de_input_stream_http_response(status, headers, body)
         154  +
            let generic = generic_builder.build();
         155  +
            let error_code = match generic.code() {
         156  +
                ::std::option::Option::Some(code) => code,
         157  +
                ::std::option::Option::None => {
         158  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         159  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::input_stream::InputStreamError::unhandled(generic)),
         160  +
                    ))
         161  +
                }
         162  +
            };
         163  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         164  +
            let protocol = _cfg
         165  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         166  +
                .expect("a SharedClientProtocol is required");
         167  +
            let err = match error_code {
         168  +
                "ErrorEvent" => crate::operation::input_stream::InputStreamError::ErrorEvent({
         169  +
                    let mut tmp = match protocol
         170  +
                        .deserialize_response(response, crate::types::error::ErrorEvent::SCHEMA, _cfg)
         171  +
                        .and_then(|mut deser| {
         172  +
                            crate::types::error::ErrorEvent::deserialize_with_response(
         173  +
                                &mut *deser,
         174  +
                                response.headers(),
         175  +
                                response.status().into(),
         176  +
                                body,
         177  +
                            )
         178  +
                        }) {
         179  +
                        ::std::result::Result::Ok(val) => val,
         180  +
                        ::std::result::Result::Err(e) => {
         181  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         182  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         183  +
                            ))
         184  +
                        }
         185  +
                    };
         186  +
                    tmp.meta = generic;
         187  +
                    if tmp.message.is_none() {
         188  +
                        tmp.message = _error_message;
         189  +
                    }
         190  +
                    tmp
         191  +
                }),
         192  +
                _ => crate::operation::input_stream::InputStreamError::generic(generic),
  147    193   
            };
  148         -
        crate::protocol_serde::type_erase_result(parse_result)
         194  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         195  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         196  +
            ))
         197  +
        } else {
         198  +
            let protocol = _cfg
         199  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         200  +
                .expect("a SharedClientProtocol is required");
         201  +
            let mut deser = protocol.deserialize_response(response, InputStream::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         202  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         203  +
            })?;
         204  +
            let body = response.body().bytes().expect("body loaded");
         205  +
            let output = crate::operation::input_stream::InputStreamOutput::deserialize_with_response(
         206  +
                &mut *deser,
         207  +
                response.headers(),
         208  +
                response.status().into(),
         209  +
                body,
         210  +
            )
         211  +
            .map_err(|e| {
         212  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         213  +
            })?;
         214  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         215  +
        }
  149    216   
    }
  150    217   
}
  151    218   
#[derive(Debug)]
  152    219   
struct InputStreamRequestSerializer;
  153    220   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for InputStreamRequestSerializer {
  154    221   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  155    222   
    fn serialize_input(
  156    223   
        &self,
  157    224   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  158    225   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  159    226   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  160    227   
        let input = input
  161    228   
            .downcast::<crate::operation::input_stream::InputStreamInput>()
  162    229   
            .expect("correct type");
  163         -
        let _header_serialization_settings = _cfg
  164         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  165         -
            .cloned()
  166         -
            .unwrap_or_default();
  167         -
        let mut request_builder = {
  168         -
            #[allow(clippy::uninlined_format_args)]
  169         -
            fn uri_base(
  170         -
                _input: &crate::operation::input_stream::InputStreamInput,
  171         -
                output: &mut ::std::string::String,
  172         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  173         -
                use ::std::fmt::Write as _;
  174         -
                ::std::write!(output, "/InputStream").expect("formatting should succeed");
  175         -
                ::std::result::Result::Ok(())
  176         -
            }
  177         -
            #[allow(clippy::unnecessary_wraps)]
  178         -
            fn update_http_builder(
  179         -
                input: &crate::operation::input_stream::InputStreamInput,
  180         -
                builder: ::http_1x::request::Builder,
  181         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  182         -
                let mut uri = ::std::string::String::new();
  183         -
                uri_base(input, &mut uri)?;
  184         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  185         -
            }
  186         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  187         -
            builder =
  188         -
                _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
  189         -
            builder
  190         -
        };
  191         -
        let body = ::aws_smithy_types::body::SdkBody::from({
         230  +
        let protocol = _cfg
         231  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         232  +
            .expect("a SharedClientProtocol is required");
         233  +
        let mut request = protocol
         234  +
            .serialize_request(&input, InputStream::INPUT_SCHEMA, "", _cfg)
         235  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         236  +
        *request.body_mut() = ::aws_smithy_types::body::SdkBody::from({
  192    237   
            let error_marshaller = crate::event_stream_serde::EventStreamErrorMarshaller::new();
  193    238   
            let marshaller = crate::event_stream_serde::EventStreamMarshaller::new();
  194    239   
            let (signer, signer_sender) = ::aws_smithy_eventstream::frame::DeferredSigner::new();
  195    240   
            _cfg.interceptor_state().store_put(signer_sender);
  196    241   
            ::aws_smithy_types::body::SdkBody::from_body_1_x(::http_body_util::StreamBody::new(input.stream.into_body_stream(
  197    242   
                marshaller,
  198    243   
                error_marshaller,
  199    244   
                signer,
  200    245   
            )))
  201    246   
        });
  202         -
        if let Some(content_length) = body.content_length() {
  203         -
            let content_length = content_length.to_string();
  204         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  205         -
        }
  206         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         247  +
        // The protocol may have set Content-Length based on the initial empty body.
         248  +
        // Remove it since the event stream body has unknown length.
         249  +
        request.headers_mut().remove("Content-Length");
         250  +
        request.headers_mut().insert("Content-Type", "application/vnd.amazon.eventstream");
         251  +
         252  +
        return ::std::result::Result::Ok(request);
  207    253   
    }
  208    254   
}
  209    255   
#[derive(Debug)]
  210    256   
struct InputStreamEndpointParamsInterceptor;
  211    257   
  212    258   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for InputStreamEndpointParamsInterceptor {
  213    259   
    fn name(&self) -> &'static str {
  214    260   
        "InputStreamEndpointParamsInterceptor"
  215    261   
    }
  216    262   

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

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

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

@@ -1,1 +40,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `InputStreamWithInitialRequest`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct InputStreamWithInitialRequest;
    6      6   
impl InputStreamWithInitialRequest {
    7      7   
    /// Creates a new `InputStreamWithInitialRequest`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          13  +
        crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput::SCHEMA;
          14  +
    /// The schema for this operation's output shape.
          15  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          16  +
        crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput::SCHEMA;
   11     17   
    pub(crate) async fn orchestrate(
   12     18   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     19   
        input: crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
   14     20   
    ) -> ::std::result::Result<
   15     21   
        crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput,
   16     22   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     23   
            crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError,
   18     24   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     25   
        >,
   20     26   
    > {
@@ -112,118 +244,294 @@
  132    138   
        ::std::borrow::Cow::Owned(rcb)
  133    139   
    }
  134    140   
}
  135    141   
  136    142   
#[derive(Debug)]
  137    143   
struct InputStreamWithInitialRequestResponseDeserializer;
  138    144   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for InputStreamWithInitialRequestResponseDeserializer {
  139    145   
    fn deserialize_nonstreaming(
  140    146   
        &self,
  141    147   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         148  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  142    149   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  143    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 {
  144    155   
            let headers = response.headers();
  145    156   
            let body = response.body().bytes().expect("body loaded");
  146    157   
            #[allow(unused_mut)]
  147         -
        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  +
            })?;
  148    161   
  149         -
        let parse_result = if !success && status != 200 || force_error {
  150         -
            crate::protocol_serde::shape_input_stream_with_initial_request::de_input_stream_with_initial_request_http_error(status, headers, body)
  151         -
        } else {
  152         -
            crate::protocol_serde::shape_input_stream_with_initial_request::de_input_stream_with_initial_request_http_response(status, headers, body)
         162  +
            let generic = generic_builder.build();
         163  +
            let error_code = match generic.code() {
         164  +
                ::std::option::Option::Some(code) => code,
         165  +
                ::std::option::Option::None => {
         166  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         167  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(
         168  +
                            crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::unhandled(generic),
         169  +
                        ),
         170  +
                    ))
         171  +
                }
         172  +
            };
         173  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         174  +
            let protocol = _cfg
         175  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         176  +
                .expect("a SharedClientProtocol is required");
         177  +
            let err = match error_code {
         178  +
                "ErrorEvent" => crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::ErrorEvent({
         179  +
                    let mut tmp = match protocol
         180  +
                        .deserialize_response(response, crate::types::error::ErrorEvent::SCHEMA, _cfg)
         181  +
                        .and_then(|mut deser| {
         182  +
                            crate::types::error::ErrorEvent::deserialize_with_response(
         183  +
                                &mut *deser,
         184  +
                                response.headers(),
         185  +
                                response.status().into(),
         186  +
                                body,
         187  +
                            )
         188  +
                        }) {
         189  +
                        ::std::result::Result::Ok(val) => val,
         190  +
                        ::std::result::Result::Err(e) => {
         191  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         192  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         193  +
                            ))
         194  +
                        }
         195  +
                    };
         196  +
                    tmp.meta = generic;
         197  +
                    if tmp.message.is_none() {
         198  +
                        tmp.message = _error_message;
         199  +
                    }
         200  +
                    tmp
         201  +
                }),
         202  +
                _ => crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestError::generic(generic),
  153    203   
            };
  154         -
        crate::protocol_serde::type_erase_result(parse_result)
         204  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         205  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         206  +
            ))
         207  +
        } else {
         208  +
            let protocol = _cfg
         209  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         210  +
                .expect("a SharedClientProtocol is required");
         211  +
            let mut deser = protocol
         212  +
                .deserialize_response(response, InputStreamWithInitialRequest::OUTPUT_SCHEMA, _cfg)
         213  +
                .map_err(|e| {
         214  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         215  +
                })?;
         216  +
            let body = response.body().bytes().expect("body loaded");
         217  +
            let output = crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput::deserialize_with_response(
         218  +
                &mut *deser,
         219  +
                response.headers(),
         220  +
                response.status().into(),
         221  +
                body,
         222  +
            )
         223  +
            .map_err(|e| {
         224  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         225  +
            })?;
         226  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         227  +
        }
  155    228   
    }
  156    229   
}
  157    230   
#[derive(Debug)]
  158    231   
struct InputStreamWithInitialRequestRequestSerializer;
  159    232   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for InputStreamWithInitialRequestRequestSerializer {
  160    233   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  161    234   
    fn serialize_input(
  162    235   
        &self,
  163    236   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  164    237   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  165    238   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  166    239   
        let input = input
  167    240   
            .downcast::<crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput>()
  168    241   
            .expect("correct type");
  169         -
        let _header_serialization_settings = _cfg
  170         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  171         -
            .cloned()
  172         -
            .unwrap_or_default();
  173         -
        let mut request_builder = {
  174         -
            #[allow(clippy::uninlined_format_args)]
  175         -
            fn uri_base(
  176         -
                _input: &crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
  177         -
                output: &mut ::std::string::String,
  178         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  179         -
                use ::std::fmt::Write as _;
  180         -
                ::std::write!(output, "/InputStreamWithInitialRequest").expect("formatting should succeed");
  181         -
                ::std::result::Result::Ok(())
  182         -
            }
  183         -
            #[allow(clippy::unnecessary_wraps)]
  184         -
            fn update_http_builder(
  185         -
                input: &crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestInput,
  186         -
                builder: ::http_1x::request::Builder,
  187         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  188         -
                let mut uri = ::std::string::String::new();
  189         -
                uri_base(input, &mut uri)?;
  190         -
                let builder =
  191         -
                    crate::protocol_serde::shape_input_stream_with_initial_request::ser_input_stream_with_initial_request_headers(input, builder)?;
  192         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  193         -
            }
  194         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  195         -
            builder =
  196         -
                _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
  197         -
            builder
  198         -
        };
  199         -
        let body = ::aws_smithy_types::body::SdkBody::from({
         242  +
        let protocol = _cfg
         243  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         244  +
            .expect("a SharedClientProtocol is required");
         245  +
        let mut request = protocol
         246  +
            .serialize_request(&input, InputStreamWithInitialRequest::INPUT_SCHEMA, "", _cfg)
         247  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         248  +
        *request.body_mut() = ::aws_smithy_types::body::SdkBody::from({
  200    249   
            let error_marshaller = crate::event_stream_serde::EventStreamErrorMarshaller::new();
  201    250   
            let marshaller = crate::event_stream_serde::EventStreamMarshaller::new();
  202    251   
            let (signer, signer_sender) = ::aws_smithy_eventstream::frame::DeferredSigner::new();
  203    252   
            _cfg.interceptor_state().store_put(signer_sender);
  204    253   
            ::aws_smithy_types::body::SdkBody::from_body_1_x(::http_body_util::StreamBody::new(input.stream.into_body_stream(
  205    254   
                marshaller,
  206    255   
                error_marshaller,
  207    256   
                signer,
  208    257   
            )))
  209    258   
        });
  210         -
        if let Some(content_length) = body.content_length() {
  211         -
            let content_length = content_length.to_string();
  212         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  213         -
        }
  214         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         259  +
        // The protocol may have set Content-Length based on the initial empty body.
         260  +
        // Remove it since the event stream body has unknown length.
         261  +
        request.headers_mut().remove("Content-Length");
         262  +
        request.headers_mut().insert("Content-Type", "application/vnd.amazon.eventstream");
         263  +
         264  +
        return ::std::result::Result::Ok(request);
  215    265   
    }
  216    266   
}
  217    267   
#[derive(Debug)]
  218    268   
struct InputStreamWithInitialRequestEndpointParamsInterceptor;
  219    269   
  220    270   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for InputStreamWithInitialRequestEndpointParamsInterceptor {
  221    271   
    fn name(&self) -> &'static str {
  222    272   
        "InputStreamWithInitialRequestEndpointParamsInterceptor"
  223    273   
    }
  224    274   

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

@@ -3,3 +128,166 @@
   23     23   
    "aws.protocoltests.restjson.synthetic",
   24     24   
    "InputStreamWithInitialRequestInput",
   25     25   
);
   26     26   
static INPUTSTREAMWITHINITIALREQUESTINPUT_MEMBER_INITIAL_REQUEST_MEMBER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   27     27   
    ::aws_smithy_schema::ShapeId::from_static(
   28     28   
        "aws.protocoltests.restjson.synthetic#InputStreamWithInitialRequestInput$initialRequestMember",
   29     29   
        "aws.protocoltests.restjson.synthetic",
   30     30   
        "InputStreamWithInitialRequestInput",
   31     31   
    ),
   32     32   
    ::aws_smithy_schema::ShapeType::String,
   33         -
    "initial_request_member",
          33  +
    "initialRequestMember",
   34     34   
    0,
   35     35   
)
   36     36   
.with_http_header("initial-request-member");
   37     37   
static INPUTSTREAMWITHINITIALREQUESTINPUT_MEMBER_STREAM: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   38     38   
    ::aws_smithy_schema::ShapeId::from_static(
   39     39   
        "aws.protocoltests.restjson.synthetic#InputStreamWithInitialRequestInput$stream",
   40     40   
        "aws.protocoltests.restjson.synthetic",
   41     41   
        "InputStreamWithInitialRequestInput",
   42     42   
    ),
   43     43   
    ::aws_smithy_schema::ShapeType::Union,
   44     44   
    "stream",
   45     45   
    1,
   46     46   
)
   47     47   
.with_http_payload();
   48     48   
static INPUTSTREAMWITHINITIALREQUESTINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   49     49   
    INPUTSTREAMWITHINITIALREQUESTINPUT_SCHEMA_ID,
   50     50   
    ::aws_smithy_schema::ShapeType::Structure,
   51     51   
    &[
   52     52   
        &INPUTSTREAMWITHINITIALREQUESTINPUT_MEMBER_INITIAL_REQUEST_MEMBER,
   53     53   
        &INPUTSTREAMWITHINITIALREQUESTINPUT_MEMBER_STREAM,
   54     54   
    ],
   55         -
);
          55  +
)
          56  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/InputStreamWithInitialRequest", None));
   56     57   
impl InputStreamWithInitialRequestInput {
   57     58   
    /// The schema for this shape.
   58     59   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &INPUTSTREAMWITHINITIALREQUESTINPUT_SCHEMA;
   59     60   
}
   60     61   
impl ::aws_smithy_schema::serde::SerializableStruct for InputStreamWithInitialRequestInput {
   61     62   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   62     63   
    fn serialize_members(
   63     64   
        &self,
   64     65   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   65     66   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   66     67   
        if let Some(ref val) = self.initial_request_member {
   67     68   
            ser.write_string(&INPUTSTREAMWITHINITIALREQUESTINPUT_MEMBER_INITIAL_REQUEST_MEMBER, val)?;
   68     69   
        }
   69         -
        {
   70         -
            let val = &self.stream;
   71         -
            ser.write_null(&INPUTSTREAMWITHINITIALREQUESTINPUT_MEMBER_STREAM)?;
   72         -
        }
   73     70   
        Ok(())
   74     71   
    }
   75     72   
}
   76     73   
impl InputStreamWithInitialRequestInput {
   77     74   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   78         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   79         -
        deserializer: &mut D,
          75  +
    pub fn deserialize(
          76  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   80     77   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   81     78   
        #[allow(unused_variables, unused_mut)]
   82     79   
        let mut builder = Self::builder();
   83     80   
        #[allow(
   84     81   
            unused_variables,
   85     82   
            unreachable_code,
   86     83   
            clippy::single_match,
   87     84   
            clippy::match_single_binding,
   88     85   
            clippy::diverging_sub_expression
   89     86   
        )]
   90         -
        deserializer.read_struct(&INPUTSTREAMWITHINITIALREQUESTINPUT_SCHEMA, (), |_, member, deser| {
          87  +
        deserializer.read_struct(&INPUTSTREAMWITHINITIALREQUESTINPUT_SCHEMA, &mut |member, deser| {
   91     88   
            match member.member_index() {
   92     89   
                Some(0) => {
   93     90   
                    builder.initial_request_member = Some(deser.read_string(member)?);
   94     91   
                }
   95     92   
                Some(1) => {
   96     93   
                    builder.stream = Some({
   97     94   
                        let _ = member;
   98         -
                        todo!("deserialize aggregate")
          95  +
                        todo!("deserialize streaming union")
          96  +
                    });
          97  +
                }
          98  +
                _ => {}
          99  +
            }
         100  +
            Ok(())
         101  +
        })?;
         102  +
        builder.initial_request_member = builder.initial_request_member.or(Some(String::new()));
         103  +
        builder
         104  +
            .build()
         105  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
         106  +
    }
         107  +
}
         108  +
impl InputStreamWithInitialRequestInput {
         109  +
    /// Deserializes this structure from a body deserializer and HTTP response headers.
         110  +
    /// Header-bound members are read directly from headers, avoiding runtime
         111  +
    /// member iteration overhead. Body members are read via the deserializer.
         112  +
    pub fn deserialize_with_response(
         113  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         114  +
        headers: &::aws_smithy_runtime_api::http::Headers,
         115  +
        _status: u16,
         116  +
        _body: &[u8],
         117  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         118  +
        #[allow(unused_variables, unused_mut)]
         119  +
        let mut builder = Self::builder();
         120  +
        if let Some(val) = headers.get("initial-request-member") {
         121  +
            builder.initial_request_member = Some(val.to_string());
         122  +
        }
         123  +
        #[allow(
         124  +
            unused_variables,
         125  +
            unreachable_code,
         126  +
            clippy::single_match,
         127  +
            clippy::match_single_binding,
         128  +
            clippy::diverging_sub_expression
         129  +
        )]
         130  +
        deserializer.read_struct(&INPUTSTREAMWITHINITIALREQUESTINPUT_SCHEMA, &mut |member, deser| {
         131  +
            match member.member_index() {
         132  +
                Some(0) => { /* read from headers above */ }
         133  +
                Some(1) => {
         134  +
                    builder.stream = Some({
         135  +
                        let _ = member;
         136  +
                        todo!("deserialize streaming union")
   99    137   
                    });
  100    138   
                }
  101    139   
                _ => {}
  102    140   
            }
  103    141   
            Ok(())
  104    142   
        })?;
  105    143   
        builder
  106    144   
            .build()
  107    145   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  108    146   
    }

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/input_stream_with_initial_request/_input_stream_with_initial_request_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 InputStreamWithInitialRequestOutput {
   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(&INPUTSTREAMWITHINITIALREQUESTOUTPUT_SCHEMA, (), |_, member, deser| {
          43  +
        deserializer.read_struct(&INPUTSTREAMWITHINITIALREQUESTOUTPUT_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 InputStreamWithInitialRequestOutput {
          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 InputStreamWithInitialRequestOutput {
   53     64   
    /// Creates a new builder-style object to manufacture [`InputStreamWithInitialRequestOutput`](crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput).
   54     65   
    pub fn builder() -> crate::operation::input_stream_with_initial_request::builders::InputStreamWithInitialRequestOutputBuilder {
   55     66   
        crate::operation::input_stream_with_initial_request::builders::InputStreamWithInitialRequestOutputBuilder::default()
   56     67   
    }
   57     68   
}
   58     69   
   59     70   
/// A builder for [`InputStreamWithInitialRequestOutput`](crate::operation::input_stream_with_initial_request::InputStreamWithInitialRequestOutput).
   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/json_blobs.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 `JsonBlobs`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct JsonBlobs;
    6      6   
impl JsonBlobs {
    7      7   
    /// Creates a new `JsonBlobs`
    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::json_blobs::JsonBlobsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_blobs::JsonBlobsOutput::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::json_blobs::JsonBlobsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::json_blobs::JsonBlobsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::json_blobs::JsonBlobsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -107,111 +224,227 @@
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct JsonBlobsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for JsonBlobsResponseDeserializer {
  134    138   
    fn deserialize_nonstreaming(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         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_json_blobs::de_json_blobs_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::json_blobs::JsonBlobsError::generic(generic)),
         158  +
            ))
  146    159   
        } else {
  147         -
            crate::protocol_serde::shape_json_blobs::de_json_blobs_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         160  +
            let protocol = _cfg
         161  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         162  +
                .expect("a SharedClientProtocol is required");
         163  +
            let mut deser = protocol.deserialize_response(response, JsonBlobs::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         164  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         165  +
            })?;
         166  +
            let body = response.body().bytes().expect("body loaded");
         167  +
            let output = crate::operation::json_blobs::JsonBlobsOutput::deserialize_with_response(
         168  +
                &mut *deser,
         169  +
                response.headers(),
         170  +
                response.status().into(),
         171  +
                body,
         172  +
            )
         173  +
            .map_err(|e| {
         174  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
            })?;
         176  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         177  +
        }
  150    178   
    }
  151    179   
}
  152    180   
#[derive(Debug)]
  153    181   
struct JsonBlobsRequestSerializer;
  154    182   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for JsonBlobsRequestSerializer {
  155    183   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    184   
    fn serialize_input(
  157    185   
        &self,
  158    186   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    187   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    188   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    189   
        let input = input.downcast::<crate::operation::json_blobs::JsonBlobsInput>().expect("correct type");
  162         -
        let _header_serialization_settings = _cfg
  163         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  164         -
            .cloned()
  165         -
            .unwrap_or_default();
  166         -
        let mut request_builder = {
  167         -
            #[allow(clippy::uninlined_format_args)]
  168         -
            fn uri_base(
  169         -
                _input: &crate::operation::json_blobs::JsonBlobsInput,
  170         -
                output: &mut ::std::string::String,
  171         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  172         -
                use ::std::fmt::Write as _;
  173         -
                ::std::write!(output, "/JsonBlobs").expect("formatting should succeed");
  174         -
                ::std::result::Result::Ok(())
  175         -
            }
  176         -
            #[allow(clippy::unnecessary_wraps)]
  177         -
            fn update_http_builder(
  178         -
                input: &crate::operation::json_blobs::JsonBlobsInput,
  179         -
                builder: ::http_1x::request::Builder,
  180         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  181         -
                let mut uri = ::std::string::String::new();
  182         -
                uri_base(input, &mut uri)?;
  183         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  184         -
            }
  185         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  186         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  187         -
            builder
  188         -
        };
  189         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_json_blobs::ser_json_blobs_input(&input)?);
  190         -
        if let Some(content_length) = body.content_length() {
  191         -
            let content_length = content_length.to_string();
  192         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  193         -
        }
  194         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         190  +
        let protocol = _cfg
         191  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         192  +
            .expect("a SharedClientProtocol is required");
         193  +
        let mut request = protocol
         194  +
            .serialize_request(&input, JsonBlobs::INPUT_SCHEMA, "", _cfg)
         195  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         196  +
         197  +
        return ::std::result::Result::Ok(request);
  195    198   
    }
  196    199   
}
  197    200   
#[derive(Debug)]
  198    201   
struct JsonBlobsEndpointParamsInterceptor;
  199    202   
  200    203   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for JsonBlobsEndpointParamsInterceptor {
  201    204   
    fn name(&self) -> &'static str {
  202    205   
        "JsonBlobsEndpointParamsInterceptor"
  203    206   
    }
  204    207   
@@ -273,276 +333,346 @@
  293    296   
            .expect("the config must have a deserializer");
  294    297   
  295    298   
        let parsed = de.deserialize_streaming(&mut http_response);
  296    299   
        let parsed = parsed.unwrap_or_else(|| {
  297    300   
            let http_response = http_response.map(|body| {
  298    301   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  299    302   
                    body.bytes().unwrap(),
  300    303   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  301    304   
                )))
  302    305   
            });
  303         -
            de.deserialize_nonstreaming(&http_response)
         306  +
            // Build a config bag with the protocol for schema-based deserialization
         307  +
            #[allow(unused_mut)]
         308  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         309  +
            {
         310  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         311  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         312  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         313  +
                ));
         314  +
                test_cfg.push_shared_layer(layer.freeze());
         315  +
            }
         316  +
            de.deserialize_nonstreaming(&http_response, &test_cfg)
  304    317   
        });
  305    318   
        let parsed = parsed
  306    319   
            .expect("should be successful response")
  307    320   
            .downcast::<crate::operation::json_blobs::JsonBlobsOutput>()
  308    321   
            .unwrap();
  309    322   
        ::pretty_assertions::assert_eq!(parsed.data, expected_output.data, "Unexpected value for `data`");
  310    323   
    }
  311    324   
}
  312    325   
  313    326   
/// Error type for the `JsonBlobsError` operation.

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

@@ -4,4 +108,120 @@
   24     24   
        "JsonBlobsInput",
   25     25   
    ),
   26     26   
    ::aws_smithy_schema::ShapeType::Blob,
   27     27   
    "data",
   28     28   
    0,
   29     29   
);
   30     30   
static JSONBLOBSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   31     31   
    JSONBLOBSINPUT_SCHEMA_ID,
   32     32   
    ::aws_smithy_schema::ShapeType::Structure,
   33     33   
    &[&JSONBLOBSINPUT_MEMBER_DATA],
   34         -
);
          34  +
)
          35  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/JsonBlobs", None));
   35     36   
impl JsonBlobsInput {
   36     37   
    /// The schema for this shape.
   37     38   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &JSONBLOBSINPUT_SCHEMA;
   38     39   
}
   39     40   
impl ::aws_smithy_schema::serde::SerializableStruct for JsonBlobsInput {
   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.data {
   46     47   
            ser.write_blob(&JSONBLOBSINPUT_MEMBER_DATA, val)?;
   47     48   
        }
   48     49   
        Ok(())
   49     50   
    }
   50     51   
}
   51     52   
impl JsonBlobsInput {
   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(&JSONBLOBSINPUT_SCHEMA, (), |_, member, deser| {
          66  +
        deserializer.read_struct(&JSONBLOBSINPUT_SCHEMA, &mut |member, deser| {
   66     67   
            match member.member_index() {
   67     68   
                Some(0) => {
   68     69   
                    builder.data = Some(deser.read_blob(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 JsonBlobsInput {
          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 JsonBlobsInput {
   80     92   
    /// Creates a new builder-style object to manufacture [`JsonBlobsInput`](crate::operation::json_blobs::JsonBlobsInput).
   81     93   
    pub fn builder() -> crate::operation::json_blobs::builders::JsonBlobsInputBuilder {
   82     94   
        crate::operation::json_blobs::builders::JsonBlobsInputBuilder::default()
   83     95   
    }
   84     96   
}
   85     97   
   86     98   
/// A builder for [`JsonBlobsInput`](crate::operation::json_blobs::JsonBlobsInput).
   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/json_blobs/_json_blobs_output.rs

@@ -23,23 +106,117 @@
   43     43   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   44     44   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   45     45   
        if let Some(ref val) = self.data {
   46     46   
            ser.write_blob(&JSONBLOBSOUTPUT_MEMBER_DATA, val)?;
   47     47   
        }
   48     48   
        Ok(())
   49     49   
    }
   50     50   
}
   51     51   
impl JsonBlobsOutput {
   52     52   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   53         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   54         -
        deserializer: &mut D,
          53  +
    pub fn deserialize(
          54  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   55     55   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   56     56   
        #[allow(unused_variables, unused_mut)]
   57     57   
        let mut builder = Self::builder();
   58     58   
        #[allow(
   59     59   
            unused_variables,
   60     60   
            unreachable_code,
   61     61   
            clippy::single_match,
   62     62   
            clippy::match_single_binding,
   63     63   
            clippy::diverging_sub_expression
   64     64   
        )]
   65         -
        deserializer.read_struct(&JSONBLOBSOUTPUT_SCHEMA, (), |_, member, deser| {
          65  +
        deserializer.read_struct(&JSONBLOBSOUTPUT_SCHEMA, &mut |member, deser| {
   66     66   
            match member.member_index() {
   67     67   
                Some(0) => {
   68     68   
                    builder.data = Some(deser.read_blob(member)?);
   69     69   
                }
   70     70   
                _ => {}
   71     71   
            }
   72     72   
            Ok(())
   73     73   
        })?;
   74     74   
        Ok(builder.build())
   75     75   
    }
   76     76   
}
          77  +
impl JsonBlobsOutput {
          78  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          79  +
    pub fn deserialize_with_response(
          80  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          81  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          82  +
        _status: u16,
          83  +
        _body: &[u8],
          84  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          85  +
        Self::deserialize(deserializer)
          86  +
    }
          87  +
}
   77     88   
impl JsonBlobsOutput {
   78     89   
    /// Creates a new builder-style object to manufacture [`JsonBlobsOutput`](crate::operation::json_blobs::JsonBlobsOutput).
   79     90   
    pub fn builder() -> crate::operation::json_blobs::builders::JsonBlobsOutputBuilder {
   80     91   
        crate::operation::json_blobs::builders::JsonBlobsOutputBuilder::default()
   81     92   
    }
   82     93   
}
   83     94   
   84     95   
/// A builder for [`JsonBlobsOutput`](crate::operation::json_blobs::JsonBlobsOutput).
   85     96   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   86     97   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/json_enums.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 `JsonEnums`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct JsonEnums;
    6      6   
impl JsonEnums {
    7      7   
    /// Creates a new `JsonEnums`
    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::json_enums::JsonEnumsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_enums::JsonEnumsOutput::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::json_enums::JsonEnumsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::json_enums::JsonEnumsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::json_enums::JsonEnumsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -107,111 +224,227 @@
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct JsonEnumsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for JsonEnumsResponseDeserializer {
  134    138   
    fn deserialize_nonstreaming(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         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_json_enums::de_json_enums_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::json_enums::JsonEnumsError::generic(generic)),
         158  +
            ))
  146    159   
        } else {
  147         -
            crate::protocol_serde::shape_json_enums::de_json_enums_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         160  +
            let protocol = _cfg
         161  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         162  +
                .expect("a SharedClientProtocol is required");
         163  +
            let mut deser = protocol.deserialize_response(response, JsonEnums::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         164  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         165  +
            })?;
         166  +
            let body = response.body().bytes().expect("body loaded");
         167  +
            let output = crate::operation::json_enums::JsonEnumsOutput::deserialize_with_response(
         168  +
                &mut *deser,
         169  +
                response.headers(),
         170  +
                response.status().into(),
         171  +
                body,
         172  +
            )
         173  +
            .map_err(|e| {
         174  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
            })?;
         176  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         177  +
        }
  150    178   
    }
  151    179   
}
  152    180   
#[derive(Debug)]
  153    181   
struct JsonEnumsRequestSerializer;
  154    182   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for JsonEnumsRequestSerializer {
  155    183   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    184   
    fn serialize_input(
  157    185   
        &self,
  158    186   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    187   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    188   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    189   
        let input = input.downcast::<crate::operation::json_enums::JsonEnumsInput>().expect("correct type");
  162         -
        let _header_serialization_settings = _cfg
  163         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  164         -
            .cloned()
  165         -
            .unwrap_or_default();
  166         -
        let mut request_builder = {
  167         -
            #[allow(clippy::uninlined_format_args)]
  168         -
            fn uri_base(
  169         -
                _input: &crate::operation::json_enums::JsonEnumsInput,
  170         -
                output: &mut ::std::string::String,
  171         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  172         -
                use ::std::fmt::Write as _;
  173         -
                ::std::write!(output, "/JsonEnums").expect("formatting should succeed");
  174         -
                ::std::result::Result::Ok(())
  175         -
            }
  176         -
            #[allow(clippy::unnecessary_wraps)]
  177         -
            fn update_http_builder(
  178         -
                input: &crate::operation::json_enums::JsonEnumsInput,
  179         -
                builder: ::http_1x::request::Builder,
  180         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  181         -
                let mut uri = ::std::string::String::new();
  182         -
                uri_base(input, &mut uri)?;
  183         -
                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
  184         -
            }
  185         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  186         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  187         -
            builder
  188         -
        };
  189         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_json_enums::ser_json_enums_input(&input)?);
  190         -
        if let Some(content_length) = body.content_length() {
  191         -
            let content_length = content_length.to_string();
  192         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  193         -
        }
  194         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         190  +
        let protocol = _cfg
         191  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         192  +
            .expect("a SharedClientProtocol is required");
         193  +
        let mut request = protocol
         194  +
            .serialize_request(&input, JsonEnums::INPUT_SCHEMA, "", _cfg)
         195  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         196  +
         197  +
        return ::std::result::Result::Ok(request);
  195    198   
    }
  196    199   
}
  197    200   
#[derive(Debug)]
  198    201   
struct JsonEnumsEndpointParamsInterceptor;
  199    202   
  200    203   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for JsonEnumsEndpointParamsInterceptor {
  201    204   
    fn name(&self) -> &'static str {
  202    205   
        "JsonEnumsEndpointParamsInterceptor"
  203    206   
    }
  204    207   
@@ -325,328 +385,398 @@
  345    348   
            .expect("the config must have a deserializer");
  346    349   
  347    350   
        let parsed = de.deserialize_streaming(&mut http_response);
  348    351   
        let parsed = parsed.unwrap_or_else(|| {
  349    352   
            let http_response = http_response.map(|body| {
  350    353   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  351    354   
                    body.bytes().unwrap(),
  352    355   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  353    356   
                )))
  354    357   
            });
  355         -
            de.deserialize_nonstreaming(&http_response)
         358  +
            // Build a config bag with the protocol for schema-based deserialization
         359  +
            #[allow(unused_mut)]
         360  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         361  +
            {
         362  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         363  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         364  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         365  +
                ));
         366  +
                test_cfg.push_shared_layer(layer.freeze());
         367  +
            }
         368  +
            de.deserialize_nonstreaming(&http_response, &test_cfg)
  356    369   
        });
  357    370   
        let parsed = parsed
  358    371   
            .expect("should be successful response")
  359    372   
            .downcast::<crate::operation::json_enums::JsonEnumsOutput>()
  360    373   
            .unwrap();
  361    374   
        ::pretty_assertions::assert_eq!(parsed.foo_enum1, expected_output.foo_enum1, "Unexpected value for `foo_enum1`");
  362    375   
        ::pretty_assertions::assert_eq!(parsed.foo_enum2, expected_output.foo_enum2, "Unexpected value for `foo_enum2`");
  363    376   
        ::pretty_assertions::assert_eq!(parsed.foo_enum3, expected_output.foo_enum3, "Unexpected value for `foo_enum3`");
  364    377   
        ::pretty_assertions::assert_eq!(
  365    378   
            parsed.foo_enum_list,

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

@@ -31,31 +284,287 @@
   51     51   
    "aws.protocoltests.restjson.synthetic",
   52     52   
    "JsonEnumsInput",
   53     53   
);
   54     54   
static JSONENUMSINPUT_MEMBER_FOO_ENUM1: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   55     55   
    ::aws_smithy_schema::ShapeId::from_static(
   56     56   
        "aws.protocoltests.restjson.synthetic#JsonEnumsInput$fooEnum1",
   57     57   
        "aws.protocoltests.restjson.synthetic",
   58     58   
        "JsonEnumsInput",
   59     59   
    ),
   60     60   
    ::aws_smithy_schema::ShapeType::String,
   61         -
    "foo_enum1",
          61  +
    "fooEnum1",
   62     62   
    0,
   63     63   
);
   64     64   
static JSONENUMSINPUT_MEMBER_FOO_ENUM2: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   65     65   
    ::aws_smithy_schema::ShapeId::from_static(
   66     66   
        "aws.protocoltests.restjson.synthetic#JsonEnumsInput$fooEnum2",
   67     67   
        "aws.protocoltests.restjson.synthetic",
   68     68   
        "JsonEnumsInput",
   69     69   
    ),
   70     70   
    ::aws_smithy_schema::ShapeType::String,
   71         -
    "foo_enum2",
          71  +
    "fooEnum2",
   72     72   
    1,
   73     73   
);
   74     74   
static JSONENUMSINPUT_MEMBER_FOO_ENUM3: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   75     75   
    ::aws_smithy_schema::ShapeId::from_static(
   76     76   
        "aws.protocoltests.restjson.synthetic#JsonEnumsInput$fooEnum3",
   77     77   
        "aws.protocoltests.restjson.synthetic",
   78     78   
        "JsonEnumsInput",
   79     79   
    ),
   80     80   
    ::aws_smithy_schema::ShapeType::String,
   81         -
    "foo_enum3",
          81  +
    "fooEnum3",
   82     82   
    2,
   83     83   
);
   84     84   
static JSONENUMSINPUT_MEMBER_FOO_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   85     85   
    ::aws_smithy_schema::ShapeId::from_static(
   86     86   
        "aws.protocoltests.restjson.synthetic#JsonEnumsInput$fooEnumList",
   87     87   
        "aws.protocoltests.restjson.synthetic",
   88     88   
        "JsonEnumsInput",
   89     89   
    ),
   90     90   
    ::aws_smithy_schema::ShapeType::List,
   91         -
    "foo_enum_list",
          91  +
    "fooEnumList",
   92     92   
    3,
   93     93   
);
   94     94   
static JSONENUMSINPUT_MEMBER_FOO_ENUM_SET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   95     95   
    ::aws_smithy_schema::ShapeId::from_static(
   96     96   
        "aws.protocoltests.restjson.synthetic#JsonEnumsInput$fooEnumSet",
   97     97   
        "aws.protocoltests.restjson.synthetic",
   98     98   
        "JsonEnumsInput",
   99     99   
    ),
  100    100   
    ::aws_smithy_schema::ShapeType::List,
  101         -
    "foo_enum_set",
         101  +
    "fooEnumSet",
  102    102   
    4,
  103    103   
);
  104    104   
static JSONENUMSINPUT_MEMBER_FOO_ENUM_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  105    105   
    ::aws_smithy_schema::ShapeId::from_static(
  106    106   
        "aws.protocoltests.restjson.synthetic#JsonEnumsInput$fooEnumMap",
  107    107   
        "aws.protocoltests.restjson.synthetic",
  108    108   
        "JsonEnumsInput",
  109    109   
    ),
  110    110   
    ::aws_smithy_schema::ShapeType::Map,
  111         -
    "foo_enum_map",
         111  +
    "fooEnumMap",
  112    112   
    5,
  113    113   
);
  114    114   
static JSONENUMSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  115    115   
    JSONENUMSINPUT_SCHEMA_ID,
  116    116   
    ::aws_smithy_schema::ShapeType::Structure,
  117    117   
    &[
  118    118   
        &JSONENUMSINPUT_MEMBER_FOO_ENUM1,
  119    119   
        &JSONENUMSINPUT_MEMBER_FOO_ENUM2,
  120    120   
        &JSONENUMSINPUT_MEMBER_FOO_ENUM3,
  121    121   
        &JSONENUMSINPUT_MEMBER_FOO_ENUM_LIST,
  122    122   
        &JSONENUMSINPUT_MEMBER_FOO_ENUM_SET,
  123    123   
        &JSONENUMSINPUT_MEMBER_FOO_ENUM_MAP,
  124    124   
    ],
  125         -
);
         125  +
)
         126  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("PUT", "/JsonEnums", None));
  126    127   
impl JsonEnumsInput {
  127    128   
    /// The schema for this shape.
  128    129   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &JSONENUMSINPUT_SCHEMA;
  129    130   
}
  130    131   
impl ::aws_smithy_schema::serde::SerializableStruct for JsonEnumsInput {
  131    132   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  132    133   
    fn serialize_members(
  133    134   
        &self,
  134    135   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  135    136   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  136    137   
        if let Some(ref val) = self.foo_enum1 {
  137    138   
            ser.write_string(&JSONENUMSINPUT_MEMBER_FOO_ENUM1, val.as_str())?;
  138    139   
        }
  139    140   
        if let Some(ref val) = self.foo_enum2 {
  140    141   
            ser.write_string(&JSONENUMSINPUT_MEMBER_FOO_ENUM2, val.as_str())?;
  141    142   
        }
  142    143   
        if let Some(ref val) = self.foo_enum3 {
  143    144   
            ser.write_string(&JSONENUMSINPUT_MEMBER_FOO_ENUM3, val.as_str())?;
  144    145   
        }
  145    146   
        if let Some(ref val) = self.foo_enum_list {
  146    147   
            ser.write_list(
  147    148   
                &JSONENUMSINPUT_MEMBER_FOO_ENUM_LIST,
  148    149   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  149    150   
                    for item in val {
  150    151   
                        ser.write_string(&aws_smithy_schema::prelude::STRING, item.as_str())?;
  151    152   
                    }
  152    153   
                    Ok(())
  153    154   
                },
  154    155   
            )?;
  155    156   
        }
  156    157   
        if let Some(ref val) = self.foo_enum_set {
  157    158   
            ser.write_list(
  158    159   
                &JSONENUMSINPUT_MEMBER_FOO_ENUM_SET,
  159    160   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  160    161   
                    for item in val {
  161    162   
                        ser.write_string(&aws_smithy_schema::prelude::STRING, item.as_str())?;
  162    163   
                    }
  163    164   
                    Ok(())
  164    165   
                },
  165    166   
            )?;
  166    167   
        }
  167    168   
        if let Some(ref val) = self.foo_enum_map {
  168    169   
            ser.write_map(
  169    170   
                &JSONENUMSINPUT_MEMBER_FOO_ENUM_MAP,
  170    171   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  171    172   
                    for (key, value) in val {
  172    173   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
  173    174   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value.as_str())?;
  174    175   
                    }
  175    176   
                    Ok(())
  176    177   
                },
  177    178   
            )?;
  178    179   
        }
  179    180   
        Ok(())
  180    181   
    }
  181    182   
}
  182    183   
impl JsonEnumsInput {
  183    184   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  184         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  185         -
        deserializer: &mut D,
         185  +
    pub fn deserialize(
         186  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  186    187   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  187    188   
        #[allow(unused_variables, unused_mut)]
  188    189   
        let mut builder = Self::builder();
  189    190   
        #[allow(
  190    191   
            unused_variables,
  191    192   
            unreachable_code,
  192    193   
            clippy::single_match,
  193    194   
            clippy::match_single_binding,
  194    195   
            clippy::diverging_sub_expression
  195    196   
        )]
  196         -
        deserializer.read_struct(&JSONENUMSINPUT_SCHEMA, (), |_, member, deser| {
         197  +
        deserializer.read_struct(&JSONENUMSINPUT_SCHEMA, &mut |member, deser| {
  197    198   
            match member.member_index() {
  198    199   
                Some(0) => {
  199    200   
                    builder.foo_enum1 = Some(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  200    201   
                }
  201    202   
                Some(1) => {
  202    203   
                    builder.foo_enum2 = Some(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  203    204   
                }
  204    205   
                Some(2) => {
  205    206   
                    builder.foo_enum3 = Some(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  206    207   
                }
  207    208   
                Some(3) => {
  208    209   
                    builder.foo_enum_list = Some({
  209         -
                        let container = if let Some(cap) = deser.container_size() {
  210         -
                            Vec::with_capacity(cap)
  211         -
                        } else {
  212         -
                            Vec::new()
  213         -
                        };
  214         -
                        deser.read_list(member, container, |mut list, deser| {
  215         -
                            list.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  216         -
                            Ok(list)
  217         -
                        })?
         210  +
                        let mut container = Vec::new();
         211  +
                        deser.read_list(member, &mut |deser| {
         212  +
                            container.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         213  +
                            Ok(())
         214  +
                        })?;
         215  +
                        container
  218    216   
                    });
  219    217   
                }
  220    218   
                Some(4) => {
  221    219   
                    builder.foo_enum_set = Some({
  222         -
                        let container = if let Some(cap) = deser.container_size() {
  223         -
                            Vec::with_capacity(cap)
  224         -
                        } else {
  225         -
                            Vec::new()
  226         -
                        };
  227         -
                        deser.read_list(member, container, |mut list, deser| {
  228         -
                            list.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  229         -
                            Ok(list)
  230         -
                        })?
         220  +
                        let mut container = Vec::new();
         221  +
                        deser.read_list(member, &mut |deser| {
         222  +
                            container.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         223  +
                            Ok(())
         224  +
                        })?;
         225  +
                        container
  231    226   
                    });
  232    227   
                }
  233    228   
                Some(5) => {
  234    229   
                    builder.foo_enum_map = Some({
  235         -
                        let container = if let Some(cap) = deser.container_size() {
  236         -
                            std::collections::HashMap::with_capacity(cap)
  237         -
                        } else {
  238         -
                            std::collections::HashMap::new()
  239         -
                        };
  240         -
                        deser.read_map(member, container, |mut map, key, deser| {
  241         -
                            map.insert(key, crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  242         -
                            Ok(map)
  243         -
                        })?
         230  +
                        let mut container = std::collections::HashMap::new();
         231  +
                        deser.read_map(member, &mut |key, deser| {
         232  +
                            container.insert(key, crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         233  +
                            Ok(())
         234  +
                        })?;
         235  +
                        container
  244    236   
                    });
  245    237   
                }
  246    238   
                _ => {}
  247    239   
            }
  248    240   
            Ok(())
  249    241   
        })?;
  250    242   
        builder
  251    243   
            .build()
  252    244   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  253    245   
    }
  254    246   
}
         247  +
impl JsonEnumsInput {
         248  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         249  +
    pub fn deserialize_with_response(
         250  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         251  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         252  +
        _status: u16,
         253  +
        _body: &[u8],
         254  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         255  +
        Self::deserialize(deserializer)
         256  +
    }
         257  +
}
  255    258   
impl JsonEnumsInput {
  256    259   
    /// Creates a new builder-style object to manufacture [`JsonEnumsInput`](crate::operation::json_enums::JsonEnumsInput).
  257    260   
    pub fn builder() -> crate::operation::json_enums::builders::JsonEnumsInputBuilder {
  258    261   
        crate::operation::json_enums::builders::JsonEnumsInputBuilder::default()
  259    262   
    }
  260    263   
}
  261    264   
  262    265   
/// A builder for [`JsonEnumsInput`](crate::operation::json_enums::JsonEnumsInput).
  263    266   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  264    267   
#[non_exhaustive]

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

@@ -31,31 +141,141 @@
   51     51   
    "aws.protocoltests.restjson.synthetic",
   52     52   
    "JsonEnumsOutput",
   53     53   
);
   54     54   
static JSONENUMSOUTPUT_MEMBER_FOO_ENUM1: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   55     55   
    ::aws_smithy_schema::ShapeId::from_static(
   56     56   
        "aws.protocoltests.restjson.synthetic#JsonEnumsOutput$fooEnum1",
   57     57   
        "aws.protocoltests.restjson.synthetic",
   58     58   
        "JsonEnumsOutput",
   59     59   
    ),
   60     60   
    ::aws_smithy_schema::ShapeType::String,
   61         -
    "foo_enum1",
          61  +
    "fooEnum1",
   62     62   
    0,
   63     63   
);
   64     64   
static JSONENUMSOUTPUT_MEMBER_FOO_ENUM2: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   65     65   
    ::aws_smithy_schema::ShapeId::from_static(
   66     66   
        "aws.protocoltests.restjson.synthetic#JsonEnumsOutput$fooEnum2",
   67     67   
        "aws.protocoltests.restjson.synthetic",
   68     68   
        "JsonEnumsOutput",
   69     69   
    ),
   70     70   
    ::aws_smithy_schema::ShapeType::String,
   71         -
    "foo_enum2",
          71  +
    "fooEnum2",
   72     72   
    1,
   73     73   
);
   74     74   
static JSONENUMSOUTPUT_MEMBER_FOO_ENUM3: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   75     75   
    ::aws_smithy_schema::ShapeId::from_static(
   76     76   
        "aws.protocoltests.restjson.synthetic#JsonEnumsOutput$fooEnum3",
   77     77   
        "aws.protocoltests.restjson.synthetic",
   78     78   
        "JsonEnumsOutput",
   79     79   
    ),
   80     80   
    ::aws_smithy_schema::ShapeType::String,
   81         -
    "foo_enum3",
          81  +
    "fooEnum3",
   82     82   
    2,
   83     83   
);
   84     84   
static JSONENUMSOUTPUT_MEMBER_FOO_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   85     85   
    ::aws_smithy_schema::ShapeId::from_static(
   86     86   
        "aws.protocoltests.restjson.synthetic#JsonEnumsOutput$fooEnumList",
   87     87   
        "aws.protocoltests.restjson.synthetic",
   88     88   
        "JsonEnumsOutput",
   89     89   
    ),
   90     90   
    ::aws_smithy_schema::ShapeType::List,
   91         -
    "foo_enum_list",
          91  +
    "fooEnumList",
   92     92   
    3,
   93     93   
);
   94     94   
static JSONENUMSOUTPUT_MEMBER_FOO_ENUM_SET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   95     95   
    ::aws_smithy_schema::ShapeId::from_static(
   96     96   
        "aws.protocoltests.restjson.synthetic#JsonEnumsOutput$fooEnumSet",
   97     97   
        "aws.protocoltests.restjson.synthetic",
   98     98   
        "JsonEnumsOutput",
   99     99   
    ),
  100    100   
    ::aws_smithy_schema::ShapeType::List,
  101         -
    "foo_enum_set",
         101  +
    "fooEnumSet",
  102    102   
    4,
  103    103   
);
  104    104   
static JSONENUMSOUTPUT_MEMBER_FOO_ENUM_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  105    105   
    ::aws_smithy_schema::ShapeId::from_static(
  106    106   
        "aws.protocoltests.restjson.synthetic#JsonEnumsOutput$fooEnumMap",
  107    107   
        "aws.protocoltests.restjson.synthetic",
  108    108   
        "JsonEnumsOutput",
  109    109   
    ),
  110    110   
    ::aws_smithy_schema::ShapeType::Map,
  111         -
    "foo_enum_map",
         111  +
    "fooEnumMap",
  112    112   
    5,
  113    113   
);
  114    114   
static JSONENUMSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  115    115   
    JSONENUMSOUTPUT_SCHEMA_ID,
  116    116   
    ::aws_smithy_schema::ShapeType::Structure,
  117    117   
    &[
  118    118   
        &JSONENUMSOUTPUT_MEMBER_FOO_ENUM1,
  119    119   
        &JSONENUMSOUTPUT_MEMBER_FOO_ENUM2,
  120    120   
        &JSONENUMSOUTPUT_MEMBER_FOO_ENUM3,
  121    121   
        &JSONENUMSOUTPUT_MEMBER_FOO_ENUM_LIST,
@@ -154,154 +282,284 @@
  174    174   
                    }
  175    175   
                    Ok(())
  176    176   
                },
  177    177   
            )?;
  178    178   
        }
  179    179   
        Ok(())
  180    180   
    }
  181    181   
}
  182    182   
impl JsonEnumsOutput {
  183    183   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  184         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  185         -
        deserializer: &mut D,
         184  +
    pub fn deserialize(
         185  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  186    186   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  187    187   
        #[allow(unused_variables, unused_mut)]
  188    188   
        let mut builder = Self::builder();
  189    189   
        #[allow(
  190    190   
            unused_variables,
  191    191   
            unreachable_code,
  192    192   
            clippy::single_match,
  193    193   
            clippy::match_single_binding,
  194    194   
            clippy::diverging_sub_expression
  195    195   
        )]
  196         -
        deserializer.read_struct(&JSONENUMSOUTPUT_SCHEMA, (), |_, member, deser| {
         196  +
        deserializer.read_struct(&JSONENUMSOUTPUT_SCHEMA, &mut |member, deser| {
  197    197   
            match member.member_index() {
  198    198   
                Some(0) => {
  199    199   
                    builder.foo_enum1 = Some(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  200    200   
                }
  201    201   
                Some(1) => {
  202    202   
                    builder.foo_enum2 = Some(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  203    203   
                }
  204    204   
                Some(2) => {
  205    205   
                    builder.foo_enum3 = Some(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  206    206   
                }
  207    207   
                Some(3) => {
  208    208   
                    builder.foo_enum_list = Some({
  209         -
                        let container = if let Some(cap) = deser.container_size() {
  210         -
                            Vec::with_capacity(cap)
  211         -
                        } else {
  212         -
                            Vec::new()
  213         -
                        };
  214         -
                        deser.read_list(member, container, |mut list, deser| {
  215         -
                            list.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  216         -
                            Ok(list)
  217         -
                        })?
         209  +
                        let mut container = Vec::new();
         210  +
                        deser.read_list(member, &mut |deser| {
         211  +
                            container.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         212  +
                            Ok(())
         213  +
                        })?;
         214  +
                        container
  218    215   
                    });
  219    216   
                }
  220    217   
                Some(4) => {
  221    218   
                    builder.foo_enum_set = Some({
  222         -
                        let container = if let Some(cap) = deser.container_size() {
  223         -
                            Vec::with_capacity(cap)
  224         -
                        } else {
  225         -
                            Vec::new()
  226         -
                        };
  227         -
                        deser.read_list(member, container, |mut list, deser| {
  228         -
                            list.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  229         -
                            Ok(list)
  230         -
                        })?
         219  +
                        let mut container = Vec::new();
         220  +
                        deser.read_list(member, &mut |deser| {
         221  +
                            container.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         222  +
                            Ok(())
         223  +
                        })?;
         224  +
                        container
  231    225   
                    });
  232    226   
                }
  233    227   
                Some(5) => {
  234    228   
                    builder.foo_enum_map = Some({
  235         -
                        let container = if let Some(cap) = deser.container_size() {
  236         -
                            std::collections::HashMap::with_capacity(cap)
  237         -
                        } else {
  238         -
                            std::collections::HashMap::new()
  239         -
                        };
  240         -
                        deser.read_map(member, container, |mut map, key, deser| {
  241         -
                            map.insert(key, crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  242         -
                            Ok(map)
  243         -
                        })?
         229  +
                        let mut container = std::collections::HashMap::new();
         230  +
                        deser.read_map(member, &mut |key, deser| {
         231  +
                            container.insert(key, crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         232  +
                            Ok(())
         233  +
                        })?;
         234  +
                        container
  244    235   
                    });
  245    236   
                }
  246    237   
                _ => {}
  247    238   
            }
  248    239   
            Ok(())
  249    240   
        })?;
  250    241   
        Ok(builder.build())
  251    242   
    }
  252    243   
}
         244  +
impl JsonEnumsOutput {
         245  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         246  +
    pub fn deserialize_with_response(
         247  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         248  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         249  +
        _status: u16,
         250  +
        _body: &[u8],
         251  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         252  +
        Self::deserialize(deserializer)
         253  +
    }
         254  +
}
  253    255   
impl JsonEnumsOutput {
  254    256   
    /// Creates a new builder-style object to manufacture [`JsonEnumsOutput`](crate::operation::json_enums::JsonEnumsOutput).
  255    257   
    pub fn builder() -> crate::operation::json_enums::builders::JsonEnumsOutputBuilder {
  256    258   
        crate::operation::json_enums::builders::JsonEnumsOutputBuilder::default()
  257    259   
    }
  258    260   
}
  259    261   
  260    262   
/// A builder for [`JsonEnumsOutput`](crate::operation::json_enums::JsonEnumsOutput).
  261    263   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  262    264   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/json_int_enums.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 `JsonIntEnums`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct JsonIntEnums;
    6      6   
impl JsonIntEnums {
    7      7   
    /// Creates a new `JsonIntEnums`
    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::json_int_enums::JsonIntEnumsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_int_enums::JsonIntEnumsOutput::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::json_int_enums::JsonIntEnumsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::json_int_enums::JsonIntEnumsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::json_int_enums::JsonIntEnumsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -107,111 +226,231 @@
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct JsonIntEnumsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for JsonIntEnumsResponseDeserializer {
  134    138   
    fn deserialize_nonstreaming(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         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_json_int_enums::de_json_int_enums_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::json_int_enums::JsonIntEnumsError::generic(
         158  +
                    generic,
         159  +
                )),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_json_int_enums::de_json_int_enums_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, JsonIntEnums::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::json_int_enums::JsonIntEnumsOutput::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 JsonIntEnumsRequestSerializer;
  154    184   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for JsonIntEnumsRequestSerializer {
  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::json_int_enums::JsonIntEnumsInput>()
  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::json_int_enums::JsonIntEnumsInput,
  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, "/JsonIntEnums").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::json_int_enums::JsonIntEnumsInput,
  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_json_int_enums::ser_json_int_enums_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, JsonIntEnums::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 JsonIntEnumsEndpointParamsInterceptor;
  201    206   
  202    207   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for JsonIntEnumsEndpointParamsInterceptor {
  203    208   
    fn name(&self) -> &'static str {
  204    209   
        "JsonIntEnumsEndpointParamsInterceptor"
  205    210   
    }
  206    211   
@@ -291,296 +351,366 @@
  311    316   
            .expect("the config must have a deserializer");
  312    317   
  313    318   
        let parsed = de.deserialize_streaming(&mut http_response);
  314    319   
        let parsed = parsed.unwrap_or_else(|| {
  315    320   
            let http_response = http_response.map(|body| {
  316    321   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  317    322   
                    body.bytes().unwrap(),
  318    323   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  319    324   
                )))
  320    325   
            });
  321         -
            de.deserialize_nonstreaming(&http_response)
         326  +
            // Build a config bag with the protocol for schema-based deserialization
         327  +
            #[allow(unused_mut)]
         328  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         329  +
            {
         330  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         331  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         332  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         333  +
                ));
         334  +
                test_cfg.push_shared_layer(layer.freeze());
         335  +
            }
         336  +
            de.deserialize_nonstreaming(&http_response, &test_cfg)
  322    337   
        });
  323    338   
        let parsed = parsed
  324    339   
            .expect("should be successful response")
  325    340   
            .downcast::<crate::operation::json_int_enums::JsonIntEnumsOutput>()
  326    341   
            .unwrap();
  327    342   
        ::pretty_assertions::assert_eq!(
  328    343   
            parsed.integer_enum1,
  329    344   
            expected_output.integer_enum1,
  330    345   
            "Unexpected value for `integer_enum1`"
  331    346   
        );

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

@@ -31,31 +284,273 @@
   51     51   
    "aws.protocoltests.restjson.synthetic",
   52     52   
    "JsonIntEnumsInput",
   53     53   
);
   54     54   
static JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM1: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   55     55   
    ::aws_smithy_schema::ShapeId::from_static(
   56     56   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsInput$integerEnum1",
   57     57   
        "aws.protocoltests.restjson.synthetic",
   58     58   
        "JsonIntEnumsInput",
   59     59   
    ),
   60     60   
    ::aws_smithy_schema::ShapeType::Integer,
   61         -
    "integer_enum1",
          61  +
    "integerEnum1",
   62     62   
    0,
   63     63   
);
   64     64   
static JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM2: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   65     65   
    ::aws_smithy_schema::ShapeId::from_static(
   66     66   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsInput$integerEnum2",
   67     67   
        "aws.protocoltests.restjson.synthetic",
   68     68   
        "JsonIntEnumsInput",
   69     69   
    ),
   70     70   
    ::aws_smithy_schema::ShapeType::Integer,
   71         -
    "integer_enum2",
          71  +
    "integerEnum2",
   72     72   
    1,
   73     73   
);
   74     74   
static JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM3: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   75     75   
    ::aws_smithy_schema::ShapeId::from_static(
   76     76   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsInput$integerEnum3",
   77     77   
        "aws.protocoltests.restjson.synthetic",
   78     78   
        "JsonIntEnumsInput",
   79     79   
    ),
   80     80   
    ::aws_smithy_schema::ShapeType::Integer,
   81         -
    "integer_enum3",
          81  +
    "integerEnum3",
   82     82   
    2,
   83     83   
);
   84     84   
static JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   85     85   
    ::aws_smithy_schema::ShapeId::from_static(
   86     86   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsInput$integerEnumList",
   87     87   
        "aws.protocoltests.restjson.synthetic",
   88     88   
        "JsonIntEnumsInput",
   89     89   
    ),
   90     90   
    ::aws_smithy_schema::ShapeType::List,
   91         -
    "integer_enum_list",
          91  +
    "integerEnumList",
   92     92   
    3,
   93     93   
);
   94     94   
static JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_SET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   95     95   
    ::aws_smithy_schema::ShapeId::from_static(
   96     96   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsInput$integerEnumSet",
   97     97   
        "aws.protocoltests.restjson.synthetic",
   98     98   
        "JsonIntEnumsInput",
   99     99   
    ),
  100    100   
    ::aws_smithy_schema::ShapeType::List,
  101         -
    "integer_enum_set",
         101  +
    "integerEnumSet",
  102    102   
    4,
  103    103   
);
  104    104   
static JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  105    105   
    ::aws_smithy_schema::ShapeId::from_static(
  106    106   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsInput$integerEnumMap",
  107    107   
        "aws.protocoltests.restjson.synthetic",
  108    108   
        "JsonIntEnumsInput",
  109    109   
    ),
  110    110   
    ::aws_smithy_schema::ShapeType::Map,
  111         -
    "integer_enum_map",
         111  +
    "integerEnumMap",
  112    112   
    5,
  113    113   
);
  114    114   
static JSONINTENUMSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  115    115   
    JSONINTENUMSINPUT_SCHEMA_ID,
  116    116   
    ::aws_smithy_schema::ShapeType::Structure,
  117    117   
    &[
  118    118   
        &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM1,
  119    119   
        &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM2,
  120    120   
        &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM3,
  121    121   
        &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_LIST,
  122    122   
        &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_SET,
  123    123   
        &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_MAP,
  124    124   
    ],
  125         -
);
         125  +
)
         126  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("PUT", "/JsonIntEnums", None));
  126    127   
impl JsonIntEnumsInput {
  127    128   
    /// The schema for this shape.
  128    129   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &JSONINTENUMSINPUT_SCHEMA;
  129    130   
}
  130    131   
impl ::aws_smithy_schema::serde::SerializableStruct for JsonIntEnumsInput {
  131    132   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  132    133   
    fn serialize_members(
  133    134   
        &self,
  134    135   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  135    136   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  136    137   
        if let Some(ref val) = self.integer_enum1 {
  137    138   
            ser.write_integer(&JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM1, *val)?;
  138    139   
        }
  139    140   
        if let Some(ref val) = self.integer_enum2 {
  140    141   
            ser.write_integer(&JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM2, *val)?;
  141    142   
        }
  142    143   
        if let Some(ref val) = self.integer_enum3 {
  143    144   
            ser.write_integer(&JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM3, *val)?;
  144    145   
        }
  145    146   
        if let Some(ref val) = self.integer_enum_list {
  146    147   
            ser.write_list(
  147    148   
                &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_LIST,
  148    149   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  149    150   
                    for item in val {
  150    151   
                        ser.write_integer(&aws_smithy_schema::prelude::INTEGER, *item)?;
  151    152   
                    }
  152    153   
                    Ok(())
  153    154   
                },
  154    155   
            )?;
  155    156   
        }
  156    157   
        if let Some(ref val) = self.integer_enum_set {
  157    158   
            ser.write_list(
  158    159   
                &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_SET,
  159    160   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  160    161   
                    for item in val {
  161    162   
                        ser.write_integer(&aws_smithy_schema::prelude::INTEGER, *item)?;
  162    163   
                    }
  163    164   
                    Ok(())
  164    165   
                },
  165    166   
            )?;
  166    167   
        }
  167    168   
        if let Some(ref val) = self.integer_enum_map {
  168    169   
            ser.write_map(
  169    170   
                &JSONINTENUMSINPUT_MEMBER_INTEGER_ENUM_MAP,
  170    171   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  171    172   
                    for (key, value) in val {
  172    173   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
  173    174   
                        ser.write_integer(&::aws_smithy_schema::prelude::INTEGER, *value)?;
  174    175   
                    }
  175    176   
                    Ok(())
  176    177   
                },
  177    178   
            )?;
  178    179   
        }
  179    180   
        Ok(())
  180    181   
    }
  181    182   
}
  182    183   
impl JsonIntEnumsInput {
  183    184   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  184         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  185         -
        deserializer: &mut D,
         185  +
    pub fn deserialize(
         186  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  186    187   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  187    188   
        #[allow(unused_variables, unused_mut)]
  188    189   
        let mut builder = Self::builder();
  189    190   
        #[allow(
  190    191   
            unused_variables,
  191    192   
            unreachable_code,
  192    193   
            clippy::single_match,
  193    194   
            clippy::match_single_binding,
  194    195   
            clippy::diverging_sub_expression
  195    196   
        )]
  196         -
        deserializer.read_struct(&JSONINTENUMSINPUT_SCHEMA, (), |_, member, deser| {
         197  +
        deserializer.read_struct(&JSONINTENUMSINPUT_SCHEMA, &mut |member, deser| {
  197    198   
            match member.member_index() {
  198    199   
                Some(0) => {
  199    200   
                    builder.integer_enum1 = Some(deser.read_integer(member)?);
  200    201   
                }
  201    202   
                Some(1) => {
  202    203   
                    builder.integer_enum2 = Some(deser.read_integer(member)?);
  203    204   
                }
  204    205   
                Some(2) => {
  205    206   
                    builder.integer_enum3 = Some(deser.read_integer(member)?);
  206    207   
                }
  207    208   
                Some(3) => {
  208         -
                    builder.integer_enum_list = Some({
  209         -
                        let container = if let Some(cap) = deser.container_size() {
  210         -
                            Vec::with_capacity(cap)
  211         -
                        } else {
  212         -
                            Vec::new()
  213         -
                        };
  214         -
                        deser.read_list(member, container, |mut list, deser| {
  215         -
                            list.push(deser.read_integer(member)?);
  216         -
                            Ok(list)
  217         -
                        })?
  218         -
                    });
         209  +
                    builder.integer_enum_list = Some(deser.read_integer_list(member)?);
  219    210   
                }
  220    211   
                Some(4) => {
  221         -
                    builder.integer_enum_set = Some({
  222         -
                        let container = if let Some(cap) = deser.container_size() {
  223         -
                            Vec::with_capacity(cap)
  224         -
                        } else {
  225         -
                            Vec::new()
  226         -
                        };
  227         -
                        deser.read_list(member, container, |mut list, deser| {
  228         -
                            list.push(deser.read_integer(member)?);
  229         -
                            Ok(list)
  230         -
                        })?
  231         -
                    });
         212  +
                    builder.integer_enum_set = Some(deser.read_integer_list(member)?);
  232    213   
                }
  233    214   
                Some(5) => {
  234    215   
                    builder.integer_enum_map = Some({
  235         -
                        let container = if let Some(cap) = deser.container_size() {
  236         -
                            std::collections::HashMap::with_capacity(cap)
  237         -
                        } else {
  238         -
                            std::collections::HashMap::new()
  239         -
                        };
  240         -
                        deser.read_map(member, container, |mut map, key, deser| {
  241         -
                            map.insert(key, deser.read_integer(member)?);
  242         -
                            Ok(map)
  243         -
                        })?
         216  +
                        let mut container = std::collections::HashMap::new();
         217  +
                        deser.read_map(member, &mut |key, deser| {
         218  +
                            container.insert(key, deser.read_integer(member)?);
         219  +
                            Ok(())
         220  +
                        })?;
         221  +
                        container
  244    222   
                    });
  245    223   
                }
  246    224   
                _ => {}
  247    225   
            }
  248    226   
            Ok(())
  249    227   
        })?;
  250    228   
        builder
  251    229   
            .build()
  252    230   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  253    231   
    }
  254    232   
}
         233  +
impl JsonIntEnumsInput {
         234  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         235  +
    pub fn deserialize_with_response(
         236  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         237  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         238  +
        _status: u16,
         239  +
        _body: &[u8],
         240  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         241  +
        Self::deserialize(deserializer)
         242  +
    }
         243  +
}
  255    244   
impl JsonIntEnumsInput {
  256    245   
    /// Creates a new builder-style object to manufacture [`JsonIntEnumsInput`](crate::operation::json_int_enums::JsonIntEnumsInput).
  257    246   
    pub fn builder() -> crate::operation::json_int_enums::builders::JsonIntEnumsInputBuilder {
  258    247   
        crate::operation::json_int_enums::builders::JsonIntEnumsInputBuilder::default()
  259    248   
    }
  260    249   
}
  261    250   
  262    251   
/// A builder for [`JsonIntEnumsInput`](crate::operation::json_int_enums::JsonIntEnumsInput).
  263    252   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  264    253   
#[non_exhaustive]

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

@@ -31,31 +141,141 @@
   51     51   
    "aws.protocoltests.restjson.synthetic",
   52     52   
    "JsonIntEnumsOutput",
   53     53   
);
   54     54   
static JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM1: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   55     55   
    ::aws_smithy_schema::ShapeId::from_static(
   56     56   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsOutput$integerEnum1",
   57     57   
        "aws.protocoltests.restjson.synthetic",
   58     58   
        "JsonIntEnumsOutput",
   59     59   
    ),
   60     60   
    ::aws_smithy_schema::ShapeType::Integer,
   61         -
    "integer_enum1",
          61  +
    "integerEnum1",
   62     62   
    0,
   63     63   
);
   64     64   
static JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM2: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   65     65   
    ::aws_smithy_schema::ShapeId::from_static(
   66     66   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsOutput$integerEnum2",
   67     67   
        "aws.protocoltests.restjson.synthetic",
   68     68   
        "JsonIntEnumsOutput",
   69     69   
    ),
   70     70   
    ::aws_smithy_schema::ShapeType::Integer,
   71         -
    "integer_enum2",
          71  +
    "integerEnum2",
   72     72   
    1,
   73     73   
);
   74     74   
static JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM3: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   75     75   
    ::aws_smithy_schema::ShapeId::from_static(
   76     76   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsOutput$integerEnum3",
   77     77   
        "aws.protocoltests.restjson.synthetic",
   78     78   
        "JsonIntEnumsOutput",
   79     79   
    ),
   80     80   
    ::aws_smithy_schema::ShapeType::Integer,
   81         -
    "integer_enum3",
          81  +
    "integerEnum3",
   82     82   
    2,
   83     83   
);
   84     84   
static JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   85     85   
    ::aws_smithy_schema::ShapeId::from_static(
   86     86   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsOutput$integerEnumList",
   87     87   
        "aws.protocoltests.restjson.synthetic",
   88     88   
        "JsonIntEnumsOutput",
   89     89   
    ),
   90     90   
    ::aws_smithy_schema::ShapeType::List,
   91         -
    "integer_enum_list",
          91  +
    "integerEnumList",
   92     92   
    3,
   93     93   
);
   94     94   
static JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM_SET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   95     95   
    ::aws_smithy_schema::ShapeId::from_static(
   96     96   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsOutput$integerEnumSet",
   97     97   
        "aws.protocoltests.restjson.synthetic",
   98     98   
        "JsonIntEnumsOutput",
   99     99   
    ),
  100    100   
    ::aws_smithy_schema::ShapeType::List,
  101         -
    "integer_enum_set",
         101  +
    "integerEnumSet",
  102    102   
    4,
  103    103   
);
  104    104   
static JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  105    105   
    ::aws_smithy_schema::ShapeId::from_static(
  106    106   
        "aws.protocoltests.restjson.synthetic#JsonIntEnumsOutput$integerEnumMap",
  107    107   
        "aws.protocoltests.restjson.synthetic",
  108    108   
        "JsonIntEnumsOutput",
  109    109   
    ),
  110    110   
    ::aws_smithy_schema::ShapeType::Map,
  111         -
    "integer_enum_map",
         111  +
    "integerEnumMap",
  112    112   
    5,
  113    113   
);
  114    114   
static JSONINTENUMSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  115    115   
    JSONINTENUMSOUTPUT_SCHEMA_ID,
  116    116   
    ::aws_smithy_schema::ShapeType::Structure,
  117    117   
    &[
  118    118   
        &JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM1,
  119    119   
        &JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM2,
  120    120   
        &JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM3,
  121    121   
        &JSONINTENUMSOUTPUT_MEMBER_INTEGER_ENUM_LIST,
@@ -154,154 +282,270 @@
  174    174   
                    }
  175    175   
                    Ok(())
  176    176   
                },
  177    177   
            )?;
  178    178   
        }
  179    179   
        Ok(())
  180    180   
    }
  181    181   
}
  182    182   
impl JsonIntEnumsOutput {
  183    183   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  184         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  185         -
        deserializer: &mut D,
         184  +
    pub fn deserialize(
         185  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  186    186   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  187    187   
        #[allow(unused_variables, unused_mut)]
  188    188   
        let mut builder = Self::builder();
  189    189   
        #[allow(
  190    190   
            unused_variables,
  191    191   
            unreachable_code,
  192    192   
            clippy::single_match,
  193    193   
            clippy::match_single_binding,
  194    194   
            clippy::diverging_sub_expression
  195    195   
        )]
  196         -
        deserializer.read_struct(&JSONINTENUMSOUTPUT_SCHEMA, (), |_, member, deser| {
         196  +
        deserializer.read_struct(&JSONINTENUMSOUTPUT_SCHEMA, &mut |member, deser| {
  197    197   
            match member.member_index() {
  198    198   
                Some(0) => {
  199    199   
                    builder.integer_enum1 = Some(deser.read_integer(member)?);
  200    200   
                }
  201    201   
                Some(1) => {
  202    202   
                    builder.integer_enum2 = Some(deser.read_integer(member)?);
  203    203   
                }
  204    204   
                Some(2) => {
  205    205   
                    builder.integer_enum3 = Some(deser.read_integer(member)?);
  206    206   
                }
  207    207   
                Some(3) => {
  208         -
                    builder.integer_enum_list = Some({
  209         -
                        let container = if let Some(cap) = deser.container_size() {
  210         -
                            Vec::with_capacity(cap)
  211         -
                        } else {
  212         -
                            Vec::new()
  213         -
                        };
  214         -
                        deser.read_list(member, container, |mut list, deser| {
  215         -
                            list.push(deser.read_integer(member)?);
  216         -
                            Ok(list)
  217         -
                        })?
  218         -
                    });
         208  +
                    builder.integer_enum_list = Some(deser.read_integer_list(member)?);
  219    209   
                }
  220    210   
                Some(4) => {
  221         -
                    builder.integer_enum_set = Some({
  222         -
                        let container = if let Some(cap) = deser.container_size() {
  223         -
                            Vec::with_capacity(cap)
  224         -
                        } else {
  225         -
                            Vec::new()
  226         -
                        };
  227         -
                        deser.read_list(member, container, |mut list, deser| {
  228         -
                            list.push(deser.read_integer(member)?);
  229         -
                            Ok(list)
  230         -
                        })?
  231         -
                    });
         211  +
                    builder.integer_enum_set = Some(deser.read_integer_list(member)?);
  232    212   
                }
  233    213   
                Some(5) => {
  234    214   
                    builder.integer_enum_map = Some({
  235         -
                        let container = if let Some(cap) = deser.container_size() {
  236         -
                            std::collections::HashMap::with_capacity(cap)
  237         -
                        } else {
  238         -
                            std::collections::HashMap::new()
  239         -
                        };
  240         -
                        deser.read_map(member, container, |mut map, key, deser| {
  241         -
                            map.insert(key, deser.read_integer(member)?);
  242         -
                            Ok(map)
  243         -
                        })?
         215  +
                        let mut container = std::collections::HashMap::new();
         216  +
                        deser.read_map(member, &mut |key, deser| {
         217  +
                            container.insert(key, deser.read_integer(member)?);
         218  +
                            Ok(())
         219  +
                        })?;
         220  +
                        container
  244    221   
                    });
  245    222   
                }
  246    223   
                _ => {}
  247    224   
            }
  248    225   
            Ok(())
  249    226   
        })?;
  250    227   
        Ok(builder.build())
  251    228   
    }
  252    229   
}
         230  +
impl JsonIntEnumsOutput {
         231  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         232  +
    pub fn deserialize_with_response(
         233  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         234  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         235  +
        _status: u16,
         236  +
        _body: &[u8],
         237  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         238  +
        Self::deserialize(deserializer)
         239  +
    }
         240  +
}
  253    241   
impl JsonIntEnumsOutput {
  254    242   
    /// Creates a new builder-style object to manufacture [`JsonIntEnumsOutput`](crate::operation::json_int_enums::JsonIntEnumsOutput).
  255    243   
    pub fn builder() -> crate::operation::json_int_enums::builders::JsonIntEnumsOutputBuilder {
  256    244   
        crate::operation::json_int_enums::builders::JsonIntEnumsOutputBuilder::default()
  257    245   
    }
  258    246   
}
  259    247   
  260    248   
/// A builder for [`JsonIntEnumsOutput`](crate::operation::json_int_enums::JsonIntEnumsOutput).
  261    249   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  262    250   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/json_lists.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 `JsonLists`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct JsonLists;
    6      6   
impl JsonLists {
    7      7   
    /// Creates a new `JsonLists`
    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::json_lists::JsonListsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_lists::JsonListsOutput::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::json_lists::JsonListsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::json_lists::JsonListsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::json_lists::JsonListsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -107,111 +224,227 @@
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct JsonListsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for JsonListsResponseDeserializer {
  134    138   
    fn deserialize_nonstreaming(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         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_json_lists::de_json_lists_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::json_lists::JsonListsError::generic(generic)),
         158  +
            ))
  146    159   
        } else {
  147         -
            crate::protocol_serde::shape_json_lists::de_json_lists_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         160  +
            let protocol = _cfg
         161  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         162  +
                .expect("a SharedClientProtocol is required");
         163  +
            let mut deser = protocol.deserialize_response(response, JsonLists::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         164  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         165  +
            })?;
         166  +
            let body = response.body().bytes().expect("body loaded");
         167  +
            let output = crate::operation::json_lists::JsonListsOutput::deserialize_with_response(
         168  +
                &mut *deser,
         169  +
                response.headers(),
         170  +
                response.status().into(),
         171  +
                body,
         172  +
            )
         173  +
            .map_err(|e| {
         174  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
            })?;
         176  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         177  +
        }
  150    178   
    }
  151    179   
}
  152    180   
#[derive(Debug)]
  153    181   
struct JsonListsRequestSerializer;
  154    182   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for JsonListsRequestSerializer {
  155    183   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    184   
    fn serialize_input(
  157    185   
        &self,
  158    186   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    187   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    188   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    189   
        let input = input.downcast::<crate::operation::json_lists::JsonListsInput>().expect("correct type");
  162         -
        let _header_serialization_settings = _cfg
  163         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  164         -
            .cloned()
  165         -
            .unwrap_or_default();
  166         -
        let mut request_builder = {
  167         -
            #[allow(clippy::uninlined_format_args)]
  168         -
            fn uri_base(
  169         -
                _input: &crate::operation::json_lists::JsonListsInput,
  170         -
                output: &mut ::std::string::String,
  171         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  172         -
                use ::std::fmt::Write as _;
  173         -
                ::std::write!(output, "/JsonLists").expect("formatting should succeed");
  174         -
                ::std::result::Result::Ok(())
  175         -
            }
  176         -
            #[allow(clippy::unnecessary_wraps)]
  177         -
            fn update_http_builder(
  178         -
                input: &crate::operation::json_lists::JsonListsInput,
  179         -
                builder: ::http_1x::request::Builder,
  180         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  181         -
                let mut uri = ::std::string::String::new();
  182         -
                uri_base(input, &mut uri)?;
  183         -
                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
  184         -
            }
  185         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  186         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  187         -
            builder
  188         -
        };
  189         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_json_lists::ser_json_lists_input(&input)?);
  190         -
        if let Some(content_length) = body.content_length() {
  191         -
            let content_length = content_length.to_string();
  192         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  193         -
        }
  194         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         190  +
        let protocol = _cfg
         191  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         192  +
            .expect("a SharedClientProtocol is required");
         193  +
        let mut request = protocol
         194  +
            .serialize_request(&input, JsonLists::INPUT_SCHEMA, "", _cfg)
         195  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         196  +
         197  +
        return ::std::result::Result::Ok(request);
  195    198   
    }
  196    199   
}
  197    200   
#[derive(Debug)]
  198    201   
struct JsonListsEndpointParamsInterceptor;
  199    202   
  200    203   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for JsonListsEndpointParamsInterceptor {
  201    204   
    fn name(&self) -> &'static str {
  202    205   
        "JsonListsEndpointParamsInterceptor"
  203    206   
    }
  204    207   
@@ -351,354 +411,424 @@
  371    374   
            .expect("the config must have a deserializer");
  372    375   
  373    376   
        let parsed = de.deserialize_streaming(&mut http_response);
  374    377   
        let parsed = parsed.unwrap_or_else(|| {
  375    378   
            let http_response = http_response.map(|body| {
  376    379   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  377    380   
                    body.bytes().unwrap(),
  378    381   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  379    382   
                )))
  380    383   
            });
  381         -
            de.deserialize_nonstreaming(&http_response)
         384  +
            // Build a config bag with the protocol for schema-based deserialization
         385  +
            #[allow(unused_mut)]
         386  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         387  +
            {
         388  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         389  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         390  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         391  +
                ));
         392  +
                test_cfg.push_shared_layer(layer.freeze());
         393  +
            }
         394  +
            de.deserialize_nonstreaming(&http_response, &test_cfg)
  382    395   
        });
  383    396   
        let parsed = parsed
  384    397   
            .expect("should be successful response")
  385    398   
            .downcast::<crate::operation::json_lists::JsonListsOutput>()
  386    399   
            .unwrap();
  387    400   
        ::pretty_assertions::assert_eq!(parsed.string_list, expected_output.string_list, "Unexpected value for `string_list`");
  388    401   
        ::pretty_assertions::assert_eq!(parsed.string_set, expected_output.string_set, "Unexpected value for `string_set`");
  389    402   
        ::pretty_assertions::assert_eq!(parsed.integer_list, expected_output.integer_list, "Unexpected value for `integer_list`");
  390    403   
        ::pretty_assertions::assert_eq!(parsed.boolean_list, expected_output.boolean_list, "Unexpected value for `boolean_list`");
  391    404   
        ::pretty_assertions::assert_eq!(
@@ -417,430 +477,500 @@
  437    450   
            .expect("the config must have a deserializer");
  438    451   
  439    452   
        let parsed = de.deserialize_streaming(&mut http_response);
  440    453   
        let parsed = parsed.unwrap_or_else(|| {
  441    454   
            let http_response = http_response.map(|body| {
  442    455   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  443    456   
                    body.bytes().unwrap(),
  444    457   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  445    458   
                )))
  446    459   
            });
  447         -
            de.deserialize_nonstreaming(&http_response)
         460  +
            // Build a config bag with the protocol for schema-based deserialization
         461  +
            #[allow(unused_mut)]
         462  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         463  +
            {
         464  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         465  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         466  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         467  +
                ));
         468  +
                test_cfg.push_shared_layer(layer.freeze());
         469  +
            }
         470  +
            de.deserialize_nonstreaming(&http_response, &test_cfg)
  448    471   
        });
  449    472   
        let parsed = parsed
  450    473   
            .expect("should be successful response")
  451    474   
            .downcast::<crate::operation::json_lists::JsonListsOutput>()
  452    475   
            .unwrap();
  453    476   
        ::pretty_assertions::assert_eq!(parsed.string_list, expected_output.string_list, "Unexpected value for `string_list`");
  454    477   
        ::pretty_assertions::assert_eq!(parsed.string_set, expected_output.string_set, "Unexpected value for `string_set`");
  455    478   
        ::pretty_assertions::assert_eq!(parsed.integer_list, expected_output.integer_list, "Unexpected value for `integer_list`");
  456    479   
        ::pretty_assertions::assert_eq!(parsed.boolean_list, expected_output.boolean_list, "Unexpected value for `boolean_list`");
  457    480   
        ::pretty_assertions::assert_eq!(