Server Test

Server Test

rev. d7e136c7f19b622057e137a83fe33a6962eff2ca (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk-http0x/rust-server-codegen/src/model.rs

@@ -343,343 +429,429 @@
  363    363   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  364    364   
            write!(
  365    365   
                f,
  366    366   
                r#"Value provided for 'com.aws.example#Language' failed to satisfy constraint: Member must satisfy enum value set: [en, es, it, jp]"#
  367    367   
            )
  368    368   
        }
  369    369   
    }
  370    370   
  371    371   
    impl ::std::error::Error for ConstraintViolation {}
  372    372   
  373         -
    /* ServerEnumGenerator.kt:48 */
         373  +
    /* ServerEnumGenerator.kt:50 */
  374    374   
}
  375         -
/* ServerEnumGenerator.kt:89 */
         375  +
/* ServerEnumGenerator.kt:91 */
  376    376   
impl ::std::convert::TryFrom<&str> for Language {
  377    377   
    type Error = crate::model::language::ConstraintViolation;
  378    378   
    fn try_from(
  379    379   
        s: &str,
  380    380   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  381    381   
        match s {
  382    382   
            "en" => Ok(Language::English),
  383    383   
            "es" => Ok(Language::Spanish),
  384    384   
            "it" => Ok(Language::Italian),
  385    385   
            "jp" => Ok(Language::Japanese),
  386    386   
            _ => Err(crate::model::language::ConstraintViolation(s.to_owned())),
  387    387   
        }
  388    388   
    }
  389    389   
}
  390    390   
impl ::std::convert::TryFrom<::std::string::String> for Language {
  391    391   
    type Error = crate::model::language::ConstraintViolation;
  392    392   
    fn try_from(
  393    393   
        s: ::std::string::String,
  394    394   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  395    395   
    {
  396    396   
        s.as_str().try_into()
  397    397   
    }
  398    398   
}
  399         -
/* ServerEnumGenerator.kt:149 */
         399  +
/* ServerEnumGenerator.kt:151 */
  400    400   
impl std::str::FromStr for Language {
  401    401   
    type Err = crate::model::language::ConstraintViolation;
  402    402   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  403    403   
        Self::try_from(s)
  404    404   
    }
  405    405   
}
  406    406   
/* EnumGenerator.kt:313 */
  407    407   
impl Language {
  408    408   
    /// Returns the `&str` value of the enum member.
  409    409   
    pub fn as_str(&self) -> &str {

tmp-codegen-diff/codegen-server-test/pokemon-service-server-sdk/rust-server-codegen/src/model.rs

@@ -343,343 +429,429 @@
  363    363   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  364    364   
            write!(
  365    365   
                f,
  366    366   
                r#"Value provided for 'com.aws.example#Language' failed to satisfy constraint: Member must satisfy enum value set: [en, es, it, jp]"#
  367    367   
            )
  368    368   
        }
  369    369   
    }
  370    370   
  371    371   
    impl ::std::error::Error for ConstraintViolation {}
  372    372   
  373         -
    /* ServerEnumGenerator.kt:48 */
         373  +
    /* ServerEnumGenerator.kt:50 */
  374    374   
}
  375         -
/* ServerEnumGenerator.kt:89 */
         375  +
/* ServerEnumGenerator.kt:91 */
  376    376   
impl ::std::convert::TryFrom<&str> for Language {
  377    377   
    type Error = crate::model::language::ConstraintViolation;
  378    378   
    fn try_from(
  379    379   
        s: &str,
  380    380   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  381    381   
        match s {
  382    382   
            "en" => Ok(Language::English),
  383    383   
            "es" => Ok(Language::Spanish),
  384    384   
            "it" => Ok(Language::Italian),
  385    385   
            "jp" => Ok(Language::Japanese),
  386    386   
            _ => Err(crate::model::language::ConstraintViolation(s.to_owned())),
  387    387   
        }
  388    388   
    }
  389    389   
}
  390    390   
impl ::std::convert::TryFrom<::std::string::String> for Language {
  391    391   
    type Error = crate::model::language::ConstraintViolation;
  392    392   
    fn try_from(
  393    393   
        s: ::std::string::String,
  394    394   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  395    395   
    {
  396    396   
        s.as_str().try_into()
  397    397   
    }
  398    398   
}
  399         -
/* ServerEnumGenerator.kt:149 */
         399  +
/* ServerEnumGenerator.kt:151 */
  400    400   
impl std::str::FromStr for Language {
  401    401   
    type Err = crate::model::language::ConstraintViolation;
  402    402   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  403    403   
        Self::try_from(s)
  404    404   
    }
  405    405   
}
  406    406   
/* EnumGenerator.kt:313 */
  407    407   
impl Language {
  408    408   
    /// Returns the `&str` value of the enum member.
  409    409   
    pub fn as_str(&self) -> &str {

tmp-codegen-diff/codegen-server-test/rest_json-http0x/rust-server-codegen/src/model.rs

@@ -124,124 +211,211 @@
  144    144   
            crate::model::ValidationExceptionField {
  145    145   
                message: format!(
  146    146   
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
  147    147   
                    &path
  148    148   
                ),
  149    149   
                path,
  150    150   
            }
  151    151   
        }
  152    152   
    }
  153    153   
  154         -
    /* ServerEnumGenerator.kt:48 */
         154  +
    /* ServerEnumGenerator.kt:50 */
  155    155   
}
  156         -
/* ServerEnumGenerator.kt:89 */
         156  +
/* ServerEnumGenerator.kt:91 */
  157    157   
impl ::std::convert::TryFrom<&str> for FooEnum {
  158    158   
    type Error = crate::model::foo_enum::ConstraintViolation;
  159    159   
    fn try_from(
  160    160   
        s: &str,
  161    161   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  162    162   
        match s {
  163    163   
            "0" => Ok(FooEnum::Zero),
  164    164   
            "1" => Ok(FooEnum::One),
  165    165   
            "Bar" => Ok(FooEnum::Bar),
  166    166   
            "Baz" => Ok(FooEnum::Baz),
  167    167   
            "Foo" => Ok(FooEnum::Foo),
  168    168   
            _ => Err(crate::model::foo_enum::ConstraintViolation(s.to_owned())),
  169    169   
        }
  170    170   
    }
  171    171   
}
  172    172   
impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
  173    173   
    type Error = crate::model::foo_enum::ConstraintViolation;
  174    174   
    fn try_from(
  175    175   
        s: ::std::string::String,
  176    176   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  177    177   
    {
  178    178   
        s.as_str().try_into()
  179    179   
    }
  180    180   
}
  181         -
/* ServerEnumGenerator.kt:149 */
         181  +
/* ServerEnumGenerator.kt:151 */
  182    182   
impl std::str::FromStr for FooEnum {
  183    183   
    type Err = crate::model::foo_enum::ConstraintViolation;
  184    184   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  185    185   
        Self::try_from(s)
  186    186   
    }
  187    187   
}
  188    188   
/* EnumGenerator.kt:313 */
  189    189   
impl FooEnum {
  190    190   
    /// Returns the `&str` value of the enum member.
  191    191   
    pub fn as_str(&self) -> &str {
@@ -377,377 +460,460 @@
  397    397   
            crate::model::ValidationExceptionField {
  398    398   
                message: format!(
  399    399   
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#,
  400    400   
                    &path
  401    401   
                ),
  402    402   
                path,
  403    403   
            }
  404    404   
        }
  405    405   
    }
  406    406   
  407         -
    /* ServerEnumGenerator.kt:48 */
         407  +
    /* ServerEnumGenerator.kt:50 */
  408    408   
}
  409         -
/* ServerEnumGenerator.kt:89 */
         409  +
/* ServerEnumGenerator.kt:91 */
  410    410   
impl ::std::convert::TryFrom<&str> for StringEnum {
  411    411   
    type Error = crate::model::string_enum::ConstraintViolation;
  412    412   
    fn try_from(
  413    413   
        s: &str,
  414    414   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  415    415   
        match s {
  416    416   
            "enumvalue" => Ok(StringEnum::V),
  417    417   
            _ => Err(crate::model::string_enum::ConstraintViolation(s.to_owned())),
  418    418   
        }
  419    419   
    }
  420    420   
}
  421    421   
impl ::std::convert::TryFrom<::std::string::String> for StringEnum {
  422    422   
    type Error = crate::model::string_enum::ConstraintViolation;
  423    423   
    fn try_from(
  424    424   
        s: ::std::string::String,
  425    425   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  426    426   
    {
  427    427   
        s.as_str().try_into()
  428    428   
    }
  429    429   
}
  430         -
/* ServerEnumGenerator.kt:149 */
         430  +
/* ServerEnumGenerator.kt:151 */
  431    431   
impl std::str::FromStr for StringEnum {
  432    432   
    type Err = crate::model::string_enum::ConstraintViolation;
  433    433   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  434    434   
        Self::try_from(s)
  435    435   
    }
  436    436   
}
  437    437   
/* EnumGenerator.kt:313 */
  438    438   
impl StringEnum {
  439    439   
    /// Returns the `&str` value of the enum member.
  440    440   
    pub fn as_str(&self) -> &str {
@@ -1772,1772 +1857,1857 @@
 1792   1792   
            crate::model::ValidationExceptionField {
 1793   1793   
                message: format!(
 1794   1794   
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
 1795   1795   
                    &path
 1796   1796   
                ),
 1797   1797   
                path,
 1798   1798   
            }
 1799   1799   
        }
 1800   1800   
    }
 1801   1801   
 1802         -
    /* ServerEnumGenerator.kt:48 */
        1802  +
    /* ServerEnumGenerator.kt:50 */
 1803   1803   
}
 1804         -
/* ServerEnumGenerator.kt:89 */
        1804  +
/* ServerEnumGenerator.kt:91 */
 1805   1805   
impl ::std::convert::TryFrom<&str> for TestEnum {
 1806   1806   
    type Error = crate::model::test_enum::ConstraintViolation;
 1807   1807   
    fn try_from(
 1808   1808   
        s: &str,
 1809   1809   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
 1810   1810   
        match s {
 1811   1811   
            "BAR" => Ok(TestEnum::Bar),
 1812   1812   
            "BAZ" => Ok(TestEnum::Baz),
 1813   1813   
            "FOO" => Ok(TestEnum::Foo),
 1814   1814   
            _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
 1815   1815   
        }
 1816   1816   
    }
 1817   1817   
}
 1818   1818   
impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
 1819   1819   
    type Error = crate::model::test_enum::ConstraintViolation;
 1820   1820   
    fn try_from(
 1821   1821   
        s: ::std::string::String,
 1822   1822   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
 1823   1823   
    {
 1824   1824   
        s.as_str().try_into()
 1825   1825   
    }
 1826   1826   
}
 1827         -
/* ServerEnumGenerator.kt:149 */
        1827  +
/* ServerEnumGenerator.kt:151 */
 1828   1828   
impl std::str::FromStr for TestEnum {
 1829   1829   
    type Err = crate::model::test_enum::ConstraintViolation;
 1830   1830   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
 1831   1831   
        Self::try_from(s)
 1832   1832   
    }
 1833   1833   
}
 1834   1834   
/* EnumGenerator.kt:313 */
 1835   1835   
impl TestEnum {
 1836   1836   
    /// Returns the `&str` value of the enum member.
 1837   1837   
    pub fn as_str(&self) -> &str {

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/model.rs

@@ -124,124 +211,211 @@
  144    144   
            crate::model::ValidationExceptionField {
  145    145   
                message: format!(
  146    146   
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
  147    147   
                    &path
  148    148   
                ),
  149    149   
                path,
  150    150   
            }
  151    151   
        }
  152    152   
    }
  153    153   
  154         -
    /* ServerEnumGenerator.kt:48 */
         154  +
    /* ServerEnumGenerator.kt:50 */
  155    155   
}
  156         -
/* ServerEnumGenerator.kt:89 */
         156  +
/* ServerEnumGenerator.kt:91 */
  157    157   
impl ::std::convert::TryFrom<&str> for FooEnum {
  158    158   
    type Error = crate::model::foo_enum::ConstraintViolation;
  159    159   
    fn try_from(
  160    160   
        s: &str,
  161    161   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  162    162   
        match s {
  163    163   
            "0" => Ok(FooEnum::Zero),
  164    164   
            "1" => Ok(FooEnum::One),
  165    165   
            "Bar" => Ok(FooEnum::Bar),
  166    166   
            "Baz" => Ok(FooEnum::Baz),
  167    167   
            "Foo" => Ok(FooEnum::Foo),
  168    168   
            _ => Err(crate::model::foo_enum::ConstraintViolation(s.to_owned())),
  169    169   
        }
  170    170   
    }
  171    171   
}
  172    172   
impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
  173    173   
    type Error = crate::model::foo_enum::ConstraintViolation;
  174    174   
    fn try_from(
  175    175   
        s: ::std::string::String,
  176    176   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  177    177   
    {
  178    178   
        s.as_str().try_into()
  179    179   
    }
  180    180   
}
  181         -
/* ServerEnumGenerator.kt:149 */
         181  +
/* ServerEnumGenerator.kt:151 */
  182    182   
impl std::str::FromStr for FooEnum {
  183    183   
    type Err = crate::model::foo_enum::ConstraintViolation;
  184    184   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  185    185   
        Self::try_from(s)
  186    186   
    }
  187    187   
}
  188    188   
/* EnumGenerator.kt:313 */
  189    189   
impl FooEnum {
  190    190   
    /// Returns the `&str` value of the enum member.
  191    191   
    pub fn as_str(&self) -> &str {
@@ -377,377 +460,460 @@
  397    397   
            crate::model::ValidationExceptionField {
  398    398   
                message: format!(
  399    399   
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#,
  400    400   
                    &path
  401    401   
                ),
  402    402   
                path,
  403    403   
            }
  404    404   
        }
  405    405   
    }
  406    406   
  407         -
    /* ServerEnumGenerator.kt:48 */
         407  +
    /* ServerEnumGenerator.kt:50 */
  408    408   
}
  409         -
/* ServerEnumGenerator.kt:89 */
         409  +
/* ServerEnumGenerator.kt:91 */
  410    410   
impl ::std::convert::TryFrom<&str> for StringEnum {
  411    411   
    type Error = crate::model::string_enum::ConstraintViolation;
  412    412   
    fn try_from(
  413    413   
        s: &str,
  414    414   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  415    415   
        match s {
  416    416   
            "enumvalue" => Ok(StringEnum::V),
  417    417   
            _ => Err(crate::model::string_enum::ConstraintViolation(s.to_owned())),
  418    418   
        }
  419    419   
    }
  420    420   
}
  421    421   
impl ::std::convert::TryFrom<::std::string::String> for StringEnum {
  422    422   
    type Error = crate::model::string_enum::ConstraintViolation;
  423    423   
    fn try_from(
  424    424   
        s: ::std::string::String,
  425    425   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  426    426   
    {
  427    427   
        s.as_str().try_into()
  428    428   
    }
  429    429   
}
  430         -
/* ServerEnumGenerator.kt:149 */
         430  +
/* ServerEnumGenerator.kt:151 */
  431    431   
impl std::str::FromStr for StringEnum {
  432    432   
    type Err = crate::model::string_enum::ConstraintViolation;
  433    433   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  434    434   
        Self::try_from(s)
  435    435   
    }
  436    436   
}
  437    437   
/* EnumGenerator.kt:313 */
  438    438   
impl StringEnum {
  439    439   
    /// Returns the `&str` value of the enum member.
  440    440   
    pub fn as_str(&self) -> &str {
@@ -1772,1772 +1857,1857 @@
 1792   1792   
            crate::model::ValidationExceptionField {
 1793   1793   
                message: format!(
 1794   1794   
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
 1795   1795   
                    &path
 1796   1796   
                ),
 1797   1797   
                path,
 1798   1798   
            }
 1799   1799   
        }
 1800   1800   
    }
 1801   1801   
 1802         -
    /* ServerEnumGenerator.kt:48 */
        1802  +
    /* ServerEnumGenerator.kt:50 */
 1803   1803   
}
 1804         -
/* ServerEnumGenerator.kt:89 */
        1804  +
/* ServerEnumGenerator.kt:91 */
 1805   1805   
impl ::std::convert::TryFrom<&str> for TestEnum {
 1806   1806   
    type Error = crate::model::test_enum::ConstraintViolation;
 1807   1807   
    fn try_from(
 1808   1808   
        s: &str,
 1809   1809   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
 1810   1810   
        match s {
 1811   1811   
            "BAR" => Ok(TestEnum::Bar),
 1812   1812   
            "BAZ" => Ok(TestEnum::Baz),
 1813   1813   
            "FOO" => Ok(TestEnum::Foo),
 1814   1814   
            _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
 1815   1815   
        }
 1816   1816   
    }
 1817   1817   
}
 1818   1818   
impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
 1819   1819   
    type Error = crate::model::test_enum::ConstraintViolation;
 1820   1820   
    fn try_from(
 1821   1821   
        s: ::std::string::String,
 1822   1822   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
 1823   1823   
    {
 1824   1824   
        s.as_str().try_into()
 1825   1825   
    }
 1826   1826   
}
 1827         -
/* ServerEnumGenerator.kt:149 */
        1827  +
/* ServerEnumGenerator.kt:151 */
 1828   1828   
impl std::str::FromStr for TestEnum {
 1829   1829   
    type Err = crate::model::test_enum::ConstraintViolation;
 1830   1830   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
 1831   1831   
        Self::try_from(s)
 1832   1832   
    }
 1833   1833   
}
 1834   1834   
/* EnumGenerator.kt:313 */
 1835   1835   
impl TestEnum {
 1836   1836   
    /// Returns the `&str` value of the enum member.
 1837   1837   
    pub fn as_str(&self) -> &str {

tmp-codegen-diff/codegen-server-test/rest_json_validation-http0x/rust-server-codegen/src/model.rs

@@ -2,2 +75,75 @@
   22     22   
}
   23     23   
/// See [`EnumString`](crate::model::EnumString).
   24     24   
pub mod enum_string {
   25     25   
    #[derive(Debug, PartialEq)]
   26     26   
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
   27     27   
   28     28   
    impl ::std::fmt::Display for ConstraintViolation {
   29     29   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   30     30   
            write!(
   31     31   
                f,
   32         -
                r#"Value provided for 'aws.protocoltests.restjson.validation#EnumString' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, ghi, jkl]"#
          32  +
                r#"Value provided for 'aws.protocoltests.restjson.validation#EnumString' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]"#
   33     33   
            )
   34     34   
        }
   35     35   
    }
   36     36   
   37     37   
    impl ::std::error::Error for ConstraintViolation {}
   38     38   
    impl ConstraintViolation {
   39     39   
        pub(crate) fn as_validation_exception_field(
   40     40   
            self,
   41     41   
            path: ::std::string::String,
   42     42   
        ) -> crate::model::ValidationExceptionField {
   43     43   
            crate::model::ValidationExceptionField {
   44     44   
                message: format!(
   45         -
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, ghi, jkl]"#,
          45  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]"#,
   46     46   
                    &path
   47     47   
                ),
   48     48   
                path,
   49     49   
            }
   50     50   
        }
   51     51   
    }
   52     52   
}
   53     53   
impl ::std::convert::TryFrom<&str> for EnumString {
   54     54   
    type Error = crate::model::enum_string::ConstraintViolation;
   55     55   
    fn try_from(
@@ -112,112 +185,185 @@
  132    132   
}
  133    133   
/// See [`EnumTraitString`](crate::model::EnumTraitString).
  134    134   
pub mod enum_trait_string {
  135    135   
    #[derive(Debug, PartialEq)]
  136    136   
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
  137    137   
  138    138   
    impl ::std::fmt::Display for ConstraintViolation {
  139    139   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  140    140   
            write!(
  141    141   
                f,
  142         -
                r#"Value provided for 'aws.protocoltests.restjson.validation#EnumTraitString' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, ghi]"#
         142  +
                r#"Value provided for 'aws.protocoltests.restjson.validation#EnumTraitString' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]"#
  143    143   
            )
  144    144   
        }
  145    145   
    }
  146    146   
  147    147   
    impl ::std::error::Error for ConstraintViolation {}
  148    148   
    impl ConstraintViolation {
  149    149   
        pub(crate) fn as_validation_exception_field(
  150    150   
            self,
  151    151   
            path: ::std::string::String,
  152    152   
        ) -> crate::model::ValidationExceptionField {
  153    153   
            crate::model::ValidationExceptionField {
  154    154   
                message: format!(
  155         -
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, ghi]"#,
         155  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]"#,
  156    156   
                    &path
  157    157   
                ),
  158    158   
                path,
  159    159   
            }
  160    160   
        }
  161    161   
    }
  162    162   
}
  163    163   
impl ::std::convert::TryFrom<&str> for EnumTraitString {
  164    164   
    type Error = crate::model::enum_trait_string::ConstraintViolation;
  165    165   
    fn try_from(

tmp-codegen-diff/codegen-server-test/rest_json_validation-http0x/rust-server-codegen/src/operation.rs

@@ -81,81 +801,789 @@
  101    101   
#[allow(unreachable_code, unused_variables)]
  102    102   
#[cfg(test)]
  103    103   
mod malformed_enum_test {
  104    104   
  105    105   
    /// When a string member does not contain a valid enum value,
  106    106   
    /// the response should be a 400 ValidationException. Internal-only
  107    107   
    /// enum values are excluded from the response message.
  108    108   
    /// Test ID: RestJsonMalformedEnumString_case0
  109    109   
    #[::tokio::test]
  110    110   
    #[::tracing_test::traced_test]
  111         -
    #[should_panic]
  112    111   
    async fn rest_json_malformed_enum_string_case0_malformed_request() {
  113    112   
        {
  114    113   
            #[allow(unused_mut)]
  115    114   
            let mut http_request = ::http::Request::builder()
  116    115   
                .uri("/MalformedEnum")
  117    116   
                .method("POST")
  118    117   
                .header("content-type", "application/json")
  119    118   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  120    119   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  121    120   
                        "{ \"string\" : \"ABC\" }".as_bytes(),
  122    121   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  123    122   
                    )),
  124    123   
                ))
  125    124   
                .unwrap();
  126    125   
            #[allow(unused_mut)]
  127    126   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  128    127   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  129    128   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  130    129   
                            .malformed_enum(
  131    130   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  132    131   
                                // since `send()` only borrows it.
  133    132   
                                #[allow(unused_assignments)]
  134    133   
                                move |input: crate::input::MalformedEnumInput| {
  135    134   
                                    let sender = sender.clone();
  136    135   
                                    async move {
  137    136   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  138    137   
                                        sender.send(()).await.expect("receiver dropped early");
  139    138   
                                        result
  140    139   
                                    }
  141    140   
                                }
  142    141   
                            )
  143    142   
                            .build_unchecked();
  144    143   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  145    144   
                .await
  146    145   
                .expect("unable to make an HTTP request");
  147    146   
            ::pretty_assertions::assert_eq!(
  148    147   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  149    148   
                http_response.status()
  150    149   
            );
  151    150   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  152    151   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  153    152   
                http_response.headers(),
  154    153   
                expected_headers,
  155    154   
            ));
  156    155   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  157    156   
                .await
  158    157   
                .expect("unable to extract body to bytes");
  159    158   
            ::aws_smithy_protocol_test::assert_ok(
  160    159   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  161    160   
            );
  162    161   
        }
  163    162   
    }
  164    163   
  165    164   
    /// When a string member does not contain a valid enum value,
  166    165   
    /// the response should be a 400 ValidationException. Internal-only
  167    166   
    /// enum values are excluded from the response message.
  168    167   
    /// Test ID: RestJsonMalformedEnumString_case1
  169    168   
    #[::tokio::test]
  170    169   
    #[::tracing_test::traced_test]
  171         -
    #[should_panic]
  172    170   
    async fn rest_json_malformed_enum_string_case1_malformed_request() {
  173    171   
        {
  174    172   
            #[allow(unused_mut)]
  175    173   
            let mut http_request = ::http::Request::builder()
  176    174   
                .uri("/MalformedEnum")
  177    175   
                .method("POST")
  178    176   
                .header("content-type", "application/json")
  179    177   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  180    178   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  181    179   
                        "{ \"string\" : \"XYZ\" }".as_bytes(),
  182    180   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  183    181   
                    )),
  184    182   
                ))
  185    183   
                .unwrap();
  186    184   
            #[allow(unused_mut)]
  187    185   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  188    186   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  189    187   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  190    188   
                            .malformed_enum(
  191    189   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  192    190   
                                // since `send()` only borrows it.
  193    191   
                                #[allow(unused_assignments)]
  194    192   
                                move |input: crate::input::MalformedEnumInput| {
  195    193   
                                    let sender = sender.clone();
  196    194   
                                    async move {
  197    195   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  198    196   
                                        sender.send(()).await.expect("receiver dropped early");
  199    197   
                                        result
  200    198   
                                    }
  201    199   
                                }
  202    200   
                            )
  203    201   
                            .build_unchecked();
  204    202   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  205    203   
                .await
  206    204   
                .expect("unable to make an HTTP request");
  207    205   
            ::pretty_assertions::assert_eq!(
  208    206   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  209    207   
                http_response.status()
  210    208   
            );
  211    209   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  212    210   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  213    211   
                http_response.headers(),
  214    212   
                expected_headers,
  215    213   
            ));
  216    214   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  217    215   
                .await
  218    216   
                .expect("unable to extract body to bytes");
  219    217   
            ::aws_smithy_protocol_test::assert_ok(
  220    218   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  221    219   
            );
  222    220   
        }
  223    221   
    }
  224    222   
  225    223   
    /// When a string member does not contain a valid enum value,
  226    224   
    /// the response should be a 400 ValidationException. Internal-only
  227    225   
    /// enum values are excluded from the response message.
  228    226   
    /// Test ID: RestJsonMalformedEnumTraitString_case0
  229    227   
    #[::tokio::test]
  230    228   
    #[::tracing_test::traced_test]
  231         -
    #[should_panic]
  232    229   
    async fn rest_json_malformed_enum_trait_string_case0_malformed_request() {
  233    230   
        {
  234    231   
            #[allow(unused_mut)]
  235    232   
            let mut http_request = ::http::Request::builder()
  236    233   
                .uri("/MalformedEnum")
  237    234   
                .method("POST")
  238    235   
                .header("content-type", "application/json")
  239    236   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  240    237   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  241    238   
                        "{ \"stringWithEnumTrait\" : \"ABC\" }".as_bytes(),
  242    239   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  243    240   
                    )),
  244    241   
                ))
  245    242   
                .unwrap();
  246    243   
            #[allow(unused_mut)]
  247    244   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  248    245   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  249    246   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  250    247   
                            .malformed_enum(
  251    248   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  252    249   
                                // since `send()` only borrows it.
  253    250   
                                #[allow(unused_assignments)]
  254    251   
                                move |input: crate::input::MalformedEnumInput| {
  255    252   
                                    let sender = sender.clone();
  256    253   
                                    async move {
  257    254   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  258    255   
                                        sender.send(()).await.expect("receiver dropped early");
  259    256   
                                        result
  260    257   
                                    }
  261    258   
                                }
  262    259   
                            )
  263    260   
                            .build_unchecked();
  264    261   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  265    262   
                .await
  266    263   
                .expect("unable to make an HTTP request");
  267    264   
            ::pretty_assertions::assert_eq!(
  268    265   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  269    266   
                http_response.status()
  270    267   
            );
  271    268   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  272    269   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  273    270   
                http_response.headers(),
  274    271   
                expected_headers,
  275    272   
            ));
  276    273   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  277    274   
                .await
  278    275   
                .expect("unable to extract body to bytes");
  279    276   
            ::aws_smithy_protocol_test::assert_ok(
  280    277   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n  \"fieldList\" : [{\"message\": \"Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/stringWithEnumTrait\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  281    278   
            );
  282    279   
        }
  283    280   
    }
  284    281   
  285    282   
    /// When a string member does not contain a valid enum value,
  286    283   
    /// the response should be a 400 ValidationException. Internal-only
  287    284   
    /// enum values are excluded from the response message.
  288    285   
    /// Test ID: RestJsonMalformedEnumTraitString_case1
  289    286   
    #[::tokio::test]
  290    287   
    #[::tracing_test::traced_test]
  291         -
    #[should_panic]
  292    288   
    async fn rest_json_malformed_enum_trait_string_case1_malformed_request() {
  293    289   
        {
  294    290   
            #[allow(unused_mut)]
  295    291   
            let mut http_request = ::http::Request::builder()
  296    292   
                .uri("/MalformedEnum")
  297    293   
                .method("POST")
  298    294   
                .header("content-type", "application/json")
  299    295   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  300    296   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  301    297   
                        "{ \"stringWithEnumTrait\" : \"XYZ\" }".as_bytes(),
  302    298   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  303    299   
                    )),
  304    300   
                ))
  305    301   
                .unwrap();
  306    302   
            #[allow(unused_mut)]
  307    303   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  308    304   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  309    305   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  310    306   
                            .malformed_enum(
  311    307   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  312    308   
                                // since `send()` only borrows it.
  313    309   
                                #[allow(unused_assignments)]
  314    310   
                                move |input: crate::input::MalformedEnumInput| {
  315    311   
                                    let sender = sender.clone();
  316    312   
                                    async move {
  317    313   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  318    314   
                                        sender.send(()).await.expect("receiver dropped early");
  319    315   
                                        result
  320    316   
                                    }
  321    317   
                                }
  322    318   
                            )
  323    319   
                            .build_unchecked();
  324    320   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  325    321   
                .await
  326    322   
                .expect("unable to make an HTTP request");
  327    323   
            ::pretty_assertions::assert_eq!(
  328    324   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  329    325   
                http_response.status()
  330    326   
            );
  331    327   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  332    328   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  333    329   
                http_response.headers(),
  334    330   
                expected_headers,
  335    331   
            ));
  336    332   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  337    333   
                .await
  338    334   
                .expect("unable to extract body to bytes");
  339    335   
            ::aws_smithy_protocol_test::assert_ok(
  340    336   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n  \"fieldList\" : [{\"message\": \"Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/stringWithEnumTrait\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  341    337   
            );
  342    338   
        }
  343    339   
    }
  344    340   
  345    341   
    /// When a list member value does not contain a valid enum value,
  346    342   
    /// the response should be a 400 ValidationException. Internal-only
  347    343   
    /// enum values are excluded from the response message.
  348    344   
    /// Test ID: RestJsonMalformedEnumList_case0
  349    345   
    #[::tokio::test]
  350    346   
    #[::tracing_test::traced_test]
  351         -
    #[should_panic]
  352    347   
    async fn rest_json_malformed_enum_list_case0_malformed_request() {
  353    348   
        {
  354    349   
            #[allow(unused_mut)]
  355    350   
            let mut http_request = ::http::Request::builder()
  356    351   
                .uri("/MalformedEnum")
  357    352   
                .method("POST")
  358    353   
                .header("content-type", "application/json")
  359    354   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  360    355   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  361    356   
                        "{ \"list\" : [\"ABC\"] }".as_bytes(),
  362    357   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  363    358   
                    )),
  364    359   
                ))
  365    360   
                .unwrap();
  366    361   
            #[allow(unused_mut)]
  367    362   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  368    363   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  369    364   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  370    365   
                            .malformed_enum(
  371    366   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  372    367   
                                // since `send()` only borrows it.
  373    368   
                                #[allow(unused_assignments)]
  374    369   
                                move |input: crate::input::MalformedEnumInput| {
  375    370   
                                    let sender = sender.clone();
  376    371   
                                    async move {
  377    372   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  378    373   
                                        sender.send(()).await.expect("receiver dropped early");
  379    374   
                                        result
  380    375   
                                    }
  381    376   
                                }
  382    377   
                            )
  383    378   
                            .build_unchecked();
  384    379   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  385    380   
                .await
  386    381   
                .expect("unable to make an HTTP request");
  387    382   
            ::pretty_assertions::assert_eq!(
  388    383   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  389    384   
                http_response.status()
  390    385   
            );
  391    386   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  392    387   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  393    388   
                http_response.headers(),
  394    389   
                expected_headers,
  395    390   
            ));
  396    391   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  397    392   
                .await
  398    393   
                .expect("unable to extract body to bytes");
  399    394   
            ::aws_smithy_protocol_test::assert_ok(
  400    395   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  401    396   
            );
  402    397   
        }
  403    398   
    }
  404    399   
  405    400   
    /// When a list member value does not contain a valid enum value,
  406    401   
    /// the response should be a 400 ValidationException. Internal-only
  407    402   
    /// enum values are excluded from the response message.
  408    403   
    /// Test ID: RestJsonMalformedEnumList_case1
  409    404   
    #[::tokio::test]
  410    405   
    #[::tracing_test::traced_test]
  411         -
    #[should_panic]
  412    406   
    async fn rest_json_malformed_enum_list_case1_malformed_request() {
  413    407   
        {
  414    408   
            #[allow(unused_mut)]
  415    409   
            let mut http_request = ::http::Request::builder()
  416    410   
                .uri("/MalformedEnum")
  417    411   
                .method("POST")
  418    412   
                .header("content-type", "application/json")
  419    413   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  420    414   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  421    415   
                        "{ \"list\" : [\"XYZ\"] }".as_bytes(),
  422    416   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  423    417   
                    )),
  424    418   
                ))
  425    419   
                .unwrap();
  426    420   
            #[allow(unused_mut)]
  427    421   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  428    422   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  429    423   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  430    424   
                            .malformed_enum(
  431    425   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  432    426   
                                // since `send()` only borrows it.
  433    427   
                                #[allow(unused_assignments)]
  434    428   
                                move |input: crate::input::MalformedEnumInput| {
  435    429   
                                    let sender = sender.clone();
  436    430   
                                    async move {
  437    431   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  438    432   
                                        sender.send(()).await.expect("receiver dropped early");
  439    433   
                                        result
  440    434   
                                    }
  441    435   
                                }
  442    436   
                            )
  443    437   
                            .build_unchecked();
  444    438   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  445    439   
                .await
  446    440   
                .expect("unable to make an HTTP request");
  447    441   
            ::pretty_assertions::assert_eq!(
  448    442   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  449    443   
                http_response.status()
  450    444   
            );
  451    445   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  452    446   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  453    447   
                http_response.headers(),
  454    448   
                expected_headers,
  455    449   
            ));
  456    450   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  457    451   
                .await
  458    452   
                .expect("unable to extract body to bytes");
  459    453   
            ::aws_smithy_protocol_test::assert_ok(
  460    454   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  461    455   
            );
  462    456   
        }
  463    457   
    }
  464    458   
  465    459   
    /// When a map member's key does not contain a valid enum value,
  466    460   
    /// the response should be a 400 ValidationException. Internal-only
  467    461   
    /// enum values are excluded from the response message.
  468    462   
    /// Test ID: RestJsonMalformedEnumMapKey_case0
  469    463   
    #[::tokio::test]
  470    464   
    #[::tracing_test::traced_test]
  471         -
    #[should_panic]
  472    465   
    async fn rest_json_malformed_enum_map_key_case0_malformed_request() {
  473    466   
        {
  474    467   
            #[allow(unused_mut)]
  475    468   
            let mut http_request = ::http::Request::builder()
  476    469   
                .uri("/MalformedEnum")
  477    470   
                .method("POST")
  478    471   
                .header("content-type", "application/json")
  479    472   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  480    473   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  481    474   
                        "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
  482    475   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  483    476   
                    )),
  484    477   
                ))
  485    478   
                .unwrap();
  486    479   
            #[allow(unused_mut)]
  487    480   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  488    481   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  489    482   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  490    483   
                            .malformed_enum(
  491    484   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  492    485   
                                // since `send()` only borrows it.
  493    486   
                                #[allow(unused_assignments)]
  494    487   
                                move |input: crate::input::MalformedEnumInput| {
  495    488   
                                    let sender = sender.clone();
  496    489   
                                    async move {
  497    490   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  498    491   
                                        sender.send(()).await.expect("receiver dropped early");
  499    492   
                                        result
  500    493   
                                    }
  501    494   
                                }
  502    495   
                            )
  503    496   
                            .build_unchecked();
  504    497   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  505    498   
                .await
  506    499   
                .expect("unable to make an HTTP request");
  507    500   
            ::pretty_assertions::assert_eq!(
  508    501   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  509    502   
                http_response.status()
  510    503   
            );
  511    504   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  512    505   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  513    506   
                http_response.headers(),
  514    507   
                expected_headers,
  515    508   
            ));
  516    509   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  517    510   
                .await
  518    511   
                .expect("unable to extract body to bytes");
  519    512   
            ::aws_smithy_protocol_test::assert_ok(
  520    513   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  521    514   
            );
  522    515   
        }
  523    516   
    }
  524    517   
  525    518   
    /// When a map member's key does not contain a valid enum value,
  526    519   
    /// the response should be a 400 ValidationException. Internal-only
  527    520   
    /// enum values are excluded from the response message.
  528    521   
    /// Test ID: RestJsonMalformedEnumMapKey_case1
  529    522   
    #[::tokio::test]
  530    523   
    #[::tracing_test::traced_test]
  531         -
    #[should_panic]
  532    524   
    async fn rest_json_malformed_enum_map_key_case1_malformed_request() {
  533    525   
        {
  534    526   
            #[allow(unused_mut)]
  535    527   
            let mut http_request = ::http::Request::builder()
  536    528   
                .uri("/MalformedEnum")
  537    529   
                .method("POST")
  538    530   
                .header("content-type", "application/json")
  539    531   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  540    532   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  541    533   
                        "{ \"map\" : { \"XYZ\" : \"abc\" } }".as_bytes(),
  542    534   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  543    535   
                    )),
  544    536   
                ))
  545    537   
                .unwrap();
  546    538   
            #[allow(unused_mut)]
  547    539   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  548    540   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  549    541   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  550    542   
                            .malformed_enum(
  551    543   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  552    544   
                                // since `send()` only borrows it.
  553    545   
                                #[allow(unused_assignments)]
  554    546   
                                move |input: crate::input::MalformedEnumInput| {
  555    547   
                                    let sender = sender.clone();
  556    548   
                                    async move {
  557    549   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  558    550   
                                        sender.send(()).await.expect("receiver dropped early");
  559    551   
                                        result
  560    552   
                                    }
  561    553   
                                }
  562    554   
                            )
  563    555   
                            .build_unchecked();
  564    556   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  565    557   
                .await
  566    558   
                .expect("unable to make an HTTP request");
  567    559   
            ::pretty_assertions::assert_eq!(
  568    560   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  569    561   
                http_response.status()
  570    562   
            );
  571    563   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  572    564   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  573    565   
                http_response.headers(),
  574    566   
                expected_headers,
  575    567   
            ));
  576    568   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  577    569   
                .await
  578    570   
                .expect("unable to extract body to bytes");
  579    571   
            ::aws_smithy_protocol_test::assert_ok(
  580    572   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  581    573   
            );
  582    574   
        }
  583    575   
    }
  584    576   
  585    577   
    /// When a map member's value does not contain a valid enum value,
  586    578   
    /// the response should be a 400 ValidationException. Internal-only
  587    579   
    /// enum values are excluded from the response message.
  588    580   
    /// Test ID: RestJsonMalformedEnumMapValue_case0
  589    581   
    #[::tokio::test]
  590    582   
    #[::tracing_test::traced_test]
  591         -
    #[should_panic]
  592    583   
    async fn rest_json_malformed_enum_map_value_case0_malformed_request() {
  593    584   
        {
  594    585   
            #[allow(unused_mut)]
  595    586   
            let mut http_request = ::http::Request::builder()
  596    587   
                .uri("/MalformedEnum")
  597    588   
                .method("POST")
  598    589   
                .header("content-type", "application/json")
  599    590   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  600    591   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  601    592   
                        "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
  602    593   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  603    594   
                    )),
  604    595   
                ))
  605    596   
                .unwrap();
  606    597   
            #[allow(unused_mut)]
  607    598   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  608    599   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  609    600   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  610    601   
                            .malformed_enum(
  611    602   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  612    603   
                                // since `send()` only borrows it.
  613    604   
                                #[allow(unused_assignments)]
  614    605   
                                move |input: crate::input::MalformedEnumInput| {
  615    606   
                                    let sender = sender.clone();
  616    607   
                                    async move {
  617    608   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  618    609   
                                        sender.send(()).await.expect("receiver dropped early");
  619    610   
                                        result
  620    611   
                                    }
  621    612   
                                }
  622    613   
                            )
  623    614   
                            .build_unchecked();
  624    615   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  625    616   
                .await
  626    617   
                .expect("unable to make an HTTP request");
  627    618   
            ::pretty_assertions::assert_eq!(
  628    619   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  629    620   
                http_response.status()
  630    621   
            );
  631    622   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  632    623   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  633    624   
                http_response.headers(),
  634    625   
                expected_headers,
  635    626   
            ));
  636    627   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  637    628   
                .await
  638    629   
                .expect("unable to extract body to bytes");
  639    630   
            ::aws_smithy_protocol_test::assert_ok(
  640    631   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  641    632   
            );
  642    633   
        }
  643    634   
    }
  644    635   
  645    636   
    /// When a map member's value does not contain a valid enum value,
  646    637   
    /// the response should be a 400 ValidationException. Internal-only
  647    638   
    /// enum values are excluded from the response message.
  648    639   
    /// Test ID: RestJsonMalformedEnumMapValue_case1
  649    640   
    #[::tokio::test]
  650    641   
    #[::tracing_test::traced_test]
  651         -
    #[should_panic]
  652    642   
    async fn rest_json_malformed_enum_map_value_case1_malformed_request() {
  653    643   
        {
  654    644   
            #[allow(unused_mut)]
  655    645   
            let mut http_request = ::http::Request::builder()
  656    646   
                .uri("/MalformedEnum")
  657    647   
                .method("POST")
  658    648   
                .header("content-type", "application/json")
  659    649   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  660    650   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  661    651   
                        "{ \"map\" : { \"abc\": \"XYZ\" } }".as_bytes(),
  662    652   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  663    653   
                    )),
  664    654   
                ))
  665    655   
                .unwrap();
  666    656   
            #[allow(unused_mut)]
  667    657   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  668    658   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  669    659   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  670    660   
                            .malformed_enum(
  671    661   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  672    662   
                                // since `send()` only borrows it.
  673    663   
                                #[allow(unused_assignments)]
  674    664   
                                move |input: crate::input::MalformedEnumInput| {
  675    665   
                                    let sender = sender.clone();
  676    666   
                                    async move {
  677    667   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  678    668   
                                        sender.send(()).await.expect("receiver dropped early");
  679    669   
                                        result
  680    670   
                                    }
  681    671   
                                }
  682    672   
                            )
  683    673   
                            .build_unchecked();
  684    674   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  685    675   
                .await
  686    676   
                .expect("unable to make an HTTP request");
  687    677   
            ::pretty_assertions::assert_eq!(
  688    678   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  689    679   
                http_response.status()
  690    680   
            );
  691    681   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  692    682   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  693    683   
                http_response.headers(),
  694    684   
                expected_headers,
  695    685   
            ));
  696    686   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  697    687   
                .await
  698    688   
                .expect("unable to extract body to bytes");
  699    689   
            ::aws_smithy_protocol_test::assert_ok(
  700    690   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  701    691   
            );
  702    692   
        }
  703    693   
    }
  704    694   
  705    695   
    /// When a union member's value does not contain a valid enum value,
  706    696   
    /// the response should be a 400 ValidationException. Internal-only
  707    697   
    /// enum values are excluded from the response message.
  708    698   
    /// Test ID: RestJsonMalformedEnumUnion_case0
  709    699   
    #[::tokio::test]
  710    700   
    #[::tracing_test::traced_test]
  711         -
    #[should_panic]
  712    701   
    async fn rest_json_malformed_enum_union_case0_malformed_request() {
  713    702   
        {
  714    703   
            #[allow(unused_mut)]
  715    704   
            let mut http_request = ::http::Request::builder()
  716    705   
                .uri("/MalformedEnum")
  717    706   
                .method("POST")
  718    707   
                .header("content-type", "application/json")
  719    708   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  720    709   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  721    710   
                        "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
  722    711   
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
  723    712   
                    )),
  724    713   
                ))
  725    714   
                .unwrap();
  726    715   
            #[allow(unused_mut)]
  727    716   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  728    717   
            let config = crate::service::RestJsonValidationConfig::builder().build();
  729    718   
            let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
  730    719   
                            .malformed_enum(
  731    720   
                                // Rust 1.94+ flags the moved `sender` as "value captured is never read"
  732    721   
                                // since `send()` only borrows it.
  733    722   
                                #[allow(unused_assignments)]
  734    723   
                                move |input: crate::input::MalformedEnumInput| {
  735    724   
                                    let sender = sender.clone();
  736    725   
                                    async move {
  737    726   
                                        let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
  738    727   
                                        sender.send(()).await.expect("receiver dropped early");
  739    728   
                                        result
  740    729   
                                    }
  741    730   
                                }
  742    731   
                            )
  743    732   
                            .build_unchecked();
  744    733   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  745    734   
                .await
  746    735   
                .expect("unable to make an HTTP request");
  747    736   
            ::pretty_assertions::assert_eq!(
  748    737   
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  749    738   
                http_response.status()
  750    739   
            );
  751    740   
            let expected_headers = [("x-amzn-errortype", "ValidationException")];
  752    741   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  753    742   
                http_response.headers(),
  754    743   
                expected_headers,
  755    744   
            ));
  756    745   
            let body = ::hyper::body::to_bytes(http_response.into_body())
  757    746   
                .await
  758    747   
                .expect("unable to extract body to bytes");
  759    748   
            ::aws_smithy_protocol_test::assert_ok(
  760    749   
            ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n  \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
  761    750   
            );
  762    751   
        }
  763    752   
    }
  764    753   
  765    754   
    /// When a union member's value does not contain a valid enum value,
  766    755   
    /// the response should be a 400 ValidationException. Internal-only
  767    756   
    /// enum values are excluded from the response message.
  768    757   
    /// Test ID: RestJsonMalformedEnumUnion_case1
  769    758   
    #[::tokio::test]
  770    759   
    #[::tracing_test::traced_test]
  771         -
    #[should_panic]
  772    760   
    async fn rest_json_malformed_enum_union_case1_malformed_request() {
  773    761   
        {
  774    762   
            #[allow(unused_mut)]
  775    763   
            let mut http_request = ::http::Request::builder()
  776    764   
                .uri("/MalformedEnum")
  777    765   
                .method("POST")
  778    766   
                .header("content-type", "application/json")
  779    767   
                .body(::aws_smithy_legacy_http_server::body::Body::from(
  780    768   
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  781    769   
                        "{ \"union\" : { \"first\": \"XYZ\" } }".as_bytes(),

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/model.rs

@@ -2,2 +75,75 @@
   22     22   
}
   23     23   
/// See [`EnumString`](crate::model::EnumString).
   24     24   
pub mod enum_string {
   25     25   
    #[derive(Debug, PartialEq)]
   26     26   
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
   27     27   
   28     28   
    impl ::std::fmt::Display for ConstraintViolation {
   29     29   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   30     30   
            write!(
   31     31   
                f,
   32         -
                r#"Value provided for 'aws.protocoltests.restjson.validation#EnumString' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, ghi, jkl]"#
          32  +
                r#"Value provided for 'aws.protocoltests.restjson.validation#EnumString' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]"#
   33     33   
            )
   34     34   
        }
   35     35   
    }
   36     36   
   37     37   
    impl ::std::error::Error for ConstraintViolation {}
   38     38   
    impl ConstraintViolation {
   39     39   
        pub(crate) fn as_validation_exception_field(
   40     40   
            self,
   41     41   
            path: ::std::string::String,
   42     42   
        ) -> crate::model::ValidationExceptionField {
   43     43   
            crate::model::ValidationExceptionField {
   44     44   
                message: format!(
   45         -
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, ghi, jkl]"#,
          45  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]"#,
   46     46   
                    &path
   47     47   
                ),
   48     48   
                path,
   49     49   
            }
   50     50   
        }
   51     51   
    }
   52     52   
}
   53     53   
impl ::std::convert::TryFrom<&str> for EnumString {
   54     54   
    type Error = crate::model::enum_string::ConstraintViolation;
   55     55   
    fn try_from(
@@ -112,112 +185,185 @@
  132    132   
}
  133    133   
/// See [`EnumTraitString`](crate::model::EnumTraitString).
  134    134   
pub mod enum_trait_string {
  135    135   
    #[derive(Debug, PartialEq)]
  136    136   
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
  137    137   
  138    138   
    impl ::std::fmt::Display for ConstraintViolation {
  139    139   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  140    140   
            write!(
  141    141   
                f,
  142         -
                r#"Value provided for 'aws.protocoltests.restjson.validation#EnumTraitString' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, ghi]"#
         142  +
                r#"Value provided for 'aws.protocoltests.restjson.validation#EnumTraitString' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]"#
  143    143   
            )
  144    144   
        }
  145    145   
    }
  146    146   
  147    147   
    impl ::std::error::Error for ConstraintViolation {}
  148    148   
    impl ConstraintViolation {
  149    149   
        pub(crate) fn as_validation_exception_field(
  150    150   
            self,
  151    151   
            path: ::std::string::String,
  152    152   
        ) -> crate::model::ValidationExceptionField {
  153    153   
            crate::model::ValidationExceptionField {
  154    154   
                message: format!(
  155         -
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, ghi]"#,
         155  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]"#,
  156    156   
                    &path
  157    157   
                ),
  158    158   
                path,
  159    159   
            }
  160    160   
        }
  161    161   
    }
  162    162   
}
  163    163   
impl ::std::convert::TryFrom<&str> for EnumTraitString {
  164    164   
    type Error = crate::model::enum_trait_string::ConstraintViolation;
  165    165   
    fn try_from(

tmp-codegen-diff/codegen-server-test/rest_json_validation/rust-server-codegen/src/operation.rs

@@ -82,82 +142,141 @@
  102    102   
#[allow(unreachable_code, unused_variables)]
  103    103   
#[cfg(test)]
  104    104   
mod malformed_enum_test {
  105    105   
  106    106   
    /// When a string member does not contain a valid enum value,
  107    107   
    /// the response should be a 400 ValidationException. Internal-only
  108    108   
    /// enum values are excluded from the response message.
  109    109   
    /// Test ID: RestJsonMalformedEnumString_case0
  110    110   
    #[::tokio::test]
  111    111   
    #[::tracing_test::traced_test]
  112         -
    #[should_panic]
  113    112   
    async fn rest_json_malformed_enum_string_case0_malformed_request() {
  114    113   
        {
  115    114   
            #[allow(unused_mut)]
  116    115   
            let mut http_request = ::http_1x::Request::builder()
  117    116   
                .uri("/MalformedEnum")
  118    117   
                .method("POST")
  119    118   
                .header("content-type", "application/json")
  120    119   
                .body(::aws_smithy_http_server::body::boxed(
  121    120   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  122    121   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -148,147 +208,206 @@
  168    167   
            );
  169    168   
        }
  170    169   
    }
  171    170   
  172    171   
    /// When a string member does not contain a valid enum value,
  173    172   
    /// the response should be a 400 ValidationException. Internal-only
  174    173   
    /// enum values are excluded from the response message.
  175    174   
    /// Test ID: RestJsonMalformedEnumString_case1
  176    175   
    #[::tokio::test]
  177    176   
    #[::tracing_test::traced_test]
  178         -
    #[should_panic]
  179    177   
    async fn rest_json_malformed_enum_string_case1_malformed_request() {
  180    178   
        {
  181    179   
            #[allow(unused_mut)]
  182    180   
            let mut http_request = ::http_1x::Request::builder()
  183    181   
                .uri("/MalformedEnum")
  184    182   
                .method("POST")
  185    183   
                .header("content-type", "application/json")
  186    184   
                .body(::aws_smithy_http_server::body::boxed(
  187    185   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  188    186   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -214,212 +274,271 @@
  234    232   
            );
  235    233   
        }
  236    234   
    }
  237    235   
  238    236   
    /// When a string member does not contain a valid enum value,
  239    237   
    /// the response should be a 400 ValidationException. Internal-only
  240    238   
    /// enum values are excluded from the response message.
  241    239   
    /// Test ID: RestJsonMalformedEnumTraitString_case0
  242    240   
    #[::tokio::test]
  243    241   
    #[::tracing_test::traced_test]
  244         -
    #[should_panic]
  245    242   
    async fn rest_json_malformed_enum_trait_string_case0_malformed_request() {
  246    243   
        {
  247    244   
            #[allow(unused_mut)]
  248    245   
            let mut http_request = ::http_1x::Request::builder()
  249    246   
                .uri("/MalformedEnum")
  250    247   
                .method("POST")
  251    248   
                .header("content-type", "application/json")
  252    249   
                .body(::aws_smithy_http_server::body::boxed(
  253    250   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  254    251   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -280,277 +340,336 @@
  300    297   
            );
  301    298   
        }
  302    299   
    }
  303    300   
  304    301   
    /// When a string member does not contain a valid enum value,
  305    302   
    /// the response should be a 400 ValidationException. Internal-only
  306    303   
    /// enum values are excluded from the response message.
  307    304   
    /// Test ID: RestJsonMalformedEnumTraitString_case1
  308    305   
    #[::tokio::test]
  309    306   
    #[::tracing_test::traced_test]
  310         -
    #[should_panic]
  311    307   
    async fn rest_json_malformed_enum_trait_string_case1_malformed_request() {
  312    308   
        {
  313    309   
            #[allow(unused_mut)]
  314    310   
            let mut http_request = ::http_1x::Request::builder()
  315    311   
                .uri("/MalformedEnum")
  316    312   
                .method("POST")
  317    313   
                .header("content-type", "application/json")
  318    314   
                .body(::aws_smithy_http_server::body::boxed(
  319    315   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  320    316   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -346,342 +406,401 @@
  366    362   
            );
  367    363   
        }
  368    364   
    }
  369    365   
  370    366   
    /// When a list member value does not contain a valid enum value,
  371    367   
    /// the response should be a 400 ValidationException. Internal-only
  372    368   
    /// enum values are excluded from the response message.
  373    369   
    /// Test ID: RestJsonMalformedEnumList_case0
  374    370   
    #[::tokio::test]
  375    371   
    #[::tracing_test::traced_test]
  376         -
    #[should_panic]
  377    372   
    async fn rest_json_malformed_enum_list_case0_malformed_request() {
  378    373   
        {
  379    374   
            #[allow(unused_mut)]
  380    375   
            let mut http_request = ::http_1x::Request::builder()
  381    376   
                .uri("/MalformedEnum")
  382    377   
                .method("POST")
  383    378   
                .header("content-type", "application/json")
  384    379   
                .body(::aws_smithy_http_server::body::boxed(
  385    380   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  386    381   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -412,407 +472,466 @@
  432    427   
            );
  433    428   
        }
  434    429   
    }
  435    430   
  436    431   
    /// When a list member value does not contain a valid enum value,
  437    432   
    /// the response should be a 400 ValidationException. Internal-only
  438    433   
    /// enum values are excluded from the response message.
  439    434   
    /// Test ID: RestJsonMalformedEnumList_case1
  440    435   
    #[::tokio::test]
  441    436   
    #[::tracing_test::traced_test]
  442         -
    #[should_panic]
  443    437   
    async fn rest_json_malformed_enum_list_case1_malformed_request() {
  444    438   
        {
  445    439   
            #[allow(unused_mut)]
  446    440   
            let mut http_request = ::http_1x::Request::builder()
  447    441   
                .uri("/MalformedEnum")
  448    442   
                .method("POST")
  449    443   
                .header("content-type", "application/json")
  450    444   
                .body(::aws_smithy_http_server::body::boxed(
  451    445   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  452    446   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -478,472 +538,531 @@
  498    492   
            );
  499    493   
        }
  500    494   
    }
  501    495   
  502    496   
    /// When a map member's key does not contain a valid enum value,
  503    497   
    /// the response should be a 400 ValidationException. Internal-only
  504    498   
    /// enum values are excluded from the response message.
  505    499   
    /// Test ID: RestJsonMalformedEnumMapKey_case0
  506    500   
    #[::tokio::test]
  507    501   
    #[::tracing_test::traced_test]
  508         -
    #[should_panic]
  509    502   
    async fn rest_json_malformed_enum_map_key_case0_malformed_request() {
  510    503   
        {
  511    504   
            #[allow(unused_mut)]
  512    505   
            let mut http_request = ::http_1x::Request::builder()
  513    506   
                .uri("/MalformedEnum")
  514    507   
                .method("POST")
  515    508   
                .header("content-type", "application/json")
  516    509   
                .body(::aws_smithy_http_server::body::boxed(
  517    510   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  518    511   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -544,537 +604,596 @@
  564    557   
            );
  565    558   
        }
  566    559   
    }
  567    560   
  568    561   
    /// When a map member's key does not contain a valid enum value,
  569    562   
    /// the response should be a 400 ValidationException. Internal-only
  570    563   
    /// enum values are excluded from the response message.
  571    564   
    /// Test ID: RestJsonMalformedEnumMapKey_case1
  572    565   
    #[::tokio::test]
  573    566   
    #[::tracing_test::traced_test]
  574         -
    #[should_panic]
  575    567   
    async fn rest_json_malformed_enum_map_key_case1_malformed_request() {
  576    568   
        {
  577    569   
            #[allow(unused_mut)]
  578    570   
            let mut http_request = ::http_1x::Request::builder()
  579    571   
                .uri("/MalformedEnum")
  580    572   
                .method("POST")
  581    573   
                .header("content-type", "application/json")
  582    574   
                .body(::aws_smithy_http_server::body::boxed(
  583    575   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  584    576   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -610,602 +670,661 @@
  630    622   
            );
  631    623   
        }
  632    624   
    }
  633    625   
  634    626   
    /// When a map member's value does not contain a valid enum value,
  635    627   
    /// the response should be a 400 ValidationException. Internal-only
  636    628   
    /// enum values are excluded from the response message.
  637    629   
    /// Test ID: RestJsonMalformedEnumMapValue_case0
  638    630   
    #[::tokio::test]
  639    631   
    #[::tracing_test::traced_test]
  640         -
    #[should_panic]
  641    632   
    async fn rest_json_malformed_enum_map_value_case0_malformed_request() {
  642    633   
        {
  643    634   
            #[allow(unused_mut)]
  644    635   
            let mut http_request = ::http_1x::Request::builder()
  645    636   
                .uri("/MalformedEnum")
  646    637   
                .method("POST")
  647    638   
                .header("content-type", "application/json")
  648    639   
                .body(::aws_smithy_http_server::body::boxed(
  649    640   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  650    641   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -676,667 +736,726 @@
  696    687   
            );
  697    688   
        }
  698    689   
    }
  699    690   
  700    691   
    /// When a map member's value does not contain a valid enum value,
  701    692   
    /// the response should be a 400 ValidationException. Internal-only
  702    693   
    /// enum values are excluded from the response message.
  703    694   
    /// Test ID: RestJsonMalformedEnumMapValue_case1
  704    695   
    #[::tokio::test]
  705    696   
    #[::tracing_test::traced_test]
  706         -
    #[should_panic]
  707    697   
    async fn rest_json_malformed_enum_map_value_case1_malformed_request() {
  708    698   
        {
  709    699   
            #[allow(unused_mut)]
  710    700   
            let mut http_request = ::http_1x::Request::builder()
  711    701   
                .uri("/MalformedEnum")
  712    702   
                .method("POST")
  713    703   
                .header("content-type", "application/json")
  714    704   
                .body(::aws_smithy_http_server::body::boxed(
  715    705   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  716    706   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -742,732 +802,791 @@
  762    752   
            );
  763    753   
        }
  764    754   
    }
  765    755   
  766    756   
    /// When a union member's value does not contain a valid enum value,
  767    757   
    /// the response should be a 400 ValidationException. Internal-only
  768    758   
    /// enum values are excluded from the response message.
  769    759   
    /// Test ID: RestJsonMalformedEnumUnion_case0
  770    760   
    #[::tokio::test]
  771    761   
    #[::tracing_test::traced_test]
  772         -
    #[should_panic]
  773    762   
    async fn rest_json_malformed_enum_union_case0_malformed_request() {
  774    763   
        {
  775    764   
            #[allow(unused_mut)]
  776    765   
            let mut http_request = ::http_1x::Request::builder()
  777    766   
                .uri("/MalformedEnum")
  778    767   
                .method("POST")
  779    768   
                .header("content-type", "application/json")
  780    769   
                .body(::aws_smithy_http_server::body::boxed(
  781    770   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  782    771   
                        &::aws_smithy_protocol_test::decode_body_data(
@@ -808,797 +868,856 @@
  828    817   
            );
  829    818   
        }
  830    819   
    }
  831    820   
  832    821   
    /// When a union member's value does not contain a valid enum value,
  833    822   
    /// the response should be a 400 ValidationException. Internal-only
  834    823   
    /// enum values are excluded from the response message.
  835    824   
    /// Test ID: RestJsonMalformedEnumUnion_case1
  836    825   
    #[::tokio::test]
  837    826   
    #[::tracing_test::traced_test]
  838         -
    #[should_panic]
  839    827   
    async fn rest_json_malformed_enum_union_case1_malformed_request() {
  840    828   
        {
  841    829   
            #[allow(unused_mut)]
  842    830   
            let mut http_request = ::http_1x::Request::builder()
  843    831   
                .uri("/MalformedEnum")
  844    832   
                .method("POST")
  845    833   
                .header("content-type", "application/json")
  846    834   
                .body(::aws_smithy_http_server::body::boxed(
  847    835   
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
  848    836   
                        &::aws_smithy_protocol_test::decode_body_data(