Client Test

Client Test

rev. ec7b2441254af868911fccffe8d8dca83aff0045 (ignoring whitespace)

Files changed:

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

@@ -63,63 +221,222 @@
   83     83   
    "aws.protocoltests.restjson.synthetic",
   84     84   
    "JsonListsInput",
   85     85   
);
   86     86   
static JSONLISTSINPUT_MEMBER_STRING_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   87     87   
    ::aws_smithy_schema::ShapeId::from_static(
   88     88   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$stringList",
   89     89   
        "aws.protocoltests.restjson.synthetic",
   90     90   
        "JsonListsInput",
   91     91   
    ),
   92     92   
    ::aws_smithy_schema::ShapeType::List,
   93         -
    "string_list",
          93  +
    "stringList",
   94     94   
    0,
   95     95   
);
   96     96   
static JSONLISTSINPUT_MEMBER_STRING_SET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   97     97   
    ::aws_smithy_schema::ShapeId::from_static(
   98     98   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$stringSet",
   99     99   
        "aws.protocoltests.restjson.synthetic",
  100    100   
        "JsonListsInput",
  101    101   
    ),
  102    102   
    ::aws_smithy_schema::ShapeType::List,
  103         -
    "string_set",
         103  +
    "stringSet",
  104    104   
    1,
  105    105   
);
  106    106   
static JSONLISTSINPUT_MEMBER_INTEGER_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  107    107   
    ::aws_smithy_schema::ShapeId::from_static(
  108    108   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$integerList",
  109    109   
        "aws.protocoltests.restjson.synthetic",
  110    110   
        "JsonListsInput",
  111    111   
    ),
  112    112   
    ::aws_smithy_schema::ShapeType::List,
  113         -
    "integer_list",
         113  +
    "integerList",
  114    114   
    2,
  115    115   
);
  116    116   
static JSONLISTSINPUT_MEMBER_BOOLEAN_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  117    117   
    ::aws_smithy_schema::ShapeId::from_static(
  118    118   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$booleanList",
  119    119   
        "aws.protocoltests.restjson.synthetic",
  120    120   
        "JsonListsInput",
  121    121   
    ),
  122    122   
    ::aws_smithy_schema::ShapeType::List,
  123         -
    "boolean_list",
         123  +
    "booleanList",
  124    124   
    3,
  125    125   
);
  126    126   
static JSONLISTSINPUT_MEMBER_TIMESTAMP_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  127    127   
    ::aws_smithy_schema::ShapeId::from_static(
  128    128   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$timestampList",
  129    129   
        "aws.protocoltests.restjson.synthetic",
  130    130   
        "JsonListsInput",
  131    131   
    ),
  132    132   
    ::aws_smithy_schema::ShapeType::List,
  133         -
    "timestamp_list",
         133  +
    "timestampList",
  134    134   
    4,
  135    135   
);
  136    136   
static JSONLISTSINPUT_MEMBER_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  137    137   
    ::aws_smithy_schema::ShapeId::from_static(
  138    138   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$enumList",
  139    139   
        "aws.protocoltests.restjson.synthetic",
  140    140   
        "JsonListsInput",
  141    141   
    ),
  142    142   
    ::aws_smithy_schema::ShapeType::List,
  143         -
    "enum_list",
         143  +
    "enumList",
  144    144   
    5,
  145    145   
);
  146    146   
static JSONLISTSINPUT_MEMBER_INT_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  147    147   
    ::aws_smithy_schema::ShapeId::from_static(
  148    148   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$intEnumList",
  149    149   
        "aws.protocoltests.restjson.synthetic",
  150    150   
        "JsonListsInput",
  151    151   
    ),
  152    152   
    ::aws_smithy_schema::ShapeType::List,
  153         -
    "int_enum_list",
         153  +
    "intEnumList",
  154    154   
    6,
  155    155   
);
  156    156   
static JSONLISTSINPUT_MEMBER_NESTED_STRING_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  157    157   
    ::aws_smithy_schema::ShapeId::from_static(
  158    158   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$nestedStringList",
  159    159   
        "aws.protocoltests.restjson.synthetic",
  160    160   
        "JsonListsInput",
  161    161   
    ),
  162    162   
    ::aws_smithy_schema::ShapeType::List,
  163         -
    "nested_string_list",
         163  +
    "nestedStringList",
  164    164   
    7,
  165    165   
);
  166    166   
static JSONLISTSINPUT_MEMBER_STRUCTURE_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  167    167   
    ::aws_smithy_schema::ShapeId::from_static(
  168    168   
        "aws.protocoltests.restjson.synthetic#JsonListsInput$structureList",
  169    169   
        "aws.protocoltests.restjson.synthetic",
  170    170   
        "JsonListsInput",
  171    171   
    ),
  172    172   
    ::aws_smithy_schema::ShapeType::List,
  173         -
    "structure_list",
         173  +
    "structureList",
  174    174   
    8,
  175    175   
)
  176    176   
.with_json_name("myStructureList");
  177    177   
static JSONLISTSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  178    178   
    JSONLISTSINPUT_SCHEMA_ID,
  179    179   
    ::aws_smithy_schema::ShapeType::Structure,
  180    180   
    &[
  181    181   
        &JSONLISTSINPUT_MEMBER_STRING_LIST,
  182    182   
        &JSONLISTSINPUT_MEMBER_STRING_SET,
  183    183   
        &JSONLISTSINPUT_MEMBER_INTEGER_LIST,
  184    184   
        &JSONLISTSINPUT_MEMBER_BOOLEAN_LIST,
  185    185   
        &JSONLISTSINPUT_MEMBER_TIMESTAMP_LIST,
  186    186   
        &JSONLISTSINPUT_MEMBER_ENUM_LIST,
  187    187   
        &JSONLISTSINPUT_MEMBER_INT_ENUM_LIST,
  188    188   
        &JSONLISTSINPUT_MEMBER_NESTED_STRING_LIST,
  189    189   
        &JSONLISTSINPUT_MEMBER_STRUCTURE_LIST,
  190    190   
    ],
  191         -
);
         191  +
)
         192  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("PUT", "/JsonLists", None));
  192    193   
impl JsonListsInput {
  193    194   
    /// The schema for this shape.
  194    195   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &JSONLISTSINPUT_SCHEMA;
  195    196   
}
  196    197   
impl ::aws_smithy_schema::serde::SerializableStruct for JsonListsInput {
  197    198   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  198    199   
    fn serialize_members(
  199    200   
        &self,
  200    201   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  201    202   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
@@ -254,255 +475,447 @@
  274    275   
                    }
  275    276   
                    Ok(())
  276    277   
                },
  277    278   
            )?;
  278    279   
        }
  279    280   
        if let Some(ref val) = self.nested_string_list {
  280    281   
            ser.write_list(
  281    282   
                &JSONLISTSINPUT_MEMBER_NESTED_STRING_LIST,
  282    283   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  283    284   
                    for item in val {
  284         -
                        todo!("schema: unsupported list element type");
         285  +
                        ser.write_list(
         286  +
                            &::aws_smithy_schema::prelude::DOCUMENT,
         287  +
                            &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
         288  +
                                for item in item {
         289  +
                                    ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
         290  +
                                }
         291  +
                                Ok(())
         292  +
                            },
         293  +
                        )?;
  285    294   
                    }
  286    295   
                    Ok(())
  287    296   
                },
  288    297   
            )?;
  289    298   
        }
  290    299   
        if let Some(ref val) = self.structure_list {
  291    300   
            ser.write_list(
  292    301   
                &JSONLISTSINPUT_MEMBER_STRUCTURE_LIST,
  293    302   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  294    303   
                    for item in val {
  295    304   
                        ser.write_struct(crate::types::StructureListMember::SCHEMA, item)?;
  296    305   
                    }
  297    306   
                    Ok(())
  298    307   
                },
  299    308   
            )?;
  300    309   
        }
  301    310   
        Ok(())
  302    311   
    }
  303    312   
}
  304    313   
impl JsonListsInput {
  305    314   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  306         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  307         -
        deserializer: &mut D,
         315  +
    pub fn deserialize(
         316  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  308    317   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  309    318   
        #[allow(unused_variables, unused_mut)]
  310    319   
        let mut builder = Self::builder();
  311    320   
        #[allow(
  312    321   
            unused_variables,
  313    322   
            unreachable_code,
  314    323   
            clippy::single_match,
  315    324   
            clippy::match_single_binding,
  316    325   
            clippy::diverging_sub_expression
  317    326   
        )]
  318         -
        deserializer.read_struct(&JSONLISTSINPUT_SCHEMA, (), |_, member, deser| {
         327  +
        deserializer.read_struct(&JSONLISTSINPUT_SCHEMA, &mut |member, deser| {
  319    328   
            match member.member_index() {
  320    329   
                Some(0) => {
  321         -
                    builder.string_list = Some({
  322         -
                        let container = if let Some(cap) = deser.container_size() {
  323         -
                            Vec::with_capacity(cap)
  324         -
                        } else {
  325         -
                            Vec::new()
  326         -
                        };
  327         -
                        deser.read_list(member, container, |mut list, deser| {
  328         -
                            list.push(deser.read_string(member)?);
  329         -
                            Ok(list)
  330         -
                        })?
  331         -
                    });
         330  +
                    builder.string_list = Some(deser.read_string_list(member)?);
  332    331   
                }
  333    332   
                Some(1) => {
  334         -
                    builder.string_set = Some({
  335         -
                        let container = if let Some(cap) = deser.container_size() {
  336         -
                            Vec::with_capacity(cap)
  337         -
                        } else {
  338         -
                            Vec::new()
  339         -
                        };
  340         -
                        deser.read_list(member, container, |mut list, deser| {
  341         -
                            list.push(deser.read_string(member)?);
  342         -
                            Ok(list)
  343         -
                        })?
  344         -
                    });
         333  +
                    builder.string_set = Some(deser.read_string_list(member)?);
  345    334   
                }
  346    335   
                Some(2) => {
  347         -
                    builder.integer_list = Some({
  348         -
                        let container = if let Some(cap) = deser.container_size() {
  349         -
                            Vec::with_capacity(cap)
  350         -
                        } else {
  351         -
                            Vec::new()
  352         -
                        };
  353         -
                        deser.read_list(member, container, |mut list, deser| {
  354         -
                            list.push(deser.read_integer(member)?);
  355         -
                            Ok(list)
  356         -
                        })?
  357         -
                    });
         336  +
                    builder.integer_list = Some(deser.read_integer_list(member)?);
  358    337   
                }
  359    338   
                Some(3) => {
  360    339   
                    builder.boolean_list = Some({
  361         -
                        let container = if let Some(cap) = deser.container_size() {
  362         -
                            Vec::with_capacity(cap)
  363         -
                        } else {
  364         -
                            Vec::new()
  365         -
                        };
  366         -
                        deser.read_list(member, container, |mut list, deser| {
  367         -
                            list.push(deser.read_boolean(member)?);
  368         -
                            Ok(list)
  369         -
                        })?
         340  +
                        let mut container = Vec::new();
         341  +
                        deser.read_list(member, &mut |deser| {
         342  +
                            container.push(deser.read_boolean(member)?);
         343  +
                            Ok(())
         344  +
                        })?;
         345  +
                        container
  370    346   
                    });
  371    347   
                }
  372    348   
                Some(4) => {
  373    349   
                    builder.timestamp_list = Some({
  374         -
                        let container = if let Some(cap) = deser.container_size() {
  375         -
                            Vec::with_capacity(cap)
  376         -
                        } else {
  377         -
                            Vec::new()
  378         -
                        };
  379         -
                        deser.read_list(member, container, |mut list, deser| {
  380         -
                            list.push(deser.read_timestamp(member)?);
  381         -
                            Ok(list)
  382         -
                        })?
         350  +
                        let mut container = Vec::new();
         351  +
                        deser.read_list(member, &mut |deser| {
         352  +
                            container.push(deser.read_timestamp(member)?);
         353  +
                            Ok(())
         354  +
                        })?;
         355  +
                        container
  383    356   
                    });
  384    357   
                }
  385    358   
                Some(5) => {
  386    359   
                    builder.enum_list = Some({
  387         -
                        let container = if let Some(cap) = deser.container_size() {
  388         -
                            Vec::with_capacity(cap)
  389         -
                        } else {
  390         -
                            Vec::new()
  391         -
                        };
  392         -
                        deser.read_list(member, container, |mut list, deser| {
  393         -
                            list.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  394         -
                            Ok(list)
  395         -
                        })?
         360  +
                        let mut container = Vec::new();
         361  +
                        deser.read_list(member, &mut |deser| {
         362  +
                            container.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         363  +
                            Ok(())
         364  +
                        })?;
         365  +
                        container
  396    366   
                    });
  397    367   
                }
  398    368   
                Some(6) => {
  399         -
                    builder.int_enum_list = Some({
  400         -
                        let container = if let Some(cap) = deser.container_size() {
  401         -
                            Vec::with_capacity(cap)
  402         -
                        } else {
  403         -
                            Vec::new()
  404         -
                        };
  405         -
                        deser.read_list(member, container, |mut list, deser| {
  406         -
                            list.push(deser.read_integer(member)?);
  407         -
                            Ok(list)
  408         -
                        })?
  409         -
                    });
         369  +
                    builder.int_enum_list = Some(deser.read_integer_list(member)?);
  410    370   
                }
  411    371   
                Some(7) => {
  412    372   
                    builder.nested_string_list = Some({
  413         -
                        let container = if let Some(cap) = deser.container_size() {
  414         -
                            Vec::with_capacity(cap)
  415         -
                        } else {
  416         -
                            Vec::new()
  417         -
                        };
  418         -
                        deser.read_list(member, container, |mut list, deser| {
  419         -
                            list.push(todo!("deserialize nested aggregate"));
  420         -
                            Ok(list)
  421         -
                        })?
         373  +
                        let mut container = Vec::new();
         374  +
                        deser.read_list(member, &mut |deser| {
         375  +
                            container.push({
         376  +
                                let mut list = Vec::new();
         377  +
                                deser.read_list(member, &mut |deser| {
         378  +
                                    list.push(deser.read_string(&::aws_smithy_schema::prelude::DOCUMENT)?);
         379  +
                                    Ok(())
         380  +
                                })?;
         381  +
                                list
         382  +
                            });
         383  +
                            Ok(())
         384  +
                        })?;
         385  +
                        container
  422    386   
                    });
  423    387   
                }
  424    388   
                Some(8) => {
  425    389   
                    builder.structure_list = Some({
  426         -
                        let container = if let Some(cap) = deser.container_size() {
  427         -
                            Vec::with_capacity(cap)
  428         -
                        } else {
  429         -
                            Vec::new()
  430         -
                        };
  431         -
                        deser.read_list(member, container, |mut list, deser| {
  432         -
                            list.push(crate::types::StructureListMember::deserialize(deser)?);
  433         -
                            Ok(list)
  434         -
                        })?
         390  +
                        let mut container = Vec::new();
         391  +
                        deser.read_list(member, &mut |deser| {
         392  +
                            container.push(crate::types::StructureListMember::deserialize(deser)?);
         393  +
                            Ok(())
         394  +
                        })?;
         395  +
                        container
  435    396   
                    });
  436    397   
                }
  437    398   
                _ => {}
  438    399   
            }
  439    400   
            Ok(())
  440    401   
        })?;
  441    402   
        builder
  442    403   
            .build()
  443    404   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  444    405   
    }
  445    406   
}
         407  +
impl JsonListsInput {
         408  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         409  +
    pub fn deserialize_with_response(
         410  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         411  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         412  +
        _status: u16,
         413  +
        _body: &[u8],
         414  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         415  +
        Self::deserialize(deserializer)
         416  +
    }
         417  +
}
  446    418   
impl JsonListsInput {
  447    419   
    /// Creates a new builder-style object to manufacture [`JsonListsInput`](crate::operation::json_lists::JsonListsInput).
  448    420   
    pub fn builder() -> crate::operation::json_lists::builders::JsonListsInputBuilder {
  449    421   
        crate::operation::json_lists::builders::JsonListsInputBuilder::default()
  450    422   
    }
  451    423   
}
  452    424   
  453    425   
/// A builder for [`JsonListsInput`](crate::operation::json_lists::JsonListsInput).
  454    426   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  455    427   
#[non_exhaustive]

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

@@ -63,63 +203,203 @@
   83     83   
    "aws.protocoltests.restjson.synthetic",
   84     84   
    "JsonListsOutput",
   85     85   
);
   86     86   
static JSONLISTSOUTPUT_MEMBER_STRING_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   87     87   
    ::aws_smithy_schema::ShapeId::from_static(
   88     88   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$stringList",
   89     89   
        "aws.protocoltests.restjson.synthetic",
   90     90   
        "JsonListsOutput",
   91     91   
    ),
   92     92   
    ::aws_smithy_schema::ShapeType::List,
   93         -
    "string_list",
          93  +
    "stringList",
   94     94   
    0,
   95     95   
);
   96     96   
static JSONLISTSOUTPUT_MEMBER_STRING_SET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   97     97   
    ::aws_smithy_schema::ShapeId::from_static(
   98     98   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$stringSet",
   99     99   
        "aws.protocoltests.restjson.synthetic",
  100    100   
        "JsonListsOutput",
  101    101   
    ),
  102    102   
    ::aws_smithy_schema::ShapeType::List,
  103         -
    "string_set",
         103  +
    "stringSet",
  104    104   
    1,
  105    105   
);
  106    106   
static JSONLISTSOUTPUT_MEMBER_INTEGER_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  107    107   
    ::aws_smithy_schema::ShapeId::from_static(
  108    108   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$integerList",
  109    109   
        "aws.protocoltests.restjson.synthetic",
  110    110   
        "JsonListsOutput",
  111    111   
    ),
  112    112   
    ::aws_smithy_schema::ShapeType::List,
  113         -
    "integer_list",
         113  +
    "integerList",
  114    114   
    2,
  115    115   
);
  116    116   
static JSONLISTSOUTPUT_MEMBER_BOOLEAN_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  117    117   
    ::aws_smithy_schema::ShapeId::from_static(
  118    118   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$booleanList",
  119    119   
        "aws.protocoltests.restjson.synthetic",
  120    120   
        "JsonListsOutput",
  121    121   
    ),
  122    122   
    ::aws_smithy_schema::ShapeType::List,
  123         -
    "boolean_list",
         123  +
    "booleanList",
  124    124   
    3,
  125    125   
);
  126    126   
static JSONLISTSOUTPUT_MEMBER_TIMESTAMP_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  127    127   
    ::aws_smithy_schema::ShapeId::from_static(
  128    128   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$timestampList",
  129    129   
        "aws.protocoltests.restjson.synthetic",
  130    130   
        "JsonListsOutput",
  131    131   
    ),
  132    132   
    ::aws_smithy_schema::ShapeType::List,
  133         -
    "timestamp_list",
         133  +
    "timestampList",
  134    134   
    4,
  135    135   
);
  136    136   
static JSONLISTSOUTPUT_MEMBER_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  137    137   
    ::aws_smithy_schema::ShapeId::from_static(
  138    138   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$enumList",
  139    139   
        "aws.protocoltests.restjson.synthetic",
  140    140   
        "JsonListsOutput",
  141    141   
    ),
  142    142   
    ::aws_smithy_schema::ShapeType::List,
  143         -
    "enum_list",
         143  +
    "enumList",
  144    144   
    5,
  145    145   
);
  146    146   
static JSONLISTSOUTPUT_MEMBER_INT_ENUM_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  147    147   
    ::aws_smithy_schema::ShapeId::from_static(
  148    148   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$intEnumList",
  149    149   
        "aws.protocoltests.restjson.synthetic",
  150    150   
        "JsonListsOutput",
  151    151   
    ),
  152    152   
    ::aws_smithy_schema::ShapeType::List,
  153         -
    "int_enum_list",
         153  +
    "intEnumList",
  154    154   
    6,
  155    155   
);
  156    156   
static JSONLISTSOUTPUT_MEMBER_NESTED_STRING_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  157    157   
    ::aws_smithy_schema::ShapeId::from_static(
  158    158   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$nestedStringList",
  159    159   
        "aws.protocoltests.restjson.synthetic",
  160    160   
        "JsonListsOutput",
  161    161   
    ),
  162    162   
    ::aws_smithy_schema::ShapeType::List,
  163         -
    "nested_string_list",
         163  +
    "nestedStringList",
  164    164   
    7,
  165    165   
);
  166    166   
static JSONLISTSOUTPUT_MEMBER_STRUCTURE_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  167    167   
    ::aws_smithy_schema::ShapeId::from_static(
  168    168   
        "aws.protocoltests.restjson.synthetic#JsonListsOutput$structureList",
  169    169   
        "aws.protocoltests.restjson.synthetic",
  170    170   
        "JsonListsOutput",
  171    171   
    ),
  172    172   
    ::aws_smithy_schema::ShapeType::List,
  173         -
    "structure_list",
         173  +
    "structureList",
  174    174   
    8,
  175    175   
)
  176    176   
.with_json_name("myStructureList");
  177    177   
static JSONLISTSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  178    178   
    JSONLISTSOUTPUT_SCHEMA_ID,
  179    179   
    ::aws_smithy_schema::ShapeType::Structure,
  180    180   
    &[
  181    181   
        &JSONLISTSOUTPUT_MEMBER_STRING_LIST,
  182    182   
        &JSONLISTSOUTPUT_MEMBER_STRING_SET,
  183    183   
        &JSONLISTSOUTPUT_MEMBER_INTEGER_LIST,
@@ -254,254 +473,444 @@
  274    274   
                    }
  275    275   
                    Ok(())
  276    276   
                },
  277    277   
            )?;
  278    278   
        }
  279    279   
        if let Some(ref val) = self.nested_string_list {
  280    280   
            ser.write_list(
  281    281   
                &JSONLISTSOUTPUT_MEMBER_NESTED_STRING_LIST,
  282    282   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  283    283   
                    for item in val {
  284         -
                        todo!("schema: unsupported list element type");
         284  +
                        ser.write_list(
         285  +
                            &::aws_smithy_schema::prelude::DOCUMENT,
         286  +
                            &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
         287  +
                                for item in item {
         288  +
                                    ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
         289  +
                                }
         290  +
                                Ok(())
         291  +
                            },
         292  +
                        )?;
  285    293   
                    }
  286    294   
                    Ok(())
  287    295   
                },
  288    296   
            )?;
  289    297   
        }
  290    298   
        if let Some(ref val) = self.structure_list {
  291    299   
            ser.write_list(
  292    300   
                &JSONLISTSOUTPUT_MEMBER_STRUCTURE_LIST,
  293    301   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  294    302   
                    for item in val {
  295    303   
                        ser.write_struct(crate::types::StructureListMember::SCHEMA, item)?;
  296    304   
                    }
  297    305   
                    Ok(())
  298    306   
                },
  299    307   
            )?;
  300    308   
        }
  301    309   
        Ok(())
  302    310   
    }
  303    311   
}
  304    312   
impl JsonListsOutput {
  305    313   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  306         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  307         -
        deserializer: &mut D,
         314  +
    pub fn deserialize(
         315  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  308    316   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  309    317   
        #[allow(unused_variables, unused_mut)]
  310    318   
        let mut builder = Self::builder();
  311    319   
        #[allow(
  312    320   
            unused_variables,
  313    321   
            unreachable_code,
  314    322   
            clippy::single_match,
  315    323   
            clippy::match_single_binding,
  316    324   
            clippy::diverging_sub_expression
  317    325   
        )]
  318         -
        deserializer.read_struct(&JSONLISTSOUTPUT_SCHEMA, (), |_, member, deser| {
         326  +
        deserializer.read_struct(&JSONLISTSOUTPUT_SCHEMA, &mut |member, deser| {
  319    327   
            match member.member_index() {
  320    328   
                Some(0) => {
  321         -
                    builder.string_list = Some({
  322         -
                        let container = if let Some(cap) = deser.container_size() {
  323         -
                            Vec::with_capacity(cap)
  324         -
                        } else {
  325         -
                            Vec::new()
  326         -
                        };
  327         -
                        deser.read_list(member, container, |mut list, deser| {
  328         -
                            list.push(deser.read_string(member)?);
  329         -
                            Ok(list)
  330         -
                        })?
  331         -
                    });
         329  +
                    builder.string_list = Some(deser.read_string_list(member)?);
  332    330   
                }
  333    331   
                Some(1) => {
  334         -
                    builder.string_set = Some({
  335         -
                        let container = if let Some(cap) = deser.container_size() {
  336         -
                            Vec::with_capacity(cap)
  337         -
                        } else {
  338         -
                            Vec::new()
  339         -
                        };
  340         -
                        deser.read_list(member, container, |mut list, deser| {
  341         -
                            list.push(deser.read_string(member)?);
  342         -
                            Ok(list)
  343         -
                        })?
  344         -
                    });
         332  +
                    builder.string_set = Some(deser.read_string_list(member)?);
  345    333   
                }
  346    334   
                Some(2) => {
  347         -
                    builder.integer_list = Some({
  348         -
                        let container = if let Some(cap) = deser.container_size() {
  349         -
                            Vec::with_capacity(cap)
  350         -
                        } else {
  351         -
                            Vec::new()
  352         -
                        };
  353         -
                        deser.read_list(member, container, |mut list, deser| {
  354         -
                            list.push(deser.read_integer(member)?);
  355         -
                            Ok(list)
  356         -
                        })?
  357         -
                    });
         335  +
                    builder.integer_list = Some(deser.read_integer_list(member)?);
  358    336   
                }
  359    337   
                Some(3) => {
  360    338   
                    builder.boolean_list = Some({
  361         -
                        let container = if let Some(cap) = deser.container_size() {
  362         -
                            Vec::with_capacity(cap)
  363         -
                        } else {
  364         -
                            Vec::new()
  365         -
                        };
  366         -
                        deser.read_list(member, container, |mut list, deser| {
  367         -
                            list.push(deser.read_boolean(member)?);
  368         -
                            Ok(list)
  369         -
                        })?
         339  +
                        let mut container = Vec::new();
         340  +
                        deser.read_list(member, &mut |deser| {
         341  +
                            container.push(deser.read_boolean(member)?);
         342  +
                            Ok(())
         343  +
                        })?;
         344  +
                        container
  370    345   
                    });
  371    346   
                }
  372    347   
                Some(4) => {
  373    348   
                    builder.timestamp_list = Some({
  374         -
                        let container = if let Some(cap) = deser.container_size() {
  375         -
                            Vec::with_capacity(cap)
  376         -
                        } else {
  377         -
                            Vec::new()
  378         -
                        };
  379         -
                        deser.read_list(member, container, |mut list, deser| {
  380         -
                            list.push(deser.read_timestamp(member)?);
  381         -
                            Ok(list)
  382         -
                        })?
         349  +
                        let mut container = Vec::new();
         350  +
                        deser.read_list(member, &mut |deser| {
         351  +
                            container.push(deser.read_timestamp(member)?);
         352  +
                            Ok(())
         353  +
                        })?;
         354  +
                        container
  383    355   
                    });
  384    356   
                }
  385    357   
                Some(5) => {
  386    358   
                    builder.enum_list = Some({
  387         -
                        let container = if let Some(cap) = deser.container_size() {
  388         -
                            Vec::with_capacity(cap)
  389         -
                        } else {
  390         -
                            Vec::new()
  391         -
                        };
  392         -
                        deser.read_list(member, container, |mut list, deser| {
  393         -
                            list.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
  394         -
                            Ok(list)
  395         -
                        })?
         359  +
                        let mut container = Vec::new();
         360  +
                        deser.read_list(member, &mut |deser| {
         361  +
                            container.push(crate::types::FooEnum::from(deser.read_string(member)?.as_str()));
         362  +
                            Ok(())
         363  +
                        })?;
         364  +
                        container
  396    365   
                    });
  397    366   
                }
  398    367   
                Some(6) => {
  399         -
                    builder.int_enum_list = Some({
  400         -
                        let container = if let Some(cap) = deser.container_size() {
  401         -
                            Vec::with_capacity(cap)
  402         -
                        } else {
  403         -
                            Vec::new()
  404         -
                        };
  405         -
                        deser.read_list(member, container, |mut list, deser| {
  406         -
                            list.push(deser.read_integer(member)?);
  407         -
                            Ok(list)
  408         -
                        })?
  409         -
                    });
         368  +
                    builder.int_enum_list = Some(deser.read_integer_list(member)?);
  410    369   
                }
  411    370   
                Some(7) => {
  412    371   
                    builder.nested_string_list = Some({
  413         -
                        let container = if let Some(cap) = deser.container_size() {
  414         -
                            Vec::with_capacity(cap)
  415         -
                        } else {
  416         -
                            Vec::new()
  417         -
                        };
  418         -
                        deser.read_list(member, container, |mut list, deser| {
  419         -
                            list.push(todo!("deserialize nested aggregate"));
  420         -
                            Ok(list)
  421         -
                        })?
         372  +
                        let mut container = Vec::new();
         373  +
                        deser.read_list(member, &mut |deser| {
         374  +
                            container.push({
         375  +
                                let mut list = Vec::new();
         376  +
                                deser.read_list(member, &mut |deser| {
         377  +
                                    list.push(deser.read_string(&::aws_smithy_schema::prelude::DOCUMENT)?);
         378  +
                                    Ok(())
         379  +
                                })?;
         380  +
                                list
         381  +
                            });
         382  +
                            Ok(())
         383  +
                        })?;
         384  +
                        container
  422    385   
                    });
  423    386   
                }
  424    387   
                Some(8) => {
  425    388   
                    builder.structure_list = Some({
  426         -
                        let container = if let Some(cap) = deser.container_size() {
  427         -
                            Vec::with_capacity(cap)
  428         -
                        } else {
  429         -
                            Vec::new()
  430         -
                        };
  431         -
                        deser.read_list(member, container, |mut list, deser| {
  432         -
                            list.push(crate::types::StructureListMember::deserialize(deser)?);
  433         -
                            Ok(list)
  434         -
                        })?
         389  +
                        let mut container = Vec::new();
         390  +
                        deser.read_list(member, &mut |deser| {
         391  +
                            container.push(crate::types::StructureListMember::deserialize(deser)?);
         392  +
                            Ok(())
         393  +
                        })?;
         394  +
                        container
  435    395   
                    });
  436    396   
                }
  437    397   
                _ => {}
  438    398   
            }
  439    399   
            Ok(())
  440    400   
        })?;
  441    401   
        Ok(builder.build())
  442    402   
    }
  443    403   
}
         404  +
impl JsonListsOutput {
         405  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         406  +
    pub fn deserialize_with_response(
         407  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         408  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         409  +
        _status: u16,
         410  +
        _body: &[u8],
         411  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         412  +
        Self::deserialize(deserializer)
         413  +
    }
         414  +
}
  444    415   
impl JsonListsOutput {
  445    416   
    /// Creates a new builder-style object to manufacture [`JsonListsOutput`](crate::operation::json_lists::JsonListsOutput).
  446    417   
    pub fn builder() -> crate::operation::json_lists::builders::JsonListsOutputBuilder {
  447    418   
        crate::operation::json_lists::builders::JsonListsOutputBuilder::default()
  448    419   
    }
  449    420   
}
  450    421   
  451    422   
/// A builder for [`JsonListsOutput`](crate::operation::json_lists::JsonListsOutput).
  452    423   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  453    424   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/json_maps.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 `JsonMaps`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct JsonMaps;
    6      6   
impl JsonMaps {
    7      7   
    /// Creates a new `JsonMaps`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_maps::JsonMapsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_maps::JsonMapsOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::json_maps::JsonMapsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::json_maps::JsonMapsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::json_maps::JsonMapsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -100,104 +220,223 @@
  120    124   
                crate::operation::json_maps::JsonMapsError,
  121    125   
            >::new());
  122    126   
  123    127   
        ::std::borrow::Cow::Owned(rcb)
  124    128   
    }
  125    129   
}
  126    130   
  127    131   
#[derive(Debug)]
  128    132   
struct JsonMapsResponseDeserializer;
  129    133   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for JsonMapsResponseDeserializer {
  130         -
    fn deserialize_nonstreaming(
         134  +
    fn deserialize_nonstreaming_with_config(
  131    135   
        &self,
  132    136   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         137  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  133    138   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  134    139   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         140  +
        #[allow(unused_mut)]
         141  +
        let mut force_error = false;
         142  +
         143  +
        if !success && status != 200 || force_error {
  135    144   
            let headers = response.headers();
  136    145   
            let body = response.body().bytes().expect("body loaded");
  137    146   
            #[allow(unused_mut)]
  138         -
        let mut force_error = false;
         147  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         148  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         149  +
            })?;
  139    150   
  140         -
        let parse_result = if !success && status != 200 || force_error {
  141         -
            crate::protocol_serde::shape_json_maps::de_json_maps_http_error(status, headers, body)
         151  +
            let generic = generic_builder.build();
         152  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         153  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(crate::operation::json_maps::JsonMapsError::generic(generic)),
         154  +
            ))
  142    155   
        } else {
  143         -
            crate::protocol_serde::shape_json_maps::de_json_maps_http_response(status, headers, body)
  144         -
        };
  145         -
        crate::protocol_serde::type_erase_result(parse_result)
         156  +
            let protocol = _cfg
         157  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         158  +
                .expect("a SharedClientProtocol is required");
         159  +
            let mut deser = protocol.deserialize_response(response, JsonMaps::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         160  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         161  +
            })?;
         162  +
            let body = response.body().bytes().expect("body loaded");
         163  +
            let output = crate::operation::json_maps::JsonMapsOutput::deserialize_with_response(
         164  +
                &mut *deser,
         165  +
                response.headers(),
         166  +
                response.status().into(),
         167  +
                body,
         168  +
            )
         169  +
            .map_err(|e| {
         170  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         171  +
            })?;
         172  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         173  +
        }
  146    174   
    }
  147    175   
}
  148    176   
#[derive(Debug)]
  149    177   
struct JsonMapsRequestSerializer;
  150    178   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for JsonMapsRequestSerializer {
  151    179   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  152    180   
    fn serialize_input(
  153    181   
        &self,
  154    182   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  155    183   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  156    184   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  157    185   
        let input = input.downcast::<crate::operation::json_maps::JsonMapsInput>().expect("correct type");
  158         -
        let _header_serialization_settings = _cfg
  159         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  160         -
            .cloned()
  161         -
            .unwrap_or_default();
  162         -
        let mut request_builder = {
  163         -
            #[allow(clippy::uninlined_format_args)]
  164         -
            fn uri_base(
  165         -
                _input: &crate::operation::json_maps::JsonMapsInput,
  166         -
                output: &mut ::std::string::String,
  167         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  168         -
                use ::std::fmt::Write as _;
  169         -
                ::std::write!(output, "/JsonMaps").expect("formatting should succeed");
  170         -
                ::std::result::Result::Ok(())
  171         -
            }
  172         -
            #[allow(clippy::unnecessary_wraps)]
  173         -
            fn update_http_builder(
  174         -
                input: &crate::operation::json_maps::JsonMapsInput,
  175         -
                builder: ::http_1x::request::Builder,
  176         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  177         -
                let mut uri = ::std::string::String::new();
  178         -
                uri_base(input, &mut uri)?;
  179         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  180         -
            }
  181         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  182         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  183         -
            builder
  184         -
        };
  185         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_json_maps::ser_json_maps_input(&input)?);
  186         -
        if let Some(content_length) = body.content_length() {
  187         -
            let content_length = content_length.to_string();
  188         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  189         -
        }
  190         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         186  +
        let protocol = _cfg
         187  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         188  +
            .expect("a SharedClientProtocol is required");
         189  +
        let mut request = protocol
         190  +
            .serialize_request(&input, JsonMaps::INPUT_SCHEMA, "", _cfg)
         191  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         192  +
         193  +
        return ::std::result::Result::Ok(request);
  191    194   
    }
  192    195   
}
  193    196   
#[derive(Debug)]
  194    197   
struct JsonMapsEndpointParamsInterceptor;
  195    198   
  196    199   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for JsonMapsEndpointParamsInterceptor {
  197    200   
    fn name(&self) -> &'static str {
  198    201   
        "JsonMapsEndpointParamsInterceptor"
  199    202   
    }
  200    203   
@@ -377,380 +437,450 @@
  397    400   
            .expect("the config must have a deserializer");
  398    401   
  399    402   
        let parsed = de.deserialize_streaming(&mut http_response);
  400    403   
        let parsed = parsed.unwrap_or_else(|| {
  401    404   
            let http_response = http_response.map(|body| {
  402    405   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  403    406   
                    body.bytes().unwrap(),
  404    407   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  405    408   
                )))
  406    409   
            });
  407         -
            de.deserialize_nonstreaming(&http_response)
         410  +
            // Build a config bag with the protocol for schema-based deserialization
         411  +
            #[allow(unused_mut)]
         412  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         413  +
            {
         414  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         415  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         416  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         417  +
                ));
         418  +
                test_cfg.push_shared_layer(layer.freeze());
         419  +
            }
         420  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  408    421   
        });
  409    422   
        let parsed = parsed
  410    423   
            .expect("should be successful response")
  411    424   
            .downcast::<crate::operation::json_maps::JsonMapsOutput>()
  412    425   
            .unwrap();
  413    426   
        ::pretty_assertions::assert_eq!(
  414    427   
            parsed.dense_struct_map,
  415    428   
            expected_output.dense_struct_map,
  416    429   
            "Unexpected value for `dense_struct_map`"
  417    430   
        );
@@ -454,467 +514,537 @@
  474    487   
            .expect("the config must have a deserializer");
  475    488   
  476    489   
        let parsed = de.deserialize_streaming(&mut http_response);
  477    490   
        let parsed = parsed.unwrap_or_else(|| {
  478    491   
            let http_response = http_response.map(|body| {
  479    492   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  480    493   
                    body.bytes().unwrap(),
  481    494   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  482    495   
                )))
  483    496   
            });
  484         -
            de.deserialize_nonstreaming(&http_response)
         497  +
            // Build a config bag with the protocol for schema-based deserialization
         498  +
            #[allow(unused_mut)]
         499  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         500  +
            {
         501  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         502  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         503  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         504  +
                ));
         505  +
                test_cfg.push_shared_layer(layer.freeze());
         506  +
            }
         507  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  485    508   
        });
  486    509   
        let parsed = parsed
  487    510   
            .expect("should be successful response")
  488    511   
            .downcast::<crate::operation::json_maps::JsonMapsOutput>()
  489    512   
            .unwrap();
  490    513   
        ::pretty_assertions::assert_eq!(
  491    514   
            parsed.dense_struct_map,
  492    515   
            expected_output.dense_struct_map,
  493    516   
            "Unexpected value for `dense_struct_map`"
  494    517   
        );
@@ -527,550 +587,620 @@
  547    570   
            .expect("the config must have a deserializer");
  548    571   
  549    572   
        let parsed = de.deserialize_streaming(&mut http_response);
  550    573   
        let parsed = parsed.unwrap_or_else(|| {
  551    574   
            let http_response = http_response.map(|body| {
  552    575   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  553    576   
                    body.bytes().unwrap(),
  554    577   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  555    578   
                )))
  556    579   
            });
  557         -
            de.deserialize_nonstreaming(&http_response)
         580  +
            // Build a config bag with the protocol for schema-based deserialization
         581  +
            #[allow(unused_mut)]
         582  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         583  +
            {
         584  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         585  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         586  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         587  +
                ));
         588  +
                test_cfg.push_shared_layer(layer.freeze());
         589  +
            }
         590  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  558    591   
        });
  559    592   
        let parsed = parsed
  560    593   
            .expect("should be successful response")
  561    594   
            .downcast::<crate::operation::json_maps::JsonMapsOutput>()
  562    595   
            .unwrap();
  563    596   
        ::pretty_assertions::assert_eq!(
  564    597   
            parsed.dense_struct_map,
  565    598   
            expected_output.dense_struct_map,
  566    599   
            "Unexpected value for `dense_struct_map`"
  567    600   
        );
@@ -602,635 +662,705 @@
  622    655   
            .expect("the config must have a deserializer");
  623    656   
  624    657   
        let parsed = de.deserialize_streaming(&mut http_response);
  625    658   
        let parsed = parsed.unwrap_or_else(|| {
  626    659   
            let http_response = http_response.map(|body| {
  627    660   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  628    661   
                    body.bytes().unwrap(),
  629    662   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  630    663   
                )))
  631    664   
            });
  632         -
            de.deserialize_nonstreaming(&http_response)
         665  +
            // Build a config bag with the protocol for schema-based deserialization
         666  +
            #[allow(unused_mut)]
         667  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         668  +
            {
         669  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         670  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         671  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         672  +
                ));
         673  +
                test_cfg.push_shared_layer(layer.freeze());
         674  +
            }
         675  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  633    676   
        });
  634    677   
        let parsed = parsed
  635    678   
            .expect("should be successful response")
  636    679   
            .downcast::<crate::operation::json_maps::JsonMapsOutput>()
  637    680   
            .unwrap();
  638    681   
        ::pretty_assertions::assert_eq!(
  639    682   
            parsed.dense_struct_map,
  640    683   
            expected_output.dense_struct_map,
  641    684   
            "Unexpected value for `dense_struct_map`"
  642    685   
        );

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

@@ -23,23 +136,137 @@
   43     43   
    "aws.protocoltests.restjson.synthetic",
   44     44   
    "JsonMapsInput",
   45     45   
);
   46     46   
static JSONMAPSINPUT_MEMBER_DENSE_STRUCT_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   47     47   
    ::aws_smithy_schema::ShapeId::from_static(
   48     48   
        "aws.protocoltests.restjson.synthetic#JsonMapsInput$denseStructMap",
   49     49   
        "aws.protocoltests.restjson.synthetic",
   50     50   
        "JsonMapsInput",
   51     51   
    ),
   52     52   
    ::aws_smithy_schema::ShapeType::Map,
   53         -
    "dense_struct_map",
          53  +
    "denseStructMap",
   54     54   
    0,
   55     55   
);
   56     56   
static JSONMAPSINPUT_MEMBER_DENSE_NUMBER_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   57     57   
    ::aws_smithy_schema::ShapeId::from_static(
   58     58   
        "aws.protocoltests.restjson.synthetic#JsonMapsInput$denseNumberMap",
   59     59   
        "aws.protocoltests.restjson.synthetic",
   60     60   
        "JsonMapsInput",
   61     61   
    ),
   62     62   
    ::aws_smithy_schema::ShapeType::Map,
   63         -
    "dense_number_map",
          63  +
    "denseNumberMap",
   64     64   
    1,
   65     65   
);
   66     66   
static JSONMAPSINPUT_MEMBER_DENSE_BOOLEAN_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   67     67   
    ::aws_smithy_schema::ShapeId::from_static(
   68     68   
        "aws.protocoltests.restjson.synthetic#JsonMapsInput$denseBooleanMap",
   69     69   
        "aws.protocoltests.restjson.synthetic",
   70     70   
        "JsonMapsInput",
   71     71   
    ),
   72     72   
    ::aws_smithy_schema::ShapeType::Map,
   73         -
    "dense_boolean_map",
          73  +
    "denseBooleanMap",
   74     74   
    2,
   75     75   
);
   76     76   
static JSONMAPSINPUT_MEMBER_DENSE_STRING_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   77     77   
    ::aws_smithy_schema::ShapeId::from_static(
   78     78   
        "aws.protocoltests.restjson.synthetic#JsonMapsInput$denseStringMap",
   79     79   
        "aws.protocoltests.restjson.synthetic",
   80     80   
        "JsonMapsInput",
   81     81   
    ),
   82     82   
    ::aws_smithy_schema::ShapeType::Map,
   83         -
    "dense_string_map",
          83  +
    "denseStringMap",
   84     84   
    3,
   85     85   
);
   86     86   
static JSONMAPSINPUT_MEMBER_DENSE_SET_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   87     87   
    ::aws_smithy_schema::ShapeId::from_static(
   88     88   
        "aws.protocoltests.restjson.synthetic#JsonMapsInput$denseSetMap",
   89     89   
        "aws.protocoltests.restjson.synthetic",
   90     90   
        "JsonMapsInput",
   91     91   
    ),
   92     92   
    ::aws_smithy_schema::ShapeType::Map,
   93         -
    "dense_set_map",
          93  +
    "denseSetMap",
   94     94   
    4,
   95     95   
);
   96     96   
static JSONMAPSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   97     97   
    JSONMAPSINPUT_SCHEMA_ID,
   98     98   
    ::aws_smithy_schema::ShapeType::Structure,
   99     99   
    &[
  100    100   
        &JSONMAPSINPUT_MEMBER_DENSE_STRUCT_MAP,
  101    101   
        &JSONMAPSINPUT_MEMBER_DENSE_NUMBER_MAP,
  102    102   
        &JSONMAPSINPUT_MEMBER_DENSE_BOOLEAN_MAP,
  103    103   
        &JSONMAPSINPUT_MEMBER_DENSE_STRING_MAP,
  104    104   
        &JSONMAPSINPUT_MEMBER_DENSE_SET_MAP,
  105    105   
    ],
  106         -
);
         106  +
)
         107  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/JsonMaps", None));
  107    108   
impl JsonMapsInput {
  108    109   
    /// The schema for this shape.
  109    110   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &JSONMAPSINPUT_SCHEMA;
  110    111   
}
  111    112   
impl ::aws_smithy_schema::serde::SerializableStruct for JsonMapsInput {
  112    113   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  113    114   
    fn serialize_members(
  114    115   
        &self,
  115    116   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  116    117   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
@@ -141,142 +299,305 @@
  161    162   
                    Ok(())
  162    163   
                },
  163    164   
            )?;
  164    165   
        }
  165    166   
        if let Some(ref val) = self.dense_set_map {
  166    167   
            ser.write_map(
  167    168   
                &JSONMAPSINPUT_MEMBER_DENSE_SET_MAP,
  168    169   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  169    170   
                    for (key, value) in val {
  170    171   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
  171         -
                        todo!("schema: unsupported map value type");
         172  +
         173  +
                        ser.write_list(
         174  +
                            &::aws_smithy_schema::prelude::DOCUMENT,
         175  +
                            &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
         176  +
                                for item in value {
         177  +
                                    ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
         178  +
                                }
         179  +
                                Ok(())
         180  +
                            },
         181  +
                        )?;
  172    182   
                    }
  173    183   
                    Ok(())
  174    184   
                },
  175    185   
            )?;
  176    186   
        }
  177    187   
        Ok(())
  178    188   
    }
  179    189   
}
  180    190   
impl JsonMapsInput {
  181    191   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  182         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  183         -
        deserializer: &mut D,
         192  +
    pub fn deserialize(
         193  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  184    194   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  185    195   
        #[allow(unused_variables, unused_mut)]
  186    196   
        let mut builder = Self::builder();
  187    197   
        #[allow(
  188    198   
            unused_variables,
  189    199   
            unreachable_code,
  190    200   
            clippy::single_match,
  191    201   
            clippy::match_single_binding,
  192    202   
            clippy::diverging_sub_expression
  193    203   
        )]
  194         -
        deserializer.read_struct(&JSONMAPSINPUT_SCHEMA, (), |_, member, deser| {
         204  +
        deserializer.read_struct(&JSONMAPSINPUT_SCHEMA, &mut |member, deser| {
  195    205   
            match member.member_index() {
  196    206   
                Some(0) => {
  197    207   
                    builder.dense_struct_map = Some({
  198         -
                        let container = if let Some(cap) = deser.container_size() {
  199         -
                            std::collections::HashMap::with_capacity(cap)
  200         -
                        } else {
  201         -
                            std::collections::HashMap::new()
  202         -
                        };
  203         -
                        deser.read_map(member, container, |mut map, key, deser| {
  204         -
                            map.insert(key, crate::types::GreetingStruct::deserialize(deser)?);
  205         -
                            Ok(map)
  206         -
                        })?
         208  +
                        let mut container = std::collections::HashMap::new();
         209  +
                        deser.read_map(member, &mut |key, deser| {
         210  +
                            container.insert(key, crate::types::GreetingStruct::deserialize(deser)?);
         211  +
                            Ok(())
         212  +
                        })?;
         213  +
                        container
  207    214   
                    });
  208    215   
                }
  209    216   
                Some(1) => {
  210    217   
                    builder.dense_number_map = Some({
  211         -
                        let container = if let Some(cap) = deser.container_size() {
  212         -
                            std::collections::HashMap::with_capacity(cap)
  213         -
                        } else {
  214         -
                            std::collections::HashMap::new()
  215         -
                        };
  216         -
                        deser.read_map(member, container, |mut map, key, deser| {
  217         -
                            map.insert(key, deser.read_integer(member)?);
  218         -
                            Ok(map)
  219         -
                        })?
         218  +
                        let mut container = std::collections::HashMap::new();
         219  +
                        deser.read_map(member, &mut |key, deser| {
         220  +
                            container.insert(key, deser.read_integer(member)?);
         221  +
                            Ok(())
         222  +
                        })?;
         223  +
                        container
  220    224   
                    });
  221    225   
                }
  222    226   
                Some(2) => {
  223    227   
                    builder.dense_boolean_map = Some({
  224         -
                        let container = if let Some(cap) = deser.container_size() {
  225         -
                            std::collections::HashMap::with_capacity(cap)
  226         -
                        } else {
  227         -
                            std::collections::HashMap::new()
  228         -
                        };
  229         -
                        deser.read_map(member, container, |mut map, key, deser| {
  230         -
                            map.insert(key, deser.read_boolean(member)?);
  231         -
                            Ok(map)
  232         -
                        })?
         228  +
                        let mut container = std::collections::HashMap::new();
         229  +
                        deser.read_map(member, &mut |key, deser| {
         230  +
                            container.insert(key, deser.read_boolean(member)?);
         231  +
                            Ok(())
         232  +
                        })?;
         233  +
                        container
  233    234   
                    });
  234    235   
                }
  235    236   
                Some(3) => {
  236         -
                    builder.dense_string_map = Some({
  237         -
                        let container = if let Some(cap) = deser.container_size() {
  238         -
                            std::collections::HashMap::with_capacity(cap)
  239         -
                        } else {
  240         -
                            std::collections::HashMap::new()
  241         -
                        };
  242         -
                        deser.read_map(member, container, |mut map, key, deser| {
  243         -
                            map.insert(key, deser.read_string(member)?);
  244         -
                            Ok(map)
  245         -
                        })?
  246         -
                    });
         237  +
                    builder.dense_string_map = Some(deser.read_string_string_map(member)?);
  247    238   
                }
  248    239   
                Some(4) => {
  249    240   
                    builder.dense_set_map = Some({
  250         -
                        let container = if let Some(cap) = deser.container_size() {
  251         -
                            std::collections::HashMap::with_capacity(cap)
  252         -
                        } else {
  253         -
                            std::collections::HashMap::new()
  254         -
                        };
  255         -
                        deser.read_map(member, container, |mut map, key, deser| {
  256         -
                            map.insert(key, todo!("deserialize nested aggregate"));
  257         -
                            Ok(map)
  258         -
                        })?
         241  +
                        let mut container = std::collections::HashMap::new();
         242  +
                        deser.read_map(member, &mut |key, deser| {
         243  +
                            container.insert(key, {
         244  +
                                let mut list = Vec::new();
         245  +
                                deser.read_list(member, &mut |deser| {
         246  +
                                    list.push(deser.read_string(&::aws_smithy_schema::prelude::DOCUMENT)?);
         247  +
                                    Ok(())
         248  +
                                })?;
         249  +
                                list
         250  +
                            });
         251  +
                            Ok(())
         252  +
                        })?;
         253  +
                        container
  259    254   
                    });
  260    255   
                }
  261    256   
                _ => {}
  262    257   
            }
  263    258   
            Ok(())
  264    259   
        })?;
  265    260   
        builder
  266    261   
            .build()
  267    262   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  268    263   
    }
  269    264   
}
         265  +
impl JsonMapsInput {
         266  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         267  +
    pub fn deserialize_with_response(
         268  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         269  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         270  +
        _status: u16,
         271  +
        _body: &[u8],
         272  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         273  +
        Self::deserialize(deserializer)
         274  +
    }
         275  +
}
  270    276   
impl JsonMapsInput {
  271    277   
    /// Creates a new builder-style object to manufacture [`JsonMapsInput`](crate::operation::json_maps::JsonMapsInput).
  272    278   
    pub fn builder() -> crate::operation::json_maps::builders::JsonMapsInputBuilder {
  273    279   
        crate::operation::json_maps::builders::JsonMapsInputBuilder::default()
  274    280   
    }
  275    281   
}
  276    282   
  277    283   
/// A builder for [`JsonMapsInput`](crate::operation::json_maps::JsonMapsInput).
  278    284   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  279    285   
#[non_exhaustive]

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

@@ -23,23 +123,123 @@
   43     43   
    "aws.protocoltests.restjson.synthetic",
   44     44   
    "JsonMapsOutput",
   45     45   
);
   46     46   
static JSONMAPSOUTPUT_MEMBER_DENSE_STRUCT_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   47     47   
    ::aws_smithy_schema::ShapeId::from_static(
   48     48   
        "aws.protocoltests.restjson.synthetic#JsonMapsOutput$denseStructMap",
   49     49   
        "aws.protocoltests.restjson.synthetic",
   50     50   
        "JsonMapsOutput",
   51     51   
    ),
   52     52   
    ::aws_smithy_schema::ShapeType::Map,
   53         -
    "dense_struct_map",
          53  +
    "denseStructMap",
   54     54   
    0,
   55     55   
);
   56     56   
static JSONMAPSOUTPUT_MEMBER_DENSE_NUMBER_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   57     57   
    ::aws_smithy_schema::ShapeId::from_static(
   58     58   
        "aws.protocoltests.restjson.synthetic#JsonMapsOutput$denseNumberMap",
   59     59   
        "aws.protocoltests.restjson.synthetic",
   60     60   
        "JsonMapsOutput",
   61     61   
    ),
   62     62   
    ::aws_smithy_schema::ShapeType::Map,
   63         -
    "dense_number_map",
          63  +
    "denseNumberMap",
   64     64   
    1,
   65     65   
);
   66     66   
static JSONMAPSOUTPUT_MEMBER_DENSE_BOOLEAN_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   67     67   
    ::aws_smithy_schema::ShapeId::from_static(
   68     68   
        "aws.protocoltests.restjson.synthetic#JsonMapsOutput$denseBooleanMap",
   69     69   
        "aws.protocoltests.restjson.synthetic",
   70     70   
        "JsonMapsOutput",
   71     71   
    ),
   72     72   
    ::aws_smithy_schema::ShapeType::Map,
   73         -
    "dense_boolean_map",
          73  +
    "denseBooleanMap",
   74     74   
    2,
   75     75   
);
   76     76   
static JSONMAPSOUTPUT_MEMBER_DENSE_STRING_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   77     77   
    ::aws_smithy_schema::ShapeId::from_static(
   78     78   
        "aws.protocoltests.restjson.synthetic#JsonMapsOutput$denseStringMap",
   79     79   
        "aws.protocoltests.restjson.synthetic",
   80     80   
        "JsonMapsOutput",
   81     81   
    ),
   82     82   
    ::aws_smithy_schema::ShapeType::Map,
   83         -
    "dense_string_map",
          83  +
    "denseStringMap",
   84     84   
    3,
   85     85   
);
   86     86   
static JSONMAPSOUTPUT_MEMBER_DENSE_SET_MAP: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   87     87   
    ::aws_smithy_schema::ShapeId::from_static(
   88     88   
        "aws.protocoltests.restjson.synthetic#JsonMapsOutput$denseSetMap",
   89     89   
        "aws.protocoltests.restjson.synthetic",
   90     90   
        "JsonMapsOutput",
   91     91   
    ),
   92     92   
    ::aws_smithy_schema::ShapeType::Map,
   93         -
    "dense_set_map",
          93  +
    "denseSetMap",
   94     94   
    4,
   95     95   
);
   96     96   
static JSONMAPSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   97     97   
    JSONMAPSOUTPUT_SCHEMA_ID,
   98     98   
    ::aws_smithy_schema::ShapeType::Structure,
   99     99   
    &[
  100    100   
        &JSONMAPSOUTPUT_MEMBER_DENSE_STRUCT_MAP,
  101    101   
        &JSONMAPSOUTPUT_MEMBER_DENSE_NUMBER_MAP,
  102    102   
        &JSONMAPSOUTPUT_MEMBER_DENSE_BOOLEAN_MAP,
  103    103   
        &JSONMAPSOUTPUT_MEMBER_DENSE_STRING_MAP,
@@ -141,141 +297,302 @@
  161    161   
                    Ok(())
  162    162   
                },
  163    163   
            )?;
  164    164   
        }
  165    165   
        if let Some(ref val) = self.dense_set_map {
  166    166   
            ser.write_map(
  167    167   
                &JSONMAPSOUTPUT_MEMBER_DENSE_SET_MAP,
  168    168   
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
  169    169   
                    for (key, value) in val {
  170    170   
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
  171         -
                        todo!("schema: unsupported map value type");
         171  +
         172  +
                        ser.write_list(
         173  +
                            &::aws_smithy_schema::prelude::DOCUMENT,
         174  +
                            &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
         175  +
                                for item in value {
         176  +
                                    ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
         177  +
                                }
         178  +
                                Ok(())
         179  +
                            },
         180  +
                        )?;
  172    181   
                    }
  173    182   
                    Ok(())
  174    183   
                },
  175    184   
            )?;
  176    185   
        }
  177    186   
        Ok(())
  178    187   
    }
  179    188   
}
  180    189   
impl JsonMapsOutput {
  181    190   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  182         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  183         -
        deserializer: &mut D,
         191  +
    pub fn deserialize(
         192  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  184    193   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  185    194   
        #[allow(unused_variables, unused_mut)]
  186    195   
        let mut builder = Self::builder();
  187    196   
        #[allow(
  188    197   
            unused_variables,
  189    198   
            unreachable_code,
  190    199   
            clippy::single_match,
  191    200   
            clippy::match_single_binding,
  192    201   
            clippy::diverging_sub_expression
  193    202   
        )]
  194         -
        deserializer.read_struct(&JSONMAPSOUTPUT_SCHEMA, (), |_, member, deser| {
         203  +
        deserializer.read_struct(&JSONMAPSOUTPUT_SCHEMA, &mut |member, deser| {
  195    204   
            match member.member_index() {
  196    205   
                Some(0) => {
  197    206   
                    builder.dense_struct_map = Some({
  198         -
                        let container = if let Some(cap) = deser.container_size() {
  199         -
                            std::collections::HashMap::with_capacity(cap)
  200         -
                        } else {
  201         -
                            std::collections::HashMap::new()
  202         -
                        };
  203         -
                        deser.read_map(member, container, |mut map, key, deser| {
  204         -
                            map.insert(key, crate::types::GreetingStruct::deserialize(deser)?);
  205         -
                            Ok(map)
  206         -
                        })?
         207  +
                        let mut container = std::collections::HashMap::new();
         208  +
                        deser.read_map(member, &mut |key, deser| {
         209  +
                            container.insert(key, crate::types::GreetingStruct::deserialize(deser)?);
         210  +
                            Ok(())
         211  +
                        })?;
         212  +
                        container
  207    213   
                    });
  208    214   
                }
  209    215   
                Some(1) => {
  210    216   
                    builder.dense_number_map = Some({
  211         -
                        let container = if let Some(cap) = deser.container_size() {
  212         -
                            std::collections::HashMap::with_capacity(cap)
  213         -
                        } else {
  214         -
                            std::collections::HashMap::new()
  215         -
                        };
  216         -
                        deser.read_map(member, container, |mut map, key, deser| {
  217         -
                            map.insert(key, deser.read_integer(member)?);
  218         -
                            Ok(map)
  219         -
                        })?
         217  +
                        let mut container = std::collections::HashMap::new();
         218  +
                        deser.read_map(member, &mut |key, deser| {
         219  +
                            container.insert(key, deser.read_integer(member)?);
         220  +
                            Ok(())
         221  +
                        })?;
         222  +
                        container
  220    223   
                    });
  221    224   
                }
  222    225   
                Some(2) => {
  223    226   
                    builder.dense_boolean_map = Some({
  224         -
                        let container = if let Some(cap) = deser.container_size() {
  225         -
                            std::collections::HashMap::with_capacity(cap)
  226         -
                        } else {
  227         -
                            std::collections::HashMap::new()
  228         -
                        };
  229         -
                        deser.read_map(member, container, |mut map, key, deser| {
  230         -
                            map.insert(key, deser.read_boolean(member)?);
  231         -
                            Ok(map)
  232         -
                        })?
         227  +
                        let mut container = std::collections::HashMap::new();
         228  +
                        deser.read_map(member, &mut |key, deser| {
         229  +
                            container.insert(key, deser.read_boolean(member)?);
         230  +
                            Ok(())
         231  +
                        })?;
         232  +
                        container
  233    233   
                    });
  234    234   
                }
  235    235   
                Some(3) => {
  236         -
                    builder.dense_string_map = Some({
  237         -
                        let container = if let Some(cap) = deser.container_size() {
  238         -
                            std::collections::HashMap::with_capacity(cap)
  239         -
                        } else {
  240         -
                            std::collections::HashMap::new()
  241         -
                        };
  242         -
                        deser.read_map(member, container, |mut map, key, deser| {
  243         -
                            map.insert(key, deser.read_string(member)?);
  244         -
                            Ok(map)
  245         -
                        })?
  246         -
                    });
         236  +
                    builder.dense_string_map = Some(deser.read_string_string_map(member)?);
  247    237   
                }
  248    238   
                Some(4) => {
  249    239   
                    builder.dense_set_map = Some({
  250         -
                        let container = if let Some(cap) = deser.container_size() {
  251         -
                            std::collections::HashMap::with_capacity(cap)
  252         -
                        } else {
  253         -
                            std::collections::HashMap::new()
  254         -
                        };
  255         -
                        deser.read_map(member, container, |mut map, key, deser| {
  256         -
                            map.insert(key, todo!("deserialize nested aggregate"));
  257         -
                            Ok(map)
  258         -
                        })?
         240  +
                        let mut container = std::collections::HashMap::new();
         241  +
                        deser.read_map(member, &mut |key, deser| {
         242  +
                            container.insert(key, {
         243  +
                                let mut list = Vec::new();
         244  +
                                deser.read_list(member, &mut |deser| {
         245  +
                                    list.push(deser.read_string(&::aws_smithy_schema::prelude::DOCUMENT)?);
         246  +
                                    Ok(())
         247  +
                                })?;
         248  +
                                list
         249  +
                            });
         250  +
                            Ok(())
         251  +
                        })?;
         252  +
                        container
  259    253   
                    });
  260    254   
                }
  261    255   
                _ => {}
  262    256   
            }
  263    257   
            Ok(())
  264    258   
        })?;
  265    259   
        Ok(builder.build())
  266    260   
    }
  267    261   
}
         262  +
impl JsonMapsOutput {
         263  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         264  +
    pub fn deserialize_with_response(
         265  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         266  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         267  +
        _status: u16,
         268  +
        _body: &[u8],
         269  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         270  +
        Self::deserialize(deserializer)
         271  +
    }
         272  +
}
  268    273   
impl JsonMapsOutput {
  269    274   
    /// Creates a new builder-style object to manufacture [`JsonMapsOutput`](crate::operation::json_maps::JsonMapsOutput).
  270    275   
    pub fn builder() -> crate::operation::json_maps::builders::JsonMapsOutputBuilder {
  271    276   
        crate::operation::json_maps::builders::JsonMapsOutputBuilder::default()
  272    277   
    }
  273    278   
}
  274    279   
  275    280   
/// A builder for [`JsonMapsOutput`](crate::operation::json_maps::JsonMapsOutput).
  276    281   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  277    282   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/json_timestamps.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 `JsonTimestamps`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct JsonTimestamps;
    6      6   
impl JsonTimestamps {
    7      7   
    /// Creates a new `JsonTimestamps`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_timestamps::JsonTimestampsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_timestamps::JsonTimestampsOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::json_timestamps::JsonTimestampsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::json_timestamps::JsonTimestampsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::json_timestamps::JsonTimestampsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +226,233 @@
  124    128   
                crate::operation::json_timestamps::JsonTimestampsError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct JsonTimestampsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for JsonTimestampsResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         144  +
        #[allow(unused_mut)]
         145  +
        let mut force_error = false;
         146  +
         147  +
        if !success && status != 200 || force_error {
  139    148   
            let headers = response.headers();
  140    149   
            let body = response.body().bytes().expect("body loaded");
  141    150   
            #[allow(unused_mut)]
  142         -
        let mut force_error = false;
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
  143    154   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_json_timestamps::de_json_timestamps_http_error(status, headers, body)
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
         158  +
                    crate::operation::json_timestamps::JsonTimestampsError::generic(generic),
         159  +
                ),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_json_timestamps::de_json_timestamps_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let mut deser = protocol
         166  +
                .deserialize_response(response, JsonTimestamps::OUTPUT_SCHEMA, _cfg)
         167  +
                .map_err(|e| {
         168  +
                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         169  +
                })?;
         170  +
            let body = response.body().bytes().expect("body loaded");
         171  +
            let output = crate::operation::json_timestamps::JsonTimestampsOutput::deserialize_with_response(
         172  +
                &mut *deser,
         173  +
                response.headers(),
         174  +
                response.status().into(),
         175  +
                body,
         176  +
            )
         177  +
            .map_err(|e| {
         178  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         179  +
            })?;
         180  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         181  +
        }
  150    182   
    }
  151    183   
}
  152    184   
#[derive(Debug)]
  153    185   
struct JsonTimestampsRequestSerializer;
  154    186   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for JsonTimestampsRequestSerializer {
  155    187   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    188   
    fn serialize_input(
  157    189   
        &self,
  158    190   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    191   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    192   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    193   
        let input = input
  162    194   
            .downcast::<crate::operation::json_timestamps::JsonTimestampsInput>()
  163    195   
            .expect("correct type");
  164         -
        let _header_serialization_settings = _cfg
  165         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  166         -
            .cloned()
  167         -
            .unwrap_or_default();
  168         -
        let mut request_builder = {
  169         -
            #[allow(clippy::uninlined_format_args)]
  170         -
            fn uri_base(
  171         -
                _input: &crate::operation::json_timestamps::JsonTimestampsInput,
  172         -
                output: &mut ::std::string::String,
  173         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  174         -
                use ::std::fmt::Write as _;
  175         -
                ::std::write!(output, "/JsonTimestamps").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::json_timestamps::JsonTimestampsInput,
  181         -
                builder: ::http_1x::request::Builder,
  182         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  183         -
                let mut uri = ::std::string::String::new();
  184         -
                uri_base(input, &mut uri)?;
  185         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  189         -
            builder
  190         -
        };
  191         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_json_timestamps::ser_json_timestamps_input(&input)?);
  192         -
        if let Some(content_length) = body.content_length() {
  193         -
            let content_length = content_length.to_string();
  194         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  195         -
        }
  196         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         196  +
        let protocol = _cfg
         197  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         198  +
            .expect("a SharedClientProtocol is required");
         199  +
        let mut request = protocol
         200  +
            .serialize_request(&input, JsonTimestamps::INPUT_SCHEMA, "", _cfg)
         201  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         202  +
         203  +
        return ::std::result::Result::Ok(request);
  197    204   
    }
  198    205   
}
  199    206   
#[derive(Debug)]
  200    207   
struct JsonTimestampsEndpointParamsInterceptor;
  201    208   
  202    209   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for JsonTimestampsEndpointParamsInterceptor {
  203    210   
    fn name(&self) -> &'static str {
  204    211   
        "JsonTimestampsEndpointParamsInterceptor"
  205    212   
    }
  206    213   
@@ -495,502 +555,572 @@
  515    522   
            .expect("the config must have a deserializer");
  516    523   
  517    524   
        let parsed = de.deserialize_streaming(&mut http_response);
  518    525   
        let parsed = parsed.unwrap_or_else(|| {
  519    526   
            let http_response = http_response.map(|body| {
  520    527   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  521    528   
                    body.bytes().unwrap(),
  522    529   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  523    530   
                )))
  524    531   
            });
  525         -
            de.deserialize_nonstreaming(&http_response)
         532  +
            // Build a config bag with the protocol for schema-based deserialization
         533  +
            #[allow(unused_mut)]
         534  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         535  +
            {
         536  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         537  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         538  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         539  +
                ));
         540  +
                test_cfg.push_shared_layer(layer.freeze());
         541  +
            }
         542  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  526    543   
        });
  527    544   
        let parsed = parsed
  528    545   
            .expect("should be successful response")
  529    546   
            .downcast::<crate::operation::json_timestamps::JsonTimestampsOutput>()
  530    547   
            .unwrap();
  531    548   
        ::pretty_assertions::assert_eq!(parsed.normal, expected_output.normal, "Unexpected value for `normal`");
  532    549   
        ::pretty_assertions::assert_eq!(parsed.date_time, expected_output.date_time, "Unexpected value for `date_time`");
  533    550   
        ::pretty_assertions::assert_eq!(
  534    551   
            parsed.date_time_on_target,
  535    552   
            expected_output.date_time_on_target,
@@ -563,580 +623,650 @@
  583    600   
            .expect("the config must have a deserializer");
  584    601   
  585    602   
        let parsed = de.deserialize_streaming(&mut http_response);
  586    603   
        let parsed = parsed.unwrap_or_else(|| {
  587    604   
            let http_response = http_response.map(|body| {
  588    605   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  589    606   
                    body.bytes().unwrap(),
  590    607   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  591    608   
                )))
  592    609   
            });
  593         -
            de.deserialize_nonstreaming(&http_response)
         610  +
            // Build a config bag with the protocol for schema-based deserialization
         611  +
            #[allow(unused_mut)]
         612  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         613  +
            {
         614  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         615  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         616  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         617  +
                ));
         618  +
                test_cfg.push_shared_layer(layer.freeze());
         619  +
            }
         620  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  594    621   
        });
  595    622   
        let parsed = parsed
  596    623   
            .expect("should be successful response")
  597    624   
            .downcast::<crate::operation::json_timestamps::JsonTimestampsOutput>()
  598    625   
            .unwrap();
  599    626   
        ::pretty_assertions::assert_eq!(parsed.normal, expected_output.normal, "Unexpected value for `normal`");
  600    627   
        ::pretty_assertions::assert_eq!(parsed.date_time, expected_output.date_time, "Unexpected value for `date_time`");
  601    628   
        ::pretty_assertions::assert_eq!(
  602    629   
            parsed.date_time_on_target,
  603    630   
            expected_output.date_time_on_target,
@@ -631,658 +691,728 @@
  651    678   
            .expect("the config must have a deserializer");
  652    679   
  653    680   
        let parsed = de.deserialize_streaming(&mut http_response);
  654    681   
        let parsed = parsed.unwrap_or_else(|| {
  655    682   
            let http_response = http_response.map(|body| {
  656    683   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  657    684   
                    body.bytes().unwrap(),
  658    685   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  659    686   
                )))
  660    687   
            });
  661         -
            de.deserialize_nonstreaming(&http_response)
         688  +
            // Build a config bag with the protocol for schema-based deserialization
         689  +
            #[allow(unused_mut)]
         690  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         691  +
            {
         692  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         693  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         694  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         695  +
                ));
         696  +
                test_cfg.push_shared_layer(layer.freeze());
         697  +
            }
         698  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  662    699   
        });
  663    700   
        let parsed = parsed
  664    701   
            .expect("should be successful response")
  665    702   
            .downcast::<crate::operation::json_timestamps::JsonTimestampsOutput>()
  666    703   
            .unwrap();
  667    704   
        ::pretty_assertions::assert_eq!(parsed.normal, expected_output.normal, "Unexpected value for `normal`");
  668    705   
        ::pretty_assertions::assert_eq!(parsed.date_time, expected_output.date_time, "Unexpected value for `date_time`");
  669    706   
        ::pretty_assertions::assert_eq!(
  670    707   
            parsed.date_time_on_target,
  671    708   
            expected_output.date_time_on_target,
@@ -697,734 +757,804 @@
  717    754   
            .expect("the config must have a deserializer");
  718    755   
  719    756   
        let parsed = de.deserialize_streaming(&mut http_response);
  720    757   
        let parsed = parsed.unwrap_or_else(|| {
  721    758   
            let http_response = http_response.map(|body| {
  722    759   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  723    760   
                    body.bytes().unwrap(),
  724    761   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  725    762   
                )))
  726    763   
            });
  727         -
            de.deserialize_nonstreaming(&http_response)
         764  +
            // Build a config bag with the protocol for schema-based deserialization
         765  +
            #[allow(unused_mut)]
         766  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         767  +
            {
         768  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         769  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         770  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         771  +
                ));
         772  +
                test_cfg.push_shared_layer(layer.freeze());
         773  +
            }
         774  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  728    775   
        });
  729    776   
        let parsed = parsed
  730    777   
            .expect("should be successful response")
  731    778   
            .downcast::<crate::operation::json_timestamps::JsonTimestampsOutput>()
  732    779   
            .unwrap();
  733    780   
        ::pretty_assertions::assert_eq!(parsed.normal, expected_output.normal, "Unexpected value for `normal`");
  734    781   
        ::pretty_assertions::assert_eq!(parsed.date_time, expected_output.date_time, "Unexpected value for `date_time`");
  735    782   
        ::pretty_assertions::assert_eq!(
  736    783   
            parsed.date_time_on_target,
  737    784   
            expected_output.date_time_on_target,
@@ -763,810 +823,880 @@
  783    830   
            .expect("the config must have a deserializer");
  784    831   
  785    832   
        let parsed = de.deserialize_streaming(&mut http_response);
  786    833   
        let parsed = parsed.unwrap_or_else(|| {
  787    834   
            let http_response = http_response.map(|body| {
  788    835   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  789    836   
                    body.bytes().unwrap(),
  790    837   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  791    838   
                )))
  792    839   
            });
  793         -
            de.deserialize_nonstreaming(&http_response)
         840  +
            // Build a config bag with the protocol for schema-based deserialization
         841  +
            #[allow(unused_mut)]
         842  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         843  +
            {
         844  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         845  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         846  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         847  +
                ));
         848  +
                test_cfg.push_shared_layer(layer.freeze());
         849  +
            }
         850  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  794    851   
        });
  795    852   
        let parsed = parsed
  796    853   
            .expect("should be successful response")
  797    854   
            .downcast::<crate::operation::json_timestamps::JsonTimestampsOutput>()
  798    855   
            .unwrap();
  799    856   
        ::pretty_assertions::assert_eq!(parsed.normal, expected_output.normal, "Unexpected value for `normal`");
  800    857   
        ::pretty_assertions::assert_eq!(parsed.date_time, expected_output.date_time, "Unexpected value for `date_time`");
  801    858   
        ::pretty_assertions::assert_eq!(
  802    859   
            parsed.date_time_on_target,
  803    860   
            expected_output.date_time_on_target,
@@ -831,888 +891,958 @@
  851    908   
            .expect("the config must have a deserializer");
  852    909   
  853    910   
        let parsed = de.deserialize_streaming(&mut http_response);
  854    911   
        let parsed = parsed.unwrap_or_else(|| {
  855    912   
            let http_response = http_response.map(|body| {
  856    913   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  857    914   
                    body.bytes().unwrap(),
  858    915   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  859    916   
                )))
  860    917   
            });
  861         -
            de.deserialize_nonstreaming(&http_response)
         918  +
            // Build a config bag with the protocol for schema-based deserialization
         919  +
            #[allow(unused_mut)]
         920  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         921  +
            {
         922  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         923  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         924  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         925  +
                ));
         926  +
                test_cfg.push_shared_layer(layer.freeze());
         927  +
            }
         928  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  862    929   
        });
  863    930   
        let parsed = parsed
  864    931   
            .expect("should be successful response")
  865    932   
            .downcast::<crate::operation::json_timestamps::JsonTimestampsOutput>()
  866    933   
            .unwrap();
  867    934   
        ::pretty_assertions::assert_eq!(parsed.normal, expected_output.normal, "Unexpected value for `normal`");
  868    935   
        ::pretty_assertions::assert_eq!(parsed.date_time, expected_output.date_time, "Unexpected value for `date_time`");
  869    936   
        ::pretty_assertions::assert_eq!(
  870    937   
            parsed.date_time_on_target,
  871    938   
            expected_output.date_time_on_target,
@@ -899,966 +959,1036 @@
  919    986   
            .expect("the config must have a deserializer");
  920    987   
  921    988   
        let parsed = de.deserialize_streaming(&mut http_response);
  922    989   
        let parsed = parsed.unwrap_or_else(|| {
  923    990   
            let http_response = http_response.map(|body| {
  924    991   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  925    992   
                    body.bytes().unwrap(),
  926    993   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  927    994   
                )))
  928    995   
            });
  929         -
            de.deserialize_nonstreaming(&http_response)
         996  +
            // Build a config bag with the protocol for schema-based deserialization
         997  +
            #[allow(unused_mut)]
         998  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         999  +
            {
        1000  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1001  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1002  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
        1003  +
                ));
        1004  +
                test_cfg.push_shared_layer(layer.freeze());
        1005  +
            }
        1006  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  930   1007   
        });
  931   1008   
        let parsed = parsed
  932   1009   
            .expect("should be successful response")
  933   1010   
            .downcast::<crate::operation::json_timestamps::JsonTimestampsOutput>()
  934   1011   
            .unwrap();
  935   1012   
        ::pretty_assertions::assert_eq!(parsed.normal, expected_output.normal, "Unexpected value for `normal`");
  936   1013   
        ::pretty_assertions::assert_eq!(parsed.date_time, expected_output.date_time, "Unexpected value for `date_time`");
  937   1014   
        ::pretty_assertions::assert_eq!(
  938   1015   
            parsed.date_time_on_target,
  939   1016   
            expected_output.date_time_on_target,

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

@@ -43,43 +251,266 @@
   63     63   
    "normal",
   64     64   
    0,
   65     65   
);
   66     66   
static JSONTIMESTAMPSINPUT_MEMBER_DATE_TIME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   67     67   
    ::aws_smithy_schema::ShapeId::from_static(
   68     68   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsInput$dateTime",
   69     69   
        "aws.protocoltests.restjson.synthetic",
   70     70   
        "JsonTimestampsInput",
   71     71   
    ),
   72     72   
    ::aws_smithy_schema::ShapeType::Timestamp,
   73         -
    "date_time",
          73  +
    "dateTime",
   74     74   
    1,
   75     75   
)
   76     76   
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::DateTime);
   77     77   
static JSONTIMESTAMPSINPUT_MEMBER_DATE_TIME_ON_TARGET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   78     78   
    ::aws_smithy_schema::ShapeId::from_static(
   79     79   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsInput$dateTimeOnTarget",
   80     80   
        "aws.protocoltests.restjson.synthetic",
   81     81   
        "JsonTimestampsInput",
   82     82   
    ),
   83     83   
    ::aws_smithy_schema::ShapeType::Timestamp,
   84         -
    "date_time_on_target",
          84  +
    "dateTimeOnTarget",
   85     85   
    2,
   86         -
);
          86  +
)
          87  +
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::DateTime);
   87     88   
static JSONTIMESTAMPSINPUT_MEMBER_EPOCH_SECONDS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   88     89   
    ::aws_smithy_schema::ShapeId::from_static(
   89     90   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsInput$epochSeconds",
   90     91   
        "aws.protocoltests.restjson.synthetic",
   91     92   
        "JsonTimestampsInput",
   92     93   
    ),
   93     94   
    ::aws_smithy_schema::ShapeType::Timestamp,
   94         -
    "epoch_seconds",
          95  +
    "epochSeconds",
   95     96   
    3,
   96     97   
)
   97     98   
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::EpochSeconds);
   98     99   
static JSONTIMESTAMPSINPUT_MEMBER_EPOCH_SECONDS_ON_TARGET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   99    100   
    ::aws_smithy_schema::ShapeId::from_static(
  100    101   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsInput$epochSecondsOnTarget",
  101    102   
        "aws.protocoltests.restjson.synthetic",
  102    103   
        "JsonTimestampsInput",
  103    104   
    ),
  104    105   
    ::aws_smithy_schema::ShapeType::Timestamp,
  105         -
    "epoch_seconds_on_target",
         106  +
    "epochSecondsOnTarget",
  106    107   
    4,
  107         -
);
         108  +
)
         109  +
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::EpochSeconds);
  108    110   
static JSONTIMESTAMPSINPUT_MEMBER_HTTP_DATE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  109    111   
    ::aws_smithy_schema::ShapeId::from_static(
  110    112   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsInput$httpDate",
  111    113   
        "aws.protocoltests.restjson.synthetic",
  112    114   
        "JsonTimestampsInput",
  113    115   
    ),
  114    116   
    ::aws_smithy_schema::ShapeType::Timestamp,
  115         -
    "http_date",
         117  +
    "httpDate",
  116    118   
    5,
  117    119   
)
  118    120   
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::HttpDate);
  119    121   
static JSONTIMESTAMPSINPUT_MEMBER_HTTP_DATE_ON_TARGET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  120    122   
    ::aws_smithy_schema::ShapeId::from_static(
  121    123   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsInput$httpDateOnTarget",
  122    124   
        "aws.protocoltests.restjson.synthetic",
  123    125   
        "JsonTimestampsInput",
  124    126   
    ),
  125    127   
    ::aws_smithy_schema::ShapeType::Timestamp,
  126         -
    "http_date_on_target",
         128  +
    "httpDateOnTarget",
  127    129   
    6,
  128         -
);
         130  +
)
         131  +
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::HttpDate);
  129    132   
static JSONTIMESTAMPSINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  130    133   
    JSONTIMESTAMPSINPUT_SCHEMA_ID,
  131    134   
    ::aws_smithy_schema::ShapeType::Structure,
  132    135   
    &[
  133    136   
        &JSONTIMESTAMPSINPUT_MEMBER_NORMAL,
  134    137   
        &JSONTIMESTAMPSINPUT_MEMBER_DATE_TIME,
  135    138   
        &JSONTIMESTAMPSINPUT_MEMBER_DATE_TIME_ON_TARGET,
  136    139   
        &JSONTIMESTAMPSINPUT_MEMBER_EPOCH_SECONDS,
  137    140   
        &JSONTIMESTAMPSINPUT_MEMBER_EPOCH_SECONDS_ON_TARGET,
  138    141   
        &JSONTIMESTAMPSINPUT_MEMBER_HTTP_DATE,
  139    142   
        &JSONTIMESTAMPSINPUT_MEMBER_HTTP_DATE_ON_TARGET,
  140    143   
    ],
  141         -
);
         144  +
)
         145  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/JsonTimestamps", None));
  142    146   
impl JsonTimestampsInput {
  143    147   
    /// The schema for this shape.
  144    148   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &JSONTIMESTAMPSINPUT_SCHEMA;
  145    149   
}
  146    150   
impl ::aws_smithy_schema::serde::SerializableStruct for JsonTimestampsInput {
  147    151   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  148    152   
    fn serialize_members(
  149    153   
        &self,
  150    154   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  151    155   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  152    156   
        if let Some(ref val) = self.normal {
  153    157   
            ser.write_timestamp(&JSONTIMESTAMPSINPUT_MEMBER_NORMAL, val)?;
  154    158   
        }
  155    159   
        if let Some(ref val) = self.date_time {
  156    160   
            ser.write_timestamp(&JSONTIMESTAMPSINPUT_MEMBER_DATE_TIME, val)?;
  157    161   
        }
  158    162   
        if let Some(ref val) = self.date_time_on_target {
  159    163   
            ser.write_timestamp(&JSONTIMESTAMPSINPUT_MEMBER_DATE_TIME_ON_TARGET, val)?;
  160    164   
        }
  161    165   
        if let Some(ref val) = self.epoch_seconds {
  162    166   
            ser.write_timestamp(&JSONTIMESTAMPSINPUT_MEMBER_EPOCH_SECONDS, val)?;
  163    167   
        }
  164    168   
        if let Some(ref val) = self.epoch_seconds_on_target {
  165    169   
            ser.write_timestamp(&JSONTIMESTAMPSINPUT_MEMBER_EPOCH_SECONDS_ON_TARGET, val)?;
  166    170   
        }
  167    171   
        if let Some(ref val) = self.http_date {
  168    172   
            ser.write_timestamp(&JSONTIMESTAMPSINPUT_MEMBER_HTTP_DATE, val)?;
  169    173   
        }
  170    174   
        if let Some(ref val) = self.http_date_on_target {
  171    175   
            ser.write_timestamp(&JSONTIMESTAMPSINPUT_MEMBER_HTTP_DATE_ON_TARGET, val)?;
  172    176   
        }
  173    177   
        Ok(())
  174    178   
    }
  175    179   
}
  176    180   
impl JsonTimestampsInput {
  177    181   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  178         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  179         -
        deserializer: &mut D,
         182  +
    pub fn deserialize(
         183  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  180    184   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  181    185   
        #[allow(unused_variables, unused_mut)]
  182    186   
        let mut builder = Self::builder();
  183    187   
        #[allow(
  184    188   
            unused_variables,
  185    189   
            unreachable_code,
  186    190   
            clippy::single_match,
  187    191   
            clippy::match_single_binding,
  188    192   
            clippy::diverging_sub_expression
  189    193   
        )]
  190         -
        deserializer.read_struct(&JSONTIMESTAMPSINPUT_SCHEMA, (), |_, member, deser| {
         194  +
        deserializer.read_struct(&JSONTIMESTAMPSINPUT_SCHEMA, &mut |member, deser| {
  191    195   
            match member.member_index() {
  192    196   
                Some(0) => {
  193    197   
                    builder.normal = Some(deser.read_timestamp(member)?);
  194    198   
                }
  195    199   
                Some(1) => {
  196    200   
                    builder.date_time = Some(deser.read_timestamp(member)?);
  197    201   
                }
  198    202   
                Some(2) => {
  199    203   
                    builder.date_time_on_target = Some(deser.read_timestamp(member)?);
  200    204   
                }
  201    205   
                Some(3) => {
  202    206   
                    builder.epoch_seconds = Some(deser.read_timestamp(member)?);
  203    207   
                }
  204    208   
                Some(4) => {
  205    209   
                    builder.epoch_seconds_on_target = Some(deser.read_timestamp(member)?);
  206    210   
                }
  207    211   
                Some(5) => {
  208    212   
                    builder.http_date = Some(deser.read_timestamp(member)?);
  209    213   
                }
  210    214   
                Some(6) => {
  211    215   
                    builder.http_date_on_target = Some(deser.read_timestamp(member)?);
  212    216   
                }
  213    217   
                _ => {}
  214    218   
            }
  215    219   
            Ok(())
  216    220   
        })?;
  217    221   
        builder
  218    222   
            .build()
  219    223   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  220    224   
    }
  221    225   
}
         226  +
impl JsonTimestampsInput {
         227  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         228  +
    pub fn deserialize_with_response(
         229  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         230  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         231  +
        _status: u16,
         232  +
        _body: &[u8],
         233  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         234  +
        Self::deserialize(deserializer)
         235  +
    }
         236  +
}
  222    237   
impl JsonTimestampsInput {
  223    238   
    /// Creates a new builder-style object to manufacture [`JsonTimestampsInput`](crate::operation::json_timestamps::JsonTimestampsInput).
  224    239   
    pub fn builder() -> crate::operation::json_timestamps::builders::JsonTimestampsInputBuilder {
  225    240   
        crate::operation::json_timestamps::builders::JsonTimestampsInputBuilder::default()
  226    241   
    }
  227    242   
}
  228    243   
  229    244   
/// A builder for [`JsonTimestampsInput`](crate::operation::json_timestamps::JsonTimestampsInput).
  230    245   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  231    246   
#[non_exhaustive]

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

@@ -43,43 +249,263 @@
   63     63   
    "normal",
   64     64   
    0,
   65     65   
);
   66     66   
static JSONTIMESTAMPSOUTPUT_MEMBER_DATE_TIME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   67     67   
    ::aws_smithy_schema::ShapeId::from_static(
   68     68   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsOutput$dateTime",
   69     69   
        "aws.protocoltests.restjson.synthetic",
   70     70   
        "JsonTimestampsOutput",
   71     71   
    ),
   72     72   
    ::aws_smithy_schema::ShapeType::Timestamp,
   73         -
    "date_time",
          73  +
    "dateTime",
   74     74   
    1,
   75     75   
)
   76     76   
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::DateTime);
   77     77   
static JSONTIMESTAMPSOUTPUT_MEMBER_DATE_TIME_ON_TARGET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   78     78   
    ::aws_smithy_schema::ShapeId::from_static(
   79     79   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsOutput$dateTimeOnTarget",
   80     80   
        "aws.protocoltests.restjson.synthetic",
   81     81   
        "JsonTimestampsOutput",
   82     82   
    ),
   83     83   
    ::aws_smithy_schema::ShapeType::Timestamp,
   84         -
    "date_time_on_target",
          84  +
    "dateTimeOnTarget",
   85     85   
    2,
   86         -
);
          86  +
)
          87  +
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::DateTime);
   87     88   
static JSONTIMESTAMPSOUTPUT_MEMBER_EPOCH_SECONDS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   88     89   
    ::aws_smithy_schema::ShapeId::from_static(
   89     90   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsOutput$epochSeconds",
   90     91   
        "aws.protocoltests.restjson.synthetic",
   91     92   
        "JsonTimestampsOutput",
   92     93   
    ),
   93     94   
    ::aws_smithy_schema::ShapeType::Timestamp,
   94         -
    "epoch_seconds",
          95  +
    "epochSeconds",
   95     96   
    3,
   96     97   
)
   97     98   
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::EpochSeconds);
   98     99   
static JSONTIMESTAMPSOUTPUT_MEMBER_EPOCH_SECONDS_ON_TARGET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   99    100   
    ::aws_smithy_schema::ShapeId::from_static(
  100    101   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsOutput$epochSecondsOnTarget",
  101    102   
        "aws.protocoltests.restjson.synthetic",
  102    103   
        "JsonTimestampsOutput",
  103    104   
    ),
  104    105   
    ::aws_smithy_schema::ShapeType::Timestamp,
  105         -
    "epoch_seconds_on_target",
         106  +
    "epochSecondsOnTarget",
  106    107   
    4,
  107         -
);
         108  +
)
         109  +
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::EpochSeconds);
  108    110   
static JSONTIMESTAMPSOUTPUT_MEMBER_HTTP_DATE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  109    111   
    ::aws_smithy_schema::ShapeId::from_static(
  110    112   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsOutput$httpDate",
  111    113   
        "aws.protocoltests.restjson.synthetic",
  112    114   
        "JsonTimestampsOutput",
  113    115   
    ),
  114    116   
    ::aws_smithy_schema::ShapeType::Timestamp,
  115         -
    "http_date",
         117  +
    "httpDate",
  116    118   
    5,
  117    119   
)
  118    120   
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::HttpDate);
  119    121   
static JSONTIMESTAMPSOUTPUT_MEMBER_HTTP_DATE_ON_TARGET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
  120    122   
    ::aws_smithy_schema::ShapeId::from_static(
  121    123   
        "aws.protocoltests.restjson.synthetic#JsonTimestampsOutput$httpDateOnTarget",
  122    124   
        "aws.protocoltests.restjson.synthetic",
  123    125   
        "JsonTimestampsOutput",
  124    126   
    ),
  125    127   
    ::aws_smithy_schema::ShapeType::Timestamp,
  126         -
    "http_date_on_target",
         128  +
    "httpDateOnTarget",
  127    129   
    6,
  128         -
);
         130  +
)
         131  +
.with_timestamp_format(aws_smithy_schema::traits::TimestampFormat::HttpDate);
  129    132   
static JSONTIMESTAMPSOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
  130    133   
    JSONTIMESTAMPSOUTPUT_SCHEMA_ID,
  131    134   
    ::aws_smithy_schema::ShapeType::Structure,
  132    135   
    &[
  133    136   
        &JSONTIMESTAMPSOUTPUT_MEMBER_NORMAL,
  134    137   
        &JSONTIMESTAMPSOUTPUT_MEMBER_DATE_TIME,
  135    138   
        &JSONTIMESTAMPSOUTPUT_MEMBER_DATE_TIME_ON_TARGET,
  136    139   
        &JSONTIMESTAMPSOUTPUT_MEMBER_EPOCH_SECONDS,
  137    140   
        &JSONTIMESTAMPSOUTPUT_MEMBER_EPOCH_SECONDS_ON_TARGET,
  138    141   
        &JSONTIMESTAMPSOUTPUT_MEMBER_HTTP_DATE,
  139    142   
        &JSONTIMESTAMPSOUTPUT_MEMBER_HTTP_DATE_ON_TARGET,
  140    143   
    ],
  141    144   
);
  142    145   
impl JsonTimestampsOutput {
  143    146   
    /// The schema for this shape.
  144    147   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &JSONTIMESTAMPSOUTPUT_SCHEMA;
  145    148   
}
  146    149   
impl ::aws_smithy_schema::serde::SerializableStruct for JsonTimestampsOutput {
  147    150   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
  148    151   
    fn serialize_members(
  149    152   
        &self,
  150    153   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
  151    154   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
  152    155   
        if let Some(ref val) = self.normal {
  153    156   
            ser.write_timestamp(&JSONTIMESTAMPSOUTPUT_MEMBER_NORMAL, val)?;
  154    157   
        }
  155    158   
        if let Some(ref val) = self.date_time {
  156    159   
            ser.write_timestamp(&JSONTIMESTAMPSOUTPUT_MEMBER_DATE_TIME, val)?;
  157    160   
        }
  158    161   
        if let Some(ref val) = self.date_time_on_target {
  159    162   
            ser.write_timestamp(&JSONTIMESTAMPSOUTPUT_MEMBER_DATE_TIME_ON_TARGET, val)?;
  160    163   
        }
  161    164   
        if let Some(ref val) = self.epoch_seconds {
  162    165   
            ser.write_timestamp(&JSONTIMESTAMPSOUTPUT_MEMBER_EPOCH_SECONDS, val)?;
  163    166   
        }
  164    167   
        if let Some(ref val) = self.epoch_seconds_on_target {
  165    168   
            ser.write_timestamp(&JSONTIMESTAMPSOUTPUT_MEMBER_EPOCH_SECONDS_ON_TARGET, val)?;
  166    169   
        }
  167    170   
        if let Some(ref val) = self.http_date {
  168    171   
            ser.write_timestamp(&JSONTIMESTAMPSOUTPUT_MEMBER_HTTP_DATE, val)?;
  169    172   
        }
  170    173   
        if let Some(ref val) = self.http_date_on_target {
  171    174   
            ser.write_timestamp(&JSONTIMESTAMPSOUTPUT_MEMBER_HTTP_DATE_ON_TARGET, val)?;
  172    175   
        }
  173    176   
        Ok(())
  174    177   
    }
  175    178   
}
  176    179   
impl JsonTimestampsOutput {
  177    180   
    /// Deserializes this structure from a [`ShapeDeserializer`].
  178         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
  179         -
        deserializer: &mut D,
         181  +
    pub fn deserialize(
         182  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
  180    183   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
  181    184   
        #[allow(unused_variables, unused_mut)]
  182    185   
        let mut builder = Self::builder();
  183    186   
        #[allow(
  184    187   
            unused_variables,
  185    188   
            unreachable_code,
  186    189   
            clippy::single_match,
  187    190   
            clippy::match_single_binding,
  188    191   
            clippy::diverging_sub_expression
  189    192   
        )]
  190         -
        deserializer.read_struct(&JSONTIMESTAMPSOUTPUT_SCHEMA, (), |_, member, deser| {
         193  +
        deserializer.read_struct(&JSONTIMESTAMPSOUTPUT_SCHEMA, &mut |member, deser| {
  191    194   
            match member.member_index() {
  192    195   
                Some(0) => {
  193    196   
                    builder.normal = Some(deser.read_timestamp(member)?);
  194    197   
                }
  195    198   
                Some(1) => {
  196    199   
                    builder.date_time = Some(deser.read_timestamp(member)?);
  197    200   
                }
  198    201   
                Some(2) => {
  199    202   
                    builder.date_time_on_target = Some(deser.read_timestamp(member)?);
  200    203   
                }
  201    204   
                Some(3) => {
  202    205   
                    builder.epoch_seconds = Some(deser.read_timestamp(member)?);
  203    206   
                }
  204    207   
                Some(4) => {
  205    208   
                    builder.epoch_seconds_on_target = Some(deser.read_timestamp(member)?);
  206    209   
                }
  207    210   
                Some(5) => {
  208    211   
                    builder.http_date = Some(deser.read_timestamp(member)?);
  209    212   
                }
  210    213   
                Some(6) => {
  211    214   
                    builder.http_date_on_target = Some(deser.read_timestamp(member)?);
  212    215   
                }
  213    216   
                _ => {}
  214    217   
            }
  215    218   
            Ok(())
  216    219   
        })?;
  217    220   
        Ok(builder.build())
  218    221   
    }
  219    222   
}
         223  +
impl JsonTimestampsOutput {
         224  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         225  +
    pub fn deserialize_with_response(
         226  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         227  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         228  +
        _status: u16,
         229  +
        _body: &[u8],
         230  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         231  +
        Self::deserialize(deserializer)
         232  +
    }
         233  +
}
  220    234   
impl JsonTimestampsOutput {
  221    235   
    /// Creates a new builder-style object to manufacture [`JsonTimestampsOutput`](crate::operation::json_timestamps::JsonTimestampsOutput).
  222    236   
    pub fn builder() -> crate::operation::json_timestamps::builders::JsonTimestampsOutputBuilder {
  223    237   
        crate::operation::json_timestamps::builders::JsonTimestampsOutputBuilder::default()
  224    238   
    }
  225    239   
}
  226    240   
  227    241   
/// A builder for [`JsonTimestampsOutput`](crate::operation::json_timestamps::JsonTimestampsOutput).
  228    242   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  229    243   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/json_unions.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 `JsonUnions`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct JsonUnions;
    6      6   
impl JsonUnions {
    7      7   
    /// Creates a new `JsonUnions`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_unions::JsonUnionsInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::json_unions::JsonUnionsOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::json_unions::JsonUnionsInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::json_unions::JsonUnionsOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::json_unions::JsonUnionsError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +224,229 @@
  124    128   
                crate::operation::json_unions::JsonUnionsError,
  125    129   
            >::new());
  126    130   
  127    131   
        ::std::borrow::Cow::Owned(rcb)
  128    132   
    }
  129    133   
}
  130    134   
  131    135   
#[derive(Debug)]
  132    136   
struct JsonUnionsResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for JsonUnionsResponseDeserializer {
  134         -
    fn deserialize_nonstreaming(
         138  +
    fn deserialize_nonstreaming_with_config(
  135    139   
        &self,
  136    140   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         141  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  137    142   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  138    143   
        let (success, status) = (response.status().is_success(), response.status().as_u16());
         144  +
        #[allow(unused_mut)]
         145  +
        let mut force_error = false;
         146  +
         147  +
        if !success && status != 200 || force_error {
  139    148   
            let headers = response.headers();
  140    149   
            let body = response.body().bytes().expect("body loaded");
  141    150   
            #[allow(unused_mut)]
  142         -
        let mut force_error = false;
         151  +
            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         152  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         153  +
            })?;
  143    154   
  144         -
        let parse_result = if !success && status != 200 || force_error {
  145         -
            crate::protocol_serde::shape_json_unions::de_json_unions_http_error(status, headers, body)
         155  +
            let generic = generic_builder.build();
         156  +
            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         157  +
                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(crate::operation::json_unions::JsonUnionsError::generic(
         158  +
                    generic,
         159  +
                )),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_json_unions::de_json_unions_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         162  +
            let protocol = _cfg
         163  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         164  +
                .expect("a SharedClientProtocol is required");
         165  +
            let mut deser = protocol.deserialize_response(response, JsonUnions::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         166  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         167  +
            })?;
         168  +
            let body = response.body().bytes().expect("body loaded");
         169  +
            let output = crate::operation::json_unions::JsonUnionsOutput::deserialize_with_response(
         170  +
                &mut *deser,
         171  +
                response.headers(),
         172  +
                response.status().into(),
         173  +
                body,
         174  +
            )
         175  +
            .map_err(|e| {
         176  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         177  +
            })?;
         178  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         179  +
        }
  150    180   
    }
  151    181   
}
  152    182   
#[derive(Debug)]
  153    183   
struct JsonUnionsRequestSerializer;
  154    184   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for JsonUnionsRequestSerializer {
  155    185   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    186   
    fn serialize_input(
  157    187   
        &self,
  158    188   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    189   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    190   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    191   
        let input = input.downcast::<crate::operation::json_unions::JsonUnionsInput>().expect("correct type");
  162         -
        let _header_serialization_settings = _cfg
  163         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  164         -
            .cloned()
  165         -
            .unwrap_or_default();
  166         -
        let mut request_builder = {
  167         -
            #[allow(clippy::uninlined_format_args)]
  168         -
            fn uri_base(
  169         -
                _input: &crate::operation::json_unions::JsonUnionsInput,
  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, "/JsonUnions").expect("formatting should succeed");
  174         -
                ::std::result::Result::Ok(())
  175         -
            }
  176         -
            #[allow(clippy::unnecessary_wraps)]
  177         -
            fn update_http_builder(
  178         -
                input: &crate::operation::json_unions::JsonUnionsInput,
  179         -
                builder: ::http_1x::request::Builder,
  180         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  181         -
                let mut uri = ::std::string::String::new();
  182         -
                uri_base(input, &mut uri)?;
  183         -
                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
  184         -
            }
  185         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  186         -
            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
  187         -
            builder
  188         -
        };
  189         -
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_json_unions::ser_json_unions_input(&input)?);
  190         -
        if let Some(content_length) = body.content_length() {
  191         -
            let content_length = content_length.to_string();
  192         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  193         -
        }
  194         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         192  +
        let protocol = _cfg
         193  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         194  +
            .expect("a SharedClientProtocol is required");
         195  +
        let mut request = protocol
         196  +
            .serialize_request(&input, JsonUnions::INPUT_SCHEMA, "", _cfg)
         197  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         198  +
         199  +
        return ::std::result::Result::Ok(request);
  195    200   
    }
  196    201   
}
  197    202   
#[derive(Debug)]
  198    203   
struct JsonUnionsEndpointParamsInterceptor;
  199    204   
  200    205   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for JsonUnionsEndpointParamsInterceptor {
  201    206   
    fn name(&self) -> &'static str {
  202    207   
        "JsonUnionsEndpointParamsInterceptor"
  203    208   
    }
  204    209   
@@ -603,608 +1073,1178 @@
  623    628   
            .expect("the config must have a deserializer");
  624    629   
  625    630   
        let parsed = de.deserialize_streaming(&mut http_response);
  626    631   
        let parsed = parsed.unwrap_or_else(|| {
  627    632   
            let http_response = http_response.map(|body| {
  628    633   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  629    634   
                    body.bytes().unwrap(),
  630    635   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  631    636   
                )))
  632    637   
            });
  633         -
            de.deserialize_nonstreaming(&http_response)
         638  +
            // Build a config bag with the protocol for schema-based deserialization
         639  +
            #[allow(unused_mut)]
         640  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         641  +
            {
         642  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         643  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         644  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         645  +
                ));
         646  +
                test_cfg.push_shared_layer(layer.freeze());
         647  +
            }
         648  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  634    649   
        });
  635    650   
        let parsed = parsed
  636    651   
            .expect("should be successful response")
  637    652   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  638    653   
            .unwrap();
  639    654   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  640    655   
    }
  641    656   
  642    657   
    /// Deserializes a boolean union value
  643    658   
    /// Test ID: RestJsonDeserializeBooleanUnionValue
  644    659   
    #[::tokio::test]
  645    660   
    #[::tracing_test::traced_test]
  646    661   
    async fn rest_json_deserialize_boolean_union_value_response() {
  647    662   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  648    663   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::BooleanValue(true)))
  649    664   
            .build();
  650    665   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  651    666   
            ::http_1x::response::Builder::new()
  652    667   
                .header("Content-Type", "application/json")
  653    668   
                .status(200)
  654    669   
                .body(::aws_smithy_types::body::SdkBody::from(
  655    670   
                    "{\n    \"contents\": {\n        \"booleanValue\": true\n    }\n}",
  656    671   
                ))
  657    672   
                .unwrap(),
  658    673   
        )
  659    674   
        .unwrap();
  660    675   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  661    676   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  662    677   
  663    678   
        let op = crate::operation::json_unions::JsonUnions::new();
  664    679   
        let config = op.config().expect("the operation has config");
  665    680   
        let de = config
  666    681   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  667    682   
            .expect("the config must have a deserializer");
  668    683   
  669    684   
        let parsed = de.deserialize_streaming(&mut http_response);
  670    685   
        let parsed = parsed.unwrap_or_else(|| {
  671    686   
            let http_response = http_response.map(|body| {
  672    687   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  673    688   
                    body.bytes().unwrap(),
  674    689   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  675    690   
                )))
  676    691   
            });
  677         -
            de.deserialize_nonstreaming(&http_response)
         692  +
            // Build a config bag with the protocol for schema-based deserialization
         693  +
            #[allow(unused_mut)]
         694  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         695  +
            {
         696  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         697  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         698  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         699  +
                ));
         700  +
                test_cfg.push_shared_layer(layer.freeze());
         701  +
            }
         702  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  678    703   
        });
  679    704   
        let parsed = parsed
  680    705   
            .expect("should be successful response")
  681    706   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  682    707   
            .unwrap();
  683    708   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  684    709   
    }
  685    710   
  686    711   
    /// Deserializes a number union value
  687    712   
    /// Test ID: RestJsonDeserializeNumberUnionValue
  688    713   
    #[::tokio::test]
  689    714   
    #[::tracing_test::traced_test]
  690    715   
    async fn rest_json_deserialize_number_union_value_response() {
  691    716   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  692    717   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::NumberValue(1)))
  693    718   
            .build();
  694    719   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  695    720   
            ::http_1x::response::Builder::new()
  696    721   
                .header("Content-Type", "application/json")
  697    722   
                .status(200)
  698    723   
                .body(::aws_smithy_types::body::SdkBody::from(
  699    724   
                    "{\n    \"contents\": {\n        \"numberValue\": 1\n    }\n}",
  700    725   
                ))
  701    726   
                .unwrap(),
  702    727   
        )
  703    728   
        .unwrap();
  704    729   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  705    730   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  706    731   
  707    732   
        let op = crate::operation::json_unions::JsonUnions::new();
  708    733   
        let config = op.config().expect("the operation has config");
  709    734   
        let de = config
  710    735   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  711    736   
            .expect("the config must have a deserializer");
  712    737   
  713    738   
        let parsed = de.deserialize_streaming(&mut http_response);
  714    739   
        let parsed = parsed.unwrap_or_else(|| {
  715    740   
            let http_response = http_response.map(|body| {
  716    741   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  717    742   
                    body.bytes().unwrap(),
  718    743   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  719    744   
                )))
  720    745   
            });
  721         -
            de.deserialize_nonstreaming(&http_response)
         746  +
            // Build a config bag with the protocol for schema-based deserialization
         747  +
            #[allow(unused_mut)]
         748  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         749  +
            {
         750  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         751  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         752  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         753  +
                ));
         754  +
                test_cfg.push_shared_layer(layer.freeze());
         755  +
            }
         756  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  722    757   
        });
  723    758   
        let parsed = parsed
  724    759   
            .expect("should be successful response")
  725    760   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  726    761   
            .unwrap();
  727    762   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  728    763   
    }
  729    764   
  730    765   
    /// Deserializes a blob union value
  731    766   
    /// Test ID: RestJsonDeserializeBlobUnionValue
  732    767   
    #[::tokio::test]
  733    768   
    #[::tracing_test::traced_test]
  734    769   
    async fn rest_json_deserialize_blob_union_value_response() {
  735    770   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  736    771   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::BlobValue(
  737    772   
                ::aws_smithy_types::Blob::new("foo"),
  738    773   
            )))
  739    774   
            .build();
  740    775   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  741    776   
            ::http_1x::response::Builder::new()
  742    777   
                .header("Content-Type", "application/json")
  743    778   
                .status(200)
  744    779   
                .body(::aws_smithy_types::body::SdkBody::from(
  745    780   
                    "{\n    \"contents\": {\n        \"blobValue\": \"Zm9v\"\n    }\n}",
  746    781   
                ))
  747    782   
                .unwrap(),
  748    783   
        )
  749    784   
        .unwrap();
  750    785   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  751    786   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  752    787   
  753    788   
        let op = crate::operation::json_unions::JsonUnions::new();
  754    789   
        let config = op.config().expect("the operation has config");
  755    790   
        let de = config
  756    791   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  757    792   
            .expect("the config must have a deserializer");
  758    793   
  759    794   
        let parsed = de.deserialize_streaming(&mut http_response);
  760    795   
        let parsed = parsed.unwrap_or_else(|| {
  761    796   
            let http_response = http_response.map(|body| {
  762    797   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  763    798   
                    body.bytes().unwrap(),
  764    799   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  765    800   
                )))
  766    801   
            });
  767         -
            de.deserialize_nonstreaming(&http_response)
         802  +
            // Build a config bag with the protocol for schema-based deserialization
         803  +
            #[allow(unused_mut)]
         804  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         805  +
            {
         806  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         807  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         808  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         809  +
                ));
         810  +
                test_cfg.push_shared_layer(layer.freeze());
         811  +
            }
         812  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  768    813   
        });
  769    814   
        let parsed = parsed
  770    815   
            .expect("should be successful response")
  771    816   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  772    817   
            .unwrap();
  773    818   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  774    819   
    }
  775    820   
  776    821   
    /// Deserializes a timestamp union value
  777    822   
    /// Test ID: RestJsonDeserializeTimestampUnionValue
  778    823   
    #[::tokio::test]
  779    824   
    #[::tracing_test::traced_test]
  780    825   
    async fn rest_json_deserialize_timestamp_union_value_response() {
  781    826   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  782    827   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::TimestampValue(
  783    828   
                ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
  784    829   
            )))
  785    830   
            .build();
  786    831   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  787    832   
            ::http_1x::response::Builder::new()
  788    833   
                .header("Content-Type", "application/json")
  789    834   
                .status(200)
  790    835   
                .body(::aws_smithy_types::body::SdkBody::from(
  791    836   
                    "{\n    \"contents\": {\n        \"timestampValue\": 1398796238\n    }\n}",
  792    837   
                ))
  793    838   
                .unwrap(),
  794    839   
        )
  795    840   
        .unwrap();
  796    841   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  797    842   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  798    843   
  799    844   
        let op = crate::operation::json_unions::JsonUnions::new();
  800    845   
        let config = op.config().expect("the operation has config");
  801    846   
        let de = config
  802    847   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  803    848   
            .expect("the config must have a deserializer");
  804    849   
  805    850   
        let parsed = de.deserialize_streaming(&mut http_response);
  806    851   
        let parsed = parsed.unwrap_or_else(|| {
  807    852   
            let http_response = http_response.map(|body| {
  808    853   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  809    854   
                    body.bytes().unwrap(),
  810    855   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  811    856   
                )))
  812    857   
            });
  813         -
            de.deserialize_nonstreaming(&http_response)
         858  +
            // Build a config bag with the protocol for schema-based deserialization
         859  +
            #[allow(unused_mut)]
         860  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         861  +
            {
         862  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         863  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         864  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         865  +
                ));
         866  +
                test_cfg.push_shared_layer(layer.freeze());
         867  +
            }
         868  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  814    869   
        });
  815    870   
        let parsed = parsed
  816    871   
            .expect("should be successful response")
  817    872   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  818    873   
            .unwrap();
  819    874   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  820    875   
    }
  821    876   
  822    877   
    /// Deserializes an enum union value
  823    878   
    /// Test ID: RestJsonDeserializeEnumUnionValue
  824    879   
    #[::tokio::test]
  825    880   
    #[::tracing_test::traced_test]
  826    881   
    async fn rest_json_deserialize_enum_union_value_response() {
  827    882   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  828    883   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::EnumValue(
  829    884   
                "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
  830    885   
            )))
  831    886   
            .build();
  832    887   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  833    888   
            ::http_1x::response::Builder::new()
  834    889   
                .header("Content-Type", "application/json")
  835    890   
                .status(200)
  836    891   
                .body(::aws_smithy_types::body::SdkBody::from(
  837    892   
                    "{\n    \"contents\": {\n        \"enumValue\": \"Foo\"\n    }\n}",
  838    893   
                ))
  839    894   
                .unwrap(),
  840    895   
        )
  841    896   
        .unwrap();
  842    897   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  843    898   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  844    899   
  845    900   
        let op = crate::operation::json_unions::JsonUnions::new();
  846    901   
        let config = op.config().expect("the operation has config");
  847    902   
        let de = config
  848    903   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  849    904   
            .expect("the config must have a deserializer");
  850    905   
  851    906   
        let parsed = de.deserialize_streaming(&mut http_response);
  852    907   
        let parsed = parsed.unwrap_or_else(|| {
  853    908   
            let http_response = http_response.map(|body| {
  854    909   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  855    910   
                    body.bytes().unwrap(),
  856    911   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  857    912   
                )))
  858    913   
            });
  859         -
            de.deserialize_nonstreaming(&http_response)
         914  +
            // Build a config bag with the protocol for schema-based deserialization
         915  +
            #[allow(unused_mut)]
         916  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         917  +
            {
         918  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         919  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         920  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         921  +
                ));
         922  +
                test_cfg.push_shared_layer(layer.freeze());
         923  +
            }
         924  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  860    925   
        });
  861    926   
        let parsed = parsed
  862    927   
            .expect("should be successful response")
  863    928   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  864    929   
            .unwrap();
  865    930   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  866    931   
    }
  867    932   
  868    933   
    /// Deserializes a list union value
  869    934   
    /// Test ID: RestJsonDeserializeListUnionValue
  870    935   
    #[::tokio::test]
  871    936   
    #[::tracing_test::traced_test]
  872    937   
    async fn rest_json_deserialize_list_union_value_response() {
  873    938   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  874    939   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::ListValue(vec![
  875    940   
                "foo".to_owned(),
  876    941   
                "bar".to_owned(),
  877    942   
            ])))
  878    943   
            .build();
  879    944   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  880    945   
            ::http_1x::response::Builder::new()
  881    946   
                .header("Content-Type", "application/json")
  882    947   
                .status(200)
  883    948   
                .body(::aws_smithy_types::body::SdkBody::from(
  884    949   
                    "{\n    \"contents\": {\n        \"listValue\": [\"foo\", \"bar\"]\n    }\n}",
  885    950   
                ))
  886    951   
                .unwrap(),
  887    952   
        )
  888    953   
        .unwrap();
  889    954   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  890    955   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  891    956   
  892    957   
        let op = crate::operation::json_unions::JsonUnions::new();
  893    958   
        let config = op.config().expect("the operation has config");
  894    959   
        let de = config
  895    960   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  896    961   
            .expect("the config must have a deserializer");
  897    962   
  898    963   
        let parsed = de.deserialize_streaming(&mut http_response);
  899    964   
        let parsed = parsed.unwrap_or_else(|| {
  900    965   
            let http_response = http_response.map(|body| {
  901    966   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  902    967   
                    body.bytes().unwrap(),
  903    968   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  904    969   
                )))
  905    970   
            });
  906         -
            de.deserialize_nonstreaming(&http_response)
         971  +
            // Build a config bag with the protocol for schema-based deserialization
         972  +
            #[allow(unused_mut)]
         973  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
         974  +
            {
         975  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
         976  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
         977  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
         978  +
                ));
         979  +
                test_cfg.push_shared_layer(layer.freeze());
         980  +
            }
         981  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  907    982   
        });
  908    983   
        let parsed = parsed
  909    984   
            .expect("should be successful response")
  910    985   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  911    986   
            .unwrap();
  912    987   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  913    988   
    }
  914    989   
  915    990   
    /// Deserializes a map union value
  916    991   
    /// Test ID: RestJsonDeserializeMapUnionValue
  917    992   
    #[::tokio::test]
  918    993   
    #[::tracing_test::traced_test]
  919    994   
    async fn rest_json_deserialize_map_union_value_response() {
  920    995   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  921    996   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::MapValue({
  922    997   
                let mut ret = ::std::collections::HashMap::new();
  923    998   
                ret.insert("foo".to_owned(), "bar".to_owned());
  924    999   
                ret.insert("spam".to_owned(), "eggs".to_owned());
  925   1000   
                ret
  926   1001   
            })))
  927   1002   
            .build();
  928   1003   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(::http_1x::response::Builder::new()
  929   1004   
        .header("Content-Type", "application/json")
  930   1005   
        .status(200)
  931   1006   
                    .body(::aws_smithy_types::body::SdkBody::from("{\n    \"contents\": {\n        \"mapValue\": {\n            \"foo\": \"bar\",\n            \"spam\": \"eggs\"\n        }\n    }\n}"))
  932   1007   
                    .unwrap()
  933   1008   
                    ).unwrap();
  934   1009   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  935   1010   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  936   1011   
  937   1012   
        let op = crate::operation::json_unions::JsonUnions::new();
  938   1013   
        let config = op.config().expect("the operation has config");
  939   1014   
        let de = config
  940   1015   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  941   1016   
            .expect("the config must have a deserializer");
  942   1017   
  943   1018   
        let parsed = de.deserialize_streaming(&mut http_response);
  944   1019   
        let parsed = parsed.unwrap_or_else(|| {
  945   1020   
            let http_response = http_response.map(|body| {
  946   1021   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  947   1022   
                    body.bytes().unwrap(),
  948   1023   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  949   1024   
                )))
  950   1025   
            });
  951         -
            de.deserialize_nonstreaming(&http_response)
        1026  +
            // Build a config bag with the protocol for schema-based deserialization
        1027  +
            #[allow(unused_mut)]
        1028  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1029  +
            {
        1030  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1031  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1032  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
        1033  +
                ));
        1034  +
                test_cfg.push_shared_layer(layer.freeze());
        1035  +
            }
        1036  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
  952   1037   
        });
  953   1038   
        let parsed = parsed
  954   1039   
            .expect("should be successful response")
  955   1040   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
  956   1041   
            .unwrap();
  957   1042   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
  958   1043   
    }
  959   1044   
  960   1045   
    /// Deserializes a structure union value
  961   1046   
    /// Test ID: RestJsonDeserializeStructureUnionValue
  962   1047   
    #[::tokio::test]
  963   1048   
    #[::tracing_test::traced_test]
  964   1049   
    async fn rest_json_deserialize_structure_union_value_response() {
  965   1050   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
  966   1051   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::StructureValue(
  967   1052   
                crate::types::GreetingStruct::builder()
  968   1053   
                    .set_hi(::std::option::Option::Some("hello".to_owned()))
  969   1054   
                    .build(),
  970   1055   
            )))
  971   1056   
            .build();
  972   1057   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(
  973   1058   
            ::http_1x::response::Builder::new()
  974   1059   
                .header("Content-Type", "application/json")
  975   1060   
                .status(200)
  976   1061   
                .body(::aws_smithy_types::body::SdkBody::from(
  977   1062   
                    "{\n    \"contents\": {\n        \"structureValue\": {\n            \"hi\": \"hello\"\n        }\n    }\n}",
  978   1063   
                ))
  979   1064   
                .unwrap(),
  980   1065   
        )
  981   1066   
        .unwrap();
  982   1067   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
  983   1068   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
  984   1069   
  985   1070   
        let op = crate::operation::json_unions::JsonUnions::new();
  986   1071   
        let config = op.config().expect("the operation has config");
  987   1072   
        let de = config
  988   1073   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
  989   1074   
            .expect("the config must have a deserializer");
  990   1075   
  991   1076   
        let parsed = de.deserialize_streaming(&mut http_response);
  992   1077   
        let parsed = parsed.unwrap_or_else(|| {
  993   1078   
            let http_response = http_response.map(|body| {
  994   1079   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  995   1080   
                    body.bytes().unwrap(),
  996   1081   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
  997   1082   
                )))
  998   1083   
            });
  999         -
            de.deserialize_nonstreaming(&http_response)
        1084  +
            // Build a config bag with the protocol for schema-based deserialization
        1085  +
            #[allow(unused_mut)]
        1086  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1087  +
            {
        1088  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1089  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1090  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
        1091  +
                ));
        1092  +
                test_cfg.push_shared_layer(layer.freeze());
        1093  +
            }
        1094  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
 1000   1095   
        });
 1001   1096   
        let parsed = parsed
 1002   1097   
            .expect("should be successful response")
 1003   1098   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
 1004   1099   
            .unwrap();
 1005   1100   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
 1006   1101   
    }
 1007   1102   
 1008   1103   
    /// Ignores an unrecognized __type property
 1009   1104   
    /// Test ID: RestJsonDeserializeIgnoreType
 1010   1105   
    #[::tokio::test]
 1011   1106   
    #[::tracing_test::traced_test]
 1012   1107   
    async fn rest_json_deserialize_ignore_type_response() {
 1013   1108   
        let expected_output = crate::operation::json_unions::JsonUnionsOutput::builder()
 1014   1109   
            .set_contents(::std::option::Option::Some(crate::types::MyUnion::StructureValue(
 1015   1110   
                crate::types::GreetingStruct::builder()
 1016   1111   
                    .set_hi(::std::option::Option::Some("hello".to_owned()))
 1017   1112   
                    .build(),
 1018   1113   
            )))
 1019   1114   
            .build();
 1020   1115   
        let mut http_response = ::aws_smithy_runtime_api::http::Response::try_from(::http_1x::response::Builder::new()
 1021   1116   
        .header("Content-Type", "application/json")
 1022   1117   
        .status(200)
 1023   1118   
                    .body(::aws_smithy_types::body::SdkBody::from("{\n    \"contents\": {\n        \"__type\": \"aws.protocoltests.json10#MyUnion\",\n        \"structureValue\": {\n            \"hi\": \"hello\"\n        }\n    }\n}"))
 1024   1119   
                    .unwrap()
 1025   1120   
                    ).unwrap();
 1026   1121   
        use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
 1027   1122   
        use ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse;
 1028   1123   
 1029   1124   
        let op = crate::operation::json_unions::JsonUnions::new();
 1030   1125   
        let config = op.config().expect("the operation has config");
 1031   1126   
        let de = config
 1032   1127   
            .load::<::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer>()
 1033   1128   
            .expect("the config must have a deserializer");
 1034   1129   
 1035   1130   
        let parsed = de.deserialize_streaming(&mut http_response);
 1036   1131   
        let parsed = parsed.unwrap_or_else(|| {
 1037   1132   
            let http_response = http_response.map(|body| {
 1038   1133   
                ::aws_smithy_types::body::SdkBody::from(::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
 1039   1134   
                    body.bytes().unwrap(),
 1040   1135   
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
 1041   1136   
                )))
 1042   1137   
            });
 1043         -
            de.deserialize_nonstreaming(&http_response)
        1138  +
            // Build a config bag with the protocol for schema-based deserialization
        1139  +
            #[allow(unused_mut)]
        1140  +
            let mut test_cfg = ::aws_smithy_types::config_bag::ConfigBag::base();
        1141  +
            {
        1142  +
                let mut layer = ::aws_smithy_types::config_bag::Layer::new("test_protocol");
        1143  +
                layer.store_put(::aws_smithy_schema::protocol::SharedClientProtocol::new(
        1144  +
                    ::aws_smithy_json::protocol::aws_rest_json_1::AwsRestJsonProtocol::new(),
        1145  +
                ));
        1146  +
                test_cfg.push_shared_layer(layer.freeze());
        1147  +
            }
        1148  +
            de.deserialize_nonstreaming_with_config(&http_response, &test_cfg)
 1044   1149   
        });
 1045   1150   
        let parsed = parsed
 1046   1151   
            .expect("should be successful response")
 1047   1152   
            .downcast::<crate::operation::json_unions::JsonUnionsOutput>()
 1048   1153   
            .unwrap();
 1049   1154   
        ::pretty_assertions::assert_eq!(parsed.contents, expected_output.contents, "Unexpected value for `contents`");
 1050   1155   
    }
 1051   1156   
}
 1052   1157   
 1053   1158   
/// Error type for the `JsonUnionsError` operation.