Server Test Python

Server Test Python

rev. 0b749be6d000fdc7ef59d1bc26f1dce00358d95c

Files changed:

tmp-codegen-diff/codegen-server-test-python/rest_json_extras/rust-server-codegen-python/src/lib.rs

@@ -134,134 +252,232 @@
  154    154   
//! use rest_json_extras::{RestJsonExtras, RestJsonExtrasConfig};
  155    155   
//!
  156    156   
//! #[::tokio::main]
  157    157   
//! pub async fn main() {
  158    158   
//!    let config = RestJsonExtrasConfig::builder().build();
  159    159   
//!    let app = RestJsonExtras::builder(config)
  160    160   
//!        .case_insensitive_error_operation(case_insensitive_error_operation)
  161    161   
//!        .empty_struct_with_content_on_wire_op(empty_struct_with_content_on_wire_op)
  162    162   
//!        .enum_query(enum_query)
  163    163   
//!        .escaped_string_values(escaped_string_values)
  164         -
//!        .http_enum_payload2(http_enum_payload2)
  165         -
//!        .http_payload_traits2(http_payload_traits2)
  166         -
//!        .http_string_payload2(http_string_payload2)
  167         -
//!        .malformed_content_type_with_body2(malformed_content_type_with_body2)
  168    164   
//!        .map_with_enum_key_op(map_with_enum_key_op)
  169    165   
//!        .null_in_non_sparse(null_in_non_sparse)
  170    166   
//!        .primitive_int_header(primitive_int_header)
  171    167   
//!        .primitive_int_op(primitive_int_op)
  172    168   
//!        .query_precedence(query_precedence)
  173    169   
//!        .status_response(status_response)
  174    170   
//!        .string_payload(string_payload)
  175    171   
//!        .build()
  176    172   
//!        .expect("failed to build an instance of RestJsonExtras");
  177    173   
//!
  178    174   
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
  179    175   
//!        .expect("unable to parse the server bind address and port");
  180    176   
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
  181    177   
//!    # let server = async { Ok::<_, ()>(()) };
  182    178   
//!
  183    179   
//!    // Run your service!
  184    180   
//!    if let Err(err) = server.await {
  185    181   
//!        eprintln!("server error: {:?}", err);
  186    182   
//!    }
  187    183   
//! }
  188    184   
//!
  189    185   
//! use rest_json_extras::{input, output, error};
  190    186   
//!
  191    187   
//! async fn case_insensitive_error_operation(input: input::CaseInsensitiveErrorOperationInput) -> Result<output::CaseInsensitiveErrorOperationOutput, error::CaseInsensitiveErrorOperationError> {
  192    188   
//!     todo!()
  193    189   
//! }
  194    190   
//!
  195    191   
//! async fn empty_struct_with_content_on_wire_op(input: input::EmptyStructWithContentOnWireOpInput) -> Result<output::EmptyStructWithContentOnWireOpOutput, error::EmptyStructWithContentOnWireOpError> {
  196    192   
//!     todo!()
  197    193   
//! }
  198    194   
//!
  199    195   
//! async fn enum_query(input: input::EnumQueryInput) -> Result<output::EnumQueryOutput, error::EnumQueryError> {
  200    196   
//!     todo!()
  201    197   
//! }
  202    198   
//!
  203    199   
//! async fn escaped_string_values(input: input::EscapedStringValuesInput) -> Result<output::EscapedStringValuesOutput, error::EscapedStringValuesError> {
  204    200   
//!     todo!()
  205    201   
//! }
  206    202   
//!
  207         -
//! async fn http_enum_payload2(input: input::HttpEnumPayload2Input) -> Result<output::HttpEnumPayload2Output, error::HttpEnumPayload2Error> {
  208         -
//!     todo!()
  209         -
//! }
  210         -
//!
  211         -
//! async fn http_payload_traits2(input: input::HttpPayloadTraits2Input) -> Result<output::HttpPayloadTraits2Output, error::HttpPayloadTraits2Error> {
  212         -
//!     todo!()
  213         -
//! }
  214         -
//!
  215         -
//! async fn http_string_payload2(input: input::HttpStringPayload2Input) -> Result<output::HttpStringPayload2Output, error::HttpStringPayload2Error> {
  216         -
//!     todo!()
  217         -
//! }
  218         -
//!
  219         -
//! async fn malformed_content_type_with_body2(input: input::MalformedContentTypeWithBody2Input) -> Result<output::MalformedContentTypeWithBody2Output, error::MalformedContentTypeWithBody2Error> {
  220         -
//!     todo!()
  221         -
//! }
  222         -
//!
  223    203   
//! async fn map_with_enum_key_op(input: input::MapWithEnumKeyOpInput) -> Result<output::MapWithEnumKeyOpOutput, error::MapWithEnumKeyOpError> {
  224    204   
//!     todo!()
  225    205   
//! }
  226    206   
//!
  227    207   
//! async fn null_in_non_sparse(input: input::NullInNonSparseInput) -> Result<output::NullInNonSparseOutput, error::NullInNonSparseError> {
  228    208   
//!     todo!()
  229    209   
//! }
  230    210   
//!
  231    211   
//! async fn primitive_int_header(input: input::PrimitiveIntHeaderInput) -> Result<output::PrimitiveIntHeaderOutput, error::PrimitiveIntHeaderError> {
  232    212   
//!     todo!()

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

@@ -1,1 +31,138 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[::pyo3::pyclass]
           3  +
/// :rtype None:
           4  +
#[allow(missing_docs)] // documentation missing in model
           5  +
#[derive(
           6  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
           7  +
)]
           8  +
pub struct EmptyStruct {}
           9  +
#[allow(clippy::new_without_default)]
          10  +
#[allow(clippy::too_many_arguments)]
          11  +
#[::pyo3::pymethods]
          12  +
impl EmptyStruct {
          13  +
    #[new]
          14  +
    pub fn new() -> Self {
          15  +
        Self {}
          16  +
    }
          17  +
    fn __repr__(&self) -> String {
          18  +
        format!("{self:?}")
          19  +
    }
          20  +
    fn __str__(&self) -> String {
          21  +
        format!("{self:?}")
          22  +
    }
          23  +
}
          24  +
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<EmptyStruct> {
          25  +
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
          26  +
        ob.extract::<EmptyStruct>().map(Box::new)
          27  +
    }
          28  +
}
          29  +
          30  +
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<EmptyStruct> {
          31  +
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
          32  +
        (*self).into_py(py)
          33  +
    }
          34  +
}
          35  +
impl EmptyStruct {
          36  +
    /// Creates a new builder-style object to manufacture [`EmptyStruct`](crate::model::EmptyStruct).
          37  +
    pub fn builder() -> crate::model::empty_struct::Builder {
          38  +
        crate::model::empty_struct::Builder::default()
          39  +
    }
          40  +
}
          41  +
          42  +
#[allow(missing_docs)] // documentation missing in model
          43  +
#[derive(
          44  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
          45  +
)]
          46  +
pub enum SingleElementUnion {
          47  +
    #[allow(missing_docs)] // documentation missing in model
          48  +
    A(::std::string::String),
          49  +
}
          50  +
impl SingleElementUnion {
          51  +
    #[allow(irrefutable_let_patterns)]
          52  +
    /// Tries to convert the enum instance into [`A`](crate::model::SingleElementUnion::A), extracting the inner [`String`](::std::string::String).
          53  +
    /// Returns `Err(&Self)` if it can't be converted.
          54  +
    pub fn as_a(&self) -> ::std::result::Result<&::std::string::String, &Self> {
          55  +
        if let SingleElementUnion::A(val) = &self {
          56  +
            ::std::result::Result::Ok(val)
          57  +
        } else {
          58  +
            ::std::result::Result::Err(self)
          59  +
        }
          60  +
    }
          61  +
    /// Returns true if this is a [`A`](crate::model::SingleElementUnion::A).
          62  +
    pub fn is_a(&self) -> bool {
          63  +
        self.as_a().is_ok()
          64  +
    }
          65  +
}
          66  +
#[pyo3::pyclass(name = "SingleElementUnion")]
          67  +
#[derive(
          68  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
          69  +
)]
          70  +
pub struct PyUnionMarkerSingleElementUnion(pub SingleElementUnion);
          71  +
#[::pyo3::pymethods]
          72  +
impl PyUnionMarkerSingleElementUnion {
          73  +
    #[allow(irrefutable_let_patterns)]
          74  +
    #[staticmethod]
          75  +
    /// Creates a new union instance of [`A`](crate::model::SingleElementUnion::A)
          76  +
    /// :param data str:
          77  +
    /// :rtype SingleElementUnion:
          78  +
    pub fn a(data: ::std::string::String) -> Self {
          79  +
        Self(SingleElementUnion::A(data))
          80  +
    }
          81  +
    /// Tries to convert the enum instance into [`A`](crate::model::SingleElementUnion::A), extracting the inner [`String`](::std::string::String).
          82  +
    /// :rtype str:
          83  +
    pub fn as_a(&self) -> ::pyo3::PyResult<::std::string::String> {
          84  +
        match self.0.as_a() {
          85  +
            Ok(variant) => Ok(variant.clone()),
          86  +
            Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
          87  +
                r"SingleElementUnion variant is not of type str",
          88  +
            )),
          89  +
        }
          90  +
    }
          91  +
    /// Returns true if this is a [`A`](crate::model::SingleElementUnion::A).
          92  +
    /// :rtype bool:
          93  +
    pub fn is_a(&self) -> bool {
          94  +
        self.0.is_a()
          95  +
    }
          96  +
}
          97  +
impl ::pyo3::IntoPy<::pyo3::PyObject> for SingleElementUnion {
          98  +
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
          99  +
        PyUnionMarkerSingleElementUnion(self).into_py(py)
         100  +
    }
         101  +
}
         102  +
impl<'source> ::pyo3::FromPyObject<'source> for SingleElementUnion {
         103  +
    fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
         104  +
        let data: PyUnionMarkerSingleElementUnion = obj.extract()?;
         105  +
        Ok(data.0)
         106  +
    }
         107  +
}
         108  +
    2    109   
#[::pyo3::pyclass]
    3    110   
/// :param path str:
    4    111   
/// :param message str:
    5    112   
/// :rtype None:
    6    113   
/// Describes one specific validation failure for an input member.
    7    114   
#[derive(
    8    115   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    9    116   
)]
   10    117   
pub struct ValidationExceptionField {
   11    118   
    #[pyo3(get, set)]
@@ -46,153 +448,469 @@
   66    173   
#[allow(missing_docs)] // documentation missing in model
   67    174   
#[derive(
   68    175   
    ::std::clone::Clone,
   69    176   
    ::std::cmp::Eq,
   70    177   
    ::std::cmp::Ord,
   71    178   
    ::std::cmp::PartialEq,
   72    179   
    ::std::cmp::PartialOrd,
   73    180   
    ::std::fmt::Debug,
   74    181   
    ::std::hash::Hash,
   75    182   
)]
   76         -
pub enum StringEnum {
         183  +
pub enum EnumWithEscapedChars {
         184  +
    /// this needs#tobe escaped
         185  +
    HasQuotes,
   77    186   
    #[allow(missing_docs)] // documentation missing in model
   78         -
    V,
         187  +
    Normal,
   79    188   
}
   80    189   
///
   81         -
pub(crate) mod string_enum_internal {
         190  +
pub(crate) mod enum_with_escaped_chars_internal {
   82    191   
    #[derive(Debug, PartialEq)]
   83    192   
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
   84    193   
   85    194   
    impl ::std::fmt::Display for ConstraintViolation {
   86    195   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   87    196   
            write!(
   88    197   
                f,
   89         -
                r#"Value provided for 'aws.protocoltests.restjson#StringEnum' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#
         198  +
                r#"Value provided for 'aws.protocoltests.restjson#EnumWithEscapedChars' failed to satisfy constraint: Member must satisfy enum value set: [has"quotes, normal]"#
   90    199   
            )
   91    200   
        }
   92    201   
    }
   93    202   
   94    203   
    impl ::std::error::Error for ConstraintViolation {}
   95    204   
    impl ConstraintViolation {
   96    205   
        pub(crate) fn as_validation_exception_field(
   97    206   
            self,
   98    207   
            path: ::std::string::String,
   99    208   
        ) -> crate::model::ValidationExceptionField {
  100    209   
            crate::model::ValidationExceptionField {
  101    210   
                message: format!(
  102         -
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#,
         211  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [has"quotes, normal]"#,
  103    212   
                    &path
  104    213   
                ),
  105    214   
                path,
  106    215   
            }
  107    216   
        }
  108    217   
    }
  109    218   
}
  110         -
impl ::std::convert::TryFrom<&str> for StringEnum {
  111         -
    type Error = crate::model::string_enum_internal::ConstraintViolation;
         219  +
impl ::std::convert::TryFrom<&str> for EnumWithEscapedChars {
         220  +
    type Error = crate::model::enum_with_escaped_chars_internal::ConstraintViolation;
  112    221   
    fn try_from(
  113    222   
        s: &str,
  114    223   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  115    224   
        match s {
  116         -
            "enumvalue" => Ok(StringEnum::V),
  117         -
            _ => Err(crate::model::string_enum_internal::ConstraintViolation(
  118         -
                s.to_owned(),
  119         -
            )),
         225  +
            "has\"quotes" => Ok(EnumWithEscapedChars::HasQuotes),
         226  +
            "normal" => Ok(EnumWithEscapedChars::Normal),
         227  +
            _ => Err(
         228  +
                crate::model::enum_with_escaped_chars_internal::ConstraintViolation(s.to_owned()),
         229  +
            ),
  120    230   
        }
  121    231   
    }
  122    232   
}
  123         -
impl ::std::convert::TryFrom<::std::string::String> for StringEnum {
  124         -
    type Error = crate::model::string_enum_internal::ConstraintViolation;
         233  +
impl ::std::convert::TryFrom<::std::string::String> for EnumWithEscapedChars {
         234  +
    type Error = crate::model::enum_with_escaped_chars_internal::ConstraintViolation;
  125    235   
    fn try_from(
  126    236   
        s: ::std::string::String,
  127    237   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  128    238   
    {
  129    239   
        s.as_str().try_into()
  130    240   
    }
  131    241   
}
  132         -
impl std::str::FromStr for StringEnum {
  133         -
    type Err = crate::model::string_enum_internal::ConstraintViolation;
         242  +
impl std::str::FromStr for EnumWithEscapedChars {
         243  +
    type Err = crate::model::enum_with_escaped_chars_internal::ConstraintViolation;
  134    244   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  135    245   
        Self::try_from(s)
  136    246   
    }
  137    247   
}
  138         -
impl StringEnum {
         248  +
impl EnumWithEscapedChars {
  139    249   
    /// Returns the `&str` value of the enum member.
  140    250   
    pub fn as_str(&self) -> &str {
  141    251   
        match self {
  142         -
            StringEnum::V => "enumvalue",
         252  +
            EnumWithEscapedChars::HasQuotes => "has\"quotes",
         253  +
            EnumWithEscapedChars::Normal => "normal",
  143    254   
        }
  144    255   
    }
  145    256   
    /// Returns all the `&str` representations of the enum members.
  146    257   
    pub const fn values() -> &'static [&'static str] {
  147         -
        &["enumvalue"]
         258  +
        &["has\"quotes", "normal"]
  148    259   
    }
  149    260   
}
  150         -
impl ::std::convert::AsRef<str> for StringEnum {
         261  +
impl ::std::convert::AsRef<str> for EnumWithEscapedChars {
  151    262   
    fn as_ref(&self) -> &str {
  152    263   
        self.as_str()
  153    264   
    }
  154    265   
}
  155    266   
#[::pyo3::pymethods]
  156         -
impl StringEnum {
         267  +
impl EnumWithEscapedChars {
  157    268   
    #[getter]
  158    269   
    pub fn name(&self) -> &str {
  159    270   
        match self {
  160         -
            StringEnum::V => "V",
         271  +
            EnumWithEscapedChars::HasQuotes => "HasQuotes",
         272  +
            EnumWithEscapedChars::Normal => "Normal",
  161    273   
        }
  162    274   
    }
  163    275   
    #[getter]
  164    276   
    pub fn value(&self) -> &str {
  165    277   
        self.as_str()
  166    278   
    }
  167    279   
    fn __repr__(&self) -> String {
  168    280   
        self.as_str().to_owned()
  169    281   
    }
  170    282   
    fn __str__(&self) -> String {
  171    283   
        self.as_str().to_owned()
  172    284   
    }
  173    285   
}
  174         -
impl crate::constrained::Constrained for StringEnum {
         286  +
impl crate::constrained::Constrained for EnumWithEscapedChars {
  175    287   
    type Unconstrained = ::std::string::String;
  176    288   
}
  177    289   
  178    290   
impl ::std::convert::From<::std::string::String>
  179         -
    for crate::constrained::MaybeConstrained<crate::model::StringEnum>
         291  +
    for crate::constrained::MaybeConstrained<crate::model::EnumWithEscapedChars>
  180    292   
{
  181    293   
    fn from(value: ::std::string::String) -> Self {
  182    294   
        Self::Unconstrained(value)
  183    295   
    }
  184    296   
}
  185    297   
  186         -
#[::pyo3::pyclass]
  187         -
/// :rtype None:
  188         -
#[allow(missing_docs)] // documentation missing in model
  189         -
#[derive(
  190         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  191         -
)]
  192         -
pub struct EmptyStruct {}
  193         -
#[allow(clippy::new_without_default)]
  194         -
#[allow(clippy::too_many_arguments)]
  195         -
#[::pyo3::pymethods]
  196         -
impl EmptyStruct {
  197         -
    #[new]
  198         -
    pub fn new() -> Self {
  199         -
        Self {}
  200         -
    }
  201         -
    fn __repr__(&self) -> String {
  202         -
        format!("{self:?}")
  203         -
    }
  204         -
    fn __str__(&self) -> String {
  205         -
        format!("{self:?}")
  206         -
    }
  207         -
}
  208         -
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<EmptyStruct> {
  209         -
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
  210         -
        ob.extract::<EmptyStruct>().map(Box::new)
  211         -
    }
  212         -
}
  213         -
  214         -
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<EmptyStruct> {
  215         -
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
  216         -
        (*self).into_py(py)
  217         -
    }
  218         -
}
  219         -
impl EmptyStruct {
  220         -
    /// Creates a new builder-style object to manufacture [`EmptyStruct`](crate::model::EmptyStruct).
  221         -
    pub fn builder() -> crate::model::empty_struct::Builder {
  222         -
        crate::model::empty_struct::Builder::default()
  223         -
    }
  224         -
}
  225         -
  226         -
#[allow(missing_docs)] // documentation missing in model
  227         -
#[derive(
  228         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  229         -
)]
  230         -
pub enum SingleElementUnion {
  231         -
    #[allow(missing_docs)] // documentation missing in model
  232         -
    A(::std::string::String),
  233         -
}
  234         -
impl SingleElementUnion {
  235         -
    #[allow(irrefutable_let_patterns)]
  236         -
    /// Tries to convert the enum instance into [`A`](crate::model::SingleElementUnion::A), extracting the inner [`String`](::std::string::String).
  237         -
    /// Returns `Err(&Self)` if it can't be converted.
  238         -
    pub fn as_a(&self) -> ::std::result::Result<&::std::string::String, &Self> {
  239         -
        if let SingleElementUnion::A(val) = &self {
  240         -
            ::std::result::Result::Ok(val)
  241         -
        } else {
  242         -
            ::std::result::Result::Err(self)
  243         -
        }
  244         -
    }
  245         -
    /// Returns true if this is a [`A`](crate::model::SingleElementUnion::A).
  246         -
    pub fn is_a(&self) -> bool {
  247         -
        self.as_a().is_ok()
  248         -
    }
  249         -
}
  250         -
#[pyo3::pyclass(name = "SingleElementUnion")]
  251         -
#[derive(
  252         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  253         -
)]
  254         -
pub struct PyUnionMarkerSingleElementUnion(pub SingleElementUnion);
  255         -
#[::pyo3::pymethods]
  256         -
impl PyUnionMarkerSingleElementUnion {
  257         -
    #[allow(irrefutable_let_patterns)]
  258         -
    #[staticmethod]
  259         -
    /// Creates a new union instance of [`A`](crate::model::SingleElementUnion::A)
  260         -
    /// :param data str:
  261         -
    /// :rtype SingleElementUnion:
  262         -
    pub fn a(data: ::std::string::String) -> Self {
  263         -
        Self(SingleElementUnion::A(data))
  264         -
    }
  265         -
    /// Tries to convert the enum instance into [`A`](crate::model::SingleElementUnion::A), extracting the inner [`String`](::std::string::String).
  266         -
    /// :rtype str:
  267         -
    pub fn as_a(&self) -> ::pyo3::PyResult<::std::string::String> {
  268         -
        match self.0.as_a() {
  269         -
            Ok(variant) => Ok(variant.clone()),
  270         -
            Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
  271         -
                r"SingleElementUnion variant is not of type str",
  272         -
            )),
  273         -
        }
  274         -
    }
  275         -
    /// Returns true if this is a [`A`](crate::model::SingleElementUnion::A).
  276         -
    /// :rtype bool:
  277         -
    pub fn is_a(&self) -> bool {
  278         -
        self.0.is_a()
  279         -
    }
  280         -
}
  281         -
impl ::pyo3::IntoPy<::pyo3::PyObject> for SingleElementUnion {
  282         -
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
  283         -
        PyUnionMarkerSingleElementUnion(self).into_py(py)
  284         -
    }
  285         -
}
  286         -
impl<'source> ::pyo3::FromPyObject<'source> for SingleElementUnion {
  287         -
    fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
  288         -
        let data: PyUnionMarkerSingleElementUnion = obj.extract()?;
  289         -
        Ok(data.0)
  290         -
    }
  291         -
}
  292         -
  293    298   
#[::pyo3::pyclass]
  294    299   
#[allow(missing_docs)] // documentation missing in model
  295    300   
#[derive(
  296    301   
    ::std::clone::Clone,
  297    302   
    ::std::cmp::Eq,
  298    303   
    ::std::cmp::Ord,
  299    304   
    ::std::cmp::PartialEq,
  300    305   
    ::std::cmp::PartialOrd,
  301    306   
    ::std::fmt::Debug,
  302    307   
    ::std::hash::Hash,
  303    308   
)]
  304         -
pub enum EnumWithEscapedChars {
  305         -
    /// this needs#tobe escaped
  306         -
    HasQuotes,
         309  +
pub enum StringEnum {
  307    310   
    #[allow(missing_docs)] // documentation missing in model
  308         -
    Normal,
         311  +
    V,
  309    312   
}
  310    313   
///
  311         -
pub(crate) mod enum_with_escaped_chars_internal {
         314  +
pub(crate) mod string_enum_internal {
  312    315   
    #[derive(Debug, PartialEq)]
  313    316   
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
  314    317   
  315    318   
    impl ::std::fmt::Display for ConstraintViolation {
  316    319   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  317    320   
            write!(
  318    321   
                f,
  319         -
                r#"Value provided for 'aws.protocoltests.restjson#EnumWithEscapedChars' failed to satisfy constraint: Member must satisfy enum value set: [has"quotes, normal]"#
         322  +
                r#"Value provided for 'aws.protocoltests.restjson#StringEnum' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#
  320    323   
            )
  321    324   
        }
  322    325   
    }
  323    326   
  324    327   
    impl ::std::error::Error for ConstraintViolation {}
  325    328   
    impl ConstraintViolation {
  326    329   
        pub(crate) fn as_validation_exception_field(
  327    330   
            self,
  328    331   
            path: ::std::string::String,
  329    332   
        ) -> crate::model::ValidationExceptionField {
  330    333   
            crate::model::ValidationExceptionField {
  331    334   
                message: format!(
  332         -
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [has"quotes, normal]"#,
         335  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#,
  333    336   
                    &path
  334    337   
                ),
  335    338   
                path,
  336    339   
            }
  337    340   
        }
  338    341   
    }
  339    342   
}
  340         -
impl ::std::convert::TryFrom<&str> for EnumWithEscapedChars {
  341         -
    type Error = crate::model::enum_with_escaped_chars_internal::ConstraintViolation;
         343  +
impl ::std::convert::TryFrom<&str> for StringEnum {
         344  +
    type Error = crate::model::string_enum_internal::ConstraintViolation;
  342    345   
    fn try_from(
  343    346   
        s: &str,
  344    347   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  345    348   
        match s {
  346         -
            "has\"quotes" => Ok(EnumWithEscapedChars::HasQuotes),
  347         -
            "normal" => Ok(EnumWithEscapedChars::Normal),
  348         -
            _ => Err(
  349         -
                crate::model::enum_with_escaped_chars_internal::ConstraintViolation(s.to_owned()),
  350         -
            ),
         349  +
            "enumvalue" => Ok(StringEnum::V),
         350  +
            _ => Err(crate::model::string_enum_internal::ConstraintViolation(
         351  +
                s.to_owned(),
         352  +
            )),
  351    353   
        }
  352    354   
    }
  353    355   
}
  354         -
impl ::std::convert::TryFrom<::std::string::String> for EnumWithEscapedChars {
  355         -
    type Error = crate::model::enum_with_escaped_chars_internal::ConstraintViolation;
         356  +
impl ::std::convert::TryFrom<::std::string::String> for StringEnum {
         357  +
    type Error = crate::model::string_enum_internal::ConstraintViolation;
  356    358   
    fn try_from(
  357    359   
        s: ::std::string::String,
  358    360   
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  359    361   
    {
  360    362   
        s.as_str().try_into()
  361    363   
    }
  362    364   
}
  363         -
impl std::str::FromStr for EnumWithEscapedChars {
  364         -
    type Err = crate::model::enum_with_escaped_chars_internal::ConstraintViolation;
         365  +
impl std::str::FromStr for StringEnum {
         366  +
    type Err = crate::model::string_enum_internal::ConstraintViolation;
  365    367   
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  366    368   
        Self::try_from(s)
  367    369   
    }
  368    370   
}
  369         -
impl EnumWithEscapedChars {
         371  +
impl StringEnum {
  370    372   
    /// Returns the `&str` value of the enum member.
  371    373   
    pub fn as_str(&self) -> &str {
  372    374   
        match self {
  373         -
            EnumWithEscapedChars::HasQuotes => "has\"quotes",
  374         -
            EnumWithEscapedChars::Normal => "normal",
         375  +
            StringEnum::V => "enumvalue",
  375    376   
        }
  376    377   
    }
  377    378   
    /// Returns all the `&str` representations of the enum members.
  378    379   
    pub const fn values() -> &'static [&'static str] {
  379         -
        &["has\"quotes", "normal"]
         380  +
        &["enumvalue"]
  380    381   
    }
  381    382   
}
  382         -
impl ::std::convert::AsRef<str> for EnumWithEscapedChars {
         383  +
impl ::std::convert::AsRef<str> for StringEnum {
  383    384   
    fn as_ref(&self) -> &str {
  384    385   
        self.as_str()
  385    386   
    }
  386    387   
}
  387    388   
#[::pyo3::pymethods]
  388         -
impl EnumWithEscapedChars {
         389  +
impl StringEnum {
  389    390   
    #[getter]
  390    391   
    pub fn name(&self) -> &str {
  391    392   
        match self {
  392         -
            EnumWithEscapedChars::HasQuotes => "HasQuotes",
  393         -
            EnumWithEscapedChars::Normal => "Normal",
         393  +
            StringEnum::V => "V",
  394    394   
        }
  395    395   
    }
  396    396   
    #[getter]
  397    397   
    pub fn value(&self) -> &str {
  398    398   
        self.as_str()
  399    399   
    }
  400    400   
    fn __repr__(&self) -> String {
  401    401   
        self.as_str().to_owned()
  402    402   
    }
  403    403   
    fn __str__(&self) -> String {
  404    404   
        self.as_str().to_owned()
  405    405   
    }
  406    406   
}
  407         -
impl crate::constrained::Constrained for EnumWithEscapedChars {
         407  +
impl crate::constrained::Constrained for StringEnum {
  408    408   
    type Unconstrained = ::std::string::String;
  409    409   
}
  410    410   
  411    411   
impl ::std::convert::From<::std::string::String>
  412         -
    for crate::constrained::MaybeConstrained<crate::model::EnumWithEscapedChars>
         412  +
    for crate::constrained::MaybeConstrained<crate::model::StringEnum>
  413    413   
{
  414    414   
    fn from(value: ::std::string::String) -> Self {
  415    415   
        Self::Unconstrained(value)
  416    416   
    }
  417    417   
}
         418  +
/// See [`EmptyStruct`](crate::model::EmptyStruct).
         419  +
///
         420  +
pub mod empty_struct {
  418    421   
         422  +
    impl ::std::convert::From<Builder> for crate::model::EmptyStruct {
         423  +
        fn from(builder: Builder) -> Self {
         424  +
            builder.build()
         425  +
        }
         426  +
    }
         427  +
    /// A builder for [`EmptyStruct`](crate::model::EmptyStruct).
         428  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         429  +
    pub struct Builder {}
         430  +
    impl Builder {
         431  +
        /// Consumes the builder and constructs a [`EmptyStruct`](crate::model::EmptyStruct).
         432  +
        pub fn build(self) -> crate::model::EmptyStruct {
         433  +
            self.build_enforcing_required_and_enum_traits()
         434  +
        }
         435  +
        fn build_enforcing_required_and_enum_traits(self) -> crate::model::EmptyStruct {
         436  +
            crate::model::EmptyStruct {}
         437  +
        }
         438  +
    }
         439  +
}
  419    440   
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
  420    441   
///
  421    442   
pub mod validation_exception_field {
  422    443   
  423    444   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  424    445   
    /// Holds one variant for each of the ways the builder can fail.
  425    446   
  426    447   
    #[allow(clippy::enum_variant_names)]
  427    448   
    pub enum ConstraintViolation {
  428    449   
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
@@ -453,474 +534,533 @@
  473    494   
        fn build_enforcing_required_and_enum_traits(
  474    495   
            self,
  475    496   
        ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
  476    497   
            Ok(crate::model::ValidationExceptionField {
  477    498   
                path: self.path.ok_or(ConstraintViolation::MissingPath)?,
  478    499   
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
  479    500   
            })
  480    501   
        }
  481    502   
    }
  482    503   
}
  483         -
/// See [`EmptyStruct`](crate::model::EmptyStruct).
  484         -
///
  485         -
pub mod empty_struct {
  486         -
  487         -
    impl ::std::convert::From<Builder> for crate::model::EmptyStruct {
  488         -
        fn from(builder: Builder) -> Self {
  489         -
            builder.build()
  490         -
        }
  491         -
    }
  492         -
    /// A builder for [`EmptyStruct`](crate::model::EmptyStruct).
  493         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
  494         -
    pub struct Builder {}
  495         -
    impl Builder {
  496         -
        /// Consumes the builder and constructs a [`EmptyStruct`](crate::model::EmptyStruct).
  497         -
        pub fn build(self) -> crate::model::EmptyStruct {
  498         -
            self.build_enforcing_required_and_enum_traits()
  499         -
        }
  500         -
        fn build_enforcing_required_and_enum_traits(self) -> crate::model::EmptyStruct {
  501         -
            crate::model::EmptyStruct {}
  502         -
        }
  503         -
    }
  504         -
}
  505    504   
///
  506    505   
pub(crate) mod map_with_enum_key_internal {
  507    506   
  508    507   
    #[allow(clippy::enum_variant_names)]
  509    508   
    #[derive(Debug, PartialEq)]
  510    509   
    pub(crate) enum ConstraintViolation {
  511    510   
        #[doc(hidden)]
  512    511   
        Key(crate::model::string_enum_internal::ConstraintViolation),
  513    512   
    }
  514    513   

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

@@ -1,1 +454,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
static CONTENT_TYPE_HTTPSTRINGPAYLOAD2: ::once_cell::sync::Lazy<::mime::Mime> =
    3         -
    ::once_cell::sync::Lazy::new(|| {
    4         -
        "text/plain"
    5         -
            .parse::<::mime::Mime>()
    6         -
            .expect("BUG: MIME parsing failed, content_type is not valid")
    7         -
    });
    8         -
::pin_project_lite::pin_project! {
    9         -
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
   10         -
    /// [`HttpStringPayload2Input`](crate::input::HttpStringPayload2Input) using modelled bindings.
   11         -
    pub struct HttpStringPayload2InputFuture {
   12         -
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HttpStringPayload2Input, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
   13         -
    }
   14         -
}
   15         -
   16         -
impl std::future::Future for HttpStringPayload2InputFuture {
   17         -
    type Output = Result<
   18         -
        crate::input::HttpStringPayload2Input,
   19         -
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
   20         -
    >;
   21         -
   22         -
    fn poll(
   23         -
        self: std::pin::Pin<&mut Self>,
   24         -
        cx: &mut std::task::Context<'_>,
   25         -
    ) -> std::task::Poll<Self::Output> {
   26         -
        let this = self.project();
   27         -
        this.inner.as_mut().poll(cx)
   28         -
    }
   29         -
}
   30         -
   31         -
impl<B>
   32         -
    ::aws_smithy_http_server::request::FromRequest<
   33         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
   34         -
        B,
   35         -
    > for crate::input::HttpStringPayload2Input
   36         -
where
   37         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   38         -
    B: 'static,
   39         -
   40         -
    B::Data: Send,
   41         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   42         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   43         -
{
   44         -
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
   45         -
    type Future = HttpStringPayload2InputFuture;
   46         -
   47         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
   48         -
        let fut = async move {
   49         -
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
   50         -
                request.headers(),
   51         -
                &CONTENT_TYPE_HTTPSTRINGPAYLOAD2,
   52         -
            ) {
   53         -
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
   54         -
            }
   55         -
            crate::protocol_serde::shape_http_string_payload2::de_http_string_payload2_http_request(
   56         -
                request,
   57         -
            )
   58         -
            .await
   59         -
            .map_err(Into::into)
   60         -
        };
   61         -
        use ::futures_util::future::TryFutureExt;
   62         -
        let fut = fut.map_err(
   63         -
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
   64         -
                ::tracing::debug!(error = %e, "failed to deserialize request");
   65         -
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
   66         -
                    e,
   67         -
                )
   68         -
            },
   69         -
        );
   70         -
        HttpStringPayload2InputFuture {
   71         -
            inner: Box::pin(fut),
   72         -
        }
   73         -
    }
   74         -
}
   75         -
impl
   76         -
    ::aws_smithy_http_server::response::IntoResponse<
   77         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
   78         -
    > for crate::output::HttpStringPayload2Output
   79         -
{
   80         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
   81         -
        match crate::protocol_serde::shape_http_string_payload2::ser_http_string_payload2_http_response(self) {
   82         -
                        Ok(response) => response,
   83         -
                        Err(e) => {
   84         -
                            ::tracing::error!(error = %e, "failed to serialize response");
   85         -
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
   86         -
                        }
   87         -
                    }
   88         -
    }
   89         -
}
   90         -
impl
   91         -
    ::aws_smithy_http_server::response::IntoResponse<
   92         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
   93         -
    > for crate::error::HttpStringPayload2Error
   94         -
{
   95         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
   96         -
        match crate::protocol_serde::shape_http_string_payload2::ser_http_string_payload2_http_error(
   97         -
            &self,
   98         -
        ) {
   99         -
            Ok(mut response) => {
  100         -
                response.extensions_mut().insert(
  101         -
                    ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
  102         -
                );
  103         -
                response
  104         -
            }
  105         -
            Err(e) => {
  106         -
                ::tracing::error!(error = %e, "failed to serialize response");
  107         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
  108         -
            }
  109         -
        }
  110         -
    }
  111         -
}
  112         -
  113         -
static CONTENT_TYPE_HTTPENUMPAYLOAD2: ::once_cell::sync::Lazy<::mime::Mime> =
  114         -
    ::once_cell::sync::Lazy::new(|| {
  115         -
        "text/plain"
  116         -
            .parse::<::mime::Mime>()
  117         -
            .expect("BUG: MIME parsing failed, content_type is not valid")
  118         -
    });
  119         -
::pin_project_lite::pin_project! {
  120         -
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
  121         -
    /// [`HttpEnumPayload2Input`](crate::input::HttpEnumPayload2Input) using modelled bindings.
  122         -
    pub struct HttpEnumPayload2InputFuture {
  123         -
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HttpEnumPayload2Input, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
  124         -
    }
  125         -
}
  126         -
  127         -
impl std::future::Future for HttpEnumPayload2InputFuture {
  128         -
    type Output = Result<
  129         -
        crate::input::HttpEnumPayload2Input,
  130         -
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
  131         -
    >;
  132         -
  133         -
    fn poll(
  134         -
        self: std::pin::Pin<&mut Self>,
  135         -
        cx: &mut std::task::Context<'_>,
  136         -
    ) -> std::task::Poll<Self::Output> {
  137         -
        let this = self.project();
  138         -
        this.inner.as_mut().poll(cx)
  139         -
    }
  140         -
}
  141         -
  142         -
impl<B>
  143         -
    ::aws_smithy_http_server::request::FromRequest<
  144         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  145         -
        B,
  146         -
    > for crate::input::HttpEnumPayload2Input
  147         -
where
  148         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  149         -
    B: 'static,
  150         -
  151         -
    B::Data: Send,
  152         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
  153         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  154         -
{
  155         -
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
  156         -
    type Future = HttpEnumPayload2InputFuture;
  157         -
  158         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
  159         -
        let fut = async move {
  160         -
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  161         -
                request.headers(),
  162         -
                &CONTENT_TYPE_HTTPENUMPAYLOAD2,
  163         -
            ) {
  164         -
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
  165         -
            }
  166         -
            crate::protocol_serde::shape_http_enum_payload2::de_http_enum_payload2_http_request(
  167         -
                request,
  168         -
            )
  169         -
            .await
  170         -
            .map_err(Into::into)
  171         -
        };
  172         -
        use ::futures_util::future::TryFutureExt;
  173         -
        let fut = fut.map_err(
  174         -
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
  175         -
                ::tracing::debug!(error = %e, "failed to deserialize request");
  176         -
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
  177         -
                    e,
  178         -
                )
  179         -
            },
  180         -
        );
  181         -
        HttpEnumPayload2InputFuture {
  182         -
            inner: Box::pin(fut),
  183         -
        }
  184         -
    }
  185         -
}
  186         -
impl
  187         -
    ::aws_smithy_http_server::response::IntoResponse<
  188         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  189         -
    > for crate::output::HttpEnumPayload2Output
  190         -
{
  191         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
  192         -
        match crate::protocol_serde::shape_http_enum_payload2::ser_http_enum_payload2_http_response(
  193         -
            self,
  194         -
        ) {
  195         -
            Ok(response) => response,
  196         -
            Err(e) => {
  197         -
                ::tracing::error!(error = %e, "failed to serialize response");
  198         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
  199         -
            }
  200         -
        }
  201         -
    }
  202         -
}
  203         -
impl
  204         -
    ::aws_smithy_http_server::response::IntoResponse<
  205         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  206         -
    > for crate::error::HttpEnumPayload2Error
  207         -
{
  208         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
  209         -
        match crate::protocol_serde::shape_http_enum_payload2::ser_http_enum_payload2_http_error(
  210         -
            &self,
  211         -
        ) {
  212         -
            Ok(mut response) => {
  213         -
                response.extensions_mut().insert(
  214         -
                    ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
  215         -
                );
  216         -
                response
  217         -
            }
  218         -
            Err(e) => {
  219         -
                ::tracing::error!(error = %e, "failed to serialize response");
  220         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
  221         -
            }
  222         -
        }
  223         -
    }
  224         -
}
  225         -
  226         -
const CONTENT_TYPE_MALFORMEDCONTENTTYPEWITHBODY2: ::mime::Mime = ::mime::APPLICATION_JSON;
  227         -
::pin_project_lite::pin_project! {
  228         -
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
  229         -
    /// [`MalformedContentTypeWithBody2Input`](crate::input::MalformedContentTypeWithBody2Input) using modelled bindings.
  230         -
    pub struct MalformedContentTypeWithBody2InputFuture {
  231         -
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedContentTypeWithBody2Input, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
  232         -
    }
  233         -
}
  234         -
  235         -
impl std::future::Future for MalformedContentTypeWithBody2InputFuture {
  236         -
    type Output = Result<
  237         -
        crate::input::MalformedContentTypeWithBody2Input,
  238         -
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
  239         -
    >;
  240         -
  241         -
    fn poll(
  242         -
        self: std::pin::Pin<&mut Self>,
  243         -
        cx: &mut std::task::Context<'_>,
  244         -
    ) -> std::task::Poll<Self::Output> {
  245         -
        let this = self.project();
  246         -
        this.inner.as_mut().poll(cx)
  247         -
    }
  248         -
}
  249         -
  250         -
impl<B>
  251         -
    ::aws_smithy_http_server::request::FromRequest<
  252         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  253         -
        B,
  254         -
    > for crate::input::MalformedContentTypeWithBody2Input
  255         -
where
  256         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  257         -
    B: 'static,
  258         -
  259         -
    B::Data: Send,
  260         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
  261         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  262         -
{
  263         -
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
  264         -
    type Future = MalformedContentTypeWithBody2InputFuture;
  265         -
  266         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
  267         -
        let fut = async move {
  268         -
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  269         -
                request.headers(),
  270         -
                &CONTENT_TYPE_MALFORMEDCONTENTTYPEWITHBODY2,
  271         -
            ) {
  272         -
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
  273         -
            }
  274         -
            crate::protocol_serde::shape_malformed_content_type_with_body2::de_malformed_content_type_with_body2_http_request(request)
  275         -
                            .await
  276         -
                            .map_err(Into::into)
  277         -
        };
  278         -
        use ::futures_util::future::TryFutureExt;
  279         -
        let fut = fut.map_err(
  280         -
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
  281         -
                ::tracing::debug!(error = %e, "failed to deserialize request");
  282         -
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
  283         -
                    e,
  284         -
                )
  285         -
            },
  286         -
        );
  287         -
        MalformedContentTypeWithBody2InputFuture {
  288         -
            inner: Box::pin(fut),
  289         -
        }
  290         -
    }
  291         -
}
  292         -
impl
  293         -
    ::aws_smithy_http_server::response::IntoResponse<
  294         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  295         -
    > for crate::output::MalformedContentTypeWithBody2Output
  296         -
{
  297         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
  298         -
        match crate::protocol_serde::shape_malformed_content_type_with_body2::ser_malformed_content_type_with_body2_http_response(self) {
  299         -
                        Ok(response) => response,
  300         -
                        Err(e) => {
  301         -
                            ::tracing::error!(error = %e, "failed to serialize response");
  302         -
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
  303         -
                        }
  304         -
                    }
  305         -
    }
  306         -
}
  307         -
impl
  308         -
    ::aws_smithy_http_server::response::IntoResponse<
  309         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  310         -
    > for crate::error::MalformedContentTypeWithBody2Error
  311         -
{
  312         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
  313         -
        match crate::protocol_serde::shape_malformed_content_type_with_body2::ser_malformed_content_type_with_body2_http_error(&self) {
  314         -
            Ok(mut response) => {
  315         -
                response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
  316         -
                response
  317         -
            },
  318         -
            Err(e) => {
  319         -
                ::tracing::error!(error = %e, "failed to serialize response");
  320         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
  321         -
            }
  322         -
        }
  323         -
    }
  324         -
}
  325         -
  326         -
::pin_project_lite::pin_project! {
  327         -
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
  328         -
    /// [`HttpPayloadTraits2Input`](crate::input::HttpPayloadTraits2Input) using modelled bindings.
  329         -
    pub struct HttpPayloadTraits2InputFuture {
  330         -
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HttpPayloadTraits2Input, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
  331         -
    }
  332         -
}
  333         -
  334         -
impl std::future::Future for HttpPayloadTraits2InputFuture {
  335         -
    type Output = Result<
  336         -
        crate::input::HttpPayloadTraits2Input,
  337         -
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
  338         -
    >;
  339         -
  340         -
    fn poll(
  341         -
        self: std::pin::Pin<&mut Self>,
  342         -
        cx: &mut std::task::Context<'_>,
  343         -
    ) -> std::task::Poll<Self::Output> {
  344         -
        let this = self.project();
  345         -
        this.inner.as_mut().poll(cx)
  346         -
    }
  347         -
}
  348         -
  349         -
impl<B>
  350         -
    ::aws_smithy_http_server::request::FromRequest<
  351         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  352         -
        B,
  353         -
    > for crate::input::HttpPayloadTraits2Input
  354         -
where
  355         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  356         -
    B: 'static,
  357         -
  358         -
    B::Data: Send,
  359         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
  360         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  361         -
{
  362         -
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
  363         -
    type Future = HttpPayloadTraits2InputFuture;
  364         -
  365         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
  366         -
        let fut = async move {
  367         -
            crate::protocol_serde::shape_http_payload_traits2::de_http_payload_traits2_http_request(
  368         -
                request,
  369         -
            )
  370         -
            .await
  371         -
            .map_err(Into::into)
  372         -
        };
  373         -
        use ::futures_util::future::TryFutureExt;
  374         -
        let fut = fut.map_err(
  375         -
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
  376         -
                ::tracing::debug!(error = %e, "failed to deserialize request");
  377         -
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
  378         -
                    e,
  379         -
                )
  380         -
            },
  381         -
        );
  382         -
        HttpPayloadTraits2InputFuture {
  383         -
            inner: Box::pin(fut),
  384         -
        }
  385         -
    }
  386         -
}
  387         -
impl
  388         -
    ::aws_smithy_http_server::response::IntoResponse<
  389         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  390         -
    > for crate::output::HttpPayloadTraits2Output
  391         -
{
  392         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
  393         -
        match crate::protocol_serde::shape_http_payload_traits2::ser_http_payload_traits2_http_response(self) {
  394         -
                        Ok(response) => response,
  395         -
                        Err(e) => {
  396         -
                            ::tracing::error!(error = %e, "failed to serialize response");
  397         -
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
  398         -
                        }
  399         -
                    }
  400         -
    }
  401         -
}
  402         -
impl
  403         -
    ::aws_smithy_http_server::response::IntoResponse<
  404         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
  405         -
    > for crate::error::HttpPayloadTraits2Error
  406         -
{
  407         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
  408         -
        match crate::protocol_serde::shape_http_payload_traits2::ser_http_payload_traits2_http_error(
  409         -
            &self,
  410         -
        ) {
  411         -
            Ok(mut response) => {
  412         -
                response.extensions_mut().insert(
  413         -
                    ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
  414         -
                );
  415         -
                response
  416         -
            }
  417         -
            Err(e) => {
  418         -
                ::tracing::error!(error = %e, "failed to serialize response");
  419         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
  420         -
            }
  421         -
        }
  422         -
    }
  423         -
}
  424         -
  425      2   
const CONTENT_TYPE_QUERYPRECEDENCE: ::mime::Mime = ::mime::APPLICATION_JSON;
  426      3   
::pin_project_lite::pin_project! {
  427      4   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
  428      5   
    /// [`QueryPrecedenceInput`](crate::input::QueryPrecedenceInput) using modelled bindings.
  429      6   
    pub struct QueryPrecedenceInputFuture {
  430      7   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::QueryPrecedenceInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
  431      8   
    }
  432      9   
}
  433     10   
  434     11   
impl std::future::Future for QueryPrecedenceInputFuture {

tmp-codegen-diff/codegen-server-test-python/rest_json_extras/rust-server-codegen-python/src/operation_shape.rs

@@ -1,1 +185,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(missing_docs)] // documentation missing in model
    3         -
pub struct HttpStringPayload2;
    4         -
    5         -
impl ::aws_smithy_http_server::operation::OperationShape for HttpStringPayload2 {
    6         -
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
    7         -
        ::aws_smithy_http_server::shape_id::ShapeId::new(
    8         -
            "aws.protocoltests.restjson#HttpStringPayload2",
    9         -
            "aws.protocoltests.restjson",
   10         -
            "HttpStringPayload2",
   11         -
        );
   12         -
   13         -
    type Input = crate::input::HttpStringPayload2Input;
   14         -
    type Output = crate::output::HttpStringPayload2Output;
   15         -
    type Error = crate::error::HttpStringPayload2Error;
   16         -
}
   17         -
   18         -
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity for HttpStringPayload2 {
   19         -
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt<
   20         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   21         -
        ::aws_smithy_http_server::instrumentation::sensitivity::uri::MakeUri<
   22         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
   23         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
   24         -
        >,
   25         -
    >;
   26         -
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt<
   27         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   28         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   29         -
    >;
   30         -
   31         -
    fn request_fmt() -> Self::RequestFmt {
   32         -
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
   33         -
    }
   34         -
   35         -
    fn response_fmt() -> Self::ResponseFmt {
   36         -
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
   37         -
    }
   38         -
}
   39         -
   40         -
#[allow(missing_docs)] // documentation missing in model
   41         -
pub struct HttpEnumPayload2;
   42         -
   43         -
impl ::aws_smithy_http_server::operation::OperationShape for HttpEnumPayload2 {
   44         -
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
   45         -
        ::aws_smithy_http_server::shape_id::ShapeId::new(
   46         -
            "aws.protocoltests.restjson#HttpEnumPayload2",
   47         -
            "aws.protocoltests.restjson",
   48         -
            "HttpEnumPayload2",
   49         -
        );
   50         -
   51         -
    type Input = crate::input::HttpEnumPayload2Input;
   52         -
    type Output = crate::output::HttpEnumPayload2Output;
   53         -
    type Error = crate::error::HttpEnumPayload2Error;
   54         -
}
   55         -
   56         -
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity for HttpEnumPayload2 {
   57         -
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt<
   58         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   59         -
        ::aws_smithy_http_server::instrumentation::sensitivity::uri::MakeUri<
   60         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
   61         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
   62         -
        >,
   63         -
    >;
   64         -
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt<
   65         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   66         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   67         -
    >;
   68         -
   69         -
    fn request_fmt() -> Self::RequestFmt {
   70         -
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
   71         -
    }
   72         -
   73         -
    fn response_fmt() -> Self::ResponseFmt {
   74         -
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
   75         -
    }
   76         -
}
   77         -
   78         -
#[allow(missing_docs)] // documentation missing in model
   79         -
pub struct MalformedContentTypeWithBody2;
   80         -
   81         -
impl ::aws_smithy_http_server::operation::OperationShape for MalformedContentTypeWithBody2 {
   82         -
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
   83         -
        ::aws_smithy_http_server::shape_id::ShapeId::new(
   84         -
            "aws.protocoltests.restjson#MalformedContentTypeWithBody2",
   85         -
            "aws.protocoltests.restjson",
   86         -
            "MalformedContentTypeWithBody2",
   87         -
        );
   88         -
   89         -
    type Input = crate::input::MalformedContentTypeWithBody2Input;
   90         -
    type Output = crate::output::MalformedContentTypeWithBody2Output;
   91         -
    type Error = crate::error::MalformedContentTypeWithBody2Error;
   92         -
}
   93         -
   94         -
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity
   95         -
    for MalformedContentTypeWithBody2
   96         -
{
   97         -
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt<
   98         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
   99         -
        ::aws_smithy_http_server::instrumentation::sensitivity::uri::MakeUri<
  100         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
  101         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
  102         -
        >,
  103         -
    >;
  104         -
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt<
  105         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
  106         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
  107         -
    >;
  108         -
  109         -
    fn request_fmt() -> Self::RequestFmt {
  110         -
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
  111         -
    }
  112         -
  113         -
    fn response_fmt() -> Self::ResponseFmt {
  114         -
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
  115         -
    }
  116         -
}
  117         -
  118         -
/// This example serializes a blob shape in the payload. In this example, no JSON document is synthesized because the payload is not a structure or a union type.
  119         -
pub struct HttpPayloadTraits2;
  120         -
  121         -
impl ::aws_smithy_http_server::operation::OperationShape for HttpPayloadTraits2 {
  122         -
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
  123         -
        ::aws_smithy_http_server::shape_id::ShapeId::new(
  124         -
            "aws.protocoltests.restjson#HttpPayloadTraits2",
  125         -
            "aws.protocoltests.restjson",
  126         -
            "HttpPayloadTraits2",
  127         -
        );
  128         -
  129         -
    type Input = crate::input::HttpPayloadTraits2Input;
  130         -
    type Output = crate::output::HttpPayloadTraits2Output;
  131         -
    type Error = crate::error::HttpPayloadTraits2Error;
  132         -
}
  133         -
  134         -
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity for HttpPayloadTraits2 {
  135         -
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt<
  136         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
  137         -
        ::aws_smithy_http_server::instrumentation::sensitivity::uri::MakeUri<
  138         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
  139         -
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
  140         -
        >,
  141         -
    >;
  142         -
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt<
  143         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
  144         -
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
  145         -
    >;
  146         -
  147         -
    fn request_fmt() -> Self::RequestFmt {
  148         -
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
  149         -
    }
  150         -
  151         -
    fn response_fmt() -> Self::ResponseFmt {
  152         -
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
  153         -
    }
  154         -
}
  155         -
  156      2   
#[allow(missing_docs)] // documentation missing in model
  157      3   
pub struct QueryPrecedence;
  158      4   
  159      5   
impl ::aws_smithy_http_server::operation::OperationShape for QueryPrecedence {
  160      6   
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
  161      7   
        ::aws_smithy_http_server::shape_id::ShapeId::new(
  162      8   
            "aws.protocoltests.restjson#QueryPrecedence",
  163      9   
            "aws.protocoltests.restjson",
  164     10   
            "QueryPrecedence",
  165     11   
        );

tmp-codegen-diff/codegen-server-test-python/rest_json_extras/rust-server-codegen-python/src/output.rs

@@ -1,1 +242,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[::pyo3::pyclass]
    3         -
/// :param payload typing.Optional\[str\]:
    4         -
/// :rtype None:
    5         -
#[allow(missing_docs)] // documentation missing in model
    6         -
#[derive(
    7         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    8         -
)]
    9         -
pub struct HttpStringPayload2Output {
   10         -
    #[pyo3(get, set)]
   11         -
    /// :type typing.Optional\[str\]:
   12         -
    #[allow(missing_docs)] // documentation missing in model
   13         -
    pub payload: ::std::option::Option<::std::string::String>,
   14         -
}
   15         -
impl HttpStringPayload2Output {
   16         -
    #[allow(missing_docs)] // documentation missing in model
   17         -
    pub fn payload(&self) -> ::std::option::Option<&str> {
   18         -
        self.payload.as_deref()
   19         -
    }
   20         -
}
   21         -
#[allow(clippy::new_without_default)]
   22         -
#[allow(clippy::too_many_arguments)]
   23         -
#[::pyo3::pymethods]
   24         -
impl HttpStringPayload2Output {
   25         -
    #[new]
   26         -
    pub fn new(payload: ::std::option::Option<::std::string::String>) -> Self {
   27         -
        Self { payload }
   28         -
    }
   29         -
    fn __repr__(&self) -> String {
   30         -
        format!("{self:?}")
   31         -
    }
   32         -
    fn __str__(&self) -> String {
   33         -
        format!("{self:?}")
   34         -
    }
   35         -
}
   36         -
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<HttpStringPayload2Output> {
   37         -
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
   38         -
        ob.extract::<HttpStringPayload2Output>().map(Box::new)
   39         -
    }
   40         -
}
   41         -
   42         -
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<HttpStringPayload2Output> {
   43         -
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
   44         -
        (*self).into_py(py)
   45         -
    }
   46         -
}
   47         -
impl HttpStringPayload2Output {
   48         -
    /// Creates a new builder-style object to manufacture [`HttpStringPayload2Output`](crate::output::HttpStringPayload2Output).
   49         -
    pub fn builder() -> crate::output::http_string_payload2_output::Builder {
   50         -
        crate::output::http_string_payload2_output::Builder::default()
   51         -
    }
   52         -
}
   53         -
   54         -
#[::pyo3::pyclass]
   55         -
/// :param payload typing.Optional\[rest_json_extras.model.StringEnum\]:
   56         -
/// :rtype None:
   57         -
#[allow(missing_docs)] // documentation missing in model
   58         -
#[derive(
   59         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   60         -
)]
   61         -
pub struct HttpEnumPayload2Output {
   62         -
    #[pyo3(get, set)]
   63         -
    /// :type typing.Optional\[rest_json_extras.model.StringEnum\]:
   64         -
    #[allow(missing_docs)] // documentation missing in model
   65         -
    pub payload: ::std::option::Option<crate::model::StringEnum>,
   66         -
}
   67         -
impl HttpEnumPayload2Output {
   68         -
    #[allow(missing_docs)] // documentation missing in model
   69         -
    pub fn payload(&self) -> ::std::option::Option<&crate::model::StringEnum> {
   70         -
        self.payload.as_ref()
   71         -
    }
   72         -
}
   73         -
#[allow(clippy::new_without_default)]
   74         -
#[allow(clippy::too_many_arguments)]
   75         -
#[::pyo3::pymethods]
   76         -
impl HttpEnumPayload2Output {
   77         -
    #[new]
   78         -
    pub fn new(payload: ::std::option::Option<crate::model::StringEnum>) -> Self {
   79         -
        Self { payload }
   80         -
    }
   81         -
    fn __repr__(&self) -> String {
   82         -
        format!("{self:?}")
   83         -
    }
   84         -
    fn __str__(&self) -> String {
   85         -
        format!("{self:?}")
   86         -
    }
   87         -
}
   88         -
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<HttpEnumPayload2Output> {
   89         -
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
   90         -
        ob.extract::<HttpEnumPayload2Output>().map(Box::new)
   91         -
    }
   92         -
}
   93         -
   94         -
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<HttpEnumPayload2Output> {
   95         -
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
   96         -
        (*self).into_py(py)
   97         -
    }
   98         -
}
   99         -
impl HttpEnumPayload2Output {
  100         -
    /// Creates a new builder-style object to manufacture [`HttpEnumPayload2Output`](crate::output::HttpEnumPayload2Output).
  101         -
    pub fn builder() -> crate::output::http_enum_payload2_output::Builder {
  102         -
        crate::output::http_enum_payload2_output::Builder::default()
  103         -
    }
  104         -
}
  105         -
  106         -
#[::pyo3::pyclass]
  107         -
/// :rtype None:
  108         -
#[allow(missing_docs)] // documentation missing in model
  109         -
#[derive(
  110         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  111         -
)]
  112         -
pub struct MalformedContentTypeWithBody2Output {}
  113         -
#[allow(clippy::new_without_default)]
  114         -
#[allow(clippy::too_many_arguments)]
  115         -
#[::pyo3::pymethods]
  116         -
impl MalformedContentTypeWithBody2Output {
  117         -
    #[new]
  118         -
    pub fn new() -> Self {
  119         -
        Self {}
  120         -
    }
  121         -
    fn __repr__(&self) -> String {
  122         -
        format!("{self:?}")
  123         -
    }
  124         -
    fn __str__(&self) -> String {
  125         -
        format!("{self:?}")
  126         -
    }
  127         -
}
  128         -
impl<'source> ::pyo3::FromPyObject<'source>
  129         -
    for std::boxed::Box<MalformedContentTypeWithBody2Output>
  130         -
{
  131         -
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
  132         -
        ob.extract::<MalformedContentTypeWithBody2Output>()
  133         -
            .map(Box::new)
  134         -
    }
  135         -
}
  136         -
  137         -
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<MalformedContentTypeWithBody2Output> {
  138         -
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
  139         -
        (*self).into_py(py)
  140         -
    }
  141         -
}
  142         -
impl MalformedContentTypeWithBody2Output {
  143         -
    /// Creates a new builder-style object to manufacture [`MalformedContentTypeWithBody2Output`](crate::output::MalformedContentTypeWithBody2Output).
  144         -
    pub fn builder() -> crate::output::malformed_content_type_with_body2_output::Builder {
  145         -
        crate::output::malformed_content_type_with_body2_output::Builder::default()
  146         -
    }
  147         -
}
  148         -
  149         -
#[::pyo3::pyclass]
  150         -
/// :param foo typing.Optional\[str\]:
  151         -
/// :param blob typing.Optional\[rest_json_extras.types.Blob\]:
  152         -
/// :rtype None:
  153         -
#[allow(missing_docs)] // documentation missing in model
  154         -
#[derive(
  155         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  156         -
)]
  157         -
pub struct HttpPayloadTraits2Output {
  158         -
    #[pyo3(get, set)]
  159         -
    /// :type typing.Optional\[str\]:
  160         -
    #[allow(missing_docs)] // documentation missing in model
  161         -
    pub foo: ::std::option::Option<::std::string::String>,
  162         -
    #[pyo3(get, set)]
  163         -
    /// :type typing.Optional\[rest_json_extras.types.Blob\]:
  164         -
    #[allow(missing_docs)] // documentation missing in model
  165         -
    pub blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
  166         -
}
  167         -
impl HttpPayloadTraits2Output {
  168         -
    #[allow(missing_docs)] // documentation missing in model
  169         -
    pub fn foo(&self) -> ::std::option::Option<&str> {
  170         -
        self.foo.as_deref()
  171         -
    }
  172         -
    #[allow(missing_docs)] // documentation missing in model
  173         -
    pub fn blob(&self) -> ::std::option::Option<&::aws_smithy_http_server_python::types::Blob> {
  174         -
        self.blob.as_ref()
  175         -
    }
  176         -
}
  177         -
#[allow(clippy::new_without_default)]
  178         -
#[allow(clippy::too_many_arguments)]
  179         -
#[::pyo3::pymethods]
  180         -
impl HttpPayloadTraits2Output {
  181         -
    #[new]
  182         -
    pub fn new(
  183         -
        foo: ::std::option::Option<::std::string::String>,
  184         -
        blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
  185         -
    ) -> Self {
  186         -
        Self { foo, blob }
  187         -
    }
  188         -
    fn __repr__(&self) -> String {
  189         -
        format!("{self:?}")
  190         -
    }
  191         -
    fn __str__(&self) -> String {
  192         -
        format!("{self:?}")
  193         -
    }
  194         -
}
  195         -
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<HttpPayloadTraits2Output> {
  196         -
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
  197         -
        ob.extract::<HttpPayloadTraits2Output>().map(Box::new)
  198         -
    }
  199         -
}
  200         -
  201         -
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<HttpPayloadTraits2Output> {
  202         -
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
  203         -
        (*self).into_py(py)
  204         -
    }
  205         -
}
  206         -
impl HttpPayloadTraits2Output {
  207         -
    /// Creates a new builder-style object to manufacture [`HttpPayloadTraits2Output`](crate::output::HttpPayloadTraits2Output).
  208         -
    pub fn builder() -> crate::output::http_payload_traits2_output::Builder {
  209         -
        crate::output::http_payload_traits2_output::Builder::default()
  210         -
    }
  211         -
}
  212         -
  213      2   
#[::pyo3::pyclass]
  214      3   
/// :rtype None:
  215      4   
#[allow(missing_docs)] // documentation missing in model
  216      5   
#[derive(
  217      6   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  218      7   
)]
  219      8   
pub struct QueryPrecedenceOutput {}
  220      9   
#[allow(clippy::new_without_default)]
  221     10   
#[allow(clippy::too_many_arguments)]
  222     11   
#[::pyo3::pymethods]
@@ -775,564 +965,623 @@
  795    584   
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
  796    585   
        (*self).into_py(py)
  797    586   
    }
  798    587   
}
  799    588   
impl StringPayloadOutput {
  800    589   
    /// Creates a new builder-style object to manufacture [`StringPayloadOutput`](crate::output::StringPayloadOutput).
  801    590   
    pub fn builder() -> crate::output::string_payload_output::Builder {
  802    591   
        crate::output::string_payload_output::Builder::default()
  803    592   
    }
  804    593   
}
  805         -
/// See [`HttpStringPayload2Output`](crate::output::HttpStringPayload2Output).
  806         -
///
  807         -
pub mod http_string_payload2_output {
  808         -
  809         -
    impl ::std::convert::From<Builder> for crate::output::HttpStringPayload2Output {
  810         -
        fn from(builder: Builder) -> Self {
  811         -
            builder.build()
  812         -
        }
  813         -
    }
  814         -
    /// A builder for [`HttpStringPayload2Output`](crate::output::HttpStringPayload2Output).
  815         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
  816         -
    pub struct Builder {
  817         -
        pub(crate) payload: ::std::option::Option<::std::string::String>,
  818         -
    }
  819         -
    impl Builder {
  820         -
        #[allow(missing_docs)] // documentation missing in model
  821         -
        pub fn payload(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
  822         -
            self.payload = input;
  823         -
            self
  824         -
        }
  825         -
        /// Consumes the builder and constructs a [`HttpStringPayload2Output`](crate::output::HttpStringPayload2Output).
  826         -
        pub fn build(self) -> crate::output::HttpStringPayload2Output {
  827         -
            self.build_enforcing_required_and_enum_traits()
  828         -
        }
  829         -
        fn build_enforcing_required_and_enum_traits(
  830         -
            self,
  831         -
        ) -> crate::output::HttpStringPayload2Output {
  832         -
            crate::output::HttpStringPayload2Output {
  833         -
                payload: self.payload,
  834         -
            }
  835         -
        }
  836         -
    }
  837         -
}
  838         -
/// See [`HttpEnumPayload2Output`](crate::output::HttpEnumPayload2Output).
  839         -
///
  840         -
pub mod http_enum_payload2_output {
  841         -
  842         -
    impl ::std::convert::From<Builder> for crate::output::HttpEnumPayload2Output {
  843         -
        fn from(builder: Builder) -> Self {
  844         -
            builder.build()
  845         -
        }
  846         -
    }
  847         -
    /// A builder for [`HttpEnumPayload2Output`](crate::output::HttpEnumPayload2Output).
  848         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
  849         -
    pub struct Builder {
  850         -
        pub(crate) payload: ::std::option::Option<crate::model::StringEnum>,
  851         -
    }
  852         -
    impl Builder {
  853         -
        #[allow(missing_docs)] // documentation missing in model
  854         -
        pub fn payload(mut self, input: ::std::option::Option<crate::model::StringEnum>) -> Self {
  855         -
            self.payload = input;
  856         -
            self
  857         -
        }
  858         -
        /// Consumes the builder and constructs a [`HttpEnumPayload2Output`](crate::output::HttpEnumPayload2Output).
  859         -
        pub fn build(self) -> crate::output::HttpEnumPayload2Output {
  860         -
            self.build_enforcing_required_and_enum_traits()
  861         -
        }
  862         -
        fn build_enforcing_required_and_enum_traits(self) -> crate::output::HttpEnumPayload2Output {
  863         -
            crate::output::HttpEnumPayload2Output {
  864         -
                payload: self.payload,
  865         -
            }
  866         -
        }
  867         -
    }
  868         -
}
  869         -
/// See [`MalformedContentTypeWithBody2Output`](crate::output::MalformedContentTypeWithBody2Output).
  870         -
///
  871         -
pub mod malformed_content_type_with_body2_output {
  872         -
  873         -
    impl ::std::convert::From<Builder> for crate::output::MalformedContentTypeWithBody2Output {
  874         -
        fn from(builder: Builder) -> Self {
  875         -
            builder.build()
  876         -
        }
  877         -
    }
  878         -
    /// A builder for [`MalformedContentTypeWithBody2Output`](crate::output::MalformedContentTypeWithBody2Output).
  879         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
  880         -
    pub struct Builder {}
  881         -
    impl Builder {
  882         -
        /// Consumes the builder and constructs a [`MalformedContentTypeWithBody2Output`](crate::output::MalformedContentTypeWithBody2Output).
  883         -
        pub fn build(self) -> crate::output::MalformedContentTypeWithBody2Output {
  884         -
            self.build_enforcing_required_and_enum_traits()
  885         -
        }
  886         -
        fn build_enforcing_required_and_enum_traits(
  887         -
            self,
  888         -
        ) -> crate::output::MalformedContentTypeWithBody2Output {
  889         -
            crate::output::MalformedContentTypeWithBody2Output {}
  890         -
        }
  891         -
    }
  892         -
}
  893         -
/// See [`HttpPayloadTraits2Output`](crate::output::HttpPayloadTraits2Output).
  894         -
///
  895         -
pub mod http_payload_traits2_output {
  896         -
  897         -
    impl ::std::convert::From<Builder> for crate::output::HttpPayloadTraits2Output {
  898         -
        fn from(builder: Builder) -> Self {
  899         -
            builder.build()
  900         -
        }
  901         -
    }
  902         -
    /// A builder for [`HttpPayloadTraits2Output`](crate::output::HttpPayloadTraits2Output).
  903         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
  904         -
    pub struct Builder {
  905         -
        pub(crate) foo: ::std::option::Option<::std::string::String>,
  906         -
        pub(crate) blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
  907         -
    }
  908         -
    impl Builder {
  909         -
        #[allow(missing_docs)] // documentation missing in model
  910         -
        pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
  911         -
            self.foo = input;
  912         -
            self
  913         -
        }
  914         -
        #[allow(missing_docs)] // documentation missing in model
  915         -
        pub fn blob(
  916         -
            mut self,
  917         -
            input: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
  918         -
        ) -> Self {
  919         -
            self.blob = input;
  920         -
            self
  921         -
        }
  922         -
        /// Consumes the builder and constructs a [`HttpPayloadTraits2Output`](crate::output::HttpPayloadTraits2Output).
  923         -
        pub fn build(self) -> crate::output::HttpPayloadTraits2Output {
  924         -
            self.build_enforcing_required_and_enum_traits()
  925         -
        }
  926         -
        fn build_enforcing_required_and_enum_traits(
  927         -
            self,
  928         -
        ) -> crate::output::HttpPayloadTraits2Output {
  929         -
            crate::output::HttpPayloadTraits2Output {
  930         -
                foo: self.foo,
  931         -
                blob: self.blob,
  932         -
            }
  933         -
        }
  934         -
    }
  935         -
}
  936    594   
/// See [`QueryPrecedenceOutput`](crate::output::QueryPrecedenceOutput).
  937    595   
///
  938    596   
pub mod query_precedence_output {
  939    597   
  940    598   
    impl ::std::convert::From<Builder> for crate::output::QueryPrecedenceOutput {
  941    599   
        fn from(builder: Builder) -> Self {
  942    600   
            builder.build()
  943    601   
        }
  944    602   
    }
  945    603   
    /// A builder for [`QueryPrecedenceOutput`](crate::output::QueryPrecedenceOutput).