Client Test

Client Test

rev. b089fac03cba5061dd86d9628e74511b55f01c68 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_xml_extras/rust-client-codegen/src/operation/enum_keys.rs

@@ -209,209 +269,271 @@
  229    229   
#[cfg(test)]
  230    230   
mod enum_keys_test {
  231    231   
  232    232   
    /// Test ID: SerEnumMap
  233    233   
    #[::tokio::test]
  234    234   
    #[::tracing_test::traced_test]
  235    235   
    async fn ser_enum_map_request() {
  236    236   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  237    237   
        let config_builder = crate::config::Config::builder()
  238    238   
            .with_test_defaults()
  239         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         239  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         240  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         241  +
            .allow_no_auth()
  240    242   
            .endpoint_url("https://example.com");
  241    243   
  242    244   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  243    245   
        let result = client
  244    246   
            .enum_keys()
  245    247   
            .set_data(::std::option::Option::Some({
  246    248   
                let mut ret = ::std::collections::HashMap::new();
  247    249   
                ret.insert(
  248    250   
                    "enumvalue".parse::<crate::types::StringEnum>().expect("static value validated to member"),
  249    251   
                    "hello".to_owned(),

tmp-codegen-diff/codegen-client-test/rest_xml_extras/rust-client-codegen/src/operation/primitive_int_op_xml.rs

@@ -224,224 +310,314 @@
  244    244   
mod primitive_int_op_xml_test {
  245    245   
  246    246   
    /// Primitive ints should not be serialized when they are unset
  247    247   
    /// Test ID: RestXmlSerPrimitiveIntUnset
  248    248   
    #[::tokio::test]
  249    249   
    #[::tracing_test::traced_test]
  250    250   
    async fn rest_xml_ser_primitive_int_unset_request() {
  251    251   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  252    252   
        let config_builder = crate::config::Config::builder()
  253    253   
            .with_test_defaults()
  254         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         254  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         255  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         256  +
            .allow_no_auth()
  255    257   
            .endpoint_url("https://example.com");
  256    258   
  257    259   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  258    260   
        let result = client.primitive_int_op_xml().send().await;
  259    261   
        let _ = dbg!(result);
  260    262   
        let http_request = request_receiver.expect_request();
  261    263   
        let body = http_request.body().bytes().expect("body should be strict");
  262    264   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  263    265   
            body,
  264    266   
            "    <PrimitiveIntDocument>\n    </PrimitiveIntDocument>\n",
  265    267   
            ::aws_smithy_protocol_test::MediaType::from("application/xml"),
  266    268   
        ));
  267    269   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  268    270   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  269    271   
        ::pretty_assertions::assert_eq!(uri.path(), "/primitive-document", "path was incorrect");
  270    272   
    }
  271    273   
  272    274   
    /// Primitive ints should not be serialized when they are unset
  273    275   
    /// Test ID: RestXmlSerPrimitiveIntSetToDefault
  274    276   
    #[::tokio::test]
  275    277   
    #[::tracing_test::traced_test]
  276    278   
    async fn rest_xml_ser_primitive_int_set_to_default_request() {
  277    279   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  278    280   
        let config_builder = crate::config::Config::builder()
  279    281   
            .with_test_defaults()
  280         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         282  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         283  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         284  +
            .allow_no_auth()
  281    285   
            .endpoint_url("https://example.com");
  282    286   
  283    287   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  284    288   
        let result = client.primitive_int_op_xml().set_value(::std::option::Option::Some(1)).send().await;
  285    289   
        let _ = dbg!(result);
  286    290   
        let http_request = request_receiver.expect_request();
  287    291   
        let body = http_request.body().bytes().expect("body should be strict");
  288    292   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  289    293   
            body,
  290    294   
            "<PrimitiveIntDocument>\n     <value>1</value>\n</PrimitiveIntDocument>\n",

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

@@ -350,350 +409,427 @@
  370    370   
  371    371   
    /// Set the auth scheme resolver for the builder
  372    372   
    ///
  373    373   
    /// # Examples
  374    374   
    /// See an example for [`Self::auth_scheme_resolver`].
  375    375   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  376    376   
        self.runtime_components
  377    377   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  378    378   
        self
  379    379   
    }
         380  +
         381  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         382  +
    ///
         383  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         384  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         385  +
    pub fn allow_no_auth(mut self) -> Self {
         386  +
        self.set_allow_no_auth();
         387  +
        self
         388  +
    }
         389  +
         390  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         391  +
    ///
         392  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         393  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         394  +
    pub fn set_allow_no_auth(&mut self) -> &mut Self {
         395  +
        self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
         396  +
        self
         397  +
    }
  380    398   
    /// Set the auth scheme preference for an auth scheme resolver
  381    399   
    /// (typically the default auth scheme resolver).
  382    400   
    ///
  383    401   
    /// Each operation has a predefined order of auth schemes, as determined by the service,
  384    402   
    /// for auth scheme resolution. By using the auth scheme preference, customers
  385    403   
    /// can reorder the schemes resolved by the auth scheme resolver.
  386    404   
    ///
  387    405   
    /// The preference list is intended as a hint rather than a strict override.
  388    406   
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
  389    407   
    ///
@@ -1198,1216 +1257,1276 @@
 1218   1236   
    {
 1219   1237   
        if config.behavior_version.is_none() {
 1220   1238   
            config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
 1221   1239   
        }
 1222   1240   
    }
 1223   1241   
 1224   1242   
    let default_retry_partition = "restxmlprotocol";
 1225   1243   
 1226   1244   
    let scope = "rest_xml_extras_unwrapped";
 1227   1245   
        1246  +
    #[allow(deprecated)]
 1228   1247   
                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
 1229   1248   
                        // defaults
 1230   1249   
                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
 1231   1250   
                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
 1232   1251   
                                .with_retry_partition_name(default_retry_partition)
 1233   1252   
                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
 1234   1253   
                        ))
 1235   1254   
                        // user config
 1236   1255   
                        .with_client_plugin(
 1237   1256   
                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()

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

@@ -350,350 +409,427 @@
  370    370   
  371    371   
    /// Set the auth scheme resolver for the builder
  372    372   
    ///
  373    373   
    /// # Examples
  374    374   
    /// See an example for [`Self::auth_scheme_resolver`].
  375    375   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  376    376   
        self.runtime_components
  377    377   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  378    378   
        self
  379    379   
    }
         380  +
         381  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         382  +
    ///
         383  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         384  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         385  +
    pub fn allow_no_auth(mut self) -> Self {
         386  +
        self.set_allow_no_auth();
         387  +
        self
         388  +
    }
         389  +
         390  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         391  +
    ///
         392  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         393  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         394  +
    pub fn set_allow_no_auth(&mut self) -> &mut Self {
         395  +
        self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
         396  +
        self
         397  +
    }
  380    398   
    /// Set the auth scheme preference for an auth scheme resolver
  381    399   
    /// (typically the default auth scheme resolver).
  382    400   
    ///
  383    401   
    /// Each operation has a predefined order of auth schemes, as determined by the service,
  384    402   
    /// for auth scheme resolution. By using the auth scheme preference, customers
  385    403   
    /// can reorder the schemes resolved by the auth scheme resolver.
  386    404   
    ///
  387    405   
    /// The preference list is intended as a hint rather than a strict override.
  388    406   
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
  389    407   
    ///
@@ -1198,1216 +1257,1276 @@
 1218   1236   
    {
 1219   1237   
        if config.behavior_version.is_none() {
 1220   1238   
            config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
 1221   1239   
        }
 1222   1240   
    }
 1223   1241   
 1224   1242   
    let default_retry_partition = "restxmlprotocolnamespace";
 1225   1243   
 1226   1244   
    let scope = "rest_xml_namespace";
 1227   1245   
        1246  +
    #[allow(deprecated)]
 1228   1247   
                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
 1229   1248   
                        // defaults
 1230   1249   
                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
 1231   1250   
                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
 1232   1251   
                                .with_retry_partition_name(default_retry_partition)
 1233   1252   
                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
 1234   1253   
                        ))
 1235   1254   
                        // user config
 1236   1255   
                        .with_client_plugin(
 1237   1256   
                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()

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

@@ -71,71 +148,130 @@
   91     91   
    pub fn builder() -> crate::config::auth::ParamsBuilder {
   92     92   
        crate::config::auth::ParamsBuilder::default()
   93     93   
    }
   94     94   
   95     95   
    /// Return the operation name for [`Params`]
   96     96   
    pub fn operation_name(&self) -> &str {
   97     97   
        self.operation_name.as_ref()
   98     98   
    }
   99     99   
}
  100    100   
  101         -
#[cfg(test)]
  102         -
#[derive(Debug)]
  103         -
pub(crate) struct NoAuthSchemeResolver;
  104         -
  105         -
#[cfg(test)]
  106         -
impl ResolveAuthScheme for NoAuthSchemeResolver {
  107         -
    fn resolve_auth_scheme<'a>(
  108         -
        &'a self,
  109         -
        _params: &'a crate::config::auth::Params,
  110         -
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
  111         -
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
  112         -
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
  113         -
        ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(::std::result::Result::Ok(vec![
  114         -
            ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID),
  115         -
        ]))
  116         -
    }
  117         -
}
  118         -
  119    101   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  120    102   
/// Builder for [`Params`]
  121    103   
pub struct ParamsBuilder {
  122    104   
    operation_name: ::std::option::Option<::std::borrow::Cow<'static, str>>,
  123    105   
}
  124    106   
impl ParamsBuilder {
  125    107   
    /// Set the operation name for the builder
  126    108   
    pub fn operation_name(self, operation_name: impl Into<::std::borrow::Cow<'static, str>>) -> Self {
  127    109   
        self.set_operation_name(::std::option::Option::Some(operation_name.into()))
  128    110   
    }

tmp-codegen-diff/codegen-client-test/rest_xml_namespace/rust-client-codegen/src/operation/simple_scalar_properties.rs

@@ -226,226 +286,288 @@
  246    246   
    use ::aws_smithy_protocol_test::FloatEquals;
  247    247   
  248    248   
    /// Serializes simple scalar properties
  249    249   
    /// Test ID: XmlNamespaceSimpleScalarProperties
  250    250   
    #[::tokio::test]
  251    251   
    #[::tracing_test::traced_test]
  252    252   
    async fn xml_namespace_simple_scalar_properties_request() {
  253    253   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  254    254   
        let config_builder = crate::config::Config::builder()
  255    255   
            .with_test_defaults()
  256         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         256  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         257  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         258  +
            .allow_no_auth()
  257    259   
            .endpoint_url("https://example.com");
  258    260   
  259    261   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  260    262   
        let result = client
  261    263   
            .simple_scalar_properties()
  262    264   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  263    265   
            .set_string_value(::std::option::Option::Some("string".to_owned()))
  264    266   
            .set_true_boolean_value(::std::option::Option::Some(true))
  265    267   
            .set_false_boolean_value(::std::option::Option::Some(false))
  266    268   
            .set_byte_value(::std::option::Option::Some(1))

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

@@ -350,350 +409,427 @@
  370    370   
  371    371   
    /// Set the auth scheme resolver for the builder
  372    372   
    ///
  373    373   
    /// # Examples
  374    374   
    /// See an example for [`Self::auth_scheme_resolver`].
  375    375   
    pub fn set_auth_scheme_resolver(&mut self, auth_scheme_resolver: impl crate::config::auth::ResolveAuthScheme + 'static) -> &mut Self {
  376    376   
        self.runtime_components
  377    377   
            .set_auth_scheme_option_resolver(::std::option::Option::Some(auth_scheme_resolver.into_shared_resolver()));
  378    378   
        self
  379    379   
    }
         380  +
         381  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         382  +
    ///
         383  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         384  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         385  +
    pub fn allow_no_auth(mut self) -> Self {
         386  +
        self.set_allow_no_auth();
         387  +
        self
         388  +
    }
         389  +
         390  +
    /// Enable no authentication regardless of what authentication mechanisms operations support
         391  +
    ///
         392  +
    /// This adds [NoAuthScheme](aws_smithy_runtime::client::auth::no_auth::NoAuthScheme) as a fallback
         393  +
    /// and the auth scheme resolver will use it when no other auth schemes are applicable.
         394  +
    pub fn set_allow_no_auth(&mut self) -> &mut Self {
         395  +
        self.push_runtime_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePluginV2::new().into_shared());
         396  +
        self
         397  +
    }
  380    398   
    /// Set the auth scheme preference for an auth scheme resolver
  381    399   
    /// (typically the default auth scheme resolver).
  382    400   
    ///
  383    401   
    /// Each operation has a predefined order of auth schemes, as determined by the service,
  384    402   
    /// for auth scheme resolution. By using the auth scheme preference, customers
  385    403   
    /// can reorder the schemes resolved by the auth scheme resolver.
  386    404   
    ///
  387    405   
    /// The preference list is intended as a hint rather than a strict override.
  388    406   
    /// Any schemes not present in the originally resolved auth schemes will be ignored.
  389    407   
    ///
@@ -1197,1215 +1256,1275 @@
 1217   1235   
    {
 1218   1236   
        if config.behavior_version.is_none() {
 1219   1237   
            config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest());
 1220   1238   
        }
 1221   1239   
    }
 1222   1240   
 1223   1241   
    let default_retry_partition = "rpcv2protocol";
 1224   1242   
 1225   1243   
    let scope = "rpcv2cbor";
 1226   1244   
        1245  +
    #[allow(deprecated)]
 1227   1246   
                    let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new()
 1228   1247   
                        // defaults
 1229   1248   
                        .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins(
 1230   1249   
                            ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new()
 1231   1250   
                                .with_retry_partition_name(default_retry_partition)
 1232   1251   
                                .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature."))
 1233   1252   
                        ))
 1234   1253   
                        // user config
 1235   1254   
                        .with_client_plugin(
 1236   1255   
                            ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new()

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

@@ -73,73 +150,132 @@
   93     93   
    pub fn builder() -> crate::config::auth::ParamsBuilder {
   94     94   
        crate::config::auth::ParamsBuilder::default()
   95     95   
    }
   96     96   
   97     97   
    /// Return the operation name for [`Params`]
   98     98   
    pub fn operation_name(&self) -> &str {
   99     99   
        self.operation_name.as_ref()
  100    100   
    }
  101    101   
}
  102    102   
  103         -
#[cfg(test)]
  104         -
#[derive(Debug)]
  105         -
pub(crate) struct NoAuthSchemeResolver;
  106         -
  107         -
#[cfg(test)]
  108         -
impl ResolveAuthScheme for NoAuthSchemeResolver {
  109         -
    fn resolve_auth_scheme<'a>(
  110         -
        &'a self,
  111         -
        _params: &'a crate::config::auth::Params,
  112         -
        _cfg: &'a ::aws_smithy_types::config_bag::ConfigBag,
  113         -
        _runtime_components: &'a ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents,
  114         -
    ) -> ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture<'a> {
  115         -
        ::aws_smithy_runtime_api::client::auth::AuthSchemeOptionsFuture::ready(::std::result::Result::Ok(vec![
  116         -
            ::aws_smithy_runtime_api::client::auth::AuthSchemeOption::from(::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID),
  117         -
        ]))
  118         -
    }
  119         -
}
  120         -
  121    103   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  122    104   
/// Builder for [`Params`]
  123    105   
pub struct ParamsBuilder {
  124    106   
    operation_name: ::std::option::Option<::std::borrow::Cow<'static, str>>,
  125    107   
}
  126    108   
impl ParamsBuilder {
  127    109   
    /// Set the operation name for the builder
  128    110   
    pub fn operation_name(self, operation_name: impl Into<::std::borrow::Cow<'static, str>>) -> Self {
  129    111   
        self.set_operation_name(::std::option::Option::Some(operation_name.into()))
  130    112   
    }

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/empty_input_output.rs

@@ -220,220 +280,282 @@
  240    240   
mod empty_input_output_test {
  241    241   
  242    242   
    /// When Input structure is empty we write CBOR equivalent of {}
  243    243   
    /// Test ID: empty_input
  244    244   
    #[::tokio::test]
  245    245   
    #[::tracing_test::traced_test]
  246    246   
    async fn empty_input_request() {
  247    247   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  248    248   
        let config_builder = crate::config::Config::builder()
  249    249   
            .with_test_defaults()
  250         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         250  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         251  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         252  +
            .allow_no_auth()
  251    253   
            .endpoint_url("https://example.com");
  252    254   
  253    255   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  254    256   
        let result = client.empty_input_output().send().await;
  255    257   
        let _ = dbg!(result);
  256    258   
        let http_request = request_receiver.expect_request();
  257    259   
        let expected_headers = [
  258    260   
            ("Accept", "application/cbor"),
  259    261   
            ("Content-Type", "application/cbor"),
  260    262   
            ("smithy-protocol", "rpc-v2-cbor"),

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/no_input_output.rs

@@ -219,219 +279,281 @@
  239    239   
mod no_input_output_test {
  240    240   
  241    241   
    /// Body is empty and no Content-Type header if no input
  242    242   
    /// Test ID: no_input
  243    243   
    #[::tokio::test]
  244    244   
    #[::tracing_test::traced_test]
  245    245   
    async fn no_input_request() {
  246    246   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  247    247   
        let config_builder = crate::config::Config::builder()
  248    248   
            .with_test_defaults()
  249         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         249  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         250  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         251  +
            .allow_no_auth()
  250    252   
            .endpoint_url("https://example.com");
  251    253   
  252    254   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  253    255   
        let result = client.no_input_output().send().await;
  254    256   
        let _ = dbg!(result);
  255    257   
        let http_request = request_receiver.expect_request();
  256    258   
        let expected_headers = [("Accept", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  257    259   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  258    260   
        let forbidden_headers = &["Content-Type", "X-Amz-Target"];
  259    261   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/operation_with_defaults.rs

@@ -230,230 +361,367 @@
  250    250   
  251    251   
    /// Client populates default values in input.
  252    252   
    /// Test ID: RpcV2CborClientPopulatesDefaultValuesInInput
  253    253   
    #[::tokio::test]
  254    254   
    #[::tracing_test::traced_test]
  255    255   
    #[should_panic]
  256    256   
    async fn rpc_v2_cbor_client_populates_default_values_in_input_request() {
  257    257   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  258    258   
        let config_builder = crate::config::Config::builder()
  259    259   
            .with_test_defaults()
  260         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         260  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         261  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         262  +
            .allow_no_auth()
  261    263   
            .endpoint_url("https://example.com");
  262    264   
  263    265   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  264    266   
        let result = client
  265    267   
            .operation_with_defaults()
  266    268   
            .set_defaults(::std::option::Option::Some(crate::types::Defaults::builder().build()))
  267    269   
            .send()
  268    270   
            .await;
  269    271   
        let _ = dbg!(result);
  270    272   
        let http_request = request_receiver.expect_request();
  271    273   
        let expected_headers = [
  272    274   
            ("Accept", "application/cbor"),
  273    275   
            ("Content-Type", "application/cbor"),
  274    276   
            ("smithy-protocol", "rpc-v2-cbor"),
  275    277   
        ];
  276    278   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  277    279   
        let required_headers = &["Content-Length"];
  278    280   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  279    281   
        let body = http_request.body().bytes().expect("body should be strict");
  280    282   
        ::aws_smithy_protocol_test::assert_ok(
  281    283   
        ::aws_smithy_protocol_test::validate_body(body, "v2hkZWZhdWx0c79tZGVmYXVsdFN0cmluZ2JoaW5kZWZhdWx0Qm9vbGVhbvVrZGVmYXVsdExpc3Sf/3BkZWZhdWx0VGltZXN0YW1wwQBrZGVmYXVsdEJsb2JDYWJja2RlZmF1bHRCeXRlAWxkZWZhdWx0U2hvcnQBbmRlZmF1bHRJbnRlZ2VyCmtkZWZhdWx0TG9uZxhkbGRlZmF1bHRGbG9hdPo/gAAAbWRlZmF1bHREb3VibGX6P4AAAGpkZWZhdWx0TWFwv/9rZGVmYXVsdEVudW1jRk9PbmRlZmF1bHRJbnRFbnVtAWtlbXB0eVN0cmluZ2BsZmFsc2VCb29sZWFu9GllbXB0eUJsb2JAaHplcm9CeXRlAGl6ZXJvU2hvcnQAa3plcm9JbnRlZ2VyAGh6ZXJvTG9uZwBpemVyb0Zsb2F0+gAAAABqemVyb0RvdWJsZfoAAAAA//8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
  282    284   
        );
  283    285   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  284    286   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  285    287   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/OperationWithDefaults", "path was incorrect");
  286    288   
    }
  287    289   
  288    290   
    /// Client skips top level default values in input.
  289    291   
    /// Test ID: RpcV2CborClientSkipsTopLevelDefaultValuesInInput
  290    292   
    #[::tokio::test]
  291    293   
    #[::tracing_test::traced_test]
  292    294   
    async fn rpc_v2_cbor_client_skips_top_level_default_values_in_input_request() {
  293    295   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  294    296   
        let config_builder = crate::config::Config::builder()
  295    297   
            .with_test_defaults()
  296         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         298  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         299  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         300  +
            .allow_no_auth()
  297    301   
            .endpoint_url("https://example.com");
  298    302   
  299    303   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  300    304   
        let result = client.operation_with_defaults().send().await;
  301    305   
        let _ = dbg!(result);
  302    306   
        let http_request = request_receiver.expect_request();
  303    307   
        let expected_headers = [
  304    308   
            ("Accept", "application/cbor"),
  305    309   
            ("Content-Type", "application/cbor"),
  306    310   
            ("smithy-protocol", "rpc-v2-cbor"),
  307    311   
        ];
  308    312   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  309    313   
        let required_headers = &["Content-Length"];
  310    314   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  311    315   
        let body = http_request.body().bytes().expect("body should be strict");
  312    316   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  313    317   
            body,
  314    318   
            "v/8=",
  315    319   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  316    320   
        ));
  317    321   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  318    322   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  319    323   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/OperationWithDefaults", "path was incorrect");
  320    324   
    }
  321    325   
  322    326   
    /// Client uses explicitly provided member values over defaults
  323    327   
    /// Test ID: RpcV2CborClientUsesExplicitlyProvidedMemberValuesOverDefaults
  324    328   
    #[::tokio::test]
  325    329   
    #[::tracing_test::traced_test]
  326    330   
    #[should_panic]
  327    331   
    async fn rpc_v2_cbor_client_uses_explicitly_provided_member_values_over_defaults_request() {
  328    332   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  329    333   
        let config_builder = crate::config::Config::builder()
  330    334   
            .with_test_defaults()
  331         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         335  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         336  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         337  +
            .allow_no_auth()
  332    338   
            .endpoint_url("https://example.com");
  333    339   
  334    340   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  335    341   
        let result = client
  336    342   
            .operation_with_defaults()
  337    343   
            .set_defaults(::std::option::Option::Some(
  338    344   
                crate::types::Defaults::builder()
  339    345   
                    .set_default_string(::std::option::Option::Some("bye".to_owned()))
  340    346   
                    .set_default_boolean(::std::option::Option::Some(true))
  341    347   
                    .set_default_list(::std::option::Option::Some(vec!["a".to_owned()]))
@@ -369,375 +468,478 @@
  389    395   
    }
  390    396   
  391    397   
    /// Any time a value is provided for a member in the top level of input, it is used, regardless of if its the default.
  392    398   
    /// Test ID: RpcV2CborClientUsesExplicitlyProvidedValuesInTopLevel
  393    399   
    #[::tokio::test]
  394    400   
    #[::tracing_test::traced_test]
  395    401   
    async fn rpc_v2_cbor_client_uses_explicitly_provided_values_in_top_level_request() {
  396    402   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  397    403   
        let config_builder = crate::config::Config::builder()
  398    404   
            .with_test_defaults()
  399         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         405  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         406  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         407  +
            .allow_no_auth()
  400    408   
            .endpoint_url("https://example.com");
  401    409   
  402    410   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  403    411   
        let result = client
  404    412   
            .operation_with_defaults()
  405    413   
            .set_top_level_default(::std::option::Option::Some("hi".to_owned()))
  406    414   
            .set_other_top_level_default(::std::option::Option::Some(0))
  407    415   
            .send()
  408    416   
            .await;
  409    417   
        let _ = dbg!(result);
  410    418   
        let http_request = request_receiver.expect_request();
  411    419   
        let expected_headers = [
  412    420   
            ("Accept", "application/cbor"),
  413    421   
            ("Content-Type", "application/cbor"),
  414    422   
            ("smithy-protocol", "rpc-v2-cbor"),
  415    423   
        ];
  416    424   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  417    425   
        let required_headers = &["Content-Length"];
  418    426   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  419    427   
        let body = http_request.body().bytes().expect("body should be strict");
  420    428   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  421    429   
            body,
  422    430   
            "v290b3BMZXZlbERlZmF1bHRiaGl0b3RoZXJUb3BMZXZlbERlZmF1bHQA/w==",
  423    431   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  424    432   
        ));
  425    433   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  426    434   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  427    435   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/OperationWithDefaults", "path was incorrect");
  428    436   
    }
  429    437   
  430    438   
    /// Typically, non top-level members would have defaults filled in, but if they have the clientOptional trait, the defaults should be ignored.
  431    439   
    /// Test ID: RpcV2CborClientIgnoresNonTopLevelDefaultsOnMembersWithClientOptional
  432    440   
    #[::tokio::test]
  433    441   
    #[::tracing_test::traced_test]
  434    442   
    async fn rpc_v2_cbor_client_ignores_non_top_level_defaults_on_members_with_client_optional_request() {
  435    443   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  436    444   
        let config_builder = crate::config::Config::builder()
  437    445   
            .with_test_defaults()
  438         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         446  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         447  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         448  +
            .allow_no_auth()
  439    449   
            .endpoint_url("https://example.com");
  440    450   
  441    451   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  442    452   
        let result = client
  443    453   
            .operation_with_defaults()
  444    454   
            .set_client_optional_defaults(::std::option::Option::Some(crate::types::ClientOptionalDefaults::builder().build()))
  445    455   
            .send()
  446    456   
            .await;
  447    457   
        let _ = dbg!(result);
  448    458   
        let http_request = request_receiver.expect_request();

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/optional_input_output.rs

@@ -222,222 +282,284 @@
  242    242   
mod optional_input_output_test {
  243    243   
  244    244   
    /// When input is empty we write CBOR equivalent of {}
  245    245   
    /// Test ID: optional_input
  246    246   
    #[::tokio::test]
  247    247   
    #[::tracing_test::traced_test]
  248    248   
    async fn optional_input_request() {
  249    249   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  250    250   
        let config_builder = crate::config::Config::builder()
  251    251   
            .with_test_defaults()
  252         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         252  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         253  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         254  +
            .allow_no_auth()
  253    255   
            .endpoint_url("https://example.com");
  254    256   
  255    257   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  256    258   
        let result = client.optional_input_output().send().await;
  257    259   
        let _ = dbg!(result);
  258    260   
        let http_request = request_receiver.expect_request();
  259    261   
        let expected_headers = [
  260    262   
            ("Accept", "application/cbor"),
  261    263   
            ("Content-Type", "application/cbor"),
  262    264   
            ("smithy-protocol", "rpc-v2-cbor"),

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/recursive_shapes.rs

@@ -220,220 +280,282 @@
  240    240   
mod recursive_shapes_test {
  241    241   
  242    242   
    /// Serializes recursive structures
  243    243   
    /// Test ID: RpcV2CborRecursiveShapes
  244    244   
    #[::tokio::test]
  245    245   
    #[::tracing_test::traced_test]
  246    246   
    async fn rpc_v2_cbor_recursive_shapes_request() {
  247    247   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  248    248   
        let config_builder = crate::config::Config::builder()
  249    249   
            .with_test_defaults()
  250         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         250  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         251  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         252  +
            .allow_no_auth()
  251    253   
            .endpoint_url("https://example.com");
  252    254   
  253    255   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  254    256   
        let result = client
  255    257   
            .recursive_shapes()
  256    258   
            .set_nested(::std::option::Option::Some(
  257    259   
                crate::types::RecursiveShapesInputOutputNested1::builder()
  258    260   
                    .set_foo(::std::option::Option::Some("Foo1".to_owned()))
  259    261   
                    .set_nested(::std::option::Option::Some(::std::boxed::Box::new(
  260    262   
                        crate::types::RecursiveShapesInputOutputNested2::builder()

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/rpc_v2_cbor_dense_maps.rs

@@ -222,222 +382,388 @@
  242    242   
mod rpc_v2_cbor_dense_maps_test {
  243    243   
  244    244   
    /// Serializes maps
  245    245   
    /// Test ID: RpcV2CborMaps
  246    246   
    #[::tokio::test]
  247    247   
    #[::tracing_test::traced_test]
  248    248   
    async fn rpc_v2_cbor_maps_request() {
  249    249   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  250    250   
        let config_builder = crate::config::Config::builder()
  251    251   
            .with_test_defaults()
  252         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         252  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         253  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         254  +
            .allow_no_auth()
  253    255   
            .endpoint_url("https://example.com");
  254    256   
  255    257   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  256    258   
        let result = client
  257    259   
            .rpc_v2_cbor_dense_maps()
  258    260   
            .set_dense_struct_map(::std::option::Option::Some({
  259    261   
                let mut ret = ::std::collections::HashMap::new();
  260    262   
                ret.insert(
  261    263   
                    "foo".to_owned(),
  262    264   
                    crate::types::GreetingStruct::builder()
  263    265   
                        .set_hi(::std::option::Option::Some("there".to_owned()))
  264    266   
                        .build(),
  265    267   
                );
  266    268   
                ret.insert(
  267    269   
                    "baz".to_owned(),
  268    270   
                    crate::types::GreetingStruct::builder()
  269    271   
                        .set_hi(::std::option::Option::Some("bye".to_owned()))
  270    272   
                        .build(),
  271    273   
                );
  272    274   
                ret
  273    275   
            }))
  274    276   
            .send()
  275    277   
            .await;
  276    278   
        let _ = dbg!(result);
  277    279   
        let http_request = request_receiver.expect_request();
  278    280   
        let expected_headers = [
  279    281   
            ("Accept", "application/cbor"),
  280    282   
            ("Content-Type", "application/cbor"),
  281    283   
            ("smithy-protocol", "rpc-v2-cbor"),
  282    284   
        ];
  283    285   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  284    286   
        let required_headers = &["Content-Length"];
  285    287   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  286    288   
        let body = http_request.body().bytes().expect("body should be strict");
  287    289   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  288    290   
            body,
  289    291   
            "oW5kZW5zZVN0cnVjdE1hcKJjZm9voWJoaWV0aGVyZWNiYXqhYmhpY2J5ZQ==",
  290    292   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  291    293   
        ));
  292    294   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  293    295   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  294    296   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps", "path was incorrect");
  295    297   
    }
  296    298   
  297    299   
    /// Ensure that 0 and false are sent over the wire in all maps and lists
  298    300   
    /// Test ID: RpcV2CborSerializesZeroValuesInMaps
  299    301   
    #[::tokio::test]
  300    302   
    #[::tracing_test::traced_test]
  301    303   
    async fn rpc_v2_cbor_serializes_zero_values_in_maps_request() {
  302    304   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  303    305   
        let config_builder = crate::config::Config::builder()
  304    306   
            .with_test_defaults()
  305         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         307  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         308  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         309  +
            .allow_no_auth()
  306    310   
            .endpoint_url("https://example.com");
  307    311   
  308    312   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  309    313   
        let result = client
  310    314   
            .rpc_v2_cbor_dense_maps()
  311    315   
            .set_dense_number_map(::std::option::Option::Some({
  312    316   
                let mut ret = ::std::collections::HashMap::new();
  313    317   
                ret.insert("x".to_owned(), 0);
  314    318   
                ret
  315    319   
            }))
  316    320   
            .set_dense_boolean_map(::std::option::Option::Some({
  317    321   
                let mut ret = ::std::collections::HashMap::new();
  318    322   
                ret.insert("x".to_owned(), false);
  319    323   
                ret
  320    324   
            }))
  321    325   
            .send()
  322    326   
            .await;
  323    327   
        let _ = dbg!(result);
  324    328   
        let http_request = request_receiver.expect_request();
  325    329   
        let expected_headers = [
  326    330   
            ("Accept", "application/cbor"),
  327    331   
            ("Content-Type", "application/cbor"),
  328    332   
            ("smithy-protocol", "rpc-v2-cbor"),
  329    333   
        ];
  330    334   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  331    335   
        let required_headers = &["Content-Length"];
  332    336   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  333    337   
        let body = http_request.body().bytes().expect("body should be strict");
  334    338   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  335    339   
            body,
  336    340   
            "om5kZW5zZU51bWJlck1hcKFheABvZGVuc2VCb29sZWFuTWFwoWF49A==",
  337    341   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  338    342   
        ));
  339    343   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  340    344   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  341    345   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps", "path was incorrect");
  342    346   
    }
  343    347   
  344    348   
    /// A request that contains a dense map of sets.
  345    349   
    /// Test ID: RpcV2CborSerializesDenseSetMap
  346    350   
    #[::tokio::test]
  347    351   
    #[::tracing_test::traced_test]
  348    352   
    async fn rpc_v2_cbor_serializes_dense_set_map_request() {
  349    353   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  350    354   
        let config_builder = crate::config::Config::builder()
  351    355   
            .with_test_defaults()
  352         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         356  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         357  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         358  +
            .allow_no_auth()
  353    359   
            .endpoint_url("https://example.com");
  354    360   
  355    361   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  356    362   
        let result = client
  357    363   
            .rpc_v2_cbor_dense_maps()
  358    364   
            .set_dense_set_map(::std::option::Option::Some({
  359    365   
                let mut ret = ::std::collections::HashMap::new();
  360    366   
                ret.insert("x".to_owned(), vec![]);
  361    367   
                ret.insert("y".to_owned(), vec!["a".to_owned(), "b".to_owned()]);
  362    368   
                ret

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/rpc_v2_cbor_lists.rs

@@ -220,220 +280,282 @@
  240    240   
mod rpc_v2_cbor_lists_test {
  241    241   
  242    242   
    /// Serializes RpcV2 Cbor lists
  243    243   
    /// Test ID: RpcV2CborLists
  244    244   
    #[::tokio::test]
  245    245   
    #[::tracing_test::traced_test]
  246    246   
    async fn rpc_v2_cbor_lists_request() {
  247    247   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  248    248   
        let config_builder = crate::config::Config::builder()
  249    249   
            .with_test_defaults()
  250         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         250  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         251  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         252  +
            .allow_no_auth()
  251    253   
            .endpoint_url("https://example.com");
  252    254   
  253    255   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  254    256   
        let result = client
  255    257   
            .rpc_v2_cbor_lists()
  256    258   
            .set_string_list(::std::option::Option::Some(vec!["foo".to_owned(), "bar".to_owned()]))
  257    259   
            .set_string_set(::std::option::Option::Some(vec!["foo".to_owned(), "bar".to_owned()]))
  258    260   
            .set_integer_list(::std::option::Option::Some(vec![1, 2]))
  259    261   
            .set_boolean_list(::std::option::Option::Some(vec![true, false]))
  260    262   
            .set_timestamp_list(::std::option::Option::Some(vec![
@@ -286,288 +384,390 @@
  306    308   
    }
  307    309   
  308    310   
    /// Serializes empty JSON lists
  309    311   
    /// Test ID: RpcV2CborListsEmpty
  310    312   
    #[::tokio::test]
  311    313   
    #[::tracing_test::traced_test]
  312    314   
    async fn rpc_v2_cbor_lists_empty_request() {
  313    315   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  314    316   
        let config_builder = crate::config::Config::builder()
  315    317   
            .with_test_defaults()
  316         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         318  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         319  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         320  +
            .allow_no_auth()
  317    321   
            .endpoint_url("https://example.com");
  318    322   
  319    323   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  320    324   
        let result = client
  321    325   
            .rpc_v2_cbor_lists()
  322    326   
            .set_string_list(::std::option::Option::Some(vec![]))
  323    327   
            .send()
  324    328   
            .await;
  325    329   
        let _ = dbg!(result);
  326    330   
        let http_request = request_receiver.expect_request();
  327    331   
        let expected_headers = [
  328    332   
            ("Accept", "application/cbor"),
  329    333   
            ("Content-Type", "application/cbor"),
  330    334   
            ("smithy-protocol", "rpc-v2-cbor"),
  331    335   
        ];
  332    336   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  333    337   
        let required_headers = &["Content-Length"];
  334    338   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  335    339   
        let body = http_request.body().bytes().expect("body should be strict");
  336    340   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  337    341   
            body,
  338    342   
            "v2pzdHJpbmdMaXN0n///",
  339    343   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  340    344   
        ));
  341    345   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  342    346   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  343    347   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborLists", "path was incorrect");
  344    348   
    }
  345    349   
  346    350   
    /// Serializes empty JSON definite length lists
  347    351   
    /// Test ID: RpcV2CborListsEmptyUsingDefiniteLength
  348    352   
    #[::tokio::test]
  349    353   
    #[::tracing_test::traced_test]
  350    354   
    async fn rpc_v2_cbor_lists_empty_using_definite_length_request() {
  351    355   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  352    356   
        let config_builder = crate::config::Config::builder()
  353    357   
            .with_test_defaults()
  354         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         358  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         359  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         360  +
            .allow_no_auth()
  355    361   
            .endpoint_url("https://example.com");
  356    362   
  357    363   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  358    364   
        let result = client
  359    365   
            .rpc_v2_cbor_lists()
  360    366   
            .set_string_list(::std::option::Option::Some(vec![]))
  361    367   
            .send()
  362    368   
            .await;
  363    369   
        let _ = dbg!(result);
  364    370   
        let http_request = request_receiver.expect_request();

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/rpc_v2_cbor_sparse_maps.rs

@@ -222,222 +483,493 @@
  242    242   
mod rpc_v2_cbor_sparse_maps_test {
  243    243   
  244    244   
    /// Serializes sparse maps
  245    245   
    /// Test ID: RpcV2CborSparseMaps
  246    246   
    #[::tokio::test]
  247    247   
    #[::tracing_test::traced_test]
  248    248   
    async fn rpc_v2_cbor_sparse_maps_request() {
  249    249   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  250    250   
        let config_builder = crate::config::Config::builder()
  251    251   
            .with_test_defaults()
  252         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         252  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         253  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         254  +
            .allow_no_auth()
  253    255   
            .endpoint_url("https://example.com");
  254    256   
  255    257   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  256    258   
        let result = client
  257    259   
            .rpc_v2_cbor_sparse_maps()
  258    260   
            .set_sparse_struct_map(::std::option::Option::Some({
  259    261   
                let mut ret = ::std::collections::HashMap::new();
  260    262   
                ret.insert(
  261    263   
                    "foo".to_owned(),
  262    264   
                    ::std::option::Option::Some(
  263    265   
                        crate::types::GreetingStruct::builder()
  264    266   
                            .set_hi(::std::option::Option::Some("there".to_owned()))
  265    267   
                            .build(),
  266    268   
                    ),
  267    269   
                );
  268    270   
                ret.insert(
  269    271   
                    "baz".to_owned(),
  270    272   
                    ::std::option::Option::Some(
  271    273   
                        crate::types::GreetingStruct::builder()
  272    274   
                            .set_hi(::std::option::Option::Some("bye".to_owned()))
  273    275   
                            .build(),
  274    276   
                    ),
  275    277   
                );
  276    278   
                ret
  277    279   
            }))
  278    280   
            .send()
  279    281   
            .await;
  280    282   
        let _ = dbg!(result);
  281    283   
        let http_request = request_receiver.expect_request();
  282    284   
        let expected_headers = [
  283    285   
            ("Accept", "application/cbor"),
  284    286   
            ("Content-Type", "application/cbor"),
  285    287   
            ("smithy-protocol", "rpc-v2-cbor"),
  286    288   
        ];
  287    289   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  288    290   
        let required_headers = &["Content-Length"];
  289    291   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  290    292   
        let body = http_request.body().bytes().expect("body should be strict");
  291    293   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  292    294   
            body,
  293    295   
            "v29zcGFyc2VTdHJ1Y3RNYXC/Y2Zvb79iaGlldGhlcmX/Y2Jher9iaGljYnll////",
  294    296   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  295    297   
        ));
  296    298   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  297    299   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  298    300   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
  299    301   
    }
  300    302   
  301    303   
    /// Serializes null map values in sparse maps
  302    304   
    /// Test ID: RpcV2CborSerializesNullMapValues
  303    305   
    #[::tokio::test]
  304    306   
    #[::tracing_test::traced_test]
  305    307   
    async fn rpc_v2_cbor_serializes_null_map_values_request() {
  306    308   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  307    309   
        let config_builder = crate::config::Config::builder()
  308    310   
            .with_test_defaults()
  309         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         311  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         312  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         313  +
            .allow_no_auth()
  310    314   
            .endpoint_url("https://example.com");
  311    315   
  312    316   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  313    317   
        let result = client
  314    318   
            .rpc_v2_cbor_sparse_maps()
  315    319   
            .set_sparse_boolean_map(::std::option::Option::Some({
  316    320   
                let mut ret = ::std::collections::HashMap::new();
  317    321   
                ret.insert("x".to_owned(), ::std::option::Option::None);
  318    322   
                ret
  319    323   
            }))
  320    324   
            .set_sparse_number_map(::std::option::Option::Some({
  321    325   
                let mut ret = ::std::collections::HashMap::new();
  322    326   
                ret.insert("x".to_owned(), ::std::option::Option::None);
  323    327   
                ret
  324    328   
            }))
  325    329   
            .set_sparse_string_map(::std::option::Option::Some({
  326    330   
                let mut ret = ::std::collections::HashMap::new();
  327    331   
                ret.insert("x".to_owned(), ::std::option::Option::None);
  328    332   
                ret
  329    333   
            }))
  330    334   
            .set_sparse_struct_map(::std::option::Option::Some({
  331    335   
                let mut ret = ::std::collections::HashMap::new();
  332    336   
                ret.insert("x".to_owned(), ::std::option::Option::None);
  333    337   
                ret
  334    338   
            }))
  335    339   
            .send()
  336    340   
            .await;
  337    341   
        let _ = dbg!(result);
  338    342   
        let http_request = request_receiver.expect_request();
  339    343   
        let expected_headers = [
  340    344   
            ("Accept", "application/cbor"),
  341    345   
            ("Content-Type", "application/cbor"),
  342    346   
            ("smithy-protocol", "rpc-v2-cbor"),
  343    347   
        ];
  344    348   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  345    349   
        let required_headers = &["Content-Length"];
  346    350   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  347    351   
        let body = http_request.body().bytes().expect("body should be strict");
  348    352   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  349    353   
            body,
  350    354   
            "v3BzcGFyc2VCb29sZWFuTWFwv2F49v9vc3BhcnNlTnVtYmVyTWFwv2F49v9vc3BhcnNlU3RyaW5nTWFwv2F49v9vc3BhcnNlU3RydWN0TWFwv2F49v//",
  351    355   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  352    356   
        ));
  353    357   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  354    358   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  355    359   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
  356    360   
    }
  357    361   
  358    362   
    /// A request that contains a sparse map of sets
  359    363   
    /// Test ID: RpcV2CborSerializesSparseSetMap
  360    364   
    #[::tokio::test]
  361    365   
    #[::tracing_test::traced_test]
  362    366   
    async fn rpc_v2_cbor_serializes_sparse_set_map_request() {
  363    367   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  364    368   
        let config_builder = crate::config::Config::builder()
  365    369   
            .with_test_defaults()
  366         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         370  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         371  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         372  +
            .allow_no_auth()
  367    373   
            .endpoint_url("https://example.com");
  368    374   
  369    375   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  370    376   
        let result = client
  371    377   
            .rpc_v2_cbor_sparse_maps()
  372    378   
            .set_sparse_set_map(::std::option::Option::Some({
  373    379   
                let mut ret = ::std::collections::HashMap::new();
  374    380   
                ret.insert("x".to_owned(), ::std::option::Option::Some(vec![]));
  375    381   
                ret.insert("y".to_owned(), ::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned()]));
  376    382   
                ret
  377    383   
            }))
  378    384   
            .send()
  379    385   
            .await;
  380    386   
        let _ = dbg!(result);
  381    387   
        let http_request = request_receiver.expect_request();
  382    388   
        let expected_headers = [
  383    389   
            ("Accept", "application/cbor"),
  384    390   
            ("Content-Type", "application/cbor"),
  385    391   
            ("smithy-protocol", "rpc-v2-cbor"),
  386    392   
        ];
  387    393   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  388    394   
        let required_headers = &["Content-Length"];
  389    395   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  390    396   
        let body = http_request.body().bytes().expect("body should be strict");
  391    397   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  392    398   
            body,
  393    399   
            "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL///8=",
  394    400   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  395    401   
        ));
  396    402   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  397    403   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  398    404   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
  399    405   
    }
  400    406   
  401    407   
    /// A request that contains a sparse map of sets.
  402    408   
    /// Test ID: RpcV2CborSerializesSparseSetMapAndRetainsNull
  403    409   
    #[::tokio::test]
  404    410   
    #[::tracing_test::traced_test]
  405    411   
    async fn rpc_v2_cbor_serializes_sparse_set_map_and_retains_null_request() {
  406    412   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  407    413   
        let config_builder = crate::config::Config::builder()
  408    414   
            .with_test_defaults()
  409         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         415  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         416  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         417  +
            .allow_no_auth()
  410    418   
            .endpoint_url("https://example.com");
  411    419   
  412    420   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  413    421   
        let result = client
  414    422   
            .rpc_v2_cbor_sparse_maps()
  415    423   
            .set_sparse_set_map(::std::option::Option::Some({
  416    424   
                let mut ret = ::std::collections::HashMap::new();
  417    425   
                ret.insert("x".to_owned(), ::std::option::Option::Some(vec![]));
  418    426   
                ret.insert("y".to_owned(), ::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned()]));
  419    427   
                ret.insert("z".to_owned(), ::std::option::Option::None);
  420    428   
                ret
  421    429   
            }))
  422    430   
            .send()
  423    431   
            .await;
  424    432   
        let _ = dbg!(result);
  425    433   
        let http_request = request_receiver.expect_request();
  426    434   
        let expected_headers = [
  427    435   
            ("Accept", "application/cbor"),
  428    436   
            ("Content-Type", "application/cbor"),
  429    437   
            ("smithy-protocol", "rpc-v2-cbor"),
  430    438   
        ];
  431    439   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  432    440   
        let required_headers = &["Content-Length"];
  433    441   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  434    442   
        let body = http_request.body().bytes().expect("body should be strict");
  435    443   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  436    444   
            body,
  437    445   
            "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL/YXr2//8=",
  438    446   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  439    447   
        ));
  440    448   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  441    449   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  442    450   
        ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
  443    451   
    }
  444    452   
  445    453   
    /// Ensure that 0 and false are sent over the wire in all maps and lists
  446    454   
    /// Test ID: RpcV2CborSerializesZeroValuesInSparseMaps
  447    455   
    #[::tokio::test]
  448    456   
    #[::tracing_test::traced_test]
  449    457   
    async fn rpc_v2_cbor_serializes_zero_values_in_sparse_maps_request() {
  450    458   
        let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
  451    459   
        let config_builder = crate::config::Config::builder()
  452    460   
            .with_test_defaults()
  453         -
            .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
         461  +
            // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
         462  +
            //  Until the incorrect separation is addressed, we need to rely on this workaround.
         463  +
            .allow_no_auth()
  454    464   
            .endpoint_url("https://example.com");
  455    465   
  456    466   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  457    467   
        let result = client
  458    468   
            .rpc_v2_cbor_sparse_maps()
  459    469   
            .set_sparse_number_map(::std::option::Option::Some({
  460    470   
                let mut ret = ::std::collections::HashMap::new();
  461    471   
                ret.insert("x".to_owned(), ::std::option::Option::Some(0));
  462    472   
                ret
  463    473   
            }))