Client Test

Client Test

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/aws_query/rust-client-codegen/src/types/error/_invalid_greeting.rs

@@ -1,1 +99,110 @@
   10     10   
}
   11     11   
static INVALIDGREETING_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
   12     12   
    ::aws_smithy_schema::ShapeId::from_static("aws.protocoltests.query#InvalidGreeting", "aws.protocoltests.query", "InvalidGreeting");
   13     13   
static INVALIDGREETING_MEMBER_MESSAGE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   14     14   
    ::aws_smithy_schema::ShapeId::from_static(
   15     15   
        "aws.protocoltests.query#InvalidGreeting$Message",
   16     16   
        "aws.protocoltests.query",
   17     17   
        "InvalidGreeting",
   18     18   
    ),
   19     19   
    ::aws_smithy_schema::ShapeType::String,
   20         -
    "message",
          20  +
    "Message",
   21     21   
    0,
   22     22   
);
   23     23   
static INVALIDGREETING_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   24     24   
    INVALIDGREETING_SCHEMA_ID,
   25     25   
    ::aws_smithy_schema::ShapeType::Structure,
   26     26   
    &[&INVALIDGREETING_MEMBER_MESSAGE],
   27     27   
);
   28     28   
impl InvalidGreeting {
   29     29   
    /// The schema for this shape.
   30     30   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &INVALIDGREETING_SCHEMA;
   31     31   
}
   32     32   
impl ::aws_smithy_schema::serde::SerializableStruct for InvalidGreeting {
   33     33   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   34     34   
    fn serialize_members(
   35     35   
        &self,
   36     36   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   37     37   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   38     38   
        if let Some(ref val) = self.message {
   39     39   
            ser.write_string(&INVALIDGREETING_MEMBER_MESSAGE, val)?;
   40     40   
        }
   41     41   
        Ok(())
   42     42   
    }
   43     43   
}
   44     44   
impl InvalidGreeting {
   45     45   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   46         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   47         -
        deserializer: &mut D,
          46  +
    pub fn deserialize(
          47  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   48     48   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   49     49   
        #[allow(unused_variables, unused_mut)]
   50     50   
        let mut builder = Self::builder();
   51     51   
        #[allow(
   52     52   
            unused_variables,
   53     53   
            unreachable_code,
   54     54   
            clippy::single_match,
   55     55   
            clippy::match_single_binding,
   56     56   
            clippy::diverging_sub_expression
   57     57   
        )]
   58         -
        deserializer.read_struct(&INVALIDGREETING_SCHEMA, (), |_, member, deser| {
          58  +
        deserializer.read_struct(&INVALIDGREETING_SCHEMA, &mut |member, deser| {
   59     59   
            match member.member_index() {
   60     60   
                Some(0) => {
   61     61   
                    builder.message = Some(deser.read_string(member)?);
   62     62   
                }
   63     63   
                _ => {}
   64     64   
            }
   65     65   
            Ok(())
   66     66   
        })?;
   67     67   
        Ok(builder.build())
   68     68   
    }
   69     69   
}
          70  +
impl InvalidGreeting {
          71  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          72  +
    pub fn deserialize_with_response(
          73  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          74  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          75  +
        _status: u16,
          76  +
        _body: &[u8],
          77  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          78  +
        Self::deserialize(deserializer)
          79  +
    }
          80  +
}
   70     81   
impl InvalidGreeting {
   71     82   
    /// Returns the error message.
   72     83   
    pub fn message(&self) -> ::std::option::Option<&str> {
   73     84   
        self.message.as_deref()
   74     85   
    }
   75     86   
}
   76     87   
impl ::std::fmt::Display for InvalidGreeting {
   77     88   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   78     89   
        ::std::write!(f, "InvalidGreeting")?;
   79     90   
        if let ::std::option::Option::Some(inner_1) = &self.message {

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/Cargo.toml

@@ -1,1 +45,43 @@
    4      4   
version = "0.0.1"
    5      5   
authors = ["protocoltest@example.com"]
    6      6   
description = "test"
    7      7   
edition = "2021"
    8      8   
    9      9   
[package.metadata.smithy]
   10     10   
codegen-version = "ci"
   11     11   
protocol = "aws.protocols#restJson1"
   12     12   
[dependencies.aws-smithy-async]
   13     13   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-async"
   14         -
[dependencies.aws-smithy-http]
   15         -
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http"
   16     14   
[dependencies.aws-smithy-json]
   17     15   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-json"
   18     16   
[dependencies.aws-smithy-runtime]
   19     17   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime"
   20     18   
features = ["client"]
   21     19   
[dependencies.aws-smithy-runtime-api]
   22     20   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
   23     21   
features = ["client", "http-1x"]
   24     22   
[dependencies.aws-smithy-schema]
   25     23   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-schema"

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/config.rs

@@ -10,10 +69,73 @@
   30     30   
            config: self.cloneable.clone(),
   31     31   
            runtime_components: self.runtime_components.clone(),
   32     32   
            runtime_plugins: self.runtime_plugins.clone(),
   33     33   
            behavior_version: self.behavior_version,
   34     34   
        }
   35     35   
    }
   36     36   
    /// Return a reference to the stalled stream protection configuration contained in this config, if any.
   37     37   
    pub fn stalled_stream_protection(&self) -> ::std::option::Option<&crate::config::StalledStreamProtectionConfig> {
   38     38   
        self.config.load::<crate::config::StalledStreamProtectionConfig>()
   39     39   
    }
          40  +
    /// Returns the client protocol used for serialization and deserialization.
          41  +
    pub fn protocol(&self) -> ::std::option::Option<&::aws_smithy_schema::protocol::SharedClientProtocol> {
          42  +
        self.config.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
          43  +
    }
   40     44   
    /// Return the [`SharedHttpClient`](crate::config::SharedHttpClient) to use when making requests, if any.
   41     45   
    pub fn http_client(&self) -> Option<crate::config::SharedHttpClient> {
   42     46   
        self.runtime_components.http_client()
   43     47   
    }
   44     48   
    /// Return the auth schemes configured on this service config
   45     49   
    pub fn auth_schemes(&self) -> impl Iterator<Item = ::aws_smithy_runtime_api::client::auth::SharedAuthScheme> + '_ {
   46     50   
        self.runtime_components.auth_schemes()
   47     51   
    }
   48     52   
   49     53   
    /// Return the auth scheme resolver configured on this service config
@@ -105,109 +185,208 @@
  125    129   
    ///
  126    130   
    pub fn new() -> Self {
  127    131   
        Self::default()
  128    132   
    }
  129    133   
    /// Constructs a config builder from the given `config_bag`, setting only fields stored in the config bag,
  130    134   
    /// but not those in runtime components.
  131    135   
    #[allow(unused)]
  132    136   
    pub(crate) fn from_config_bag(config_bag: &::aws_smithy_types::config_bag::ConfigBag) -> Self {
  133    137   
        let mut builder = Self::new();
  134    138   
        builder.set_stalled_stream_protection(config_bag.load::<crate::config::StalledStreamProtectionConfig>().cloned());
         139  +
        if let ::std::option::Option::Some(protocol) = config_bag.load::<::aws_smithy_schema::protocol::SharedClientProtocol>().cloned() {
         140  +
            builder.set_protocol(::std::option::Option::Some(protocol));
         141  +
        }
  135    142   
        builder.set_auth_scheme_preference(config_bag.load::<::aws_smithy_runtime_api::client::auth::AuthSchemePreference>().cloned());
  136    143   
        builder.set_retry_config(config_bag.load::<::aws_smithy_types::retry::RetryConfig>().cloned());
  137    144   
        builder.set_timeout_config(config_bag.load::<::aws_smithy_types::timeout::TimeoutConfig>().cloned());
  138    145   
        builder.set_retry_partition(config_bag.load::<::aws_smithy_runtime::client::retries::RetryPartition>().cloned());
  139    146   
        builder
  140    147   
    }
  141    148   
    /// Set the [`StalledStreamProtectionConfig`](crate::config::StalledStreamProtectionConfig)
  142    149   
    /// to configure protection for stalled streams.
  143    150   
    pub fn stalled_stream_protection(mut self, stalled_stream_protection_config: crate::config::StalledStreamProtectionConfig) -> Self {
  144    151   
        self.set_stalled_stream_protection(::std::option::Option::Some(stalled_stream_protection_config));
  145    152   
        self
  146    153   
    }
  147    154   
    /// Set the [`StalledStreamProtectionConfig`](crate::config::StalledStreamProtectionConfig)
  148    155   
    /// to configure protection for stalled streams.
  149    156   
    pub fn set_stalled_stream_protection(
  150    157   
        &mut self,
  151    158   
        stalled_stream_protection_config: ::std::option::Option<crate::config::StalledStreamProtectionConfig>,
  152    159   
    ) -> &mut Self {
  153    160   
        self.config.store_or_unset(stalled_stream_protection_config);
  154    161   
        self
  155    162   
    }
         163  +
    /// Sets the client protocol to use for serialization and deserialization.
         164  +
    ///
         165  +
    /// This overrides the default protocol determined by the service model,
         166  +
    /// enabling runtime protocol selection.
         167  +
    pub fn protocol(mut self, protocol: impl ::aws_smithy_schema::protocol::ClientProtocol + 'static) -> Self {
         168  +
        self.set_protocol(::std::option::Option::Some(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         169  +
            protocol,
         170  +
        )));
         171  +
        self
         172  +
    }
         173  +
         174  +
    /// Sets the client protocol to use for serialization and deserialization.
         175  +
    pub fn set_protocol(&mut self, protocol: ::std::option::Option<::aws_smithy_schema::protocol::SharedClientProtocol>) -> &mut Self {
         176  +
        self.config.store_or_unset(protocol);
         177  +
        self
         178  +
    }
  156    179   
    /// Sets the HTTP client to use when making requests.
  157    180   
    ///
  158    181   
    /// # Examples
  159    182   
    /// ```no_run
  160    183   
    /// # #[cfg(test)]
  161    184   
    /// # mod tests {
  162    185   
    /// # #[test]
  163    186   
    /// # fn example() {
  164    187   
    /// use std::time::Duration;
  165    188   
    /// use big_numbers::config::Config;
@@ -1116,1139 +1175,1203 @@
 1136   1159   
#[derive(::std::fmt::Debug)]
 1137   1160   
pub(crate) struct ServiceRuntimePlugin {
 1138   1161   
    config: ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer>,
 1139   1162   
    runtime_components: ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
 1140   1163   
}
 1141   1164   
 1142   1165   
impl ServiceRuntimePlugin {
 1143   1166   
    pub fn new(_service_config: crate::config::Config) -> Self {
 1144   1167   
        let config = {
 1145   1168   
            let mut cfg = ::aws_smithy_types::config_bag::Layer::new("BigNumberService");
        1169  +
            if _service_config.protocol().is_none() {
        1170  +
                cfg.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1171  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
        1172  +
                ));
        1173  +
            }
 1146   1174   
            cfg.store_put(::aws_smithy_runtime::client::orchestrator::AuthSchemeAndEndpointOrchestrationV2);
 1147   1175   
            ::std::option::Option::Some(cfg.freeze())
 1148   1176   
        };
 1149   1177   
        let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin");
 1150   1178   
        runtime_components.set_auth_scheme_option_resolver(::std::option::Option::Some({
 1151   1179   
            use crate::config::auth::ResolveAuthScheme;
 1152   1180   
            crate::config::auth::DefaultAuthSchemeResolver::default().into_shared_resolver()
 1153   1181   
        }));
 1154   1182   
        runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new());
 1155   1183   
        runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default());

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/lib.rs

@@ -76,76 +110,108 @@
   96     96   
/// Primitives such as `Blob` or `DateTime` used by other types.
   97     97   
pub mod primitives;
   98     98   
   99     99   
/// All operations that this crate can perform.
  100    100   
pub mod operation;
  101    101   
  102    102   
pub(crate) mod protocol_serde;
  103    103   
  104    104   
mod sdk_feature_tracker;
  105    105   
  106         -
mod serialization_settings;
  107         -
  108    106   
mod json_errors;
  109    107   
  110    108   
pub use client::Client;

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/operation/process_big_numbers.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 `ProcessBigNumbers`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct ProcessBigNumbers;
    6      6   
impl ProcessBigNumbers {
    7      7   
    /// Creates a new `ProcessBigNumbers`
    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::process_big_numbers::ProcessBigNumbersInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::process_big_numbers::ProcessBigNumbersOutput::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::process_big_numbers::ProcessBigNumbersInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::process_big_numbers::ProcessBigNumbersOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::process_big_numbers::ProcessBigNumbersError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -110,114 +232,239 @@
  130    134   
                crate::operation::process_big_numbers::ProcessBigNumbersError,
  131    135   
            >::new());
  132    136   
  133    137   
        ::std::borrow::Cow::Owned(rcb)
  134    138   
    }
  135    139   
}
  136    140   
  137    141   
#[derive(Debug)]
  138    142   
struct ProcessBigNumbersResponseDeserializer;
  139    143   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ProcessBigNumbersResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         144  +
    fn deserialize_nonstreaming_with_config(
  141    145   
        &self,
  142    146   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         147  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    148   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    149   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         150  +
        #[allow(unused_mut)]
         151  +
        let mut force_error = false;
         152  +
         153  +
        if !success && status != 200 || force_error {
  145    154   
            let headers = response.headers();
  146    155   
            let body = response.body().bytes().expect("body loaded");
  147    156   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         157  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         158  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         159  +
            })?;
  149    160   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_process_big_numbers::de_process_big_numbers_http_error(status, headers, body)
         161  +
            let generic = generic_builder.build();
         162  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         163  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         164  +
                    crate::operation::process_big_numbers::ProcessBigNumbersError::generic(generic),
         165  +
                ),
         166  +
            ))
  152    167   
        } else {
  153         -
            crate::protocol_serde::shape_process_big_numbers::de_process_big_numbers_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         168  +
            let protocol = _cfg
         169  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         170  +
                .expect("a SharedClientProtocol is required");
         171  +
            let mut deser = protocol
         172  +
                .deserialize_response(response, ProcessBigNumbers::OUTPUT_SCHEMA, _cfg)
         173  +
                .map_err(|e| {
         174  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
                })?;
         176  +
            let body = response.body().bytes().expect("body loaded");
         177  +
            let output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::deserialize_with_response(
         178  +
                &mut *deser,
         179  +
                response.headers(),
         180  +
                response.status().into(),
         181  +
                body,
         182  +
            )
         183  +
            .map_err(|e| {
         184  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         185  +
            })?;
         186  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         187  +
        }
  156    188   
    }
  157    189   
}
  158    190   
#[derive(Debug)]
  159    191   
struct ProcessBigNumbersRequestSerializer;
  160    192   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ProcessBigNumbersRequestSerializer {
  161    193   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    194   
    fn serialize_input(
  163    195   
        &self,
  164    196   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    197   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    198   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    199   
        let input = input
  168    200   
            .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersInput>()
  169    201   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::process_big_numbers::ProcessBigNumbersInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/process").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::process_big_numbers::ProcessBigNumbersInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_process_big_numbers::ser_process_big_numbers_input(&input)?);
  198         -
        if let Some(content_length) = body.content_length() {
  199         -
            let content_length = content_length.to_string();
  200         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  201         -
        }
  202         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         202  +
        let protocol = _cfg
         203  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         204  +
            .expect("a SharedClientProtocol is required");
         205  +
        let mut request = protocol
         206  +
            .serialize_request(&input, ProcessBigNumbers::INPUT_SCHEMA, "", _cfg)
         207  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         208  +
         209  +
        return ::std::result::Result::Ok(request);
  203    210   
    }
  204    211   
}
  205    212   
#[derive(Debug)]
  206    213   
struct ProcessBigNumbersEndpointParamsInterceptor;
  207    214   
  208    215   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ProcessBigNumbersEndpointParamsInterceptor {
  209    216   
    fn name(&self) -> &'static str {
  210    217   
        "ProcessBigNumbersEndpointParamsInterceptor"
  211    218   
    }
  212    219   
@@ -473,480 +806,883 @@
  493    500   
            .expect("the config must have a deserializer");
  494    501   
  495    502   
        let parsed = de.deserialize_streaming(&mut http_response);
  496    503   
        let parsed = parsed.unwrap_or_else(|| {
  497    504   
            let http_response = http_response.map(|body| {
  498    505   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  499    506   
                    body.bytes().unwrap(),
  500    507   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  501    508   
                )))
  502    509   
            });
  503         -
            de.deserialize_nonstreaming(&http_response)
         510  +
            // Build a config bag with the protocol for schema-based deserialization
         511  +
            #[allow(unused_mut)]
         512  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         513  +
            {
         514  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         515  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         516  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         517  +
                ));
         518  +
                test_cfg.push_shared_layer(layer.freeze());
         519  +
            }
         520  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  504    521   
        });
  505    522   
        let parsed = parsed
  506    523   
            .expect("should be successful response")
  507    524   
            .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
  508    525   
            .unwrap();
  509    526   
        ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
  510    527   
        ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
  511    528   
    }
  512    529   
    /// Test ID: NegativeBigNumbersInJsonResponse
  513    530   
    #[::tokio::test]
  514    531   
    #[::tracing_test::traced_test]
  515    532   
    async fn negative_big_numbers_in_json_response_response() {
  516    533   
        let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
  517    534   
            .set_result(::std::option::Option::Some(
  518    535   
                <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("-123456789").expect("Invalid string for BigInteger"),
  519    536   
            ))
  520    537   
            .set_ratio(::std::option::Option::Some(
  521    538   
                <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("-999.999").expect("invalid string for BigDecimal"),
  522    539   
            ))
  523    540   
            .build();
  524    541   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  525    542   
            ::http_1x::response::Builder::new()
  526    543   
                .header("Content-Type", "application/json")
  527    544   
                .status(200)
  528    545   
                .body(::aws_smithy_types::body::SdkBody::from("{\"result\":-123456789,\"ratio\":-999.999}"))
  529    546   
                .unwrap(),
  530    547   
        )
  531    548   
        .unwrap();
  532    549   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  533    550   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  534    551   
  535    552   
        let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
  536    553   
        let config = op.config().expect("the operation has config");
  537    554   
        let de = config
  538    555   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  539    556   
            .expect("the config must have a deserializer");
  540    557   
  541    558   
        let parsed = de.deserialize_streaming(&mut http_response);
  542    559   
        let parsed = parsed.unwrap_or_else(|| {
  543    560   
            let http_response = http_response.map(|body| {
  544    561   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  545    562   
                    body.bytes().unwrap(),
  546    563   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  547    564   
                )))
  548    565   
            });
  549         -
            de.deserialize_nonstreaming(&http_response)
         566  +
            // Build a config bag with the protocol for schema-based deserialization
         567  +
            #[allow(unused_mut)]
         568  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         569  +
            {
         570  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         571  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         572  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         573  +
                ));
         574  +
                test_cfg.push_shared_layer(layer.freeze());
         575  +
            }
         576  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  550    577   
        });
  551    578   
        let parsed = parsed
  552    579   
            .expect("should be successful response")
  553    580   
            .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
  554    581   
            .unwrap();
  555    582   
        ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
  556    583   
        ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
  557    584   
    }
  558    585   
    /// Test ID: VeryLargeBigNumbersInJsonResponse
  559    586   
    #[::tokio::test]
  560    587   
    #[::tracing_test::traced_test]
  561    588   
    async fn very_large_big_numbers_in_json_response_response() {
  562    589   
        let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
  563    590   
            .set_result(::std::option::Option::Some(
  564    591   
                <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("18446744073709551616").expect("Invalid string for BigInteger"),
  565    592   
            ))
  566    593   
            .set_ratio(::std::option::Option::Some(
  567    594   
                <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("123456.789").expect("invalid string for BigDecimal"),
  568    595   
            ))
  569    596   
            .build();
  570    597   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  571    598   
            ::http_1x::response::Builder::new()
  572    599   
                .header("Content-Type", "application/json")
  573    600   
                .status(200)
  574    601   
                .body(::aws_smithy_types::body::SdkBody::from(
  575    602   
                    "{\"result\":18446744073709551616,\"ratio\":123456.789}",
  576    603   
                ))
  577    604   
                .unwrap(),
  578    605   
        )
  579    606   
        .unwrap();
  580    607   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  581    608   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  582    609   
  583    610   
        let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
  584    611   
        let config = op.config().expect("the operation has config");
  585    612   
        let de = config
  586    613   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  587    614   
            .expect("the config must have a deserializer");
  588    615   
  589    616   
        let parsed = de.deserialize_streaming(&mut http_response);
  590    617   
        let parsed = parsed.unwrap_or_else(|| {
  591    618   
            let http_response = http_response.map(|body| {
  592    619   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  593    620   
                    body.bytes().unwrap(),
  594    621   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  595    622   
                )))
  596    623   
            });
  597         -
            de.deserialize_nonstreaming(&http_response)
         624  +
            // Build a config bag with the protocol for schema-based deserialization
         625  +
            #[allow(unused_mut)]
         626  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         627  +
            {
         628  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         629  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         630  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         631  +
                ));
         632  +
                test_cfg.push_shared_layer(layer.freeze());
         633  +
            }
         634  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  598    635   
        });
  599    636   
        let parsed = parsed
  600    637   
            .expect("should be successful response")
  601    638   
            .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
  602    639   
            .unwrap();
  603    640   
        ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
  604    641   
        ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
  605    642   
    }
  606    643   
    /// Test ID: ZeroBigNumbersInJsonResponse
  607    644   
    #[::tokio::test]
  608    645   
    #[::tracing_test::traced_test]
  609    646   
    async fn zero_big_numbers_in_json_response_response() {
  610    647   
        let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
  611    648   
            .set_result(::std::option::Option::Some(
  612    649   
                <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("0").expect("Invalid string for BigInteger"),
  613    650   
            ))
  614    651   
            .set_ratio(::std::option::Option::Some(
  615    652   
                <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("0.0").expect("invalid string for BigDecimal"),
  616    653   
            ))
  617    654   
            .build();
  618    655   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  619    656   
            ::http_1x::response::Builder::new()
  620    657   
                .header("Content-Type", "application/json")
  621    658   
                .status(200)
  622    659   
                .body(::aws_smithy_types::body::SdkBody::from("{\"result\":0,\"ratio\":0.0}"))
  623    660   
                .unwrap(),
  624    661   
        )
  625    662   
        .unwrap();
  626    663   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  627    664   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  628    665   
  629    666   
        let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
  630    667   
        let config = op.config().expect("the operation has config");
  631    668   
        let de = config
  632    669   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  633    670   
            .expect("the config must have a deserializer");
  634    671   
  635    672   
        let parsed = de.deserialize_streaming(&mut http_response);
  636    673   
        let parsed = parsed.unwrap_or_else(|| {
  637    674   
            let http_response = http_response.map(|body| {
  638    675   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  639    676   
                    body.bytes().unwrap(),
  640    677   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  641    678   
                )))
  642    679   
            });
  643         -
            de.deserialize_nonstreaming(&http_response)
         680  +
            // Build a config bag with the protocol for schema-based deserialization
         681  +
            #[allow(unused_mut)]
         682  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         683  +
            {
         684  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         685  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         686  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         687  +
                ));
         688  +
                test_cfg.push_shared_layer(layer.freeze());
         689  +
            }
         690  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  644    691   
        });
  645    692   
        let parsed = parsed
  646    693   
            .expect("should be successful response")
  647    694   
            .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
  648    695   
            .unwrap();
  649    696   
        ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
  650    697   
        ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
  651    698   
    }
  652    699   
    /// Test ID: NullBigNumbersInJsonResponse
  653    700   
    #[::tokio::test]
  654    701   
    #[::tracing_test::traced_test]
  655    702   
    async fn null_big_numbers_in_json_response_response() {
  656    703   
        let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder().build();
  657    704   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  658    705   
            ::http_1x::response::Builder::new()
  659    706   
                .header("Content-Type", "application/json")
  660    707   
                .status(200)
  661    708   
                .body(::aws_smithy_types::body::SdkBody::from("{\"result\":null,\"ratio\":null}"))
  662    709   
                .unwrap(),
  663    710   
        )
  664    711   
        .unwrap();
  665    712   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  666    713   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  667    714   
  668    715   
        let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
  669    716   
        let config = op.config().expect("the operation has config");
  670    717   
        let de = config
  671    718   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  672    719   
            .expect("the config must have a deserializer");
  673    720   
  674    721   
        let parsed = de.deserialize_streaming(&mut http_response);
  675    722   
        let parsed = parsed.unwrap_or_else(|| {
  676    723   
            let http_response = http_response.map(|body| {
  677    724   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  678    725   
                    body.bytes().unwrap(),
  679    726   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  680    727   
                )))
  681    728   
            });
  682         -
            de.deserialize_nonstreaming(&http_response)
         729  +
            // Build a config bag with the protocol for schema-based deserialization
         730  +
            #[allow(unused_mut)]
         731  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         732  +
            {
         733  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         734  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         735  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         736  +
                ));
         737  +
                test_cfg.push_shared_layer(layer.freeze());
         738  +
            }
         739  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  683    740   
        });
  684    741   
        let parsed = parsed
  685    742   
            .expect("should be successful response")
  686    743   
            .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
  687    744   
            .unwrap();
  688    745   
        ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
  689    746   
        ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
  690    747   
    }
  691    748   
    /// Test ID: ScientificNotationBigNumbersInJsonResponse
  692    749   
    #[::tokio::test]
  693    750   
    #[::tracing_test::traced_test]
  694    751   
    async fn scientific_notation_big_numbers_in_json_response_response() {
  695    752   
        let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
  696    753   
            .set_result(::std::option::Option::Some(
  697    754   
                <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("1500000000000").expect("Invalid string for BigInteger"),
  698    755   
            ))
  699    756   
            .set_ratio(::std::option::Option::Some(
  700    757   
                <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("2.5E-8").expect("invalid string for BigDecimal"),
  701    758   
            ))
  702    759   
            .build();
  703    760   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  704    761   
            ::http_1x::response::Builder::new()
  705    762   
                .header("Content-Type", "application/json")
  706    763   
                .status(200)
  707    764   
                .body(::aws_smithy_types::body::SdkBody::from("{\"result\":1500000000000,\"ratio\":2.5E-8}"))
  708    765   
                .unwrap(),
  709    766   
        )
  710    767   
        .unwrap();
  711    768   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  712    769   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  713    770   
  714    771   
        let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
  715    772   
        let config = op.config().expect("the operation has config");
  716    773   
        let de = config
  717    774   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  718    775   
            .expect("the config must have a deserializer");
  719    776   
  720    777   
        let parsed = de.deserialize_streaming(&mut http_response);
  721    778   
        let parsed = parsed.unwrap_or_else(|| {
  722    779   
            let http_response = http_response.map(|body| {
  723    780   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  724    781   
                    body.bytes().unwrap(),
  725    782   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  726    783   
                )))
  727    784   
            });
  728         -
            de.deserialize_nonstreaming(&http_response)
         785  +
            // Build a config bag with the protocol for schema-based deserialization
         786  +
            #[allow(unused_mut)]
         787  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         788  +
            {
         789  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         790  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         791  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         792  +
                ));
         793  +
                test_cfg.push_shared_layer(layer.freeze());
         794  +
            }
         795  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  729    796   
        });
  730    797   
        let parsed = parsed
  731    798   
            .expect("should be successful response")
  732    799   
            .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
  733    800   
            .unwrap();
  734    801   
        ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
  735    802   
        ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
  736    803   
    }
  737    804   
    /// Test ID: UppercaseScientificNotationBigNumbersInJsonResponse
  738    805   
    #[::tokio::test]
  739    806   
    #[::tracing_test::traced_test]
  740    807   
    async fn uppercase_scientific_notation_big_numbers_in_json_response_response() {
  741    808   
        let expected_output = crate::operation::process_big_numbers::ProcessBigNumbersOutput::builder()
  742    809   
            .set_result(::std::option::Option::Some(
  743    810   
                <::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str("789000000000000000000").expect("Invalid string for BigInteger"),
  744    811   
            ))
  745    812   
            .set_ratio(::std::option::Option::Some(
  746    813   
                <::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str("1.23E-15").expect("invalid string for BigDecimal"),
  747    814   
            ))
  748    815   
            .build();
  749    816   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  750    817   
            ::http_1x::response::Builder::new()
  751    818   
                .header("Content-Type", "application/json")
  752    819   
                .status(200)
  753    820   
                .body(::aws_smithy_types::body::SdkBody::from(
  754    821   
                    "{\"result\":789000000000000000000,\"ratio\":1.23E-15}",
  755    822   
                ))
  756    823   
                .unwrap(),
  757    824   
        )
  758    825   
        .unwrap();
  759    826   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  760    827   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  761    828   
  762    829   
        let op = crate::operation::process_big_numbers::ProcessBigNumbers::new();
  763    830   
        let config = op.config().expect("the operation has config");
  764    831   
        let de = config
  765    832   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  766    833   
            .expect("the config must have a deserializer");
  767    834   
  768    835   
        let parsed = de.deserialize_streaming(&mut http_response);
  769    836   
        let parsed = parsed.unwrap_or_else(|| {
  770    837   
            let http_response = http_response.map(|body| {
  771    838   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  772    839   
                    body.bytes().unwrap(),
  773    840   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  774    841   
                )))
  775    842   
            });
  776         -
            de.deserialize_nonstreaming(&http_response)
         843  +
            // Build a config bag with the protocol for schema-based deserialization
         844  +
            #[allow(unused_mut)]
         845  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         846  +
            {
         847  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         848  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         849  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         850  +
                ));
         851  +
                test_cfg.push_shared_layer(layer.freeze());
         852  +
            }
         853  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  777    854   
        });
  778    855   
        let parsed = parsed
  779    856   
            .expect("should be successful response")
  780    857   
            .downcast::<crate::operation::process_big_numbers::ProcessBigNumbersOutput>()
  781    858   
            .unwrap();
  782    859   
        ::pretty_assertions::assert_eq!(parsed.result, expected_output.result, "Unexpected value for `result`");
  783    860   
        ::pretty_assertions::assert_eq!(parsed.ratio, expected_output.ratio, "Unexpected value for `ratio`");
  784    861   
    }
  785    862   
}
  786    863   

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/operation/process_big_numbers/_process_big_numbers_input.rs

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

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/operation/process_big_numbers/_process_big_numbers_output.rs

@@ -42,42 +128,139 @@
   62     62   
            ser.write_big_integer(&PROCESSBIGNUMBERSOUTPUT_MEMBER_RESULT, val)?;
   63     63   
        }
   64     64   
        if let Some(ref val) = self.ratio {
   65     65   
            ser.write_big_decimal(&PROCESSBIGNUMBERSOUTPUT_MEMBER_RATIO, val)?;
   66     66   
        }
   67     67   
        Ok(())
   68     68   
    }
   69     69   
}
   70     70   
impl ProcessBigNumbersOutput {
   71     71   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   72         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   73         -
        deserializer: &mut D,
          72  +
    pub fn deserialize(
          73  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   74     74   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   75     75   
        #[allow(unused_variables, unused_mut)]
   76     76   
        let mut builder = Self::builder();
   77     77   
        #[allow(
   78     78   
            unused_variables,
   79     79   
            unreachable_code,
   80     80   
            clippy::single_match,
   81     81   
            clippy::match_single_binding,
   82     82   
            clippy::diverging_sub_expression
   83     83   
        )]
   84         -
        deserializer.read_struct(&PROCESSBIGNUMBERSOUTPUT_SCHEMA, (), |_, member, deser| {
          84  +
        deserializer.read_struct(&PROCESSBIGNUMBERSOUTPUT_SCHEMA, &mut |member, deser| {
   85     85   
            match member.member_index() {
   86     86   
                Some(0) => {
   87     87   
                    builder.result = Some(deser.read_big_integer(member)?);
   88     88   
                }
   89     89   
                Some(1) => {
   90     90   
                    builder.ratio = Some(deser.read_big_decimal(member)?);
   91     91   
                }
   92     92   
                _ => {}
   93     93   
            }
   94     94   
            Ok(())
   95     95   
        })?;
   96     96   
        Ok(builder.build())
   97     97   
    }
   98     98   
}
          99  +
impl ProcessBigNumbersOutput {
         100  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         101  +
    pub fn deserialize_with_response(
         102  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         103  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         104  +
        _status: u16,
         105  +
        _body: &[u8],
         106  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         107  +
        Self::deserialize(deserializer)
         108  +
    }
         109  +
}
   99    110   
impl ProcessBigNumbersOutput {
  100    111   
    /// Creates a new builder-style object to manufacture [`ProcessBigNumbersOutput`](crate::operation::process_big_numbers::ProcessBigNumbersOutput).
  101    112   
    pub fn builder() -> crate::operation::process_big_numbers::builders::ProcessBigNumbersOutputBuilder {
  102    113   
        crate::operation::process_big_numbers::builders::ProcessBigNumbersOutputBuilder::default()
  103    114   
    }
  104    115   
}
  105    116   
  106    117   
/// A builder for [`ProcessBigNumbersOutput`](crate::operation::process_big_numbers::ProcessBigNumbersOutput).
  107    118   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  108    119   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/operation/process_nested_big_numbers.rs

@@ -1,1 +40,45 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `ProcessNestedBigNumbers`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct ProcessNestedBigNumbers;
    6      6   
impl ProcessNestedBigNumbers {
    7      7   
    /// Creates a new `ProcessNestedBigNumbers`
    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::process_nested_big_numbers::ProcessNestedBigNumbersInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
          15  +
        crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersOutput::SCHEMA;
   11     16   
    pub(crate) async fn orchestrate(
   12     17   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     18   
        input: crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersInput,
   14     19   
    ) -> ::std::result::Result<
   15     20   
        crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersOutput,
   16     21   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     22   
            crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersError,
   18     23   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     24   
        >,
   20     25   
    > {
@@ -110,115 +234,240 @@
  130    135   
                crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersError,
  131    136   
            >::new());
  132    137   
  133    138   
        ::std::borrow::Cow::Owned(rcb)
  134    139   
    }
  135    140   
}
  136    141   
  137    142   
#[derive(Debug)]
  138    143   
struct ProcessNestedBigNumbersResponseDeserializer;
  139    144   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ProcessNestedBigNumbersResponseDeserializer {
  140         -
    fn deserialize_nonstreaming(
         145  +
    fn deserialize_nonstreaming_with_config(
  141    146   
        &self,
  142    147   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         148  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  143    149   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  144    150   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         151  +
        #[allow(unused_mut)]
         152  +
        let mut force_error = false;
         153  +
         154  +
        if !success && status != 200 || force_error {
  145    155   
            let headers = response.headers();
  146    156   
            let body = response.body().bytes().expect("body loaded");
  147    157   
            #[allow(unused_mut)]
  148         -
        let mut force_error = false;
         158  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         159  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         160  +
            })?;
  149    161   
  150         -
        let parse_result = if !success && status != 200 || force_error {
  151         -
            crate::protocol_serde::shape_process_nested_big_numbers::de_process_nested_big_numbers_http_error(status, headers, body)
         162  +
            let generic = generic_builder.build();
         163  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         164  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         165  +
                    crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersError::generic(generic),
         166  +
                ),
         167  +
            ))
  152    168   
        } else {
  153         -
            crate::protocol_serde::shape_process_nested_big_numbers::de_process_nested_big_numbers_http_response(status, headers, body)
  154         -
        };
  155         -
        crate::protocol_serde::type_erase_result(parse_result)
         169  +
            let protocol = _cfg
         170  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         171  +
                .expect("a SharedClientProtocol is required");
         172  +
            let mut deser = protocol
         173  +
                .deserialize_response(response, ProcessNestedBigNumbers::OUTPUT_SCHEMA, _cfg)
         174  +
                .map_err(|e| {
         175  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         176  +
                })?;
         177  +
            let body = response.body().bytes().expect("body loaded");
         178  +
            let output = crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersOutput::deserialize_with_response(
         179  +
                &mut *deser,
         180  +
                response.headers(),
         181  +
                response.status().into(),
         182  +
                body,
         183  +
            )
         184  +
            .map_err(|e| {
         185  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         186  +
            })?;
         187  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         188  +
        }
  156    189   
    }
  157    190   
}
  158    191   
#[derive(Debug)]
  159    192   
struct ProcessNestedBigNumbersRequestSerializer;
  160    193   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ProcessNestedBigNumbersRequestSerializer {
  161    194   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  162    195   
    fn serialize_input(
  163    196   
        &self,
  164    197   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  165    198   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  166    199   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  167    200   
        let input = input
  168    201   
            .downcast::<crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersInput>()
  169    202   
            .expect("correct type");
  170         -
        let _header_serialization_settings = _cfg
  171         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  172         -
            .cloned()
  173         -
            .unwrap_or_default();
  174         -
        let mut request_builder = {
  175         -
            #[allow(clippy::uninlined_format_args)]
  176         -
            fn uri_base(
  177         -
                _input: &crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersInput,
  178         -
                output: &mut ::std::string::String,
  179         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  180         -
                use ::std::fmt::Write as _;
  181         -
                ::std::write!(output, "/nested").expect("formatting should succeed");
  182         -
                ::std::result::Result::Ok(())
  183         -
            }
  184         -
            #[allow(clippy::unnecessary_wraps)]
  185         -
            fn update_http_builder(
  186         -
                input: &crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersInput,
  187         -
                builder: ::http_1x::request::Builder,
  188         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  189         -
                let mut uri = ::std::string::String::new();
  190         -
                uri_base(input, &mut uri)?;
  191         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  192         -
            }
  193         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  194         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  195         -
            builder
  196         -
        };
  197         -
        let body = ::aws_smithy_types::body::SdkBody::from(
  198         -
            crate::protocol_serde::shape_process_nested_big_numbers::ser_process_nested_big_numbers_input(&input)?,
  199         -
        );
  200         -
        if let Some(content_length) = body.content_length() {
  201         -
            let content_length = content_length.to_string();
  202         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  203         -
        }
  204         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         203  +
        let protocol = _cfg
         204  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         205  +
            .expect("a SharedClientProtocol is required");
         206  +
        let mut request = protocol
         207  +
            .serialize_request(&input, ProcessNestedBigNumbers::INPUT_SCHEMA, "", _cfg)
         208  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         209  +
         210  +
        return ::std::result::Result::Ok(request);
  205    211   
    }
  206    212   
}
  207    213   
#[derive(Debug)]
  208    214   
struct ProcessNestedBigNumbersEndpointParamsInterceptor;
  209    215   
  210    216   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ProcessNestedBigNumbersEndpointParamsInterceptor {
  211    217   
    fn name(&self) -> &'static str {
  212    218   
        "ProcessNestedBigNumbersEndpointParamsInterceptor"
  213    219   
    }
  214    220   
@@ -391,397 +451,467 @@
  411    417   
            .expect("the config must have a deserializer");
  412    418   
  413    419   
        let parsed = de.deserialize_streaming(&mut http_response);
  414    420   
        let parsed = parsed.unwrap_or_else(|| {
  415    421   
            let http_response = http_response.map(|body| {
  416    422   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  417    423   
                    body.bytes().unwrap(),
  418    424   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  419    425   
                )))
  420    426   
            });
  421         -
            de.deserialize_nonstreaming(&http_response)
         427  +
            // Build a config bag with the protocol for schema-based deserialization
         428  +
            #[allow(unused_mut)]
         429  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         430  +
            {
         431  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         432  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         433  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         434  +
                ));
         435  +
                test_cfg.push_shared_layer(layer.freeze());
         436  +
            }
         437  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  422    438   
        });
  423    439   
        let parsed = parsed
  424    440   
            .expect("should be successful response")
  425    441   
            .downcast::<crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersOutput>()
  426    442   
            .unwrap();
  427    443   
        ::pretty_assertions::assert_eq!(parsed.numbers, expected_output.numbers, "Unexpected value for `numbers`");
  428    444   
        ::pretty_assertions::assert_eq!(parsed.ratios, expected_output.ratios, "Unexpected value for `ratios`");
  429    445   
        ::pretty_assertions::assert_eq!(parsed.int_map, expected_output.int_map, "Unexpected value for `int_map`");
  430    446   
        ::pretty_assertions::assert_eq!(parsed.dec_map, expected_output.dec_map, "Unexpected value for `dec_map`");
  431    447   
    }

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/operation/process_nested_big_numbers/_process_nested_big_numbers_input.rs

@@ -39,39 +121,122 @@
   59     59   
    "ratios",
   60     60   
    1,
   61     61   
);
   62     62   
static PROCESSNESTEDBIGNUMBERSINPUT_MEMBER_INT_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   63     63   
    ::aws_smithy_schema::ShapeId::from_static(
   64     64   
        "com.amazonaws.bignumbers.synthetic#ProcessNestedBigNumbersInput$intMap",
   65     65   
        "com.amazonaws.bignumbers.synthetic",
   66     66   
        "ProcessNestedBigNumbersInput",
   67     67   
    ),
   68     68   
    ::aws_smithy_schema::ShapeType::Map,
   69         -
    "int_map",
          69  +
    "intMap",
   70     70   
    2,
   71     71   
);
   72     72   
static PROCESSNESTEDBIGNUMBERSINPUT_MEMBER_DEC_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   73     73   
    ::aws_smithy_schema::ShapeId::from_static(
   74     74   
        "com.amazonaws.bignumbers.synthetic#ProcessNestedBigNumbersInput$decMap",
   75     75   
        "com.amazonaws.bignumbers.synthetic",
   76     76   
        "ProcessNestedBigNumbersInput",
   77     77   
    ),
   78     78   
    ::aws_smithy_schema::ShapeType::Map,
   79         -
    "dec_map",
          79  +
    "decMap",
   80     80   
    3,
   81     81   
);
   82     82   
static PROCESSNESTEDBIGNUMBERSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   83     83   
    PROCESSNESTEDBIGNUMBERSINPUT_SCHEMA_ID,
   84     84   
    ::aws_smithy_schema::ShapeType::Structure,
   85     85   
    &[
   86     86   
        &PROCESSNESTEDBIGNUMBERSINPUT_MEMBER_NUMBERS,
   87     87   
        &PROCESSNESTEDBIGNUMBERSINPUT_MEMBER_RATIOS,
   88     88   
        &PROCESSNESTEDBIGNUMBERSINPUT_MEMBER_INT_MAP,
   89     89   
        &PROCESSNESTEDBIGNUMBERSINPUT_MEMBER_DEC_MAP,
   90     90   
    ],
   91         -
);
          91  +
)
          92  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/nested", None));
   92     93   
impl ProcessNestedBigNumbersInput {
   93     94   
    /// The schema for this shape.
   94     95   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &PROCESSNESTEDBIGNUMBERSINPUT_SCHEMA;
   95     96   
}
   96     97   
impl ::aws_smithy_schema::serde::SerializableStruct for ProcessNestedBigNumbersInput {
   97     98   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   98     99   
    fn serialize_members(
   99    100   
        &self,
  100    101   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  101    102   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
@@ -123,124 +257,257 @@
  143    144   
                    }
  144    145   
                    Ok(())
  145    146   
                },
  146    147   
            )?;
  147    148   
        }
  148    149   
        Ok(())
  149    150   
    }
  150    151   
}
  151    152   
impl ProcessNestedBigNumbersInput {
  152    153   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  153         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  154         -
        deserializer: &mut D,
         154  +
    pub fn deserialize(
         155  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  155    156   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  156    157   
        #[allow(unused_variables, unused_mut)]
  157    158   
        let mut builder = Self::builder();
  158    159   
        #[allow(
  159    160   
            unused_variables,
  160    161   
            unreachable_code,
  161    162   
            clippy::single_match,
  162    163   
            clippy::match_single_binding,
  163    164   
            clippy::diverging_sub_expression
  164    165   
        )]
  165         -
        deserializer.read_struct(&PROCESSNESTEDBIGNUMBERSINPUT_SCHEMA, (), |_, member, deser| {
         166  +
        deserializer.read_struct(&PROCESSNESTEDBIGNUMBERSINPUT_SCHEMA, &mut |member, deser| {
  166    167   
            match member.member_index() {
  167    168   
                Some(0) => {
  168    169   
                    builder.numbers = Some({
  169         -
                        let container = if let Some(cap) = deser.container_size() {
  170         -
                            Vec::with_capacity(cap)
  171         -
                        } else {
  172         -
                            Vec::new()
  173         -
                        };
  174         -
                        deser.read_list(member, container, |mut list, deser| {
  175         -
                            list.push(deser.read_big_integer(member)?);
  176         -
                            Ok(list)
  177         -
                        })?
         170  +
                        let mut container = Vec::new();
         171  +
                        deser.read_list(member, &mut |deser| {
         172  +
                            container.push(deser.read_big_integer(member)?);
         173  +
                            Ok(())
         174  +
                        })?;
         175  +
                        container
  178    176   
                    });
  179    177   
                }
  180    178   
                Some(1) => {
  181    179   
                    builder.ratios = Some({
  182         -
                        let container = if let Some(cap) = deser.container_size() {
  183         -
                            Vec::with_capacity(cap)
  184         -
                        } else {
  185         -
                            Vec::new()
  186         -
                        };
  187         -
                        deser.read_list(member, container, |mut list, deser| {
  188         -
                            list.push(deser.read_big_decimal(member)?);
  189         -
                            Ok(list)
  190         -
                        })?
         180  +
                        let mut container = Vec::new();
         181  +
                        deser.read_list(member, &mut |deser| {
         182  +
                            container.push(deser.read_big_decimal(member)?);
         183  +
                            Ok(())
         184  +
                        })?;
         185  +
                        container
  191    186   
                    });
  192    187   
                }
  193    188   
                Some(2) => {
  194    189   
                    builder.int_map = Some({
  195         -
                        let container = if let Some(cap) = deser.container_size() {
  196         -
                            std::collections::HashMap::with_capacity(cap)
  197         -
                        } else {
  198         -
                            std::collections::HashMap::new()
  199         -
                        };
  200         -
                        deser.read_map(member, container, |mut map, key, deser| {
  201         -
                            map.insert(key, deser.read_big_integer(member)?);
  202         -
                            Ok(map)
  203         -
                        })?
         190  +
                        let mut container = std::collections::HashMap::new();
         191  +
                        deser.read_map(member, &mut |key, deser| {
         192  +
                            container.insert(key, deser.read_big_integer(member)?);
         193  +
                            Ok(())
         194  +
                        })?;
         195  +
                        container
  204    196   
                    });
  205    197   
                }
  206    198   
                Some(3) => {
  207    199   
                    builder.dec_map = Some({
  208         -
                        let container = if let Some(cap) = deser.container_size() {
  209         -
                            std::collections::HashMap::with_capacity(cap)
  210         -
                        } else {
  211         -
                            std::collections::HashMap::new()
  212         -
                        };
  213         -
                        deser.read_map(member, container, |mut map, key, deser| {
  214         -
                            map.insert(key, deser.read_big_decimal(member)?);
  215         -
                            Ok(map)
  216         -
                        })?
         200  +
                        let mut container = std::collections::HashMap::new();
         201  +
                        deser.read_map(member, &mut |key, deser| {
         202  +
                            container.insert(key, deser.read_big_decimal(member)?);
         203  +
                            Ok(())
         204  +
                        })?;
         205  +
                        container
  217    206   
                    });
  218    207   
                }
  219    208   
                _ => {}
  220    209   
            }
  221    210   
            Ok(())
  222    211   
        })?;
  223    212   
        builder
  224    213   
            .build()
  225    214   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  226    215   
    }
  227    216   
}
         217  +
impl ProcessNestedBigNumbersInput {
         218  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         219  +
    pub fn deserialize_with_response(
         220  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         221  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         222  +
        _status: u16,
         223  +
        _body: &[u8],
         224  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         225  +
        Self::deserialize(deserializer)
         226  +
    }
         227  +
}
  228    228   
impl ProcessNestedBigNumbersInput {
  229    229   
    /// Creates a new builder-style object to manufacture [`ProcessNestedBigNumbersInput`](crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersInput).
  230    230   
    pub fn builder() -> crate::operation::process_nested_big_numbers::builders::ProcessNestedBigNumbersInputBuilder {
  231    231   
        crate::operation::process_nested_big_numbers::builders::ProcessNestedBigNumbersInputBuilder::default()
  232    232   
    }
  233    233   
}
  234    234   
  235    235   
/// A builder for [`ProcessNestedBigNumbersInput`](crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersInput).
  236    236   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  237    237   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/operation/process_nested_big_numbers/_process_nested_big_numbers_output.rs

@@ -39,39 +109,109 @@
   59     59   
    "ratios",
   60     60   
    1,
   61     61   
);
   62     62   
static PROCESSNESTEDBIGNUMBERSOUTPUT_MEMBER_INT_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   63     63   
    ::aws_smithy_schema::ShapeId::from_static(
   64     64   
        "com.amazonaws.bignumbers.synthetic#ProcessNestedBigNumbersOutput$intMap",
   65     65   
        "com.amazonaws.bignumbers.synthetic",
   66     66   
        "ProcessNestedBigNumbersOutput",
   67     67   
    ),
   68     68   
    ::aws_smithy_schema::ShapeType::Map,
   69         -
    "int_map",
          69  +
    "intMap",
   70     70   
    2,
   71     71   
);
   72     72   
static PROCESSNESTEDBIGNUMBERSOUTPUT_MEMBER_DEC_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   73     73   
    ::aws_smithy_schema::ShapeId::from_static(
   74     74   
        "com.amazonaws.bignumbers.synthetic#ProcessNestedBigNumbersOutput$decMap",
   75     75   
        "com.amazonaws.bignumbers.synthetic",
   76     76   
        "ProcessNestedBigNumbersOutput",
   77     77   
    ),
   78     78   
    ::aws_smithy_schema::ShapeType::Map,
   79         -
    "dec_map",
          79  +
    "decMap",
   80     80   
    3,
   81     81   
);
   82     82   
static PROCESSNESTEDBIGNUMBERSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   83     83   
    PROCESSNESTEDBIGNUMBERSOUTPUT_SCHEMA_ID,
   84     84   
    ::aws_smithy_schema::ShapeType::Structure,
   85     85   
    &[
   86     86   
        &PROCESSNESTEDBIGNUMBERSOUTPUT_MEMBER_NUMBERS,
   87     87   
        &PROCESSNESTEDBIGNUMBERSOUTPUT_MEMBER_RATIOS,
   88     88   
        &PROCESSNESTEDBIGNUMBERSOUTPUT_MEMBER_INT_MAP,
   89     89   
        &PROCESSNESTEDBIGNUMBERSOUTPUT_MEMBER_DEC_MAP,
@@ -123,123 +255,254 @@
  143    143   
                    }
  144    144   
                    Ok(())
  145    145   
                },
  146    146   
            )?;
  147    147   
        }
  148    148   
        Ok(())
  149    149   
    }
  150    150   
}
  151    151   
impl ProcessNestedBigNumbersOutput {
  152    152   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  153         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  154         -
        deserializer: &mut D,
         153  +
    pub fn deserialize(
         154  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  155    155   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  156    156   
        #[allow(unused_variables, unused_mut)]
  157    157   
        let mut builder = Self::builder();
  158    158   
        #[allow(
  159    159   
            unused_variables,
  160    160   
            unreachable_code,
  161    161   
            clippy::single_match,
  162    162   
            clippy::match_single_binding,
  163    163   
            clippy::diverging_sub_expression
  164    164   
        )]
  165         -
        deserializer.read_struct(&PROCESSNESTEDBIGNUMBERSOUTPUT_SCHEMA, (), |_, member, deser| {
         165  +
        deserializer.read_struct(&PROCESSNESTEDBIGNUMBERSOUTPUT_SCHEMA, &mut |member, deser| {
  166    166   
            match member.member_index() {
  167    167   
                Some(0) => {
  168    168   
                    builder.numbers = Some({
  169         -
                        let container = if let Some(cap) = deser.container_size() {
  170         -
                            Vec::with_capacity(cap)
  171         -
                        } else {
  172         -
                            Vec::new()
  173         -
                        };
  174         -
                        deser.read_list(member, container, |mut list, deser| {
  175         -
                            list.push(deser.read_big_integer(member)?);
  176         -
                            Ok(list)
  177         -
                        })?
         169  +
                        let mut container = Vec::new();
         170  +
                        deser.read_list(member, &mut |deser| {
         171  +
                            container.push(deser.read_big_integer(member)?);
         172  +
                            Ok(())
         173  +
                        })?;
         174  +
                        container
  178    175   
                    });
  179    176   
                }
  180    177   
                Some(1) => {
  181    178   
                    builder.ratios = Some({
  182         -
                        let container = if let Some(cap) = deser.container_size() {
  183         -
                            Vec::with_capacity(cap)
  184         -
                        } else {
  185         -
                            Vec::new()
  186         -
                        };
  187         -
                        deser.read_list(member, container, |mut list, deser| {
  188         -
                            list.push(deser.read_big_decimal(member)?);
  189         -
                            Ok(list)
  190         -
                        })?
         179  +
                        let mut container = Vec::new();
         180  +
                        deser.read_list(member, &mut |deser| {
         181  +
                            container.push(deser.read_big_decimal(member)?);
         182  +
                            Ok(())
         183  +
                        })?;
         184  +
                        container
  191    185   
                    });
  192    186   
                }
  193    187   
                Some(2) => {
  194    188   
                    builder.int_map = Some({
  195         -
                        let container = if let Some(cap) = deser.container_size() {
  196         -
                            std::collections::HashMap::with_capacity(cap)
  197         -
                        } else {
  198         -
                            std::collections::HashMap::new()
  199         -
                        };
  200         -
                        deser.read_map(member, container, |mut map, key, deser| {
  201         -
                            map.insert(key, deser.read_big_integer(member)?);
  202         -
                            Ok(map)
  203         -
                        })?
         189  +
                        let mut container = std::collections::HashMap::new();
         190  +
                        deser.read_map(member, &mut |key, deser| {
         191  +
                            container.insert(key, deser.read_big_integer(member)?);
         192  +
                            Ok(())
         193  +
                        })?;
         194  +
                        container
  204    195   
                    });
  205    196   
                }
  206    197   
                Some(3) => {
  207    198   
                    builder.dec_map = Some({
  208         -
                        let container = if let Some(cap) = deser.container_size() {
  209         -
                            std::collections::HashMap::with_capacity(cap)
  210         -
                        } else {
  211         -
                            std::collections::HashMap::new()
  212         -
                        };
  213         -
                        deser.read_map(member, container, |mut map, key, deser| {
  214         -
                            map.insert(key, deser.read_big_decimal(member)?);
  215         -
                            Ok(map)
  216         -
                        })?
         199  +
                        let mut container = std::collections::HashMap::new();
         200  +
                        deser.read_map(member, &mut |key, deser| {
         201  +
                            container.insert(key, deser.read_big_decimal(member)?);
         202  +
                            Ok(())
         203  +
                        })?;
         204  +
                        container
  217    205   
                    });
  218    206   
                }
  219    207   
                _ => {}
  220    208   
            }
  221    209   
            Ok(())
  222    210   
        })?;
  223    211   
        Ok(builder.build())
  224    212   
    }
  225    213   
}
         214  +
impl ProcessNestedBigNumbersOutput {
         215  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         216  +
    pub fn deserialize_with_response(
         217  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         218  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         219  +
        _status: u16,
         220  +
        _body: &[u8],
         221  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         222  +
        Self::deserialize(deserializer)
         223  +
    }
         224  +
}
  226    225   
impl ProcessNestedBigNumbersOutput {
  227    226   
    /// Creates a new builder-style object to manufacture [`ProcessNestedBigNumbersOutput`](crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersOutput).
  228    227   
    pub fn builder() -> crate::operation::process_nested_big_numbers::builders::ProcessNestedBigNumbersOutputBuilder {
  229    228   
        crate::operation::process_nested_big_numbers::builders::ProcessNestedBigNumbersOutputBuilder::default()
  230    229   
    }
  231    230   
}
  232    231   
  233    232   
/// A builder for [`ProcessNestedBigNumbersOutput`](crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersOutput).
  234    233   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  235    234   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/protocol_serde.rs

@@ -1,1 +48,0 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn type_erase_result<O, E>(
    3         -
    result: ::std::result::Result<O, E>,
    4         -
) -> ::std::result::Result<
    5         -
    ::aws_smithy_runtime_api::client::interceptors::context::Output,
    6         -
    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError<::aws_smithy_runtime_api::client::interceptors::context::Error>,
    7         -
>
    8         -
where
    9         -
    O: ::std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
   10         -
    E: ::std::error::Error + std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static,
   11         -
{
   12         -
    result
   13         -
        .map(|output| ::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
   14         -
        .map_err(|error| ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(error))
   15         -
        .map_err(::std::convert::Into::into)
   16         -
}
   17         -
   18      2   
pub fn parse_http_error_metadata(
   19      3   
    _response_status: u16,
   20      4   
    response_headers: &::aws_smithy_runtime_api::http::Headers,
   21      5   
    response_body: &[u8],
   22      6   
) -> ::std::result::Result<::aws_smithy_types::error::metadata::Builder, ::aws_smithy_json::deserialize::error::DeserializeError> {
   23      7   
    crate::json_errors::parse_error_metadata(response_body, response_headers)
   24      8   
}
   25         -
   26         -
pub(crate) mod shape_process_big_numbers;
   27         -
   28         -
pub(crate) mod shape_process_nested_big_numbers;
   29         -
   30         -
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   31         -
    if data.is_empty() {
   32         -
        b"{}"
   33         -
    } else {
   34         -
        data
   35         -
    }
   36         -
}
   37         -
   38         -
pub(crate) mod shape_process_big_numbers_input;
   39         -
   40         -
pub(crate) mod shape_process_nested_big_numbers_input;
   41         -
   42         -
pub(crate) mod shape_big_decimal_list;
   43         -
   44         -
pub(crate) mod shape_big_integer_list;
   45         -
   46         -
pub(crate) mod shape_string_to_big_decimal_map;
   47         -
   48         -
pub(crate) mod shape_string_to_big_integer_map;

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/protocol_serde/shape_big_decimal_list.rs

@@ -1,0 +40,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_big_decimal_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<::aws_smithy_types::BigDecimal>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   12         -
            let mut items = Vec::new();
   13         -
            loop {
   14         -
                match tokens.peek() {
   15         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   16         -
                        tokens.next().transpose().unwrap();
   17         -
                        break;
   18         -
                    }
   19         -
                    _ => {
   20         -
                        let value = ::aws_smithy_json::deserialize::token::expect_number_as_string_or_null(tokens.next(), _value)?
   21         -
                            .map(<::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str)
   22         -
                            .transpose()
   23         -
                            .map_err(|e| ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("invalid BigDecimal: {e}")))?;
   24         -
                        if let Some(value) = value {
   25         -
                            items.push(value);
   26         -
                        } else {
   27         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   28         -
                                "dense list cannot contain null values",
   29         -
                            ));
   30         -
                        }
   31         -
                    }
   32         -
                }
   33         -
            }
   34         -
            Ok(Some(items))
   35         -
        }
   36         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37         -
            "expected start array or null",
   38         -
        )),
   39         -
    }
   40         -
}

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/protocol_serde/shape_big_integer_list.rs

@@ -1,0 +40,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_big_integer_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<::aws_smithy_types::BigInteger>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   12         -
            let mut items = Vec::new();
   13         -
            loop {
   14         -
                match tokens.peek() {
   15         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   16         -
                        tokens.next().transpose().unwrap();
   17         -
                        break;
   18         -
                    }
   19         -
                    _ => {
   20         -
                        let value = ::aws_smithy_json::deserialize::token::expect_number_as_string_or_null(tokens.next(), _value)?
   21         -
                            .map(<::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str)
   22         -
                            .transpose()
   23         -
                            .map_err(|e| ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("invalid BigInteger: {e}")))?;
   24         -
                        if let Some(value) = value {
   25         -
                            items.push(value);
   26         -
                        } else {
   27         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   28         -
                                "dense list cannot contain null values",
   29         -
                            ));
   30         -
                        }
   31         -
                    }
   32         -
                }
   33         -
            }
   34         -
            Ok(Some(items))
   35         -
        }
   36         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37         -
            "expected start array or null",
   38         -
        )),
   39         -
    }
   40         -
}

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/protocol_serde/shape_process_big_numbers.rs

@@ -1,0 +87,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_process_big_numbers_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<crate::operation::process_big_numbers::ProcessBigNumbersOutput, crate::operation::process_big_numbers::ProcessBigNumbersError>
    8         -
{
    9         -
    #[allow(unused_mut)]
   10         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   11         -
        .map_err(crate::operation::process_big_numbers::ProcessBigNumbersError::unhandled)?;
   12         -
    let generic = generic_builder.build();
   13         -
    Err(crate::operation::process_big_numbers::ProcessBigNumbersError::generic(generic))
   14         -
}
   15         -
   16         -
#[allow(clippy::unnecessary_wraps)]
   17         -
pub fn de_process_big_numbers_http_response(
   18         -
    _response_status: u16,
   19         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   20         -
    _response_body: &[u8],
   21         -
) -> std::result::Result<crate::operation::process_big_numbers::ProcessBigNumbersOutput, crate::operation::process_big_numbers::ProcessBigNumbersError>
   22         -
{
   23         -
    Ok({
   24         -
        #[allow(unused_mut)]
   25         -
        let mut output = crate::operation::process_big_numbers::builders::ProcessBigNumbersOutputBuilder::default();
   26         -
        output = crate::protocol_serde::shape_process_big_numbers::de_process_big_numbers(_response_body, output)
   27         -
            .map_err(crate::operation::process_big_numbers::ProcessBigNumbersError::unhandled)?;
   28         -
        output.build()
   29         -
    })
   30         -
}
   31         -
   32         -
pub fn ser_process_big_numbers_input(
   33         -
    input: &crate::operation::process_big_numbers::ProcessBigNumbersInput,
   34         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   35         -
    let mut out = String::new();
   36         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   37         -
    crate::protocol_serde::shape_process_big_numbers_input::ser_process_big_numbers_input_input(&mut object, input)?;
   38         -
    object.finish();
   39         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   40         -
}
   41         -
   42         -
pub(crate) fn de_process_big_numbers(
   43         -
    _value: &[u8],
   44         -
    mut builder: crate::operation::process_big_numbers::builders::ProcessBigNumbersOutputBuilder,
   45         -
) -> ::std::result::Result<
   46         -
    crate::operation::process_big_numbers::builders::ProcessBigNumbersOutputBuilder,
   47         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   48         -
> {
   49         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   50         -
    let tokens = &mut tokens_owned;
   51         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   52         -
    loop {
   53         -
        match tokens.next().transpose()? {
   54         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   55         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   56         -
                "ratio" => {
   57         -
                    builder = builder.set_ratio(
   58         -
                        ::aws_smithy_json::deserialize::token::expect_number_as_string_or_null(tokens.next(), _value)?
   59         -
                            .map(<::aws_smithy_types::BigDecimal as ::std::str::FromStr>::from_str)
   60         -
                            .transpose()
   61         -
                            .map_err(|e| ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("invalid BigDecimal: {e}")))?,
   62         -
                    );
   63         -
                }
   64         -
                "result" => {
   65         -
                    builder = builder.set_result(
   66         -
                        ::aws_smithy_json::deserialize::token::expect_number_as_string_or_null(tokens.next(), _value)?
   67         -
                            .map(<::aws_smithy_types::BigInteger as ::std::str::FromStr>::from_str)
   68         -
                            .transpose()
   69         -
                            .map_err(|e| ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("invalid BigInteger: {e}")))?,
   70         -
                    );
   71         -
                }
   72         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   73         -
            },
   74         -
            other => {
   75         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   76         -
                    "expected object key or end object, found: {other:?}"
   77         -
                )))
   78         -
            }
   79         -
        }
   80         -
    }
   81         -
    if tokens.next().is_some() {
   82         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   83         -
            "found more JSON tokens after completing parsing",
   84         -
        ));
   85         -
    }
   86         -
    Ok(builder)
   87         -
}

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/protocol_serde/shape_process_big_numbers_input.rs

@@ -1,0 +13,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_process_big_numbers_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::process_big_numbers::ProcessBigNumbersInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.big_dec {
    7         -
        object.key("bigDec").write_raw_value(var_1.as_ref());
    8         -
    }
    9         -
    if let Some(var_2) = &input.big_int {
   10         -
        object.key("bigInt").write_raw_value(var_2.as_ref());
   11         -
    }
   12         -
    Ok(())
   13         -
}

tmp-codegen-diff/codegen-client-test/big_numbers/rust-client-codegen/src/protocol_serde/shape_process_nested_big_numbers.rs

@@ -1,0 +93,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_process_nested_big_numbers_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<
    8         -
    crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersOutput,
    9         -
    crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersError,
   10         -
> {
   11         -
    #[allow(unused_mut)]
   12         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13         -
        .map_err(crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersError::generic(
   16         -
        generic,
   17         -
    ))
   18         -
}
   19         -
   20         -
#[allow(clippy::unnecessary_wraps)]
   21         -
pub fn de_process_nested_big_numbers_http_response(
   22         -
    _response_status: u16,
   23         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24         -
    _response_body: &[u8],
   25         -
) -> std::result::Result<
   26         -
    crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersOutput,
   27         -
    crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersError,
   28         -
> {
   29         -
    Ok({
   30         -
        #[allow(unused_mut)]
   31         -
        let mut output = crate::operation::process_nested_big_numbers::builders::ProcessNestedBigNumbersOutputBuilder::default();
   32         -
        output = crate::protocol_serde::shape_process_nested_big_numbers::de_process_nested_big_numbers(_response_body, output)
   33         -
            .map_err(crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersError::unhandled)?;
   34         -
        output.build()
   35         -
    })
   36         -
}
   37         -
   38         -
pub fn ser_process_nested_big_numbers_input(
   39         -
    input: &crate::operation::process_nested_big_numbers::ProcessNestedBigNumbersInput,
   40         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   41         -
    let mut out = String::new();
   42         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   43         -
    crate::protocol_serde::shape_process_nested_big_numbers_input::ser_process_nested_big_numbers_input_input(&mut object, input)?;
   44         -
    object.finish();
   45         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   46         -
}
   47         -
   48         -
pub(crate) fn de_process_nested_big_numbers(
   49         -
    _value: &[u8],
   50         -
    mut builder: crate::operation::process_nested_big_numbers::builders::ProcessNestedBigNumbersOutputBuilder,
   51         -
) -> ::std::result::Result<
   52         -
    crate::operation::process_nested_big_numbers::builders::ProcessNestedBigNumbersOutputBuilder,
   53         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
   54         -
> {
   55         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
   56         -
    let tokens = &mut tokens_owned;
   57         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
   58         -
    loop {
   59         -
        match tokens.next().transpose()? {
   60         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   61         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   62         -
                "decMap" => {
   63         -
                    builder = builder.set_dec_map(crate::protocol_serde::shape_string_to_big_decimal_map::de_string_to_big_decimal_map(
   64         -
                        tokens, _value,
   65         -
                    )?);
   66         -
                }
   67         -
                "intMap" => {
   68         -
                    builder = builder.set_int_map(crate::protocol_serde::shape_string_to_big_integer_map::de_string_to_big_integer_map(
   69         -
                        tokens, _value,
   70         -
                    )?);
   71         -
                }
   72         -
                "numbers" => {
   73         -
                    builder = builder.set_numbers(crate::protocol_serde::shape_big_integer_list::de_big_integer_list(tokens, _value)?);
   74         -
                }
   75         -
                "ratios" => {
   76         -
                    builder = builder.set_ratios(crate::protocol_serde::shape_big_decimal_list::de_big_decimal_list(tokens, _value)?);
   77         -
                }
   78         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   79         -
            },
   80         -
            other => {
   81         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   82         -
                    "expected object key or end object, found: {other:?}"
   83         -
                )))
   84         -
            }
   85         -
        }
   86         -
    }
   87         -
    if tokens.next().is_some() {
   88         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   89         -
            "found more JSON tokens after completing parsing",
   90         -
        ));
   91         -
    }
   92         -
    Ok(builder)
   93         -
}