Client Test

Client Test

rev. 97ba95e6039d206ffea5b866ddc214d34f7f88c3

Files changed:

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/types/_dialog.rs

@@ -1,1 +57,154 @@
   18     18   
    #[allow(missing_docs)] // documentation missing in model
   19     19   
    pub fn greeting(&self) -> &str {
   20     20   
        use std::ops::Deref;
   21     21   
        self.greeting.deref()
   22     22   
    }
   23     23   
    #[allow(missing_docs)] // documentation missing in model
   24     24   
    pub fn farewell(&self) -> ::std::option::Option<&crate::types::Farewell> {
   25     25   
        self.farewell.as_ref()
   26     26   
    }
   27     27   
}
          28  +
static DIALOG_MEMBER_LANGUAGE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          29  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#Dialog$language", "aws.protocoltests.json10", "Dialog"),
          30  +
    ::aws_smithy_schema::ShapeType::String,
          31  +
    "language",
          32  +
    0,
          33  +
);
          34  +
static DIALOG_MEMBER_GREETING: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          35  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#Dialog$greeting", "aws.protocoltests.json10", "Dialog"),
          36  +
    ::aws_smithy_schema::ShapeType::String,
          37  +
    "greeting",
          38  +
    1,
          39  +
);
          40  +
static DIALOG_MEMBER_FAREWELL: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          41  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#Dialog$farewell", "aws.protocoltests.json10", "Dialog"),
          42  +
    ::aws_smithy_schema::ShapeType::Structure,
          43  +
    "farewell",
          44  +
    2,
          45  +
);
          46  +
static DIALOG_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          47  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#Dialog", "aws.protocoltests.json10", "Dialog"),
          48  +
    ::aws_smithy_schema::ShapeType::Structure,
          49  +
    &[&DIALOG_MEMBER_LANGUAGE, &DIALOG_MEMBER_GREETING, &DIALOG_MEMBER_FAREWELL],
          50  +
);
          51  +
impl Dialog {
          52  +
    /// The schema for this shape.
          53  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &DIALOG_SCHEMA;
          54  +
}
          55  +
impl ::aws_smithy_schema::serde::SerializableStruct for Dialog {
          56  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          57  +
    fn serialize_members(
          58  +
        &self,
          59  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          60  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          61  +
        if let Some(ref val) = self.language {
          62  +
            ser.write_string(&DIALOG_MEMBER_LANGUAGE, val)?;
          63  +
        }
          64  +
        {
          65  +
            let val = &self.greeting;
          66  +
            ser.write_string(&DIALOG_MEMBER_GREETING, val)?;
          67  +
        }
          68  +
        if let Some(ref val) = self.farewell {
          69  +
            ser.write_struct(&DIALOG_MEMBER_FAREWELL, val)?;
          70  +
        }
          71  +
        Ok(())
          72  +
    }
          73  +
}
          74  +
impl Dialog {
          75  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          76  +
    pub fn deserialize(
          77  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          78  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          79  +
        #[allow(unused_variables, unused_mut)]
          80  +
        let mut builder = Self::builder();
          81  +
        #[allow(
          82  +
            unused_variables,
          83  +
            unreachable_code,
          84  +
            clippy::single_match,
          85  +
            clippy::match_single_binding,
          86  +
            clippy::diverging_sub_expression
          87  +
        )]
          88  +
        deserializer.read_struct(&DIALOG_SCHEMA, &mut |member, deser| {
          89  +
            match member.member_index() {
          90  +
                Some(0) => {
          91  +
                    if deser.is_null() {
          92  +
                        deser.read_null()?;
          93  +
                    } else {
          94  +
                        builder.language = Some(deser.read_string(member)?);
          95  +
                    }
          96  +
                }
          97  +
                Some(1) => {
          98  +
                    builder.greeting = Some(deser.read_string(member)?);
          99  +
                }
         100  +
                Some(2) => {
         101  +
                    if deser.is_null() {
         102  +
                        deser.read_null()?;
         103  +
                    } else {
         104  +
                        builder.farewell = Some(crate::types::Farewell::deserialize(deser)?);
         105  +
                    }
         106  +
                }
         107  +
                _ => {}
         108  +
            }
         109  +
            Ok(())
         110  +
        })?;
         111  +
        Ok(builder.build())
         112  +
    }
         113  +
}
         114  +
impl Dialog {
         115  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         116  +
    pub fn deserialize_with_response(
         117  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         118  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         119  +
        _status: u16,
         120  +
        _body: &[u8],
         121  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         122  +
        Self::deserialize(deserializer)
         123  +
    }
         124  +
}
   28    125   
impl Dialog {
   29    126   
    /// Creates a new builder-style object to manufacture [`Dialog`](crate::types::Dialog).
   30    127   
    pub fn builder() -> crate::types::builders::DialogBuilder {
   31    128   
        crate::types::builders::DialogBuilder::default()
   32    129   
    }
   33    130   
}
   34    131   
   35    132   
/// A builder for [`Dialog`](crate::types::Dialog).
   36    133   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   37    134   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/types/_farewell.rs

@@ -1,1 +45,110 @@
    6      6   
    #[allow(missing_docs)] // documentation missing in model
    7      7   
    pub phrase: ::std::string::String,
    8      8   
}
    9      9   
impl Farewell {
   10     10   
    #[allow(missing_docs)] // documentation missing in model
   11     11   
    pub fn phrase(&self) -> &str {
   12     12   
        use std::ops::Deref;
   13     13   
        self.phrase.deref()
   14     14   
    }
   15     15   
}
          16  +
static FAREWELL_MEMBER_PHRASE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          17  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#Farewell$phrase", "aws.protocoltests.json10", "Farewell"),
          18  +
    ::aws_smithy_schema::ShapeType::String,
          19  +
    "phrase",
          20  +
    0,
          21  +
);
          22  +
static FAREWELL_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          23  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#Farewell", "aws.protocoltests.json10", "Farewell"),
          24  +
    ::aws_smithy_schema::ShapeType::Structure,
          25  +
    &[&FAREWELL_MEMBER_PHRASE],
          26  +
);
          27  +
impl Farewell {
          28  +
    /// The schema for this shape.
          29  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &FAREWELL_SCHEMA;
          30  +
}
          31  +
impl ::aws_smithy_schema::serde::SerializableStruct for Farewell {
          32  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          33  +
    fn serialize_members(
          34  +
        &self,
          35  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          36  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          37  +
        {
          38  +
            let val = &self.phrase;
          39  +
            ser.write_string(&FAREWELL_MEMBER_PHRASE, val)?;
          40  +
        }
          41  +
        Ok(())
          42  +
    }
          43  +
}
          44  +
impl Farewell {
          45  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          46  +
    pub fn deserialize(
          47  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          48  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          49  +
        #[allow(unused_variables, unused_mut)]
          50  +
        let mut builder = Self::builder();
          51  +
        #[allow(
          52  +
            unused_variables,
          53  +
            unreachable_code,
          54  +
            clippy::single_match,
          55  +
            clippy::match_single_binding,
          56  +
            clippy::diverging_sub_expression
          57  +
        )]
          58  +
        deserializer.read_struct(&FAREWELL_SCHEMA, &mut |member, deser| {
          59  +
            match member.member_index() {
          60  +
                Some(0) => {
          61  +
                    builder.phrase = Some(deser.read_string(member)?);
          62  +
                }
          63  +
                _ => {}
          64  +
            }
          65  +
            Ok(())
          66  +
        })?;
          67  +
        Ok(builder.build())
          68  +
    }
          69  +
}
          70  +
impl Farewell {
          71  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          72  +
    pub fn deserialize_with_response(
          73  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          74  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          75  +
        _status: u16,
          76  +
        _body: &[u8],
          77  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          78  +
        Self::deserialize(deserializer)
          79  +
    }
          80  +
}
   16     81   
impl Farewell {
   17     82   
    /// Creates a new builder-style object to manufacture [`Farewell`](crate::types::Farewell).
   18     83   
    pub fn builder() -> crate::types::builders::FarewellBuilder {
   19     84   
        crate::types::builders::FarewellBuilder::default()
   20     85   
    }
   21     86   
}
   22     87   
   23     88   
/// A builder for [`Farewell`](crate::types::Farewell).
   24     89   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   25     90   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/types/_greeting_struct.rs

@@ -1,1 +44,112 @@
    5      5   
pub struct GreetingStruct {
    6      6   
    #[allow(missing_docs)] // documentation missing in model
    7      7   
    pub hi: ::std::option::Option<::std::string::String>,
    8      8   
}
    9      9   
impl GreetingStruct {
   10     10   
    #[allow(missing_docs)] // documentation missing in model
   11     11   
    pub fn hi(&self) -> ::std::option::Option<&str> {
   12     12   
        self.hi.as_deref()
   13     13   
    }
   14     14   
}
          15  +
static GREETINGSTRUCT_MEMBER_HI: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          16  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.shared#GreetingStruct$hi", "aws.protocoltests.shared", "GreetingStruct"),
          17  +
    ::aws_smithy_schema::ShapeType::String,
          18  +
    "hi",
          19  +
    0,
          20  +
);
          21  +
static GREETINGSTRUCT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          22  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.shared#GreetingStruct", "aws.protocoltests.shared", "GreetingStruct"),
          23  +
    ::aws_smithy_schema::ShapeType::Structure,
          24  +
    &[&GREETINGSTRUCT_MEMBER_HI],
          25  +
);
          26  +
impl GreetingStruct {
          27  +
    /// The schema for this shape.
          28  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &GREETINGSTRUCT_SCHEMA;
          29  +
}
          30  +
impl ::aws_smithy_schema::serde::SerializableStruct for GreetingStruct {
          31  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          32  +
    fn serialize_members(
          33  +
        &self,
          34  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          35  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          36  +
        if let Some(ref val) = self.hi {
          37  +
            ser.write_string(&GREETINGSTRUCT_MEMBER_HI, val)?;
          38  +
        }
          39  +
        Ok(())
          40  +
    }
          41  +
}
          42  +
impl GreetingStruct {
          43  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          44  +
    pub fn deserialize(
          45  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          46  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          47  +
        #[allow(unused_variables, unused_mut)]
          48  +
        let mut builder = Self::builder();
          49  +
        #[allow(
          50  +
            unused_variables,
          51  +
            unreachable_code,
          52  +
            clippy::single_match,
          53  +
            clippy::match_single_binding,
          54  +
            clippy::diverging_sub_expression
          55  +
        )]
          56  +
        deserializer.read_struct(&GREETINGSTRUCT_SCHEMA, &mut |member, deser| {
          57  +
            match member.member_index() {
          58  +
                Some(0) => {
          59  +
                    if deser.is_null() {
          60  +
                        deser.read_null()?;
          61  +
                    } else {
          62  +
                        builder.hi = Some(deser.read_string(member)?);
          63  +
                    }
          64  +
                }
          65  +
                _ => {}
          66  +
            }
          67  +
            Ok(())
          68  +
        })?;
          69  +
        Ok(builder.build())
          70  +
    }
          71  +
}
          72  +
impl GreetingStruct {
          73  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          74  +
    pub fn deserialize_with_response(
          75  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          76  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          77  +
        _status: u16,
          78  +
        _body: &[u8],
          79  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          80  +
        Self::deserialize(deserializer)
          81  +
    }
          82  +
}
   15     83   
impl GreetingStruct {
   16     84   
    /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::types::GreetingStruct).
   17     85   
    pub fn builder() -> crate::types::builders::GreetingStructBuilder {
   18     86   
        crate::types::builders::GreetingStructBuilder::default()
   19     87   
    }
   20     88   
}
   21     89   
   22     90   
/// A builder for [`GreetingStruct`](crate::types::GreetingStruct).
   23     91   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   24     92   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/types/_my_union.rs

@@ -143,143 +0,347 @@
  163    163   
    }
  164    164   
    /// Returns true if this is a [`TimestampValue`](crate::types::MyUnion::TimestampValue).
  165    165   
    pub fn is_timestamp_value(&self) -> bool {
  166    166   
        self.as_timestamp_value().is_ok()
  167    167   
    }
  168    168   
    /// Returns true if the enum instance is the `Unknown` variant.
  169    169   
    pub fn is_unknown(&self) -> bool {
  170    170   
        matches!(self, Self::Unknown)
  171    171   
    }
  172    172   
}
         173  +
static MYUNION_MEMBER_STRINGVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         174  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$stringValue", "aws.protocoltests.json10", "MyUnion"),
         175  +
    ::aws_smithy_schema::ShapeType::String,
         176  +
    "stringValue",
         177  +
    0,
         178  +
);
         179  +
static MYUNION_MEMBER_BOOLEANVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         180  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$booleanValue", "aws.protocoltests.json10", "MyUnion"),
         181  +
    ::aws_smithy_schema::ShapeType::Boolean,
         182  +
    "booleanValue",
         183  +
    1,
         184  +
);
         185  +
static MYUNION_MEMBER_NUMBERVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         186  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$numberValue", "aws.protocoltests.json10", "MyUnion"),
         187  +
    ::aws_smithy_schema::ShapeType::Integer,
         188  +
    "numberValue",
         189  +
    2,
         190  +
);
         191  +
static MYUNION_MEMBER_BLOBVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         192  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$blobValue", "aws.protocoltests.json10", "MyUnion"),
         193  +
    ::aws_smithy_schema::ShapeType::Blob,
         194  +
    "blobValue",
         195  +
    3,
         196  +
);
         197  +
static MYUNION_MEMBER_TIMESTAMPVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         198  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$timestampValue", "aws.protocoltests.json10", "MyUnion"),
         199  +
    ::aws_smithy_schema::ShapeType::Timestamp,
         200  +
    "timestampValue",
         201  +
    4,
         202  +
);
         203  +
static MYUNION_MEMBER_ENUMVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         204  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$enumValue", "aws.protocoltests.json10", "MyUnion"),
         205  +
    ::aws_smithy_schema::ShapeType::String,
         206  +
    "enumValue",
         207  +
    5,
         208  +
);
         209  +
static MYUNION_MEMBER_INTENUMVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         210  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$intEnumValue", "aws.protocoltests.json10", "MyUnion"),
         211  +
    ::aws_smithy_schema::ShapeType::Integer,
         212  +
    "intEnumValue",
         213  +
    6,
         214  +
);
         215  +
static MYUNION_MEMBER_LISTVALUE_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         216  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.shared#StringList$member", "aws.protocoltests.shared", "StringList"),
         217  +
    ::aws_smithy_schema::ShapeType::String,
         218  +
    "member",
         219  +
    0,
         220  +
);
         221  +
static MYUNION_MEMBER_LISTVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         222  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$listValue", "aws.protocoltests.json10", "MyUnion"),
         223  +
    ::aws_smithy_schema::ShapeType::List,
         224  +
    "listValue",
         225  +
    7,
         226  +
)
         227  +
.with_list_member(&MYUNION_MEMBER_LISTVALUE_MEMBER);
         228  +
static MYUNION_MEMBER_MAPVALUE_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         229  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.shared#StringMap$key", "aws.protocoltests.shared", "StringMap"),
         230  +
    ::aws_smithy_schema::ShapeType::String,
         231  +
    "key",
         232  +
    0,
         233  +
);
         234  +
static MYUNION_MEMBER_MAPVALUE_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         235  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.shared#StringMap$value", "aws.protocoltests.shared", "StringMap"),
         236  +
    ::aws_smithy_schema::ShapeType::String,
         237  +
    "value",
         238  +
    1,
         239  +
);
         240  +
static MYUNION_MEMBER_MAPVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         241  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$mapValue", "aws.protocoltests.json10", "MyUnion"),
         242  +
    ::aws_smithy_schema::ShapeType::Map,
         243  +
    "mapValue",
         244  +
    8,
         245  +
)
         246  +
.with_map_members(&MYUNION_MEMBER_MAPVALUE_KEY, &MYUNION_MEMBER_MAPVALUE_VALUE);
         247  +
static MYUNION_MEMBER_STRUCTUREVALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
         248  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion$structureValue", "aws.protocoltests.json10", "MyUnion"),
         249  +
    ::aws_smithy_schema::ShapeType::Structure,
         250  +
    "structureValue",
         251  +
    9,
         252  +
);
         253  +
static MYUNION_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
         254  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#MyUnion", "aws.protocoltests.json10", "MyUnion"),
         255  +
    ::aws_smithy_schema::ShapeType::Union,
         256  +
    &[
         257  +
        &MYUNION_MEMBER_STRINGVALUE,
         258  +
        &MYUNION_MEMBER_BOOLEANVALUE,
         259  +
        &MYUNION_MEMBER_NUMBERVALUE,
         260  +
        &MYUNION_MEMBER_BLOBVALUE,
         261  +
        &MYUNION_MEMBER_TIMESTAMPVALUE,
         262  +
        &MYUNION_MEMBER_ENUMVALUE,
         263  +
        &MYUNION_MEMBER_INTENUMVALUE,
         264  +
        &MYUNION_MEMBER_LISTVALUE,
         265  +
        &MYUNION_MEMBER_MAPVALUE,
         266  +
        &MYUNION_MEMBER_STRUCTUREVALUE,
         267  +
    ],
         268  +
);
         269  +
impl MyUnion {
         270  +
    /// The schema for this shape.
         271  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &MYUNION_SCHEMA;
         272  +
}
         273  +
impl ::aws_smithy_schema::serde::SerializableStruct for MyUnion {
         274  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
         275  +
    fn serialize_members(
         276  +
        &self,
         277  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
         278  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
         279  +
        match self {
         280  +
            Self::StringValue(val) => {
         281  +
                ser.write_string(&MYUNION_MEMBER_STRINGVALUE, val)?;
         282  +
            }
         283  +
            Self::BooleanValue(val) => {
         284  +
                ser.write_boolean(&MYUNION_MEMBER_BOOLEANVALUE, *val)?;
         285  +
            }
         286  +
            Self::NumberValue(val) => {
         287  +
                ser.write_integer(&MYUNION_MEMBER_NUMBERVALUE, *val)?;
         288  +
            }
         289  +
            Self::BlobValue(val) => {
         290  +
                ser.write_blob(&MYUNION_MEMBER_BLOBVALUE, val.clone())?;
         291  +
            }
         292  +
            Self::TimestampValue(val) => {
         293  +
                ser.write_timestamp(&MYUNION_MEMBER_TIMESTAMPVALUE, val)?;
         294  +
            }
         295  +
            Self::EnumValue(val) => {
         296  +
                ser.write_string(&MYUNION_MEMBER_ENUMVALUE, val.as_str())?;
         297  +
            }
         298  +
            Self::IntEnumValue(val) => {
         299  +
                ser.write_integer(&MYUNION_MEMBER_INTENUMVALUE, *val)?;
         300  +
            }
         301  +
            Self::ListValue(val) => {
         302  +
                ser.write_string_list(&MYUNION_MEMBER_LISTVALUE, val)?;
         303  +
            }
         304  +
            Self::MapValue(val) => {
         305  +
                ser.write_string_string_map(&MYUNION_MEMBER_MAPVALUE, val)?;
         306  +
            }
         307  +
            Self::StructureValue(val) => {
         308  +
                ser.write_struct(&MYUNION_MEMBER_STRUCTUREVALUE, val)?;
         309  +
            }
         310  +
            Self::Unknown => return Err(::aws_smithy_schema::serde::SerdeError::custom("cannot serialize unknown union variant")),
         311  +
        }
         312  +
        Ok(())
         313  +
    }
         314  +
}
         315  +
impl MyUnion {
         316  +
    /// Deserializes this union from a [`ShapeDeserializer`].
         317  +
    pub fn deserialize(
         318  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         319  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         320  +
        let mut result: ::std::option::Option<Self> = ::std::option::Option::None;
         321  +
        #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding)]
         322  +
        deserializer.read_struct(&MYUNION_SCHEMA, &mut |member, deser| {
         323  +
            // A union holds exactly one member; the deserializer reports every key
         324  +
            // (known or not), so a second one is an error whatever it names.
         325  +
            if result.is_some() {
         326  +
                return Err(::aws_smithy_schema::serde::SerdeError::invalid_input(
         327  +
                    "encountered mixed variants in union",
         328  +
                ));
         329  +
            }
         330  +
            result = ::std::option::Option::Some(match member.member_index() {
         331  +
                Some(0) => Self::StringValue(deser.read_string(member)?),
         332  +
                Some(1) => Self::BooleanValue(deser.read_boolean(member)?),
         333  +
                Some(2) => Self::NumberValue(deser.read_integer(member)?),
         334  +
                Some(3) => Self::BlobValue(deser.read_blob(member)?),
         335  +
                Some(4) => Self::TimestampValue(deser.read_timestamp(member)?),
         336  +
                Some(5) => Self::EnumValue(crate::types::FooEnum::from(deser.read_string(member)?.as_str())),
         337  +
                Some(6) => Self::IntEnumValue(deser.read_integer(member)?),
         338  +
                Some(7) => Self::ListValue(deser.read_string_list(member)?),
         339  +
                Some(8) => Self::MapValue(deser.read_string_string_map(member)?),
         340  +
                Some(9) => Self::StructureValue(crate::types::GreetingStruct::deserialize(deser)?),
         341  +
                _ => Self::Unknown,
         342  +
            });
         343  +
            Ok(())
         344  +
        })?;
         345  +
        result.ok_or_else(|| ::aws_smithy_schema::serde::SerdeError::custom("expected a union variant"))
         346  +
    }
         347  +
}

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/types/_top_level.rs

@@ -1,1 +57,201 @@
   18     18   
    #[allow(missing_docs)] // documentation missing in model
   19     19   
    pub fn dialog_list(&self) -> &[crate::types::Dialog] {
   20     20   
        use std::ops::Deref;
   21     21   
        self.dialog_list.deref()
   22     22   
    }
   23     23   
    #[allow(missing_docs)] // documentation missing in model
   24     24   
    pub fn dialog_map(&self) -> &::std::collections::HashMap<::std::string::String, crate::types::Dialog> {
   25     25   
        &self.dialog_map
   26     26   
    }
   27     27   
}
          28  +
static TOPLEVEL_MEMBER_DIALOG: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          29  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#TopLevel$dialog", "aws.protocoltests.json10", "TopLevel"),
          30  +
    ::aws_smithy_schema::ShapeType::Structure,
          31  +
    "dialog",
          32  +
    0,
          33  +
);
          34  +
static TOPLEVEL_MEMBER_DIALOG_LIST_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          35  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#DialogList$member", "aws.protocoltests.json10", "DialogList"),
          36  +
    ::aws_smithy_schema::ShapeType::Structure,
          37  +
    "member",
          38  +
    0,
          39  +
);
          40  +
static TOPLEVEL_MEMBER_DIALOG_LIST: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          41  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#TopLevel$dialogList", "aws.protocoltests.json10", "TopLevel"),
          42  +
    ::aws_smithy_schema::ShapeType::List,
          43  +
    "dialogList",
          44  +
    1,
          45  +
)
          46  +
.with_list_member(&TOPLEVEL_MEMBER_DIALOG_LIST_MEMBER);
          47  +
static TOPLEVEL_MEMBER_DIALOG_MAP_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          48  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#DialogMap$key", "aws.protocoltests.json10", "DialogMap"),
          49  +
    ::aws_smithy_schema::ShapeType::String,
          50  +
    "key",
          51  +
    0,
          52  +
);
          53  +
static TOPLEVEL_MEMBER_DIALOG_MAP_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          54  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#DialogMap$value", "aws.protocoltests.json10", "DialogMap"),
          55  +
    ::aws_smithy_schema::ShapeType::Structure,
          56  +
    "value",
          57  +
    1,
          58  +
);
          59  +
static TOPLEVEL_MEMBER_DIALOG_MAP: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          60  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#TopLevel$dialogMap", "aws.protocoltests.json10", "TopLevel"),
          61  +
    ::aws_smithy_schema::ShapeType::Map,
          62  +
    "dialogMap",
          63  +
    2,
          64  +
)
          65  +
.with_map_members(&TOPLEVEL_MEMBER_DIALOG_MAP_KEY, &TOPLEVEL_MEMBER_DIALOG_MAP_VALUE);
          66  +
static TOPLEVEL_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          67  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#TopLevel", "aws.protocoltests.json10", "TopLevel"),
          68  +
    ::aws_smithy_schema::ShapeType::Structure,
          69  +
    &[&TOPLEVEL_MEMBER_DIALOG, &TOPLEVEL_MEMBER_DIALOG_LIST, &TOPLEVEL_MEMBER_DIALOG_MAP],
          70  +
);
          71  +
impl TopLevel {
          72  +
    /// The schema for this shape.
          73  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &TOPLEVEL_SCHEMA;
          74  +
}
          75  +
impl ::aws_smithy_schema::serde::SerializableStruct for TopLevel {
          76  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          77  +
    fn serialize_members(
          78  +
        &self,
          79  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          80  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          81  +
        {
          82  +
            let val = &self.dialog;
          83  +
            ser.write_struct(&TOPLEVEL_MEMBER_DIALOG, val)?;
          84  +
        }
          85  +
        {
          86  +
            let val = &self.dialog_list;
          87  +
          88  +
            ser.write_list(
          89  +
                &TOPLEVEL_MEMBER_DIALOG_LIST,
          90  +
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
          91  +
                    for item in val {
          92  +
                        ser.write_struct(crate::types::Dialog::SCHEMA, item)?;
          93  +
                    }
          94  +
                    Ok(())
          95  +
                },
          96  +
            )?;
          97  +
        }
          98  +
        {
          99  +
            let val = &self.dialog_map;
         100  +
         101  +
            ser.write_map(
         102  +
                &TOPLEVEL_MEMBER_DIALOG_MAP,
         103  +
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
         104  +
                    for (key, value) in val {
         105  +
                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
         106  +
                        ser.write_struct(crate::types::Dialog::SCHEMA, value)?;
         107  +
                    }
         108  +
                    Ok(())
         109  +
                },
         110  +
            )?;
         111  +
        }
         112  +
        Ok(())
         113  +
    }
         114  +
}
         115  +
impl TopLevel {
         116  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
         117  +
    pub fn deserialize(
         118  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         119  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         120  +
        #[allow(unused_variables, unused_mut)]
         121  +
        let mut builder = Self::builder();
         122  +
        #[allow(
         123  +
            unused_variables,
         124  +
            unreachable_code,
         125  +
            clippy::single_match,
         126  +
            clippy::match_single_binding,
         127  +
            clippy::diverging_sub_expression
         128  +
        )]
         129  +
        deserializer.read_struct(&TOPLEVEL_SCHEMA, &mut |member, deser| {
         130  +
            match member.member_index() {
         131  +
                Some(0) => {
         132  +
                    builder.dialog = Some(crate::types::Dialog::deserialize(deser)?);
         133  +
                }
         134  +
                Some(1) => {
         135  +
                    builder.dialog_list = Some({
         136  +
                        let mut container = Vec::new();
         137  +
                        deser.read_list(member, &mut |deser| {
         138  +
                            container.push(crate::types::Dialog::deserialize(deser)?);
         139  +
                            Ok(())
         140  +
                        })?;
         141  +
                        container
         142  +
                    });
         143  +
                }
         144  +
                Some(2) => {
         145  +
                    builder.dialog_map = Some({
         146  +
                        let mut container = std::collections::HashMap::new();
         147  +
                        deser.read_map(member, &mut |key, deser| {
         148  +
                            container.insert(key, crate::types::Dialog::deserialize(deser)?);
         149  +
                            Ok(())
         150  +
                        })?;
         151  +
                        container
         152  +
                    });
         153  +
                }
         154  +
                _ => {}
         155  +
            }
         156  +
            Ok(())
         157  +
        })?;
         158  +
        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
         159  +
    }
         160  +
}
         161  +
impl TopLevel {
         162  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         163  +
    pub fn deserialize_with_response(
         164  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         165  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         166  +
        _status: u16,
         167  +
        _body: &[u8],
         168  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         169  +
        Self::deserialize(deserializer)
         170  +
    }
         171  +
}
   28    172   
impl TopLevel {
   29    173   
    /// Creates a new builder-style object to manufacture [`TopLevel`](crate::types::TopLevel).
   30    174   
    pub fn builder() -> crate::types::builders::TopLevelBuilder {
   31    175   
        crate::types::builders::TopLevelBuilder::default()
   32    176   
    }
   33    177   
}
   34    178   
   35    179   
/// A builder for [`TopLevel`](crate::types::TopLevel).
   36    180   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   37    181   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/types/error/_complex_error.rs

@@ -1,1 +54,165 @@
   15     15   
impl ComplexError {
   16     16   
    #[allow(missing_docs)] // documentation missing in model
   17     17   
    pub fn top_level(&self) -> ::std::option::Option<&str> {
   18     18   
        self.top_level.as_deref()
   19     19   
    }
   20     20   
    #[allow(missing_docs)] // documentation missing in model
   21     21   
    pub fn nested(&self) -> ::std::option::Option<&crate::types::ComplexNestedErrorData> {
   22     22   
        self.nested.as_ref()
   23     23   
    }
   24     24   
}
          25  +
static COMPLEXERROR_MEMBER_TOP_LEVEL: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          26  +
    ::aws_smithy_schema::ShapeId::from_parts(
          27  +
        "aws.protocoltests.json10#ComplexError$TopLevel",
          28  +
        "aws.protocoltests.json10",
          29  +
        "ComplexError",
          30  +
    ),
          31  +
    ::aws_smithy_schema::ShapeType::String,
          32  +
    "TopLevel",
          33  +
    0,
          34  +
);
          35  +
static COMPLEXERROR_MEMBER_NESTED: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          36  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#ComplexError$Nested", "aws.protocoltests.json10", "ComplexError"),
          37  +
    ::aws_smithy_schema::ShapeType::Structure,
          38  +
    "Nested",
          39  +
    1,
          40  +
);
          41  +
static COMPLEXERROR_MEMBER_MESSAGE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          42  +
    ::aws_smithy_schema::ShapeId::from_parts(
          43  +
        "aws.protocoltests.json10#ComplexError$Message",
          44  +
        "aws.protocoltests.json10",
          45  +
        "ComplexError",
          46  +
    ),
          47  +
    ::aws_smithy_schema::ShapeType::String,
          48  +
    "Message",
          49  +
    2,
          50  +
);
          51  +
static COMPLEXERROR_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          52  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#ComplexError", "aws.protocoltests.json10", "ComplexError"),
          53  +
    ::aws_smithy_schema::ShapeType::Structure,
          54  +
    &[&COMPLEXERROR_MEMBER_TOP_LEVEL, &COMPLEXERROR_MEMBER_NESTED, &COMPLEXERROR_MEMBER_MESSAGE],
          55  +
);
          56  +
impl ComplexError {
          57  +
    /// The schema for this shape.
          58  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &COMPLEXERROR_SCHEMA;
          59  +
}
          60  +
impl ::aws_smithy_schema::serde::SerializableStruct for ComplexError {
          61  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          62  +
    fn serialize_members(
          63  +
        &self,
          64  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          65  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          66  +
        if let Some(ref val) = self.top_level {
          67  +
            ser.write_string(&COMPLEXERROR_MEMBER_TOP_LEVEL, val)?;
          68  +
        }
          69  +
        if let Some(ref val) = self.nested {
          70  +
            ser.write_struct(&COMPLEXERROR_MEMBER_NESTED, val)?;
          71  +
        }
          72  +
        if let Some(ref val) = self.message {
          73  +
            ser.write_string(&COMPLEXERROR_MEMBER_MESSAGE, val)?;
          74  +
        }
          75  +
        Ok(())
          76  +
    }
          77  +
}
          78  +
impl ComplexError {
          79  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          80  +
    pub fn deserialize(
          81  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          82  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          83  +
        #[allow(unused_variables, unused_mut)]
          84  +
        let mut builder = Self::builder();
          85  +
        #[allow(
          86  +
            unused_variables,
          87  +
            unreachable_code,
          88  +
            clippy::single_match,
          89  +
            clippy::match_single_binding,
          90  +
            clippy::diverging_sub_expression
          91  +
        )]
          92  +
        deserializer.read_struct(&COMPLEXERROR_SCHEMA, &mut |member, deser| {
          93  +
            match member.member_index() {
          94  +
                Some(0) => {
          95  +
                    if deser.is_null() {
          96  +
                        deser.read_null()?;
          97  +
                    } else {
          98  +
                        builder.top_level = Some(deser.read_string(member)?);
          99  +
                    }
         100  +
                }
         101  +
                Some(1) => {
         102  +
                    if deser.is_null() {
         103  +
                        deser.read_null()?;
         104  +
                    } else {
         105  +
                        builder.nested = Some(crate::types::ComplexNestedErrorData::deserialize(deser)?);
         106  +
                    }
         107  +
                }
         108  +
                Some(2) => {
         109  +
                    if deser.is_null() {
         110  +
                        deser.read_null()?;
         111  +
                    } else {
         112  +
                        builder.message = Some(deser.read_string(member)?);
         113  +
                    }
         114  +
                }
         115  +
                _ => {}
         116  +
            }
         117  +
            Ok(())
         118  +
        })?;
         119  +
        Ok(builder.build())
         120  +
    }
         121  +
}
         122  +
impl ComplexError {
         123  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         124  +
    pub fn deserialize_with_response(
         125  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         126  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         127  +
        _status: u16,
         128  +
        body: &[u8],
         129  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         130  +
        if body.is_empty() {
         131  +
            return Ok(Self::builder().build());
         132  +
        }
         133  +
        Self::deserialize(deserializer)
         134  +
    }
         135  +
}
   25    136   
impl ComplexError {
   26    137   
    /// Returns the error message.
   27    138   
    pub fn message(&self) -> ::std::option::Option<&str> {
   28    139   
        self.message.as_deref()
   29    140   
    }
   30    141   
}
   31    142   
impl ::std::fmt::Display for ComplexError {
   32    143   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   33    144   
        ::std::write!(f, "ComplexError")?;
   34    145   
        if let ::std::option::Option::Some(inner_1) = &self.message {

tmp-codegen-diff/codegen-client-test/json_rpc10/rust-client-codegen/src/types/error/_foo_error.rs

@@ -1,1 +40,111 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3      3   
/// This error has test cases that test some of the dark corners of Amazon service framework history. It should only be implemented by clients.
    4      4   
#[non_exhaustive]
    5      5   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6      6   
pub struct FooError {
    7      7   
    #[allow(missing_docs)] // documentation missing in model
    8      8   
    pub message: ::std::option::Option<::std::string::String>,
    9      9   
    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
   10     10   
}
          11  +
static FOOERROR_MEMBER_MESSAGE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          12  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#FooError$Message", "aws.protocoltests.json10", "FooError"),
          13  +
    ::aws_smithy_schema::ShapeType::String,
          14  +
    "Message",
          15  +
    0,
          16  +
);
          17  +
static FOOERROR_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          18  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#FooError", "aws.protocoltests.json10", "FooError"),
          19  +
    ::aws_smithy_schema::ShapeType::Structure,
          20  +
    &[&FOOERROR_MEMBER_MESSAGE],
          21  +
);
          22  +
impl FooError {
          23  +
    /// The schema for this shape.
          24  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &FOOERROR_SCHEMA;
          25  +
}
          26  +
impl ::aws_smithy_schema::serde::SerializableStruct for FooError {
          27  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          28  +
    fn serialize_members(
          29  +
        &self,
          30  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          31  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          32  +
        if let Some(ref val) = self.message {
          33  +
            ser.write_string(&FOOERROR_MEMBER_MESSAGE, val)?;
          34  +
        }
          35  +
        Ok(())
          36  +
    }
          37  +
}
          38  +
impl FooError {
          39  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          40  +
    pub fn deserialize(
          41  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          42  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          43  +
        #[allow(unused_variables, unused_mut)]
          44  +
        let mut builder = Self::builder();
          45  +
        #[allow(
          46  +
            unused_variables,
          47  +
            unreachable_code,
          48  +
            clippy::single_match,
          49  +
            clippy::match_single_binding,
          50  +
            clippy::diverging_sub_expression
          51  +
        )]
          52  +
        deserializer.read_struct(&FOOERROR_SCHEMA, &mut |member, deser| {
          53  +
            match member.member_index() {
          54  +
                Some(0) => {
          55  +
                    if deser.is_null() {
          56  +
                        deser.read_null()?;
          57  +
                    } else {
          58  +
                        builder.message = Some(deser.read_string(member)?);
          59  +
                    }
          60  +
                }
          61  +
                _ => {}
          62  +
            }
          63  +
            Ok(())
          64  +
        })?;
          65  +
        Ok(builder.build())
          66  +
    }
          67  +
}
          68  +
impl FooError {
          69  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          70  +
    pub fn deserialize_with_response(
          71  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          72  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          73  +
        _status: u16,
          74  +
        body: &[u8],
          75  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          76  +
        if body.is_empty() {
          77  +
            return Ok(Self::builder().build());
          78  +
        }
          79  +
        Self::deserialize(deserializer)
          80  +
    }
          81  +
}
   11     82   
impl FooError {
   12     83   
    /// Returns the error message.
   13     84   
    pub fn message(&self) -> ::std::option::Option<&str> {
   14     85   
        self.message.as_deref()
   15     86   
    }
   16     87   
}
   17     88   
impl ::std::fmt::Display for FooError {
   18     89   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   19     90   
        ::std::write!(f, "FooError")?;
   20     91   
        if let ::std::option::Option::Some(inner_1) = &self.message {

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

@@ -1,1 +40,115 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3      3   
/// This error is thrown when an invalid greeting value is provided.
    4      4   
#[non_exhaustive]
    5      5   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6      6   
pub struct InvalidGreeting {
    7      7   
    #[allow(missing_docs)] // documentation missing in model
    8      8   
    pub message: ::std::option::Option<::std::string::String>,
    9      9   
    pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
   10     10   
}
          11  +
static INVALIDGREETING_MEMBER_MESSAGE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
          12  +
    ::aws_smithy_schema::ShapeId::from_parts(
          13  +
        "aws.protocoltests.json10#InvalidGreeting$Message",
          14  +
        "aws.protocoltests.json10",
          15  +
        "InvalidGreeting",
          16  +
    ),
          17  +
    ::aws_smithy_schema::ShapeType::String,
          18  +
    "Message",
          19  +
    0,
          20  +
);
          21  +
static INVALIDGREETING_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
          22  +
    ::aws_smithy_schema::ShapeId::from_parts("aws.protocoltests.json10#InvalidGreeting", "aws.protocoltests.json10", "InvalidGreeting"),
          23  +
    ::aws_smithy_schema::ShapeType::Structure,
          24  +
    &[&INVALIDGREETING_MEMBER_MESSAGE],
          25  +
);
          26  +
impl InvalidGreeting {
          27  +
    /// The schema for this shape.
          28  +
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &INVALIDGREETING_SCHEMA;
          29  +
}
          30  +
impl ::aws_smithy_schema::serde::SerializableStruct for InvalidGreeting {
          31  +
    #[allow(unused_variables, clippy::diverging_sub_expression)]
          32  +
    fn serialize_members(
          33  +
        &self,
          34  +
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
          35  +
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
          36  +
        if let Some(ref val) = self.message {
          37  +
            ser.write_string(&INVALIDGREETING_MEMBER_MESSAGE, val)?;
          38  +
        }
          39  +
        Ok(())
          40  +
    }
          41  +
}
          42  +
impl InvalidGreeting {
          43  +
    /// Deserializes this structure from a [`ShapeDeserializer`].
          44  +
    pub fn deserialize(
          45  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          46  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          47  +
        #[allow(unused_variables, unused_mut)]
          48  +
        let mut builder = Self::builder();
          49  +
        #[allow(
          50  +
            unused_variables,
          51  +
            unreachable_code,
          52  +
            clippy::single_match,
          53  +
            clippy::match_single_binding,
          54  +
            clippy::diverging_sub_expression
          55  +
        )]
          56  +
        deserializer.read_struct(&INVALIDGREETING_SCHEMA, &mut |member, deser| {
          57  +
            match member.member_index() {
          58  +
                Some(0) => {
          59  +
                    if deser.is_null() {
          60  +
                        deser.read_null()?;
          61  +
                    } else {
          62  +
                        builder.message = Some(deser.read_string(member)?);
          63  +
                    }
          64  +
                }
          65  +
                _ => {}
          66  +
            }
          67  +
            Ok(())
          68  +
        })?;
          69  +
        Ok(builder.build())
          70  +
    }
          71  +
}
          72  +
impl InvalidGreeting {
          73  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          74  +
    pub fn deserialize_with_response(
          75  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          76  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          77  +
        _status: u16,
          78  +
        body: &[u8],
          79  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          80  +
        if body.is_empty() {
          81  +
            return Ok(Self::builder().build());
          82  +
        }
          83  +
        Self::deserialize(deserializer)
          84  +
    }
          85  +
}
   11     86   
impl InvalidGreeting {
   12     87   
    /// Returns the error message.
   13     88   
    pub fn message(&self) -> ::std::option::Option<&str> {
   14     89   
        self.message.as_deref()
   15     90   
    }
   16     91   
}
   17     92   
impl ::std::fmt::Display for InvalidGreeting {
   18     93   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   19     94   
        ::std::write!(f, "InvalidGreeting")?;
   20     95   
        if let ::std::option::Option::Some(inner_1) = &self.message {