Client Test

Client Test

rev. 163d4d6410694aaf071424777ecbecd050925f36

Files changed:

tmp-codegen-diff/codegen-client-test/misc/rust-client-codegen/src/types/error/_validation_exception.rs

@@ -6,6 +142,151 @@
   26     26   
    "message",
   27     27   
    0,
   28     28   
);
   29     29   
static VALIDATIONERROR_MEMBER_FIELD_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   30     30   
    ::aws_smithy_schema::ShapeId::from_static(
   31     31   
        "smithy.framework#ValidationException$fieldList",
   32     32   
        "smithy.framework",
   33     33   
        "ValidationException",
   34     34   
    ),
   35     35   
    ::aws_smithy_schema::ShapeType::List,
   36         -
    "field_list",
          36  +
    "fieldList",
   37     37   
    1,
   38     38   
);
   39     39   
static VALIDATIONERROR_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   40     40   
    VALIDATIONERROR_SCHEMA_ID,
   41     41   
    ::aws_smithy_schema::ShapeType::Structure,
   42     42   
    &[&VALIDATIONERROR_MEMBER_MESSAGE, &VALIDATIONERROR_MEMBER_FIELD_LIST],
   43     43   
);
   44     44   
impl ValidationError {
   45     45   
    /// The schema for this shape.
   46     46   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &VALIDATIONERROR_SCHEMA;
   47     47   
}
   48     48   
impl ::aws_smithy_schema::serde::SerializableStruct for ValidationError {
   49     49   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   50     50   
    fn serialize_members(
   51     51   
        &self,
   52     52   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   53     53   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   54     54   
        {
   55     55   
            let val = &self.message;
   56     56   
            ser.write_string(&VALIDATIONERROR_MEMBER_MESSAGE, val)?;
   57     57   
        }
   58     58   
        if let Some(ref val) = self.field_list {
   59     59   
            ser.write_list(
   60     60   
                &VALIDATIONERROR_MEMBER_FIELD_LIST,
   61     61   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
   62     62   
                    for item in val {
   63     63   
                        ser.write_struct(crate::types::ValidationExceptionField::SCHEMA, item)?;
   64     64   
                    }
   65     65   
                    Ok(())
   66     66   
                },
   67     67   
            )?;
   68     68   
        }
   69     69   
        Ok(())
   70     70   
    }
   71     71   
}
   72     72   
impl ValidationError {
   73     73   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   74         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   75         -
        deserializer: &mut D,
          74  +
    pub fn deserialize(
          75  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   76     76   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   77     77   
        #[allow(unused_variables, unused_mut)]
   78     78   
        let mut builder = Self::builder();
   79     79   
        #[allow(
   80     80   
            unused_variables,
   81     81   
            unreachable_code,
   82     82   
            clippy::single_match,
   83     83   
            clippy::match_single_binding,
   84     84   
            clippy::diverging_sub_expression
   85     85   
        )]
   86         -
        deserializer.read_struct(&VALIDATIONERROR_SCHEMA, (), |_, member, deser| {
          86  +
        deserializer.read_struct(&VALIDATIONERROR_SCHEMA, &mut |member, deser| {
   87     87   
            match member.member_index() {
   88     88   
                Some(0) => {
   89     89   
                    builder.message = Some(deser.read_string(member)?);
   90     90   
                }
   91     91   
                Some(1) => {
   92     92   
                    builder.field_list = Some({
   93         -
                        let container = if let Some(cap) = deser.container_size() {
   94         -
                            Vec::with_capacity(cap)
   95         -
                        } else {
   96         -
                            Vec::new()
   97         -
                        };
   98         -
                        deser.read_list(member, container, |mut list, deser| {
   99         -
                            list.push(crate::types::ValidationExceptionField::deserialize(deser)?);
  100         -
                            Ok(list)
  101         -
                        })?
          93  +
                        let mut container = Vec::new();
          94  +
                        deser.read_list(member, &mut |deser| {
          95  +
                            container.push(crate::types::ValidationExceptionField::deserialize(deser)?);
          96  +
                            Ok(())
          97  +
                        })?;
          98  +
                        container
  102     99   
                    });
  103    100   
                }
  104    101   
                _ => {}
  105    102   
            }
  106    103   
            Ok(())
  107    104   
        })?;
         105  +
        builder.message = builder.message.or(Some(String::new()));
  108    106   
        builder
  109    107   
            .build()
  110    108   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  111    109   
    }
  112    110   
}
         111  +
impl ValidationError {
         112  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         113  +
    pub fn deserialize_with_response(
         114  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         115  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         116  +
        _status: u16,
         117  +
        _body: &[u8],
         118  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         119  +
        Self::deserialize(deserializer)
         120  +
    }
         121  +
}
  113    122   
impl ValidationError {
  114    123   
    /// Returns the error message.
  115    124   
    pub fn message(&self) -> &str {
  116    125   
        &self.message
  117    126   
    }
  118    127   
}
  119    128   
impl ::std::fmt::Display for ValidationError {
  120    129   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  121    130   
        ::std::write!(f, "ValidationError [ValidationException]")?;
  122    131   
        {

tmp-codegen-diff/codegen-client-test/naming_test_casing/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#awsJson1_1"
   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/naming_test_casing/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 naming_test_casing::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("ACRONYMInside_Service");
        1169  +
            if _service_config.protocol().is_none() {
        1170  +
                cfg.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1171  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("ACRONYMInside_Service"),
        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/naming_test_casing/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/naming_test_casing/rust-client-codegen/src/operation/do_nothing.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 `DoNothing`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct DoNothing;
    6      6   
impl DoNothing {
    7      7   
    /// Creates a new `DoNothing`
    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::do_nothing::DoNothingInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::do_nothing::DoNothingOutput::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::do_nothing::DoNothingInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::do_nothing::DoNothingOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::do_nothing::DoNothingError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -107,111 +226,227 @@
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct DoNothingResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DoNothingResponseDeserializer {
  134    138   
    fn deserialize_nonstreaming(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  139         -
        let headers = response.headers();
  140         -
        let body = response.body().bytes().expect("body loaded");
  141    144   
        #[allow(unused_mut)]
  142    145   
        let mut force_error = false;
  143    146   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_do_nothing::de_do_nothing_http_error(status, headers, body)
         147  +
        if !success && status != 200 || force_error {
         148  +
            let headers = response.headers();
         149  +
            let body = response.body().bytes().expect("body loaded");
         150  +
            #[allow(unused_mut)]
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
         154  +
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(crate::operation::do_nothing::DoNothingError::generic(generic)),
         158  +
            ))
  146    159   
        } else {
  147         -
            crate::protocol_serde::shape_do_nothing::de_do_nothing_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         160  +
            let protocol = _cfg
         161  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         162  +
                .expect("a SharedClientProtocol is required");
         163  +
            let mut deser = protocol.deserialize_response(response, DoNothing::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         164  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         165  +
            })?;
         166  +
            let body = response.body().bytes().expect("body loaded");
         167  +
            let output = crate::operation::do_nothing::DoNothingOutput::deserialize_with_response(
         168  +
                &mut *deser,
         169  +
                response.headers(),
         170  +
                response.status().into(),
         171  +
                body,
         172  +
            )
         173  +
            .map_err(|e| {
         174  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
            })?;
         176  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         177  +
        }
  150    178   
    }
  151    179   
}
  152    180   
#[derive(Debug)]
  153    181   
struct DoNothingRequestSerializer;
  154    182   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DoNothingRequestSerializer {
  155    183   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    184   
    fn serialize_input(
  157    185   
        &self,
  158    186   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    187   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    188   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    189   
        let input = input.downcast::<crate::operation::do_nothing::DoNothingInput>().expect("correct type");
  162         -
        let _header_serialization_settings = _cfg
  163         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  164         -
            .cloned()
  165         -
            .unwrap_or_default();
  166         -
        let mut request_builder = {
  167         -
            #[allow(clippy::uninlined_format_args)]
  168         -
            fn uri_base(
  169         -
                _input: &crate::operation::do_nothing::DoNothingInput,
  170         -
                output: &mut ::std::string::String,
  171         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  172         -
                use ::std::fmt::Write as _;
  173         -
                ::std::write!(output, "/").expect("formatting should succeed");
  174         -
                ::std::result::Result::Ok(())
  175         -
            }
  176         -
            #[allow(clippy::unnecessary_wraps)]
  177         -
            fn update_http_builder(
  178         -
                input: &crate::operation::do_nothing::DoNothingInput,
  179         -
                builder: ::http_1x::request::Builder,
  180         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  181         -
                let mut uri = ::std::string::String::new();
  182         -
                uri_base(input, &mut uri)?;
  183         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  184         -
            }
  185         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  186         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
  187         -
            builder = _header_serialization_settings.set_default_header(
  188         -
                builder,
  189         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  190         -
                "ACRONYMInside_Service.DoNothing",
  191         -
            );
  192         -
            builder
  193         -
        };
  194         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_do_nothing::ser_do_nothing_input(&input)?);
         190  +
        let protocol = _cfg
         191  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         192  +
            .expect("a SharedClientProtocol is required");
         193  +
        let mut request = protocol
         194  +
            .serialize_request(&input, DoNothing::INPUT_SCHEMA, "", _cfg)
         195  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  195    196   
  196         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         197  +
        return ::std::result::Result::Ok(request);
  197    198   
    }
  198    199   
}
  199    200   
#[derive(Debug)]
  200    201   
struct DoNothingEndpointParamsInterceptor;
  201    202   
  202    203   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DoNothingEndpointParamsInterceptor {
  203    204   
    fn name(&self) -> &'static str {
  204    205   
        "DoNothingEndpointParamsInterceptor"
  205    206   
    }
  206    207   

tmp-codegen-diff/codegen-client-test/naming_test_casing/rust-client-codegen/src/operation/do_nothing/_do_nothing_input.rs

@@ -1,1 +64,77 @@
   15     15   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   16     16   
    fn serialize_members(
   17     17   
        &self,
   18     18   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   19     19   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   20     20   
        Ok(())
   21     21   
    }
   22     22   
}
   23     23   
impl DoNothingInput {
   24     24   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   25         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   26         -
        deserializer: &mut D,
          25  +
    pub fn deserialize(
          26  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   27     27   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   28     28   
        #[allow(unused_variables, unused_mut)]
   29     29   
        let mut builder = Self::builder();
   30     30   
        #[allow(
   31     31   
            unused_variables,
   32     32   
            unreachable_code,
   33     33   
            clippy::single_match,
   34     34   
            clippy::match_single_binding,
   35     35   
            clippy::diverging_sub_expression
   36     36   
        )]
   37         -
        deserializer.read_struct(&DONOTHINGINPUT_SCHEMA, (), |_, member, deser| {
          37  +
        deserializer.read_struct(&DONOTHINGINPUT_SCHEMA, &mut |member, deser| {
   38     38   
            match member.member_index() {
   39     39   
                _ => {}
   40     40   
            }
   41     41   
            Ok(())
   42     42   
        })?;
   43     43   
        builder
   44     44   
            .build()
   45     45   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   46     46   
    }
   47     47   
}
          48  +
impl DoNothingInput {
          49  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          50  +
    pub fn deserialize_with_response(
          51  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          52  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          53  +
        _status: u16,
          54  +
        _body: &[u8],
          55  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          56  +
        Self::builder()
          57  +
            .build()
          58  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          59  +
    }
          60  +
}
   48     61   
impl DoNothingInput {
   49     62   
    /// Creates a new builder-style object to manufacture [`DoNothingInput`](crate::operation::do_nothing::DoNothingInput).
   50     63   
    pub fn builder() -> crate::operation::do_nothing::builders::DoNothingInputBuilder {
   51     64   
        crate::operation::do_nothing::builders::DoNothingInputBuilder::default()
   52     65   
    }
   53     66   
}
   54     67   
   55     68   
/// A builder for [`DoNothingInput`](crate::operation::do_nothing::DoNothingInput).
   56     69   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   57     70   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/naming_test_casing/rust-client-codegen/src/operation/do_nothing/_do_nothing_output.rs

@@ -1,1 +62,73 @@
   15     15   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   16     16   
    fn serialize_members(
   17     17   
        &self,
   18     18   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   19     19   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   20     20   
        Ok(())
   21     21   
    }
   22     22   
}
   23     23   
impl DoNothingOutput {
   24     24   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   25         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   26         -
        deserializer: &mut D,
          25  +
    pub fn deserialize(
          26  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   27     27   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   28     28   
        #[allow(unused_variables, unused_mut)]
   29     29   
        let mut builder = Self::builder();
   30     30   
        #[allow(
   31     31   
            unused_variables,
   32     32   
            unreachable_code,
   33     33   
            clippy::single_match,
   34     34   
            clippy::match_single_binding,
   35     35   
            clippy::diverging_sub_expression
   36     36   
        )]
   37         -
        deserializer.read_struct(&DONOTHINGOUTPUT_SCHEMA, (), |_, member, deser| {
          37  +
        deserializer.read_struct(&DONOTHINGOUTPUT_SCHEMA, &mut |member, deser| {
   38     38   
            match member.member_index() {
   39     39   
                _ => {}
   40     40   
            }
   41     41   
            Ok(())
   42     42   
        })?;
   43     43   
        Ok(builder.build())
   44     44   
    }
   45     45   
}
          46  +
impl DoNothingOutput {
          47  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          48  +
    pub fn deserialize_with_response(
          49  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          50  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          51  +
        _status: u16,
          52  +
        _body: &[u8],
          53  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          54  +
        Ok(Self::builder().build())
          55  +
    }
          56  +
}
   46     57   
impl DoNothingOutput {
   47     58   
    /// Creates a new builder-style object to manufacture [`DoNothingOutput`](crate::operation::do_nothing::DoNothingOutput).
   48     59   
    pub fn builder() -> crate::operation::do_nothing::builders::DoNothingOutputBuilder {
   49     60   
        crate::operation::do_nothing::builders::DoNothingOutputBuilder::default()
   50     61   
    }
   51     62   
}
   52     63   
   53     64   
/// A builder for [`DoNothingOutput`](crate::operation::do_nothing::DoNothingOutput).
   54     65   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   55     66   
#[non_exhaustive]

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

@@ -1,1 +26,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_do_nothing;

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

@@ -1,0 +32,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_do_nothing_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::do_nothing::DoNothingOutput, crate::operation::do_nothing::DoNothingError> {
    8         -
    #[allow(unused_mut)]
    9         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   10         -
        .map_err(crate::operation::do_nothing::DoNothingError::unhandled)?;
   11         -
    let generic = generic_builder.build();
   12         -
    Err(crate::operation::do_nothing::DoNothingError::generic(generic))
   13         -
}
   14         -
   15         -
#[allow(clippy::unnecessary_wraps)]
   16         -
pub fn de_do_nothing_http_response(
   17         -
    _response_status: u16,
   18         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   19         -
    _response_body: &[u8],
   20         -
) -> std::result::Result<crate::operation::do_nothing::DoNothingOutput, crate::operation::do_nothing::DoNothingError> {
   21         -
    Ok({
   22         -
        #[allow(unused_mut)]
   23         -
        let mut output = crate::operation::do_nothing::builders::DoNothingOutputBuilder::default();
   24         -
        output.build()
   25         -
    })
   26         -
}
   27         -
   28         -
pub fn ser_do_nothing_input(
   29         -
    _input: &crate::operation::do_nothing::DoNothingInput,
   30         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   31         -
    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
   32         -
}

tmp-codegen-diff/codegen-client-test/naming_test_casing/rust-client-codegen/src/serialization_settings.rs

@@ -1,0 +89,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
/*
    3         -
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
    4         -
 * SPDX-License-Identifier: Apache-2.0
    5         -
 */
    6         -
    7         -
#![allow(dead_code)]
    8         -
    9         -
use aws_smithy_http::header::set_request_header_if_absent;
   10         -
use aws_smithy_types::config_bag::{Storable, StoreReplace};
   11         -
use http_1x::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE};
   12         -
   13         -
/// Configuration for how default protocol headers are serialized
   14         -
#[derive(Clone, Debug, Default)]
   15         -
pub(crate) struct HeaderSerializationSettings {
   16         -
    omit_default_content_length: bool,
   17         -
    omit_default_content_type: bool,
   18         -
}
   19         -
   20         -
impl HeaderSerializationSettings {
   21         -
    /// Creates new [`HeaderSerializationSettings`]
   22         -
    pub(crate) fn new() -> Self {
   23         -
        Default::default()
   24         -
    }
   25         -
   26         -
    /// Omit the default `Content-Length` header during serialization
   27         -
    pub(crate) fn omit_default_content_length(self) -> Self {
   28         -
        Self {
   29         -
            omit_default_content_length: true,
   30         -
            ..self
   31         -
        }
   32         -
    }
   33         -
   34         -
    /// Omit the default `Content-Type` header during serialization
   35         -
    pub(crate) fn omit_default_content_type(self) -> Self {
   36         -
        Self {
   37         -
            omit_default_content_type: true,
   38         -
            ..self
   39         -
        }
   40         -
    }
   41         -
   42         -
    /// Returns true if the given default header name should be serialized
   43         -
    fn include_header(&self, header: &HeaderName) -> bool {
   44         -
        (!self.omit_default_content_length || header != CONTENT_LENGTH) && (!self.omit_default_content_type || header != CONTENT_TYPE)
   45         -
    }
   46         -
   47         -
    /// Sets a default header on the given request builder if it should be serialized
   48         -
    pub(crate) fn set_default_header(
   49         -
        &self,
   50         -
        mut request: http_1x::request::Builder,
   51         -
        header_name: HeaderName,
   52         -
        value: &str,
   53         -
    ) -> http_1x::request::Builder {
   54         -
        if self.include_header(&header_name) {
   55         -
            request = set_request_header_if_absent(request, header_name, value);
   56         -
        }
   57         -
        request
   58         -
    }
   59         -
}
   60         -
   61         -
impl Storable for HeaderSerializationSettings {
   62         -
    type Storer = StoreReplace<Self>;
   63         -
}
   64         -
   65         -
#[cfg(test)]
   66         -
mod tests {
   67         -
    use super::*;
   68         -
   69         -
    #[test]
   70         -
    fn test_include_header() {
   71         -
        let settings = HeaderSerializationSettings::default();
   72         -
        assert!(settings.include_header(&CONTENT_LENGTH));
   73         -
        assert!(settings.include_header(&CONTENT_TYPE));
   74         -
   75         -
        let settings = HeaderSerializationSettings::default().omit_default_content_length();
   76         -
        assert!(!settings.include_header(&CONTENT_LENGTH));
   77         -
        assert!(settings.include_header(&CONTENT_TYPE));
   78         -
   79         -
        let settings = HeaderSerializationSettings::default().omit_default_content_type();
   80         -
        assert!(settings.include_header(&CONTENT_LENGTH));
   81         -
        assert!(!settings.include_header(&CONTENT_TYPE));
   82         -
   83         -
        let settings = HeaderSerializationSettings::default()
   84         -
            .omit_default_content_type()
   85         -
            .omit_default_content_length();
   86         -
        assert!(!settings.include_header(&CONTENT_LENGTH));
   87         -
        assert!(!settings.include_header(&CONTENT_TYPE));
   88         -
    }
   89         -
}

tmp-codegen-diff/codegen-client-test/naming_test_ops/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#awsJson1_1"
   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/naming_test_ops/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 naming_test_ops::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("Config");
        1169  +
            if _service_config.protocol().is_none() {
        1170  +
                cfg.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1171  +
                    ::aws_smithy_json::protocol::aws_json_rpc::AwsJsonRpcProtocol::aws_json_1_1("Config"),
        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/naming_test_ops/rust-client-codegen/src/lib.rs

@@ -97,97 +133,129 @@
  117    117   
/// Data structures used by operation inputs/outputs.
  118    118   
pub mod types;
  119    119   
  120    120   
/// All operations that this crate can perform.
  121    121   
pub mod operation;
  122    122   
  123    123   
pub(crate) mod protocol_serde;
  124    124   
  125    125   
mod sdk_feature_tracker;
  126    126   
  127         -
mod serialization_settings;
  128         -
  129         -
mod serde_util;
  130         -
  131    127   
mod json_errors;
  132    128   
  133    129   
pub use client::Client;

tmp-codegen-diff/codegen-client-test/naming_test_ops/rust-client-codegen/src/operation/err_collisions.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 `ErrCollisions`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct ErrCollisions;
    6      6   
impl ErrCollisions {
    7      7   
    /// Creates a new `ErrCollisions`
    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::err_collisions::ErrCollisionsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::err_collisions::ErrCollisionsOutput::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::err_collisions::ErrCollisionsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::err_collisions::ErrCollisionsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::err_collisions::ErrCollisionsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +225,289 @@
  124    128   
        ::std::borrow::Cow::Owned(rcb)
  125    129   
    }
  126    130   
}
  127    131   
  128    132   
#[derive(Debug)]
  129    133   
struct ErrCollisionsResponseDeserializer;
  130    134   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ErrCollisionsResponseDeserializer {
  131    135   
    fn deserialize_nonstreaming(
  132    136   
        &self,
  133    137   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         138  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  134    139   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  135    140   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
  136         -
        let headers = response.headers();
  137         -
        let body = response.body().bytes().expect("body loaded");
  138    141   
        #[allow(unused_mut)]
  139    142   
        let mut force_error = false;
  140    143   
  141         -
        let parse_result = if !success && status != 200 || force_error {
  142         -
            crate::protocol_serde::shape_err_collisions::de_err_collisions_http_error(status, headers, body)
         144  +
        if !success && status != 200 || force_error {
         145  +
            let headers = response.headers();
         146  +
            let body = response.body().bytes().expect("body loaded");
         147  +
            #[allow(unused_mut)]
         148  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         149  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         150  +
            })?;
         151  +
         152  +
            let generic = generic_builder.build();
         153  +
            let error_code = match generic.code() {
         154  +
                ::std::option::Option::Some(code) => code,
         155  +
                ::std::option::Option::None => {
         156  +
                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         157  +
                        ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::err_collisions::ErrCollisionsError::unhandled(generic)),
         158  +
                    ))
         159  +
                }
         160  +
            };
         161  +
            let _error_message = generic.message().map(|msg| msg.to_owned());
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let err = match error_code {
         166  +
                "CollidingError" => crate::operation::err_collisions::ErrCollisionsError::CollidingError({
         167  +
                    let mut tmp = match protocol
         168  +
                        .deserialize_response(response, crate::types::error::CollidingError::SCHEMA, _cfg)
         169  +
                        .and_then(|mut deser| {
         170  +
                            crate::types::error::CollidingError::deserialize_with_response(
         171  +
                                &mut *deser,
         172  +
                                response.headers(),
         173  +
                                response.status().into(),
         174  +
                                body,
         175  +
                            )
         176  +
                        }) {
         177  +
                        ::std::result::Result::Ok(val) => val,
         178  +
                        ::std::result::Result::Err(e) => {
         179  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         180  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         181  +
                            ))
         182  +
                        }
         183  +
                    };
         184  +
                    tmp.meta = generic;
         185  +
                    if tmp.message.is_none() {
         186  +
                        tmp.message = _error_message;
         187  +
                    }
         188  +
                    tmp
         189  +
                }),
         190  +
                "CollidingException" => crate::operation::err_collisions::ErrCollisionsError::CollidingException({
         191  +
                    let mut tmp = match protocol
         192  +
                        .deserialize_response(response, crate::types::error::CollidingException::SCHEMA, _cfg)
         193  +
                        .and_then(|mut deser| {
         194  +
                            crate::types::error::CollidingException::deserialize_with_response(
         195  +
                                &mut *deser,
         196  +
                                response.headers(),
         197  +
                                response.status().into(),
         198  +
                                body,
         199  +
                            )
         200  +
                        }) {
         201  +
                        ::std::result::Result::Ok(val) => val,
         202  +
                        ::std::result::Result::Err(e) => {
         203  +
                            return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         204  +
                                ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         205  +
                            ))
         206  +
                        }
         207  +
                    };
         208  +
                    tmp.meta = generic;
         209  +
                    if tmp.message.is_none() {
         210  +
                        tmp.message = _error_message;
         211  +
                    }
         212  +
                    tmp
         213  +
                }),
         214  +
                _ => crate::operation::err_collisions::ErrCollisionsError::generic(generic),
         215  +
            };
         216  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         217  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
         218  +
            ))
  143    219   
        } else {
  144         -
            crate::protocol_serde::shape_err_collisions::de_err_collisions_http_response(status, headers, body)
  145         -
        };
  146         -
        crate::protocol_serde::type_erase_result(parse_result)
         220  +
            let protocol = _cfg
         221  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         222  +
                .expect("a SharedClientProtocol is required");
         223  +
            let mut deser = protocol.deserialize_response(response, ErrCollisions::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         224  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         225  +
            })?;
         226  +
            let body = response.body().bytes().expect("body loaded");
         227  +
            let output = crate::operation::err_collisions::ErrCollisionsOutput::deserialize_with_response(
         228  +
                &mut *deser,
         229  +
                response.headers(),
         230  +
                response.status().into(),
         231  +
                body,
         232  +
            )
         233  +
            .map_err(|e| {
         234  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         235  +
            })?;
         236  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         237  +
        }
  147    238   
    }
  148    239   
}
  149    240   
#[derive(Debug)]
  150    241   
struct ErrCollisionsRequestSerializer;
  151    242   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ErrCollisionsRequestSerializer {
  152    243   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  153    244   
    fn serialize_input(
  154    245   
        &self,
  155    246   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  156    247   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  157    248   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  158    249   
        let input = input
  159    250   
            .downcast::<crate::operation::err_collisions::ErrCollisionsInput>()
  160    251   
            .expect("correct type");
  161         -
        let _header_serialization_settings = _cfg
  162         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  163         -
            .cloned()
  164         -
            .unwrap_or_default();
  165         -
        let mut request_builder = {
  166         -
            #[allow(clippy::uninlined_format_args)]
  167         -
            fn uri_base(
  168         -
                _input: &crate::operation::err_collisions::ErrCollisionsInput,
  169         -
                output: &mut ::std::string::String,
  170         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  171         -
                use ::std::fmt::Write as _;
  172         -
                ::std::write!(output, "/").expect("formatting should succeed");
  173         -
                ::std::result::Result::Ok(())
  174         -
            }
  175         -
            #[allow(clippy::unnecessary_wraps)]
  176         -
            fn update_http_builder(
  177         -
                input: &crate::operation::err_collisions::ErrCollisionsInput,
  178         -
                builder: ::http_1x::request::Builder,
  179         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  180         -
                let mut uri = ::std::string::String::new();
  181         -
                uri_base(input, &mut uri)?;
  182         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  183         -
            }
  184         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  185         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
  186         -
            builder = _header_serialization_settings.set_default_header(
  187         -
                builder,
  188         -
                ::http_1x::header::HeaderName::from_static("x-amz-target"),
  189         -
                "Config.ErrCollisions",
  190         -
            );
  191         -
            builder
  192         -
        };
  193         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_err_collisions::ser_err_collisions_input(&input)?);
         252  +
        let protocol = _cfg
         253  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         254  +
            .expect("a SharedClientProtocol is required");
         255  +
        let mut request = protocol
         256  +
            .serialize_request(&input, ErrCollisions::INPUT_SCHEMA, "", _cfg)
         257  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  194    258   
  195         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         259  +
        return ::std::result::Result::Ok(request);
  196    260   
    }
  197    261   
}
  198    262   
#[derive(Debug)]
  199    263   
struct ErrCollisionsEndpointParamsInterceptor;
  200    264   
  201    265   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ErrCollisionsEndpointParamsInterceptor {
  202    266   
    fn name(&self) -> &'static str {
  203    267   
        "ErrCollisionsEndpointParamsInterceptor"
  204    268   
    }
  205    269   

tmp-codegen-diff/codegen-client-test/naming_test_ops/rust-client-codegen/src/operation/err_collisions/_err_collisions_input.rs

@@ -1,1 +66,79 @@
   15     15   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   16     16   
    fn serialize_members(
   17     17   
        &self,
   18     18   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   19     19   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   20     20   
        Ok(())
   21     21   
    }
   22     22   
}
   23     23   
impl ErrCollisionsInput {
   24     24   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   25         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   26         -
        deserializer: &mut D,
          25  +
    pub fn deserialize(
          26  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   27     27   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   28     28   
        #[allow(unused_variables, unused_mut)]
   29     29   
        let mut builder = Self::builder();
   30     30   
        #[allow(
   31     31   
            unused_variables,
   32     32   
            unreachable_code,
   33     33   
            clippy::single_match,
   34     34   
            clippy::match_single_binding,
   35     35   
            clippy::diverging_sub_expression
   36     36   
        )]
   37         -
        deserializer.read_struct(&ERRCOLLISIONSINPUT_SCHEMA, (), |_, member, deser| {
          37  +
        deserializer.read_struct(&ERRCOLLISIONSINPUT_SCHEMA, &mut |member, deser| {
   38     38   
            match member.member_index() {
   39     39   
                _ => {}
   40     40   
            }
   41     41   
            Ok(())
   42     42   
        })?;
   43     43   
        builder
   44     44   
            .build()
   45     45   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   46     46   
    }
   47     47   
}
          48  +
impl ErrCollisionsInput {
          49  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          50  +
    pub fn deserialize_with_response(
          51  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          52  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          53  +
        _status: u16,
          54  +
        _body: &[u8],
          55  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          56  +
        Self::builder()
          57  +
            .build()
          58  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          59  +
    }
          60  +
}
   48     61   
impl ErrCollisionsInput {
   49     62   
    /// Creates a new builder-style object to manufacture [`ErrCollisionsInput`](crate::operation::err_collisions::ErrCollisionsInput).
   50     63   
    pub fn builder() -> crate::operation::err_collisions::builders::ErrCollisionsInputBuilder {
   51     64   
        crate::operation::err_collisions::builders::ErrCollisionsInputBuilder::default()
   52     65   
    }
   53     66   
}
   54     67   
   55     68   
/// A builder for [`ErrCollisionsInput`](crate::operation::err_collisions::ErrCollisionsInput).
   56     69   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   57     70   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/naming_test_ops/rust-client-codegen/src/operation/err_collisions/_err_collisions_output.rs

@@ -1,1 +62,73 @@
   15     15   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   16     16   
    fn serialize_members(
   17     17   
        &self,
   18     18   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   19     19   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   20     20   
        Ok(())
   21     21   
    }
   22     22   
}
   23     23   
impl ErrCollisionsOutput {
   24     24   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   25         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   26         -
        deserializer: &mut D,
          25  +
    pub fn deserialize(
          26  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   27     27   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   28     28   
        #[allow(unused_variables, unused_mut)]
   29     29   
        let mut builder = Self::builder();
   30     30   
        #[allow(
   31     31   
            unused_variables,
   32     32   
            unreachable_code,
   33     33   
            clippy::single_match,
   34     34   
            clippy::match_single_binding,
   35     35   
            clippy::diverging_sub_expression
   36     36   
        )]
   37         -
        deserializer.read_struct(&ERRCOLLISIONSOUTPUT_SCHEMA, (), |_, member, deser| {
          37  +
        deserializer.read_struct(&ERRCOLLISIONSOUTPUT_SCHEMA, &mut |member, deser| {
   38     38   
            match member.member_index() {
   39     39   
                _ => {}
   40     40   
            }
   41     41   
            Ok(())
   42     42   
        })?;
   43     43   
        Ok(builder.build())
   44     44   
    }
   45     45   
}
          46  +
impl ErrCollisionsOutput {
          47  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          48  +
    pub fn deserialize_with_response(
          49  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          50  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          51  +
        _status: u16,
          52  +
        _body: &[u8],
          53  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          54  +
        Ok(Self::builder().build())
          55  +
    }
          56  +
}
   46     57   
impl ErrCollisionsOutput {
   47     58   
    /// Creates a new builder-style object to manufacture [`ErrCollisionsOutput`](crate::operation::err_collisions::ErrCollisionsOutput).
   48     59   
    pub fn builder() -> crate::operation::err_collisions::builders::ErrCollisionsOutputBuilder {
   49     60   
        crate::operation::err_collisions::builders::ErrCollisionsOutputBuilder::default()
   50     61   
    }
   51     62   
}
   52     63   
   53     64   
/// A builder for [`ErrCollisionsOutput`](crate::operation::err_collisions::ErrCollisionsOutput).
   54     65   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   55     66   
#[non_exhaustive]