Client Test

Client Test

rev. ec7b2441254af868911fccffe8d8dca83aff0045 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/types/_validation_exception_field.rs

@@ -47,47 +135,148 @@
   67     67   
        }
   68     68   
        {
   69     69   
            let val = &self.message;
   70     70   
            ser.write_string(&VALIDATIONEXCEPTIONFIELD_MEMBER_MESSAGE, val)?;
   71     71   
        }
   72     72   
        Ok(())
   73     73   
    }
   74     74   
}
   75     75   
impl ValidationExceptionField {
   76     76   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   77         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   78         -
        deserializer: &mut D,
          77  +
    pub fn deserialize(
          78  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   79     79   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   80     80   
        #[allow(unused_variables, unused_mut)]
   81     81   
        let mut builder = Self::builder();
   82     82   
        #[allow(
   83     83   
            unused_variables,
   84     84   
            unreachable_code,
   85     85   
            clippy::single_match,
   86     86   
            clippy::match_single_binding,
   87     87   
            clippy::diverging_sub_expression
   88     88   
        )]
   89         -
        deserializer.read_struct(&VALIDATIONEXCEPTIONFIELD_SCHEMA, (), |_, member, deser| {
          89  +
        deserializer.read_struct(&VALIDATIONEXCEPTIONFIELD_SCHEMA, &mut |member, deser| {
   90     90   
            match member.member_index() {
   91     91   
                Some(0) => {
   92     92   
                    builder.path = Some(deser.read_string(member)?);
   93     93   
                }
   94     94   
                Some(1) => {
   95     95   
                    builder.message = Some(deser.read_string(member)?);
   96     96   
                }
   97     97   
                _ => {}
   98     98   
            }
   99     99   
            Ok(())
  100    100   
        })?;
         101  +
        builder.path = builder.path.or(Some(String::new()));
         102  +
        builder.message = builder.message.or(Some(String::new()));
  101    103   
        builder
  102    104   
            .build()
  103    105   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  104    106   
    }
  105    107   
}
         108  +
impl ValidationExceptionField {
         109  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         110  +
    pub fn deserialize_with_response(
         111  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         112  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         113  +
        _status: u16,
         114  +
        _body: &[u8],
         115  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         116  +
        Self::deserialize(deserializer)
         117  +
    }
         118  +
}
  106    119   
impl ValidationExceptionField {
  107    120   
    /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::types::ValidationExceptionField).
  108    121   
    pub fn builder() -> crate::types::builders::ValidationExceptionFieldBuilder {
  109    122   
        crate::types::builders::ValidationExceptionFieldBuilder::default()
  110    123   
    }
  111    124   
}
  112    125   
  113    126   
/// A builder for [`ValidationExceptionField`](crate::types::ValidationExceptionField).
  114    127   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
  115    128   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/types/error/_invalid_pokeball_error.rs

@@ -1,1 +118,130 @@
   20     20   
    ::aws_smithy_schema::ShapeId::from_static("com.aws.example#InvalidPokeballError", "com.aws.example", "InvalidPokeballError");
   21     21   
static INVALIDPOKEBALLERROR_MEMBER_POKEBALL: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   22     22   
    ::aws_smithy_schema::ShapeId::from_static("com.aws.example#InvalidPokeballError$pokeball", "com.aws.example", "InvalidPokeballError"),
   23     23   
    ::aws_smithy_schema::ShapeType::String,
   24     24   
    "pokeball",
   25     25   
    0,
   26     26   
);
   27     27   
static INVALIDPOKEBALLERROR_MEMBER_MESSAGE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   28     28   
    ::aws_smithy_schema::ShapeId::from_static("com.aws.example#InvalidPokeballError$Message", "com.aws.example", "InvalidPokeballError"),
   29     29   
    ::aws_smithy_schema::ShapeType::String,
   30         -
    "message",
          30  +
    "Message",
   31     31   
    1,
   32     32   
);
   33     33   
static INVALIDPOKEBALLERROR_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   34     34   
    INVALIDPOKEBALLERROR_SCHEMA_ID,
   35     35   
    ::aws_smithy_schema::ShapeType::Structure,
   36     36   
    &[&INVALIDPOKEBALLERROR_MEMBER_POKEBALL, &INVALIDPOKEBALLERROR_MEMBER_MESSAGE],
   37     37   
);
   38     38   
impl InvalidPokeballError {
   39     39   
    /// The schema for this shape.
   40     40   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &INVALIDPOKEBALLERROR_SCHEMA;
   41     41   
}
   42     42   
impl ::aws_smithy_schema::serde::SerializableStruct for InvalidPokeballError {
   43     43   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   44     44   
    fn serialize_members(
   45     45   
        &self,
   46     46   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   47     47   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   48     48   
        {
   49     49   
            let val = &self.pokeball;
   50     50   
            ser.write_string(&INVALIDPOKEBALLERROR_MEMBER_POKEBALL, val)?;
   51     51   
        }
   52     52   
        if let Some(ref val) = self.message {
   53     53   
            ser.write_string(&INVALIDPOKEBALLERROR_MEMBER_MESSAGE, val)?;
   54     54   
        }
   55     55   
        Ok(())
   56     56   
    }
   57     57   
}
   58     58   
impl InvalidPokeballError {
   59     59   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   60         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   61         -
        deserializer: &mut D,
          60  +
    pub fn deserialize(
          61  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   62     62   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   63     63   
        #[allow(unused_variables, unused_mut)]
   64     64   
        let mut builder = Self::builder();
   65     65   
        #[allow(
   66     66   
            unused_variables,
   67     67   
            unreachable_code,
   68     68   
            clippy::single_match,
   69     69   
            clippy::match_single_binding,
   70     70   
            clippy::diverging_sub_expression
   71     71   
        )]
   72         -
        deserializer.read_struct(&INVALIDPOKEBALLERROR_SCHEMA, (), |_, member, deser| {
          72  +
        deserializer.read_struct(&INVALIDPOKEBALLERROR_SCHEMA, &mut |member, deser| {
   73     73   
            match member.member_index() {
   74     74   
                Some(0) => {
   75     75   
                    builder.pokeball = Some(deser.read_string(member)?);
   76     76   
                }
   77     77   
                Some(1) => {
   78     78   
                    builder.message = Some(deser.read_string(member)?);
   79     79   
                }
   80     80   
                _ => {}
   81     81   
            }
   82     82   
            Ok(())
   83     83   
        })?;
          84  +
        builder.pokeball = builder.pokeball.or(Some(String::new()));
   84     85   
        builder
   85     86   
            .build()
   86     87   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   87     88   
    }
   88     89   
}
          90  +
impl InvalidPokeballError {
          91  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          92  +
    pub fn deserialize_with_response(
          93  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          94  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          95  +
        _status: u16,
          96  +
        _body: &[u8],
          97  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          98  +
        Self::deserialize(deserializer)
          99  +
    }
         100  +
}
   89    101   
impl InvalidPokeballError {
   90    102   
    /// Returns the error message.
   91    103   
    pub fn message(&self) -> ::std::option::Option<&str> {
   92    104   
        self.message.as_deref()
   93    105   
    }
   94    106   
}
   95    107   
impl ::std::fmt::Display for InvalidPokeballError {
   96    108   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   97    109   
        ::std::write!(f, "InvalidPokeballError")?;
   98    110   
        if let ::std::option::Option::Some(inner_1) = &self.message {

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/types/error/_master_ball_unsuccessful.rs

@@ -15,15 +98,109 @@
   35     35   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   36     36   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   37     37   
        if let Some(ref val) = self.message {
   38     38   
            ser.write_string(&MASTERBALLUNSUCCESSFUL_MEMBER_MESSAGE, val)?;
   39     39   
        }
   40     40   
        Ok(())
   41     41   
    }
   42     42   
}
   43     43   
impl MasterBallUnsuccessful {
   44     44   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   45         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   46         -
        deserializer: &mut D,
          45  +
    pub fn deserialize(
          46  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   47     47   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   48     48   
        #[allow(unused_variables, unused_mut)]
   49     49   
        let mut builder = Self::builder();
   50     50   
        #[allow(
   51     51   
            unused_variables,
   52     52   
            unreachable_code,
   53     53   
            clippy::single_match,
   54     54   
            clippy::match_single_binding,
   55     55   
            clippy::diverging_sub_expression
   56     56   
        )]
   57         -
        deserializer.read_struct(&MASTERBALLUNSUCCESSFUL_SCHEMA, (), |_, member, deser| {
          57  +
        deserializer.read_struct(&MASTERBALLUNSUCCESSFUL_SCHEMA, &mut |member, deser| {
   58     58   
            match member.member_index() {
   59     59   
                Some(0) => {
   60     60   
                    builder.message = Some(deser.read_string(member)?);
   61     61   
                }
   62     62   
                _ => {}
   63     63   
            }
   64     64   
            Ok(())
   65     65   
        })?;
   66     66   
        Ok(builder.build())
   67     67   
    }
   68     68   
}
          69  +
impl MasterBallUnsuccessful {
          70  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          71  +
    pub fn deserialize_with_response(
          72  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          73  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          74  +
        _status: u16,
          75  +
        _body: &[u8],
          76  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          77  +
        Self::deserialize(deserializer)
          78  +
    }
          79  +
}
   69     80   
impl MasterBallUnsuccessful {
   70     81   
    /// Returns the error message.
   71     82   
    pub fn message(&self) -> ::std::option::Option<&str> {
   72     83   
        self.message.as_deref()
   73     84   
    }
   74     85   
}
   75     86   
impl ::std::fmt::Display for MasterBallUnsuccessful {
   76     87   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   77     88   
        ::std::write!(f, "MasterBallUnsuccessful")?;
   78     89   
        if let ::std::option::Option::Some(inner_1) = &self.message {

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/types/error/_throttling_error.rs

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

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/types/error/_unsupported_region_error.rs

@@ -8,8 +126,138 @@
   28     28   
    "region",
   29     29   
    0,
   30     30   
);
   31     31   
static UNSUPPORTEDREGIONERROR_MEMBER_MESSAGE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
   32     32   
    ::aws_smithy_schema::ShapeId::from_static(
   33     33   
        "com.aws.example#UnsupportedRegionError$Message",
   34     34   
        "com.aws.example",
   35     35   
        "UnsupportedRegionError",
   36     36   
    ),
   37     37   
    ::aws_smithy_schema::ShapeType::String,
   38         -
    "message",
          38  +
    "Message",
   39     39   
    1,
   40     40   
);
   41     41   
static UNSUPPORTEDREGIONERROR_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   42     42   
    UNSUPPORTEDREGIONERROR_SCHEMA_ID,
   43     43   
    ::aws_smithy_schema::ShapeType::Structure,
   44     44   
    &[&UNSUPPORTEDREGIONERROR_MEMBER_REGION, &UNSUPPORTEDREGIONERROR_MEMBER_MESSAGE],
   45     45   
);
   46     46   
impl UnsupportedRegionError {
   47     47   
    /// The schema for this shape.
   48     48   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &UNSUPPORTEDREGIONERROR_SCHEMA;
   49     49   
}
   50     50   
impl ::aws_smithy_schema::serde::SerializableStruct for UnsupportedRegionError {
   51     51   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   52     52   
    fn serialize_members(
   53     53   
        &self,
   54     54   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   55     55   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   56     56   
        {
   57     57   
            let val = &self.region;
   58     58   
            ser.write_string(&UNSUPPORTEDREGIONERROR_MEMBER_REGION, val)?;
   59     59   
        }
   60     60   
        if let Some(ref val) = self.message {
   61     61   
            ser.write_string(&UNSUPPORTEDREGIONERROR_MEMBER_MESSAGE, val)?;
   62     62   
        }
   63     63   
        Ok(())
   64     64   
    }
   65     65   
}
   66     66   
impl UnsupportedRegionError {
   67     67   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   68         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   69         -
        deserializer: &mut D,
          68  +
    pub fn deserialize(
          69  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   70     70   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   71     71   
        #[allow(unused_variables, unused_mut)]
   72     72   
        let mut builder = Self::builder();
   73     73   
        #[allow(
   74     74   
            unused_variables,
   75     75   
            unreachable_code,
   76     76   
            clippy::single_match,
   77     77   
            clippy::match_single_binding,
   78     78   
            clippy::diverging_sub_expression
   79     79   
        )]
   80         -
        deserializer.read_struct(&UNSUPPORTEDREGIONERROR_SCHEMA, (), |_, member, deser| {
          80  +
        deserializer.read_struct(&UNSUPPORTEDREGIONERROR_SCHEMA, &mut |member, deser| {
   81     81   
            match member.member_index() {
   82     82   
                Some(0) => {
   83     83   
                    builder.region = Some(deser.read_string(member)?);
   84     84   
                }
   85     85   
                Some(1) => {
   86     86   
                    builder.message = Some(deser.read_string(member)?);
   87     87   
                }
   88     88   
                _ => {}
   89     89   
            }
   90     90   
            Ok(())
   91     91   
        })?;
          92  +
        builder.region = builder.region.or(Some(String::new()));
   92     93   
        builder
   93     94   
            .build()
   94     95   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   95     96   
    }
   96     97   
}
          98  +
impl UnsupportedRegionError {
          99  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         100  +
    pub fn deserialize_with_response(
         101  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         102  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         103  +
        _status: u16,
         104  +
        _body: &[u8],
         105  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         106  +
        Self::deserialize(deserializer)
         107  +
    }
         108  +
}
   97    109   
impl UnsupportedRegionError {
   98    110   
    /// Returns the error message.
   99    111   
    pub fn message(&self) -> ::std::option::Option<&str> {
  100    112   
        self.message.as_deref()
  101    113   
    }
  102    114   
}
  103    115   
impl ::std::fmt::Display for UnsupportedRegionError {
  104    116   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  105    117   
        ::std::write!(f, "UnsupportedRegionError")?;
  106    118   
        if let ::std::option::Option::Some(inner_1) = &self.message {

tmp-codegen-diff/codegen-client-test/pokemon-service-awsjson-client/rust-client-codegen/src/types/error/_validation_exception.rs

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

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

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

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

@@ -101,101 +137,135 @@
  121    121   
  122    122   
mod event_stream_serde;
  123    123   
  124    124   
/// All operations that this crate can perform.
  125    125   
pub mod operation;
  126    126   
  127    127   
pub(crate) mod protocol_serde;
  128    128   
  129    129   
mod sdk_feature_tracker;
  130    130   
  131         -
mod serialization_settings;
         131  +
mod json_errors;
  132    132   
  133    133   
mod serde_util;
  134    134   
  135         -
mod json_errors;
  136         -
  137    135   
pub use client::Client;

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/capture_pokemon.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 `CapturePokemon`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct CapturePokemon;
    6      6   
impl CapturePokemon {
    7      7   
    /// Creates a new `CapturePokemon`
    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::capture_pokemon::CapturePokemonInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::capture_pokemon::CapturePokemonOutput::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::capture_pokemon::CapturePokemonInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::capture_pokemon::CapturePokemonOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::capture_pokemon::CapturePokemonError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -119,123 +258,369 @@
  139    143   
  140    144   
        // If this is an error, defer to the non-streaming parser
  141    145   
        if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
  142    146   
            return ::std::option::Option::None;
  143    147   
        }
  144    148   
        ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
  145    149   
            crate::protocol_serde::shape_capture_pokemon::de_capture_pokemon_http_response(response),
  146    150   
        ))
  147    151   
    }
  148    152   
  149         -
    fn deserialize_nonstreaming(
         153  +
    fn deserialize_nonstreaming_with_config(
  150    154   
        &self,
  151    155   
        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
         156  +
        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
  152    157   
    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
  153    158   
        // For streaming operations, we only hit this case if its an error
  154    159   
        let body = response.body().bytes().expect("body loaded");
  155         -
        crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_capture_pokemon::de_capture_pokemon_http_error(
  156         -
            response.status().as_u16(),
         160  +
        let status = response.status().as_u16();
         161  +
        let headers = response.headers();
         162  +
        #[allow(unused_mut)]
         163  +
        let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
         164  +
            ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         165  +
        })?;
         166  +
         167  +
        let generic = generic_builder.build();
         168  +
        let error_code = match generic.code() {
         169  +
            ::std::option::Option::Some(code) => code,
         170  +
            ::std::option::Option::None => {
         171  +
                return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         172  +
                    ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::capture_pokemon::CapturePokemonError::unhandled(generic)),
         173  +
                ))
         174  +
            }
         175  +
        };
         176  +
        let _error_message = generic.message().map(|msg| msg.to_owned());
         177  +
        let protocol = _cfg
         178  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         179  +
            .expect("a SharedClientProtocol is required");
         180  +
        let err = match error_code {
         181  +
            "UnsupportedRegionError" => crate::operation::capture_pokemon::CapturePokemonError::UnsupportedRegionError({
         182  +
                let mut tmp = match protocol
         183  +
                    .deserialize_response(response, crate::types::error::UnsupportedRegionError::SCHEMA, _cfg)
         184  +
                    .and_then(|mut deser| {
         185  +
                        crate::types::error::UnsupportedRegionError::deserialize_with_response(
         186  +
                            &mut *deser,
         187  +
                            response.headers(),
         188  +
                            response.status().into(),
         189  +
                            body,
         190  +
                        )
         191  +
                    }) {
         192  +
                    ::std::result::Result::Ok(val) => val,
         193  +
                    ::std::result::Result::Err(e) => {
         194  +
                        return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         195  +
                            ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         196  +
                        ))
         197  +
                    }
         198  +
                };
         199  +
                tmp.meta = generic;
         200  +
                if tmp.message.is_none() {
         201  +
                    tmp.message = _error_message;
         202  +
                }
         203  +
                tmp
         204  +
            }),
         205  +
            "ThrottlingError" => crate::operation::capture_pokemon::CapturePokemonError::ThrottlingError({
         206  +
                let mut tmp = match protocol
         207  +
                    .deserialize_response(response, crate::types::error::ThrottlingError::SCHEMA, _cfg)
         208  +
                    .and_then(|mut deser| {
         209  +
                        crate::types::error::ThrottlingError::deserialize_with_response(
         210  +
                            &mut *deser,
  157    211   
                            response.headers(),
         212  +
                            response.status().into(),
  158    213   
                            body,
         214  +
                        )
         215  +
                    }) {
         216  +
                    ::std::result::Result::Ok(val) => val,
         217  +
                    ::std::result::Result::Err(e) => {
         218  +
                        return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         219  +
                            ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         220  +
                        ))
         221  +
                    }
         222  +
                };
         223  +
                tmp.meta = generic;
         224  +
                if tmp.message.is_none() {
         225  +
                    tmp.message = _error_message;
         226  +
                }
         227  +
                tmp
         228  +
            }),
         229  +
            "ValidationException" => crate::operation::capture_pokemon::CapturePokemonError::ValidationError({
         230  +
                let mut tmp = match protocol
         231  +
                    .deserialize_response(response, crate::types::error::ValidationError::SCHEMA, _cfg)
         232  +
                    .and_then(|mut deser| {
         233  +
                        crate::types::error::ValidationError::deserialize_with_response(
         234  +
                            &mut *deser,
         235  +
                            response.headers(),
         236  +
                            response.status().into(),
         237  +
                            body,
         238  +
                        )
         239  +
                    }) {
         240  +
                    ::std::result::Result::Ok(val) => val,
         241  +
                    ::std::result::Result::Err(e) => {
         242  +
                        return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         243  +
                            ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         244  +
                        ))
         245  +
                    }
         246  +
                };
         247  +
                tmp.meta = generic;
         248  +
                tmp
         249  +
            }),
         250  +
            "MasterBallUnsuccessful" => crate::operation::capture_pokemon::CapturePokemonError::MasterBallUnsuccessful({
         251  +
                let mut tmp = match protocol
         252  +
                    .deserialize_response(response, crate::types::error::MasterBallUnsuccessful::SCHEMA, _cfg)
         253  +
                    .and_then(|mut deser| {
         254  +
                        crate::types::error::MasterBallUnsuccessful::deserialize_with_response(
         255  +
                            &mut *deser,
         256  +
                            response.headers(),
         257  +
                            response.status().into(),
         258  +
                            body,
         259  +
                        )
         260  +
                    }) {
         261  +
                    ::std::result::Result::Ok(val) => val,
         262  +
                    ::std::result::Result::Err(e) => {
         263  +
                        return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         264  +
                            ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         265  +
                        ))
         266  +
                    }
         267  +
                };
         268  +
                tmp.meta = generic;
         269  +
                if tmp.message.is_none() {
         270  +
                    tmp.message = _error_message;
         271  +
                }
         272  +
                tmp
         273  +
            }),
         274  +
            "InvalidPokeballError" => crate::operation::capture_pokemon::CapturePokemonError::InvalidPokeballError({
         275  +
                let mut tmp = match protocol
         276  +
                    .deserialize_response(response, crate::types::error::InvalidPokeballError::SCHEMA, _cfg)
         277  +
                    .and_then(|mut deser| {
         278  +
                        crate::types::error::InvalidPokeballError::deserialize_with_response(
         279  +
                            &mut *deser,
         280  +
                            response.headers(),
         281  +
                            response.status().into(),
         282  +
                            body,
         283  +
                        )
         284  +
                    }) {
         285  +
                    ::std::result::Result::Ok(val) => val,
         286  +
                    ::std::result::Result::Err(e) => {
         287  +
                        return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
         288  +
                            ::aws_smithy_runtime_api::box_error::BoxError::from(e),
         289  +
                        ))
         290  +
                    }
         291  +
                };
         292  +
                tmp.meta = generic;
         293  +
                if tmp.message.is_none() {
         294  +
                    tmp.message = _error_message;
         295  +
                }
         296  +
                tmp
         297  +
            }),
         298  +
            _ => crate::operation::capture_pokemon::CapturePokemonError::generic(generic),
         299  +
        };
         300  +
        ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
         301  +
            ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
  159    302   
        ))
  160    303   
    }
  161    304   
}
  162    305   
#[derive(Debug)]
  163    306   
struct CapturePokemonRequestSerializer;
  164    307   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CapturePokemonRequestSerializer {
  165    308   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  166    309   
    fn serialize_input(
  167    310   
        &self,
  168    311   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  169    312   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  170    313   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  171    314   
        let input = input
  172    315   
            .downcast::<crate::operation::capture_pokemon::CapturePokemonInput>()
  173    316   
            .expect("correct type");
  174         -
        let _header_serialization_settings = _cfg
  175         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  176         -
            .cloned()
  177         -
            .unwrap_or_default();
  178         -
        let mut request_builder = {
  179         -
            #[allow(clippy::uninlined_format_args)]
  180         -
            fn uri_base(
  181         -
                _input: &crate::operation::capture_pokemon::CapturePokemonInput,
  182         -
                output: &mut ::std::string::String,
  183         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  184         -
                use ::std::fmt::Write as _;
  185         -
                let input_1 = &_input.region;
  186         -
                let input_1 = input_1
  187         -
                    .as_ref()
  188         -
                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("region", "cannot be empty or unset"))?;
  189         -
                let region = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
  190         -
                if region.is_empty() {
  191         -
                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
  192         -
                        "region",
  193         -
                        "cannot be empty or unset",
  194         -
                    ));
  195         -
                }
  196         -
                ::std::write!(output, "/capture-pokemon-event/{region}", region = region).expect("formatting should succeed");
  197         -
                ::std::result::Result::Ok(())
  198         -
            }
  199         -
            #[allow(clippy::unnecessary_wraps)]
  200         -
            fn update_http_builder(
  201         -
                input: &crate::operation::capture_pokemon::CapturePokemonInput,
  202         -
                builder: ::http_1x::request::Builder,
  203         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  204         -
                let mut uri = ::std::string::String::new();
  205         -
                uri_base(input, &mut uri)?;
  206         -
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  207         -
            }
  208         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  209         -
            builder =
  210         -
                _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
  211         -
            builder
  212         -
        };
  213         -
        let body = ::aws_smithy_types::body::SdkBody::from({
         317  +
        let protocol = _cfg
         318  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         319  +
            .expect("a SharedClientProtocol is required");
         320  +
        let mut request = protocol
         321  +
            .serialize_request(&input, CapturePokemon::INPUT_SCHEMA, "", _cfg)
         322  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
         323  +
        *request.body_mut() = ::aws_smithy_types::body::SdkBody::from({
  214    324   
            let error_marshaller = crate::event_stream_serde::AttemptCapturingPokemonEventErrorMarshaller::new();
  215    325   
            let marshaller = crate::event_stream_serde::AttemptCapturingPokemonEventMarshaller::new();
  216    326   
            let (signer, signer_sender) = ::aws_smithy_eventstream::frame::DeferredSigner::new();
  217    327   
            _cfg.interceptor_state().store_put(signer_sender);
  218    328   
            ::aws_smithy_types::body::SdkBody::from_body_1_x(::http_body_util::StreamBody::new(input.events.into_body_stream(
  219    329   
                marshaller,
  220    330   
                error_marshaller,
  221    331   
                signer,
  222    332   
            )))
  223    333   
        });
  224         -
        if let Some(content_length) = body.content_length() {
  225         -
            let content_length = content_length.to_string();
  226         -
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
  227         -
        }
  228         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         334  +
        // The protocol may have set Content-Length based on the initial empty body.
         335  +
        // Remove it since the event stream body has unknown length.
         336  +
        request.headers_mut().remove("Content-Length");
         337  +
        request.headers_mut().insert("Content-Type", "application/vnd.amazon.eventstream");
         338  +
         339  +
        return ::std::result::Result::Ok(request);
  229    340   
    }
  230    341   
}
  231    342   
#[derive(Debug)]
  232    343   
struct CapturePokemonEndpointParamsInterceptor;
  233    344   
  234    345   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CapturePokemonEndpointParamsInterceptor {
  235    346   
    fn name(&self) -> &'static str {
  236    347   
        "CapturePokemonEndpointParamsInterceptor"
  237    348   
    }
  238    349   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/capture_pokemon/_capture_pokemon_input.rs

@@ -30,30 +144,153 @@
   50     50   
    ),
   51     51   
    ::aws_smithy_schema::ShapeType::String,
   52     52   
    "region",
   53     53   
    1,
   54     54   
)
   55     55   
.with_http_label();
   56     56   
static CAPTUREPOKEMONINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
   57     57   
    CAPTUREPOKEMONINPUT_SCHEMA_ID,
   58     58   
    ::aws_smithy_schema::ShapeType::Structure,
   59     59   
    &[&CAPTUREPOKEMONINPUT_MEMBER_EVENTS, &CAPTUREPOKEMONINPUT_MEMBER_REGION],
   60         -
);
          60  +
)
          61  +
.with_http(aws_smithy_schema::traits::HttpTrait::new("POST", "/capture-pokemon-event/{region}", None));
   61     62   
impl CapturePokemonInput {
   62     63   
    /// The schema for this shape.
   63     64   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CAPTUREPOKEMONINPUT_SCHEMA;
   64     65   
}
   65     66   
impl ::aws_smithy_schema::serde::SerializableStruct for CapturePokemonInput {
   66     67   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   67     68   
    fn serialize_members(
   68     69   
        &self,
   69     70   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   70     71   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   71         -
        {
   72         -
            let val = &self.events;
   73         -
            ser.write_null(&CAPTUREPOKEMONINPUT_MEMBER_EVENTS)?;
   74         -
        }
   75     72   
        if let Some(ref val) = self.region {
   76     73   
            ser.write_string(&CAPTUREPOKEMONINPUT_MEMBER_REGION, val)?;
   77     74   
        }
   78     75   
        Ok(())
   79     76   
    }
   80     77   
}
   81     78   
impl CapturePokemonInput {
   82     79   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   83         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   84         -
        deserializer: &mut D,
          80  +
    pub fn deserialize(
          81  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   85     82   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   86     83   
        #[allow(unused_variables, unused_mut)]
   87     84   
        let mut builder = Self::builder();
   88     85   
        #[allow(
   89     86   
            unused_variables,
   90     87   
            unreachable_code,
   91     88   
            clippy::single_match,
   92     89   
            clippy::match_single_binding,
   93     90   
            clippy::diverging_sub_expression
   94     91   
        )]
   95         -
        deserializer.read_struct(&CAPTUREPOKEMONINPUT_SCHEMA, (), |_, member, deser| {
          92  +
        deserializer.read_struct(&CAPTUREPOKEMONINPUT_SCHEMA, &mut |member, deser| {
   96     93   
            match member.member_index() {
   97     94   
                Some(0) => {
   98     95   
                    builder.events = Some({
   99     96   
                        let _ = member;
  100         -
                        todo!("deserialize aggregate")
          97  +
                        todo!("deserialize streaming union")
  101     98   
                    });
  102     99   
                }
  103    100   
                Some(1) => {
  104    101   
                    builder.region = Some(deser.read_string(member)?);
  105    102   
                }
  106    103   
                _ => {}
  107    104   
            }
  108    105   
            Ok(())
  109    106   
        })?;
         107  +
        builder.region = builder.region.or(Some(String::new()));
  110    108   
        builder
  111    109   
            .build()
  112    110   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
  113    111   
    }
  114    112   
}
         113  +
impl CapturePokemonInput {
         114  +
    /// Deserializes this structure from a body deserializer and HTTP response.
         115  +
    pub fn deserialize_with_response(
         116  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
         117  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
         118  +
        _status: u16,
         119  +
        _body: &[u8],
         120  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
         121  +
        Self::deserialize(deserializer)
         122  +
    }
         123  +
}
  115    124   
impl CapturePokemonInput {
  116    125   
    /// Creates a new builder-style object to manufacture [`CapturePokemonInput`](crate::operation::capture_pokemon::CapturePokemonInput).
  117    126   
    pub fn builder() -> crate::operation::capture_pokemon::builders::CapturePokemonInputBuilder {
  118    127   
        crate::operation::capture_pokemon::builders::CapturePokemonInputBuilder::default()
  119    128   
    }
  120    129   
}
  121    130   
  122    131   
/// A builder for [`CapturePokemonInput`](crate::operation::capture_pokemon::CapturePokemonInput).
  123    132   
#[derive(::std::default::Default, ::std::fmt::Debug)]
  124    133   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/capture_pokemon/_capture_pokemon_output.rs

@@ -18,18 +115,122 @@
   38     38   
impl CapturePokemonOutput {
   39     39   
    /// The schema for this shape.
   40     40   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CAPTUREPOKEMONOUTPUT_SCHEMA;
   41     41   
}
   42     42   
impl ::aws_smithy_schema::serde::SerializableStruct for CapturePokemonOutput {
   43     43   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   44     44   
    fn serialize_members(
   45     45   
        &self,
   46     46   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   47     47   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   48         -
        {
   49         -
            let val = &self.events;
   50         -
            ser.write_null(&CAPTUREPOKEMONOUTPUT_MEMBER_EVENTS)?;
   51         -
        }
   52     48   
        Ok(())
   53     49   
    }
   54     50   
}
   55     51   
impl CapturePokemonOutput {
   56     52   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   57         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   58         -
        deserializer: &mut D,
          53  +
    pub fn deserialize(
          54  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   59     55   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   60     56   
        #[allow(unused_variables, unused_mut)]
   61     57   
        let mut builder = Self::builder();
   62     58   
        #[allow(
   63     59   
            unused_variables,
   64     60   
            unreachable_code,
   65     61   
            clippy::single_match,
   66     62   
            clippy::match_single_binding,
   67     63   
            clippy::diverging_sub_expression
   68     64   
        )]
   69         -
        deserializer.read_struct(&CAPTUREPOKEMONOUTPUT_SCHEMA, (), |_, member, deser| {
          65  +
        deserializer.read_struct(&CAPTUREPOKEMONOUTPUT_SCHEMA, &mut |member, deser| {
   70     66   
            match member.member_index() {
   71     67   
                Some(0) => {
   72     68   
                    builder.events = Some({
   73     69   
                        let _ = member;
   74         -
                        todo!("deserialize aggregate")
          70  +
                        todo!("deserialize streaming union")
   75     71   
                    });
   76     72   
                }
   77     73   
                _ => {}
   78     74   
            }
   79     75   
            Ok(())
   80     76   
        })?;
   81     77   
        builder
   82     78   
            .build()
   83     79   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   84     80   
    }
   85     81   
}
          82  +
impl CapturePokemonOutput {
          83  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          84  +
    pub fn deserialize_with_response(
          85  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          86  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          87  +
        _status: u16,
          88  +
        _body: &[u8],
          89  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          90  +
        Self::deserialize(deserializer)
          91  +
    }
          92  +
}
   86     93   
impl CapturePokemonOutput {
   87     94   
    /// Creates a new builder-style object to manufacture [`CapturePokemonOutput`](crate::operation::capture_pokemon::CapturePokemonOutput).
   88     95   
    pub fn builder() -> crate::operation::capture_pokemon::builders::CapturePokemonOutputBuilder {
   89     96   
        crate::operation::capture_pokemon::builders::CapturePokemonOutputBuilder::default()
   90     97   
    }
   91     98   
}
   92     99   
   93    100   
/// A builder for [`CapturePokemonOutput`](crate::operation::capture_pokemon::CapturePokemonOutput).
   94    101   
#[derive(::std::default::Default, ::std::fmt::Debug)]
   95    102   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/check_health.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 `CheckHealth`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct CheckHealth;
    6      6   
impl CheckHealth {
    7      7   
    /// Creates a new `CheckHealth`
    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::check_health::CheckHealthInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::check_health::CheckHealthOutput::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::check_health::CheckHealthInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::check_health::CheckHealthOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::check_health::CheckHealthError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +222,231 @@
  124    128   
                crate::operation::check_health::CheckHealthError,
  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 CheckHealthResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CheckHealthResponseDeserializer {
  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_check_health::de_check_health_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::check_health::CheckHealthError::generic(
         158  +
                    generic,
         159  +
                )),
         160  +
            ))
  146    161   
        } else {
  147         -
            crate::protocol_serde::shape_check_health::de_check_health_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, CheckHealth::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::check_health::CheckHealthOutput::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 CheckHealthRequestSerializer;
  154    184   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CheckHealthRequestSerializer {
  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
  162    192   
            .downcast::<crate::operation::check_health::CheckHealthInput>()
  163    193   
            .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::check_health::CheckHealthInput,
  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, "/ping").expect("formatting should succeed");
  176         -
                ::std::result::Result::Ok(())
  177         -
            }
  178         -
            #[allow(clippy::unnecessary_wraps)]
  179         -
            fn update_http_builder(
  180         -
                input: &crate::operation::check_health::CheckHealthInput,
  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("GET").uri(uri))
  186         -
            }
  187         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  188         -
            builder
  189         -
        };
  190         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
         194  +
        let protocol = _cfg
         195  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         196  +
            .expect("a SharedClientProtocol is required");
         197  +
        let mut request = protocol
         198  +
            .serialize_request(&input, CheckHealth::INPUT_SCHEMA, "", _cfg)
         199  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  191    200   
  192         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         201  +
        return ::std::result::Result::Ok(request);
  193    202   
    }
  194    203   
}
  195    204   
#[derive(Debug)]
  196    205   
struct CheckHealthEndpointParamsInterceptor;
  197    206   
  198    207   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CheckHealthEndpointParamsInterceptor {
  199    208   
    fn name(&self) -> &'static str {
  200    209   
        "CheckHealthEndpointParamsInterceptor"
  201    210   
    }
  202    211   

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/check_health/_check_health_input.rs

@@ -1,1 +67,81 @@
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct CheckHealthInput {}
    6      6   
static CHECKHEALTHINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
    7      7   
    "com.aws.example.synthetic#CheckHealthInput",
    8      8   
    "com.aws.example.synthetic",
    9      9   
    "CheckHealthInput",
   10     10   
);
   11     11   
static CHECKHEALTHINPUT_SCHEMA: ::aws_smithy_schema::Schema =
   12         -
    ::aws_smithy_schema::Schema::new_struct(CHECKHEALTHINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
          12  +
    ::aws_smithy_schema::Schema::new_struct(CHECKHEALTHINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          13  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/ping", None));
   13     14   
impl CheckHealthInput {
   14     15   
    /// The schema for this shape.
   15     16   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CHECKHEALTHINPUT_SCHEMA;
   16     17   
}
   17     18   
impl ::aws_smithy_schema::serde::SerializableStruct for CheckHealthInput {
   18     19   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   19     20   
    fn serialize_members(
   20     21   
        &self,
   21     22   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   22     23   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   23     24   
        Ok(())
   24     25   
    }
   25     26   
}
   26     27   
impl CheckHealthInput {
   27     28   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   28         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   29         -
        deserializer: &mut D,
          29  +
    pub fn deserialize(
          30  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   30     31   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   31     32   
        #[allow(unused_variables, unused_mut)]
   32     33   
        let mut builder = Self::builder();
   33     34   
        #[allow(
   34     35   
            unused_variables,
   35     36   
            unreachable_code,
   36     37   
            clippy::single_match,
   37     38   
            clippy::match_single_binding,
   38     39   
            clippy::diverging_sub_expression
   39     40   
        )]
   40         -
        deserializer.read_struct(&CHECKHEALTHINPUT_SCHEMA, (), |_, member, deser| {
          41  +
        deserializer.read_struct(&CHECKHEALTHINPUT_SCHEMA, &mut |member, deser| {
   41     42   
            match member.member_index() {
   42     43   
                _ => {}
   43     44   
            }
   44     45   
            Ok(())
   45     46   
        })?;
   46     47   
        builder
   47     48   
            .build()
   48     49   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   49     50   
    }
   50     51   
}
          52  +
impl CheckHealthInput {
          53  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          54  +
    pub fn deserialize_with_response(
          55  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          56  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          57  +
        _status: u16,
          58  +
        _body: &[u8],
          59  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          60  +
        Self::builder()
          61  +
            .build()
          62  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          63  +
    }
          64  +
}
   51     65   
impl CheckHealthInput {
   52     66   
    /// Creates a new builder-style object to manufacture [`CheckHealthInput`](crate::operation::check_health::CheckHealthInput).
   53     67   
    pub fn builder() -> crate::operation::check_health::builders::CheckHealthInputBuilder {
   54     68   
        crate::operation::check_health::builders::CheckHealthInputBuilder::default()
   55     69   
    }
   56     70   
}
   57     71   
   58     72   
/// A builder for [`CheckHealthInput`](crate::operation::check_health::CheckHealthInput).
   59     73   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   60     74   
#[non_exhaustive]

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/check_health/_check_health_output.rs

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

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/operation/do_nothing.rs

@@ -1,1 +40,44 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// Orchestration and serialization glue logic for `DoNothing`.
    3      3   
#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
    4      4   
#[non_exhaustive]
    5      5   
pub struct DoNothing;
    6      6   
impl DoNothing {
    7      7   
    /// Creates a new `DoNothing`
    8      8   
    pub fn new() -> Self {
    9      9   
        Self
   10     10   
    }
          11  +
    /// The schema for this operation's input shape.
          12  +
    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::do_nothing::DoNothingInput::SCHEMA;
          13  +
    /// The schema for this operation's output shape.
          14  +
    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::do_nothing::DoNothingOutput::SCHEMA;
   11     15   
    pub(crate) async fn orchestrate(
   12     16   
        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
   13     17   
        input: crate::operation::do_nothing::DoNothingInput,
   14     18   
    ) -> ::std::result::Result<
   15     19   
        crate::operation::do_nothing::DoNothingOutput,
   16     20   
        ::aws_smithy_runtime_api::client::result::SdkError<
   17     21   
            crate::operation::do_nothing::DoNothingError,
   18     22   
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
   19     23   
        >,
   20     24   
    > {
@@ -104,108 +220,227 @@
  124    128   
                crate::operation::do_nothing::DoNothingError,
  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 DoNothingResponseDeserializer;
  133    137   
impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DoNothingResponseDeserializer {
  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_do_nothing::de_do_nothing_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::do_nothing::DoNothingError::generic(generic)),
         158  +
            ))
  146    159   
        } else {
  147         -
            crate::protocol_serde::shape_do_nothing::de_do_nothing_http_response(status, headers, body)
  148         -
        };
  149         -
        crate::protocol_serde::type_erase_result(parse_result)
         160  +
            let protocol = _cfg
         161  +
                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         162  +
                .expect("a SharedClientProtocol is required");
         163  +
            let mut deser = protocol.deserialize_response(response, DoNothing::OUTPUT_SCHEMA, _cfg).map_err(|e| {
         164  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         165  +
            })?;
         166  +
            let body = response.body().bytes().expect("body loaded");
         167  +
            let output = crate::operation::do_nothing::DoNothingOutput::deserialize_with_response(
         168  +
                &mut *deser,
         169  +
                response.headers(),
         170  +
                response.status().into(),
         171  +
                body,
         172  +
            )
         173  +
            .map_err(|e| {
         174  +
                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
         175  +
            })?;
         176  +
            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
         177  +
        }
  150    178   
    }
  151    179   
}
  152    180   
#[derive(Debug)]
  153    181   
struct DoNothingRequestSerializer;
  154    182   
impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DoNothingRequestSerializer {
  155    183   
    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
  156    184   
    fn serialize_input(
  157    185   
        &self,
  158    186   
        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
  159    187   
        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
  160    188   
    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
  161    189   
        let input = input.downcast::<crate::operation::do_nothing::DoNothingInput>().expect("correct type");
  162         -
        let _header_serialization_settings = _cfg
  163         -
            .load::<crate::serialization_settings::HeaderSerializationSettings>()
  164         -
            .cloned()
  165         -
            .unwrap_or_default();
  166         -
        let mut request_builder = {
  167         -
            #[allow(clippy::uninlined_format_args)]
  168         -
            fn uri_base(
  169         -
                _input: &crate::operation::do_nothing::DoNothingInput,
  170         -
                output: &mut ::std::string::String,
  171         -
            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
  172         -
                use ::std::fmt::Write as _;
  173         -
                ::std::write!(output, "/do-nothing").expect("formatting should succeed");
  174         -
                ::std::result::Result::Ok(())
  175         -
            }
  176         -
            #[allow(clippy::unnecessary_wraps)]
  177         -
            fn update_http_builder(
  178         -
                input: &crate::operation::do_nothing::DoNothingInput,
  179         -
                builder: ::http_1x::request::Builder,
  180         -
            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  181         -
                let mut uri = ::std::string::String::new();
  182         -
                uri_base(input, &mut uri)?;
  183         -
                ::std::result::Result::Ok(builder.method("GET").uri(uri))
  184         -
            }
  185         -
            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
  186         -
            builder
  187         -
        };
  188         -
        let body = ::aws_smithy_types::body::SdkBody::from("");
         190  +
        let protocol = _cfg
         191  +
            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
         192  +
            .expect("a SharedClientProtocol is required");
         193  +
        let mut request = protocol
         194  +
            .serialize_request(&input, DoNothing::INPUT_SCHEMA, "", _cfg)
         195  +
            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
  189    196   
  190         -
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
         197  +
        return ::std::result::Result::Ok(request);
  191    198   
    }
  192    199   
}
  193    200   
#[derive(Debug)]
  194    201   
struct DoNothingEndpointParamsInterceptor;
  195    202   
  196    203   
impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DoNothingEndpointParamsInterceptor {
  197    204   
    fn name(&self) -> &'static str {
  198    205   
        "DoNothingEndpointParamsInterceptor"
  199    206   
    }
  200    207   

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

@@ -1,1 +64,78 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3      3   
#[non_exhaustive]
    4      4   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5      5   
pub struct DoNothingInput {}
    6      6   
static DONOTHINGINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
    7      7   
    ::aws_smithy_schema::ShapeId::from_static("com.aws.example.synthetic#DoNothingInput", "com.aws.example.synthetic", "DoNothingInput");
    8      8   
static DONOTHINGINPUT_SCHEMA: ::aws_smithy_schema::Schema =
    9         -
    ::aws_smithy_schema::Schema::new_struct(DONOTHINGINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[]);
           9  +
    ::aws_smithy_schema::Schema::new_struct(DONOTHINGINPUT_SCHEMA_ID, ::aws_smithy_schema::ShapeType::Structure, &[])
          10  +
        .with_http(aws_smithy_schema::traits::HttpTrait::new("GET", "/do-nothing", None));
   10     11   
impl DoNothingInput {
   11     12   
    /// The schema for this shape.
   12     13   
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &DONOTHINGINPUT_SCHEMA;
   13     14   
}
   14     15   
impl ::aws_smithy_schema::serde::SerializableStruct for DoNothingInput {
   15     16   
    #[allow(unused_variables, clippy::diverging_sub_expression)]
   16     17   
    fn serialize_members(
   17     18   
        &self,
   18     19   
        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
   19     20   
    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
   20     21   
        Ok(())
   21     22   
    }
   22     23   
}
   23     24   
impl DoNothingInput {
   24     25   
    /// Deserializes this structure from a [`ShapeDeserializer`].
   25         -
    pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
   26         -
        deserializer: &mut D,
          26  +
    pub fn deserialize(
          27  +
        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
   27     28   
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
   28     29   
        #[allow(unused_variables, unused_mut)]
   29     30   
        let mut builder = Self::builder();
   30     31   
        #[allow(
   31     32   
            unused_variables,
   32     33   
            unreachable_code,
   33     34   
            clippy::single_match,
   34     35   
            clippy::match_single_binding,
   35     36   
            clippy::diverging_sub_expression
   36     37   
        )]
   37         -
        deserializer.read_struct(&DONOTHINGINPUT_SCHEMA, (), |_, member, deser| {
          38  +
        deserializer.read_struct(&DONOTHINGINPUT_SCHEMA, &mut |member, deser| {
   38     39   
            match member.member_index() {
   39     40   
                _ => {}
   40     41   
            }
   41     42   
            Ok(())
   42     43   
        })?;
   43     44   
        builder
   44     45   
            .build()
   45     46   
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
   46     47   
    }
   47     48   
}
          49  +
impl DoNothingInput {
          50  +
    /// Deserializes this structure from a body deserializer and HTTP response.
          51  +
    pub fn deserialize_with_response(
          52  +
        _deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
          53  +
        _headers: &::aws_smithy_runtime_api::http::Headers,
          54  +
        _status: u16,
          55  +
        _body: &[u8],
          56  +
    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
          57  +
        Self::builder()
          58  +
            .build()
          59  +
            .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
          60  +
    }
          61  +
}
   48     62   
impl DoNothingInput {
   49     63   
    /// Creates a new builder-style object to manufacture [`DoNothingInput`](crate::operation::do_nothing::DoNothingInput).
   50     64   
    pub fn builder() -> crate::operation::do_nothing::builders::DoNothingInputBuilder {
   51     65   
        crate::operation::do_nothing::builders::DoNothingInputBuilder::default()
   52     66   
    }
   53     67   
}
   54     68   
   55     69   
/// A builder for [`DoNothingInput`](crate::operation::do_nothing::DoNothingInput).
   56     70   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
   57     71   
#[non_exhaustive]