Server Test

Server Test

rev. a7fb2e3446d314cfbe48069306e4e0a389b39aeb

Files changed:

tmp-codegen-diff/codegen-server-test/constraints/rust-server-codegen/src/constrained.rs

@@ -457,457 +516,572 @@
  477    477   
    }
  478    478   
  479    479   
    impl ::std::convert::From<MapOfLengthStringConstrained>
  480    480   
        for ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>
  481    481   
    {
  482    482   
        fn from(v: MapOfLengthStringConstrained) -> Self {
  483    483   
            v.0
  484    484   
        }
  485    485   
    }
  486    486   
}
         487  +
pub(crate) mod indirectly_constrained_map_constrained {
         488  +
         489  +
    #[derive(Debug, Clone)]
         490  +
    pub(crate) struct IndirectlyConstrainedMapConstrained(
         491  +
        pub(crate) std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         492  +
    );
         493  +
         494  +
    impl crate::constrained::Constrained for IndirectlyConstrainedMapConstrained {
         495  +
        type Unconstrained = crate::unconstrained::indirectly_constrained_map_unconstrained::IndirectlyConstrainedMapUnconstrained;
         496  +
    }
         497  +
    impl
         498  +
        ::std::convert::From<
         499  +
            ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         500  +
        > for IndirectlyConstrainedMapConstrained
         501  +
    {
         502  +
        fn from(
         503  +
            v: ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         504  +
        ) -> Self {
         505  +
            Self(v)
         506  +
        }
         507  +
    }
         508  +
         509  +
    impl ::std::convert::From<IndirectlyConstrainedMapConstrained>
         510  +
        for ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>
         511  +
    {
         512  +
        fn from(v: IndirectlyConstrainedMapConstrained) -> Self {
         513  +
            v.0
         514  +
        }
         515  +
    }
         516  +
}
         517  +
pub(crate) mod indirectly_constrained_list_constrained {
         518  +
         519  +
    #[derive(Debug, Clone)]
         520  +
    pub(crate) struct IndirectlyConstrainedListConstrained(
         521  +
        pub(crate) std::vec::Vec<crate::model::LengthString>,
         522  +
    );
         523  +
         524  +
    impl crate::constrained::Constrained for IndirectlyConstrainedListConstrained {
         525  +
        type Unconstrained = crate::unconstrained::indirectly_constrained_list_unconstrained::IndirectlyConstrainedListUnconstrained;
         526  +
    }
         527  +
    impl ::std::convert::From<::std::vec::Vec<crate::model::LengthString>>
         528  +
        for IndirectlyConstrainedListConstrained
         529  +
    {
         530  +
        fn from(v: ::std::vec::Vec<crate::model::LengthString>) -> Self {
         531  +
            Self(v)
         532  +
        }
         533  +
    }
         534  +
         535  +
    impl ::std::convert::From<IndirectlyConstrainedListConstrained>
         536  +
        for ::std::vec::Vec<crate::model::LengthString>
         537  +
    {
         538  +
        fn from(v: IndirectlyConstrainedListConstrained) -> Self {
         539  +
            v.0
         540  +
        }
         541  +
    }
         542  +
}
  487    543   
pub(crate) mod recursive_list_constrained {
  488    544   
  489    545   
    #[derive(Debug, Clone)]
  490    546   
    pub(crate) struct RecursiveListConstrained(
  491    547   
        pub(crate) std::vec::Vec<crate::model::RecursiveShapesInputOutputNested1>,
  492    548   
    );
  493    549   
  494    550   
    impl crate::constrained::Constrained for RecursiveListConstrained {
  495    551   
        type Unconstrained =
  496    552   
            crate::unconstrained::recursive_list_unconstrained::RecursiveListUnconstrained;

tmp-codegen-diff/codegen-server-test/constraints/rust-server-codegen/src/error.rs

@@ -785,785 +844,896 @@
  805    805   
impl ::std::convert::From<crate::error::ValidationException>
  806    806   
    for crate::error::QueryParamsTargetingLengthMapOperationError
  807    807   
{
  808    808   
    fn from(
  809    809   
        variant: crate::error::ValidationException,
  810    810   
    ) -> crate::error::QueryParamsTargetingLengthMapOperationError {
  811    811   
        Self::ValidationException(variant)
  812    812   
    }
  813    813   
}
  814    814   
         815  +
/// Error type for the `ConstrainedListWithIndirectlyConstrainedAggregateOperation` operation.
         816  +
/// Each variant represents an error that can occur for the `ConstrainedListWithIndirectlyConstrainedAggregateOperation` operation.
         817  +
#[derive(::std::fmt::Debug)]
         818  +
pub enum ConstrainedListWithIndirectlyConstrainedAggregateOperationError {
         819  +
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         820  +
    ValidationException(crate::error::ValidationException),
         821  +
}
         822  +
impl ::std::fmt::Display for ConstrainedListWithIndirectlyConstrainedAggregateOperationError {
         823  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         824  +
        match &self {
         825  +
            ConstrainedListWithIndirectlyConstrainedAggregateOperationError::ValidationException(_inner) =>
         826  +
            _inner.fmt(f)
         827  +
            ,
         828  +
        }
         829  +
    }
         830  +
}
         831  +
impl ConstrainedListWithIndirectlyConstrainedAggregateOperationError {
         832  +
    /// Returns `true` if the error kind is `ConstrainedListWithIndirectlyConstrainedAggregateOperationError::ValidationException`.
         833  +
    pub fn is_validation_exception(&self) -> bool {
         834  +
        matches!(
         835  +
            &self,
         836  +
            ConstrainedListWithIndirectlyConstrainedAggregateOperationError::ValidationException(_)
         837  +
        )
         838  +
    }
         839  +
    /// Returns the error name string by matching the correct variant.
         840  +
    pub fn name(&self) -> &'static str {
         841  +
        match &self {
         842  +
            ConstrainedListWithIndirectlyConstrainedAggregateOperationError::ValidationException(_inner) =>
         843  +
            _inner.name()
         844  +
            ,
         845  +
        }
         846  +
    }
         847  +
}
         848  +
impl ::std::error::Error for ConstrainedListWithIndirectlyConstrainedAggregateOperationError {
         849  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         850  +
        match &self {
         851  +
            ConstrainedListWithIndirectlyConstrainedAggregateOperationError::ValidationException(_inner) =>
         852  +
            Some(_inner)
         853  +
            ,
         854  +
        }
         855  +
    }
         856  +
}
         857  +
impl ::std::convert::From<crate::error::ValidationException>
         858  +
    for crate::error::ConstrainedListWithIndirectlyConstrainedAggregateOperationError
         859  +
{
         860  +
    fn from(
         861  +
        variant: crate::error::ValidationException,
         862  +
    ) -> crate::error::ConstrainedListWithIndirectlyConstrainedAggregateOperationError {
         863  +
        Self::ValidationException(variant)
         864  +
    }
         865  +
}
         866  +
  815    867   
/// Error type for the `ConstrainedRecursiveShapesOperation` operation.
  816    868   
/// Each variant represents an error that can occur for the `ConstrainedRecursiveShapesOperation` operation.
  817    869   
#[derive(::std::fmt::Debug)]
  818    870   
pub enum ConstrainedRecursiveShapesOperationError {
  819    871   
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
  820    872   
    ValidationException(crate::error::ValidationException),
  821    873   
}
  822    874   
impl ::std::fmt::Display for ConstrainedRecursiveShapesOperationError {
  823    875   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  824    876   
        match &self {

tmp-codegen-diff/codegen-server-test/constraints/rust-server-codegen/src/input.rs

@@ -451,451 +510,542 @@
  471    471   
impl QueryParamsTargetingLengthMapOperationInput {
  472    472   
    /// Creates a new builder-style object to manufacture [`QueryParamsTargetingLengthMapOperationInput`](crate::input::QueryParamsTargetingLengthMapOperationInput).
  473    473   
    pub fn builder() -> crate::input::query_params_targeting_length_map_operation_input::Builder {
  474    474   
        crate::input::query_params_targeting_length_map_operation_input::Builder::default()
  475    475   
    }
  476    476   
}
  477    477   
impl crate::constrained::Constrained for crate::input::QueryParamsTargetingLengthMapOperationInput {
  478    478   
    type Unconstrained = crate::input::query_params_targeting_length_map_operation_input::Builder;
  479    479   
}
  480    480   
         481  +
#[allow(missing_docs)] // documentation missing in model
         482  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
         483  +
pub struct ConstrainedListWithIndirectlyConstrainedAggregateOperationInput {
         484  +
    #[allow(missing_docs)] // documentation missing in model
         485  +
    pub a: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedList>,
         486  +
    #[allow(missing_docs)] // documentation missing in model
         487  +
    pub b: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedMap>,
         488  +
}
         489  +
impl ConstrainedListWithIndirectlyConstrainedAggregateOperationInput {
         490  +
    #[allow(missing_docs)] // documentation missing in model
         491  +
    pub fn a(&self) -> ::std::option::Option<&crate::model::ListWithIndirectlyConstrainedList> {
         492  +
        self.a.as_ref()
         493  +
    }
         494  +
    #[allow(missing_docs)] // documentation missing in model
         495  +
    pub fn b(&self) -> ::std::option::Option<&crate::model::ListWithIndirectlyConstrainedMap> {
         496  +
        self.b.as_ref()
         497  +
    }
         498  +
}
         499  +
impl ConstrainedListWithIndirectlyConstrainedAggregateOperationInput {
         500  +
    /// Creates a new builder-style object to manufacture [`ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`](crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput).
         501  +
    pub fn builder(
         502  +
    ) -> crate::input::constrained_list_with_indirectly_constrained_aggregate_operation_input::Builder
         503  +
    {
         504  +
        crate::input::constrained_list_with_indirectly_constrained_aggregate_operation_input::Builder::default()
         505  +
    }
         506  +
}
         507  +
impl crate::constrained::Constrained
         508  +
    for crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput
         509  +
{
         510  +
    type Unconstrained = crate::input::constrained_list_with_indirectly_constrained_aggregate_operation_input::Builder;
         511  +
}
         512  +
  481    513   
#[allow(missing_docs)] // documentation missing in model
  482    514   
#[derive(
  483    515   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  484    516   
)]
  485    517   
pub struct ConstrainedRecursiveShapesOperationInput {
  486    518   
    #[allow(missing_docs)] // documentation missing in model
  487    519   
    pub nested: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
  488    520   
    #[allow(missing_docs)] // documentation missing in model
  489    521   
    pub recursive_list: ::std::vec::Vec<crate::model::RecursiveShapesInputOutputNested1>,
  490    522   
}
@@ -2647,2679 +2706,2913 @@
 2667   2699   
                    .map(|v| match v {
 2668   2700   
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
 2669   2701   
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
 2670   2702   
                    })
 2671   2703   
                    .map(|res| res.map_err(ConstraintViolation::LengthMap))
 2672   2704   
                    .transpose()?,
 2673   2705   
            })
 2674   2706   
        }
 2675   2707   
    }
 2676   2708   
}
        2709  +
/// See [`ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`](crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput).
        2710  +
pub mod constrained_list_with_indirectly_constrained_aggregate_operation_input {
        2711  +
        2712  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        2713  +
    /// Holds one variant for each of the ways the builder can fail.
        2714  +
    #[non_exhaustive]
        2715  +
    #[allow(clippy::enum_variant_names)]
        2716  +
    pub enum ConstraintViolation {
        2717  +
        /// Constraint violation occurred building member `a` when building `ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`.
        2718  +
        #[doc(hidden)]
        2719  +
        A(crate::model::list_with_indirectly_constrained_list::ConstraintViolation),
        2720  +
        /// Constraint violation occurred building member `b` when building `ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`.
        2721  +
        #[doc(hidden)]
        2722  +
        B(crate::model::list_with_indirectly_constrained_map::ConstraintViolation),
        2723  +
    }
        2724  +
    impl ::std::fmt::Display for ConstraintViolation {
        2725  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        2726  +
            match self {
        2727  +
                ConstraintViolation::A(_) => write!(f, "constraint violation occurred building member `a` when building `ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`"),
        2728  +
                ConstraintViolation::B(_) => write!(f, "constraint violation occurred building member `b` when building `ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`"),
        2729  +
            }
        2730  +
        }
        2731  +
    }
        2732  +
    impl ::std::error::Error for ConstraintViolation {}
        2733  +
    impl ConstraintViolation {
        2734  +
        pub(crate) fn as_validation_exception_field(
        2735  +
            self,
        2736  +
            path: ::std::string::String,
        2737  +
        ) -> crate::model::ValidationExceptionField {
        2738  +
            match self {
        2739  +
                ConstraintViolation::A(inner) => inner.as_validation_exception_field(path + "/a"),
        2740  +
                ConstraintViolation::B(inner) => inner.as_validation_exception_field(path + "/b"),
        2741  +
            }
        2742  +
        }
        2743  +
    }
        2744  +
    impl ::std::convert::From<ConstraintViolation>
        2745  +
        for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
        2746  +
    {
        2747  +
        fn from(constraint_violation: ConstraintViolation) -> Self {
        2748  +
            let first_validation_exception_field =
        2749  +
                constraint_violation.as_validation_exception_field("".to_owned());
        2750  +
            let validation_exception = crate::error::ValidationException {
        2751  +
                message: format!(
        2752  +
                    "1 validation error detected. {}",
        2753  +
                    &first_validation_exception_field.message
        2754  +
                ),
        2755  +
                field_list: Some(vec![first_validation_exception_field]),
        2756  +
            };
        2757  +
            Self::ConstraintViolation(
        2758  +
                                crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
        2759  +
                                    .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
        2760  +
                            )
        2761  +
        }
        2762  +
    }
        2763  +
    impl ::std::convert::From<Builder>
        2764  +
        for crate::constrained::MaybeConstrained<
        2765  +
            crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput,
        2766  +
        >
        2767  +
    {
        2768  +
        fn from(builder: Builder) -> Self {
        2769  +
            Self::Unconstrained(builder)
        2770  +
        }
        2771  +
    }
        2772  +
    impl ::std::convert::TryFrom<Builder>
        2773  +
        for crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput
        2774  +
    {
        2775  +
        type Error = ConstraintViolation;
        2776  +
        2777  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        2778  +
            builder.build()
        2779  +
        }
        2780  +
    }
        2781  +
    /// A builder for [`ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`](crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput).
        2782  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        2783  +
    pub struct Builder {
        2784  +
        pub(crate) a: ::std::option::Option<
        2785  +
            crate::constrained::MaybeConstrained<crate::model::ListWithIndirectlyConstrainedList>,
        2786  +
        >,
        2787  +
        pub(crate) b: ::std::option::Option<
        2788  +
            crate::constrained::MaybeConstrained<crate::model::ListWithIndirectlyConstrainedMap>,
        2789  +
        >,
        2790  +
    }
        2791  +
    impl Builder {
        2792  +
        #[allow(missing_docs)] // documentation missing in model
        2793  +
        pub fn a(
        2794  +
            mut self,
        2795  +
            input: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedList>,
        2796  +
        ) -> Self {
        2797  +
            self.a = input.map(
        2798  +
                #[allow(clippy::redundant_closure)]
        2799  +
                |v| crate::constrained::MaybeConstrained::Constrained(v),
        2800  +
            );
        2801  +
            self
        2802  +
        }
        2803  +
        #[allow(missing_docs)] // documentation missing in model
        2804  +
        pub(crate) fn set_a(
        2805  +
            mut self,
        2806  +
            input: Option<
        2807  +
                impl ::std::convert::Into<
        2808  +
                    crate::constrained::MaybeConstrained<
        2809  +
                        crate::model::ListWithIndirectlyConstrainedList,
        2810  +
                    >,
        2811  +
                >,
        2812  +
            >,
        2813  +
        ) -> Self {
        2814  +
            self.a = input.map(|v| v.into());
        2815  +
            self
        2816  +
        }
        2817  +
        #[allow(missing_docs)] // documentation missing in model
        2818  +
        pub fn b(
        2819  +
            mut self,
        2820  +
            input: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedMap>,
        2821  +
        ) -> Self {
        2822  +
            self.b = input.map(
        2823  +
                #[allow(clippy::redundant_closure)]
        2824  +
                |v| crate::constrained::MaybeConstrained::Constrained(v),
        2825  +
            );
        2826  +
            self
        2827  +
        }
        2828  +
        #[allow(missing_docs)] // documentation missing in model
        2829  +
        pub(crate) fn set_b(
        2830  +
            mut self,
        2831  +
            input: Option<
        2832  +
                impl ::std::convert::Into<
        2833  +
                    crate::constrained::MaybeConstrained<
        2834  +
                        crate::model::ListWithIndirectlyConstrainedMap,
        2835  +
                    >,
        2836  +
                >,
        2837  +
            >,
        2838  +
        ) -> Self {
        2839  +
            self.b = input.map(|v| v.into());
        2840  +
            self
        2841  +
        }
        2842  +
        /// Consumes the builder and constructs a [`ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`](crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput).
        2843  +
        ///
        2844  +
        /// The builder fails to construct a [`ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`](crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput) if a [`ConstraintViolation`] occurs.
        2845  +
        ///
        2846  +
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
        2847  +
        pub fn build(
        2848  +
            self,
        2849  +
        ) -> Result<
        2850  +
            crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput,
        2851  +
            ConstraintViolation,
        2852  +
        > {
        2853  +
            self.build_enforcing_all_constraints()
        2854  +
        }
        2855  +
        fn build_enforcing_all_constraints(
        2856  +
            self,
        2857  +
        ) -> Result<
        2858  +
            crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput,
        2859  +
            ConstraintViolation,
        2860  +
        > {
        2861  +
            Ok(
        2862  +
                crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput {
        2863  +
                    a: self
        2864  +
                        .a
        2865  +
                        .map(|v| match v {
        2866  +
                            crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        2867  +
                            crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        2868  +
                        })
        2869  +
                        .map(|res| res.map_err(ConstraintViolation::A))
        2870  +
                        .transpose()?,
        2871  +
                    b: self
        2872  +
                        .b
        2873  +
                        .map(|v| match v {
        2874  +
                            crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        2875  +
                            crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        2876  +
                        })
        2877  +
                        .map(|res| res.map_err(ConstraintViolation::B))
        2878  +
                        .transpose()?,
        2879  +
                },
        2880  +
            )
        2881  +
        }
        2882  +
    }
        2883  +
}
 2677   2884   
/// See [`ConstrainedRecursiveShapesOperationInput`](crate::input::ConstrainedRecursiveShapesOperationInput).
 2678   2885   
pub mod constrained_recursive_shapes_operation_input {
 2679   2886   
 2680   2887   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 2681   2888   
    /// Holds one variant for each of the ways the builder can fail.
 2682   2889   
    #[non_exhaustive]
 2683   2890   
    #[allow(clippy::enum_variant_names)]
 2684   2891   
    pub enum ConstraintViolation {
 2685   2892   
        /// Constraint violation occurred building member `nested` when building `ConstrainedRecursiveShapesOperationInput`.
 2686   2893   
        #[doc(hidden)]

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

@@ -139,139 +240,245 @@
  159    159   
//! ```rust,no_run
  160    160   
//! # use std::net::SocketAddr;
  161    161   
//! use constraints::{ConstraintsService, ConstraintsServiceConfig};
  162    162   
//!
  163    163   
//! #[::tokio::main]
  164    164   
//! pub async fn main() {
  165    165   
//!    let config = ConstraintsServiceConfig::builder().build();
  166    166   
//!    let app = ConstraintsService::builder(config)
  167    167   
//!        .constrained_http_bound_shapes_operation(constrained_http_bound_shapes_operation)
  168    168   
//!        .constrained_http_payload_bound_shape_operation(constrained_http_payload_bound_shape_operation)
         169  +
//!        .constrained_list_with_indirectly_constrained_aggregate_operation(constrained_list_with_indirectly_constrained_aggregate_operation)
  169    170   
//!        .constrained_recursive_shapes_operation(constrained_recursive_shapes_operation)
  170    171   
//!        .constrained_shapes_only_in_output_operation(constrained_shapes_only_in_output_operation)
  171    172   
//!        .constrained_shapes_operation(constrained_shapes_operation)
  172    173   
//!        .event_streams_operation(event_streams_operation)
  173    174   
//!        .http_prefix_headers_targeting_length_map_operation(http_prefix_headers_targeting_length_map_operation)
  174    175   
//!        .non_streaming_blob_operation(non_streaming_blob_operation)
  175    176   
//!        .query_params_targeting_length_map_operation(query_params_targeting_length_map_operation)
  176    177   
//!        .query_params_targeting_map_of_enum_string_operation(query_params_targeting_map_of_enum_string_operation)
  177    178   
//!        .query_params_targeting_map_of_length_list_of_pattern_string_operation(query_params_targeting_map_of_length_list_of_pattern_string_operation)
  178    179   
//!        .query_params_targeting_map_of_length_pattern_string_operation(query_params_targeting_map_of_length_pattern_string_operation)
  179    180   
//!        .query_params_targeting_map_of_length_string_operation(query_params_targeting_map_of_length_string_operation)
  180    181   
//!        .query_params_targeting_map_of_list_of_enum_string_operation(query_params_targeting_map_of_list_of_enum_string_operation)
  181    182   
//!        .query_params_targeting_map_of_list_of_length_pattern_string_operation(query_params_targeting_map_of_list_of_length_pattern_string_operation)
  182    183   
//!        .query_params_targeting_map_of_list_of_length_string_operation(query_params_targeting_map_of_list_of_length_string_operation)
  183    184   
//!        .query_params_targeting_map_of_list_of_pattern_string_operation(query_params_targeting_map_of_list_of_pattern_string_operation)
  184    185   
//!        .query_params_targeting_map_of_pattern_string_operation(query_params_targeting_map_of_pattern_string_operation)
  185    186   
//!        .query_params_targeting_map_of_set_of_length_string_operation(query_params_targeting_map_of_set_of_length_string_operation)
  186    187   
//!        .streaming_blob_operation(streaming_blob_operation)
  187    188   
//!        .build()
  188    189   
//!        .expect("failed to build an instance of ConstraintsService");
  189    190   
//!
  190    191   
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
  191    192   
//!        .expect("unable to parse the server bind address and port");
  192    193   
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
  193    194   
//!    # let server = async { Ok::<_, ()>(()) };
  194    195   
//!
  195    196   
//!    // Run your service!
  196    197   
//!    if let Err(err) = server.await {
  197    198   
//!        eprintln!("server error: {:?}", err);
  198    199   
//!    }
  199    200   
//! }
  200    201   
//!
  201    202   
//! use constraints::{input, output, error};
  202    203   
//!
  203    204   
//! async fn constrained_http_bound_shapes_operation(input: input::ConstrainedHttpBoundShapesOperationInput) -> Result<output::ConstrainedHttpBoundShapesOperationOutput, error::ConstrainedHttpBoundShapesOperationError> {
  204    205   
//!     todo!()
  205    206   
//! }
  206    207   
//!
  207    208   
//! async fn constrained_http_payload_bound_shape_operation(input: input::ConstrainedHttpPayloadBoundShapeOperationInput) -> Result<output::ConstrainedHttpPayloadBoundShapeOperationOutput, error::ConstrainedHttpPayloadBoundShapeOperationError> {
  208    209   
//!     todo!()
  209    210   
//! }
  210    211   
//!
         212  +
//! async fn constrained_list_with_indirectly_constrained_aggregate_operation(input: input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput) -> Result<output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput, error::ConstrainedListWithIndirectlyConstrainedAggregateOperationError> {
         213  +
//!     todo!()
         214  +
//! }
         215  +
//!
  211    216   
//! async fn constrained_recursive_shapes_operation(input: input::ConstrainedRecursiveShapesOperationInput) -> Result<output::ConstrainedRecursiveShapesOperationOutput, error::ConstrainedRecursiveShapesOperationError> {
  212    217   
//!     todo!()
  213    218   
//! }
  214    219   
//!
  215    220   
//! async fn constrained_shapes_only_in_output_operation(input: input::ConstrainedShapesOnlyInOutputOperationInput) -> output::ConstrainedShapesOnlyInOutputOperationOutput {
  216    221   
//!     todo!()
  217    222   
//! }
  218    223   
//!
  219    224   
//! async fn constrained_shapes_operation(input: input::ConstrainedShapesOperationInput) -> Result<output::ConstrainedShapesOperationOutput, error::ConstrainedShapesOperationError> {
  220    225   
//!     todo!()

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

@@ -625,625 +684,826 @@
  645    645   
impl ::std::convert::From<SetOfLengthString> for ::std::vec::Vec<crate::model::LengthString> {
  646    646   
    fn from(value: SetOfLengthString) -> Self {
  647    647   
        value.into_inner()
  648    648   
    }
  649    649   
}
  650    650   
impl crate::constrained::Constrained for SetOfLengthString {
  651    651   
    type Unconstrained =
  652    652   
        crate::unconstrained::set_of_length_string_unconstrained::SetOfLengthStringUnconstrained;
  653    653   
}
  654    654   
         655  +
#[allow(missing_docs)] // documentation missing in model
         656  +
///
         657  +
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
         658  +
/// [constraint traits]. Use [`ListWithIndirectlyConstrainedMap::try_from`] to construct values of this type.
         659  +
///
         660  +
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
         661  +
///
         662  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
         663  +
pub struct ListWithIndirectlyConstrainedMap(
         664  +
    pub(crate)  ::std::vec::Vec<
         665  +
        ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         666  +
    >,
         667  +
);
         668  +
impl ListWithIndirectlyConstrainedMap {
         669  +
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::collections::HashMap::<crate::model::LengthString, crate::model::LengthString>>`].
         670  +
    pub fn inner(
         671  +
        &self,
         672  +
    ) -> &::std::vec::Vec<
         673  +
        ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         674  +
    > {
         675  +
        &self.0
         676  +
    }
         677  +
    /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::collections::HashMap::<crate::model::LengthString, crate::model::LengthString>>`].
         678  +
    pub fn into_inner(
         679  +
        self,
         680  +
    ) -> ::std::vec::Vec<
         681  +
        ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         682  +
    > {
         683  +
        self.0
         684  +
    }
         685  +
         686  +
    fn check_length(
         687  +
        length: usize,
         688  +
    ) -> Result<(), crate::model::list_with_indirectly_constrained_map::ConstraintViolation> {
         689  +
        if (1..=10).contains(&length) {
         690  +
            Ok(())
         691  +
        } else {
         692  +
            Err(
         693  +
                crate::model::list_with_indirectly_constrained_map::ConstraintViolation::Length(
         694  +
                    length,
         695  +
                ),
         696  +
            )
         697  +
        }
         698  +
    }
         699  +
}
         700  +
impl
         701  +
    ::std::convert::TryFrom<
         702  +
        ::std::vec::Vec<
         703  +
            ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         704  +
        >,
         705  +
    > for ListWithIndirectlyConstrainedMap
         706  +
{
         707  +
    type Error = crate::model::list_with_indirectly_constrained_map::ConstraintViolation;
         708  +
         709  +
    /// Constructs a `ListWithIndirectlyConstrainedMap` from an [`::std::vec::Vec<::std::collections::HashMap::<crate::model::LengthString, crate::model::LengthString>>`], failing when the provided value does not satisfy the modeled constraints.
         710  +
    fn try_from(
         711  +
        value: ::std::vec::Vec<
         712  +
            ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         713  +
        >,
         714  +
    ) -> Result<Self, Self::Error> {
         715  +
        Self::check_length(value.len())?;
         716  +
         717  +
        Ok(Self(value))
         718  +
    }
         719  +
}
         720  +
         721  +
impl ::std::convert::From<ListWithIndirectlyConstrainedMap>
         722  +
    for ::std::vec::Vec<
         723  +
        ::std::collections::HashMap<crate::model::LengthString, crate::model::LengthString>,
         724  +
    >
         725  +
{
         726  +
    fn from(value: ListWithIndirectlyConstrainedMap) -> Self {
         727  +
        value.into_inner()
         728  +
    }
         729  +
}
         730  +
impl crate::constrained::Constrained for ListWithIndirectlyConstrainedMap {
         731  +
    type Unconstrained = crate::unconstrained::list_with_indirectly_constrained_map_unconstrained::ListWithIndirectlyConstrainedMapUnconstrained;
         732  +
}
         733  +
         734  +
#[allow(missing_docs)] // documentation missing in model
         735  +
///
         736  +
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
         737  +
/// [constraint traits]. Use [`ListWithIndirectlyConstrainedList::try_from`] to construct values of this type.
         738  +
///
         739  +
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
         740  +
///
         741  +
#[derive(
         742  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         743  +
)]
         744  +
pub struct ListWithIndirectlyConstrainedList(
         745  +
    pub(crate) ::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>>,
         746  +
);
         747  +
impl ListWithIndirectlyConstrainedList {
         748  +
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::vec::Vec::<crate::model::LengthString>>`].
         749  +
    pub fn inner(&self) -> &::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>> {
         750  +
        &self.0
         751  +
    }
         752  +
    /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::vec::Vec::<crate::model::LengthString>>`].
         753  +
    pub fn into_inner(self) -> ::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>> {
         754  +
        self.0
         755  +
    }
         756  +
         757  +
    fn check_length(
         758  +
        length: usize,
         759  +
    ) -> Result<(), crate::model::list_with_indirectly_constrained_list::ConstraintViolation> {
         760  +
        if (1..=10).contains(&length) {
         761  +
            Ok(())
         762  +
        } else {
         763  +
            Err(
         764  +
                crate::model::list_with_indirectly_constrained_list::ConstraintViolation::Length(
         765  +
                    length,
         766  +
                ),
         767  +
            )
         768  +
        }
         769  +
    }
         770  +
}
         771  +
impl ::std::convert::TryFrom<::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>>>
         772  +
    for ListWithIndirectlyConstrainedList
         773  +
{
         774  +
    type Error = crate::model::list_with_indirectly_constrained_list::ConstraintViolation;
         775  +
         776  +
    /// Constructs a `ListWithIndirectlyConstrainedList` from an [`::std::vec::Vec<::std::vec::Vec::<crate::model::LengthString>>`], failing when the provided value does not satisfy the modeled constraints.
         777  +
    fn try_from(
         778  +
        value: ::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>>,
         779  +
    ) -> Result<Self, Self::Error> {
         780  +
        Self::check_length(value.len())?;
         781  +
         782  +
        Ok(Self(value))
         783  +
    }
         784  +
}
         785  +
         786  +
impl ::std::convert::From<ListWithIndirectlyConstrainedList>
         787  +
    for ::std::vec::Vec<::std::vec::Vec<crate::model::LengthString>>
         788  +
{
         789  +
    fn from(value: ListWithIndirectlyConstrainedList) -> Self {
         790  +
        value.into_inner()
         791  +
    }
         792  +
}
         793  +
impl crate::constrained::Constrained for ListWithIndirectlyConstrainedList {
         794  +
    type Unconstrained = crate::unconstrained::list_with_indirectly_constrained_list_unconstrained::ListWithIndirectlyConstrainedListUnconstrained;
         795  +
}
         796  +
  655    797   
#[allow(missing_docs)] // documentation missing in model
  656    798   
#[derive(
  657    799   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  658    800   
)]
  659    801   
pub struct RecursiveShapesInputOutputNested1 {
  660    802   
    #[allow(missing_docs)] // documentation missing in model
  661    803   
    pub recursive_member: ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
  662    804   
}
  663    805   
impl RecursiveShapesInputOutputNested1 {
  664    806   
    #[allow(missing_docs)] // documentation missing in model
@@ -5107,5249 +5166,5486 @@
 5127   5269   
            match self {
 5128   5270   
                Self::Key(key_constraint_violation) => {
 5129   5271   
                    key_constraint_violation.as_validation_exception_field(path)
 5130   5272   
                }
 5131   5273   
                Self::Value(key, value_constraint_violation) => value_constraint_violation
 5132   5274   
                    .as_validation_exception_field(path + "/" + key.as_str()),
 5133   5275   
            }
 5134   5276   
        }
 5135   5277   
    }
 5136   5278   
}
        5279  +
/// See [`ListWithIndirectlyConstrainedMap`](crate::model::ListWithIndirectlyConstrainedMap).
        5280  +
pub mod list_with_indirectly_constrained_map {
        5281  +
        5282  +
    #[allow(clippy::enum_variant_names)]
        5283  +
    #[derive(Debug, PartialEq)]
        5284  +
    pub enum ConstraintViolation {
        5285  +
        /// Constraint violation error when the list doesn't have the required length
        5286  +
        Length(usize),
        5287  +
        /// Constraint violation error when an element doesn't satisfy its own constraints.
        5288  +
        /// The first component of the tuple is the index in the collection where the
        5289  +
        /// first constraint violation was found.
        5290  +
        #[doc(hidden)]
        5291  +
        Member(
        5292  +
            usize,
        5293  +
            crate::model::indirectly_constrained_map::ConstraintViolation,
        5294  +
        ),
        5295  +
    }
        5296  +
        5297  +
    impl ::std::fmt::Display for ConstraintViolation {
        5298  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        5299  +
            let message = match self {
        5300  +
                Self::Length(length) => {
        5301  +
                    format!("Value with length {} provided for 'com.amazonaws.constraints#ListWithIndirectlyConstrainedMap' failed to satisfy constraint: Member must have length between 1 and 10, inclusive", length)
        5302  +
                }
        5303  +
                Self::Member(index, failing_member) => format!(
        5304  +
                    "Value at index {index} failed to satisfy constraint. {}",
        5305  +
                    failing_member
        5306  +
                ),
        5307  +
            };
        5308  +
            write!(f, "{message}")
        5309  +
        }
        5310  +
    }
        5311  +
        5312  +
    impl ::std::error::Error for ConstraintViolation {}
        5313  +
    impl ConstraintViolation {
        5314  +
        pub(crate) fn as_validation_exception_field(
        5315  +
            self,
        5316  +
            path: ::std::string::String,
        5317  +
        ) -> crate::model::ValidationExceptionField {
        5318  +
            match self {
        5319  +
                        Self::Length(length) => crate::model::ValidationExceptionField {
        5320  +
                                message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 1 and 10, inclusive", length, &path),
        5321  +
                                path,
        5322  +
                            },
        5323  +
    Self::Member(index, member_constraint_violation) =>
        5324  +
                        member_constraint_violation.as_validation_exception_field(path + "/" + &index.to_string())
        5325  +
                    }
        5326  +
        }
        5327  +
    }
        5328  +
}
        5329  +
pub mod indirectly_constrained_map {
        5330  +
        5331  +
    #[allow(clippy::enum_variant_names)]
        5332  +
    #[derive(Debug, PartialEq)]
        5333  +
    pub enum ConstraintViolation {
        5334  +
        #[doc(hidden)]
        5335  +
        Key(crate::model::length_string::ConstraintViolation),
        5336  +
        #[doc(hidden)]
        5337  +
        Value(
        5338  +
            crate::model::LengthString,
        5339  +
            crate::model::length_string::ConstraintViolation,
        5340  +
        ),
        5341  +
    }
        5342  +
        5343  +
    impl ::std::fmt::Display for ConstraintViolation {
        5344  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        5345  +
            match self {
        5346  +
                Self::Key(key_constraint_violation) => write!(f, "{}", key_constraint_violation),
        5347  +
                Self::Value(_, value_constraint_violation) => {
        5348  +
                    write!(f, "{}", value_constraint_violation)
        5349  +
                }
        5350  +
            }
        5351  +
        }
        5352  +
    }
        5353  +
        5354  +
    impl ::std::error::Error for ConstraintViolation {}
        5355  +
    impl ConstraintViolation {
        5356  +
        pub(crate) fn as_validation_exception_field(
        5357  +
            self,
        5358  +
            path: ::std::string::String,
        5359  +
        ) -> crate::model::ValidationExceptionField {
        5360  +
            match self {
        5361  +
                Self::Key(key_constraint_violation) => {
        5362  +
                    key_constraint_violation.as_validation_exception_field(path)
        5363  +
                }
        5364  +
                Self::Value(key, value_constraint_violation) => value_constraint_violation
        5365  +
                    .as_validation_exception_field(path + "/" + key.as_str()),
        5366  +
            }
        5367  +
        }
        5368  +
    }
        5369  +
}
        5370  +
/// See [`ListWithIndirectlyConstrainedList`](crate::model::ListWithIndirectlyConstrainedList).
        5371  +
pub mod list_with_indirectly_constrained_list {
        5372  +
        5373  +
    #[allow(clippy::enum_variant_names)]
        5374  +
    #[derive(Debug, PartialEq)]
        5375  +
    pub enum ConstraintViolation {
        5376  +
        /// Constraint violation error when the list doesn't have the required length
        5377  +
        Length(usize),
        5378  +
        /// Constraint violation error when an element doesn't satisfy its own constraints.
        5379  +
        /// The first component of the tuple is the index in the collection where the
        5380  +
        /// first constraint violation was found.
        5381  +
        #[doc(hidden)]
        5382  +
        Member(
        5383  +
            usize,
        5384  +
            crate::model::indirectly_constrained_list::ConstraintViolation,
        5385  +
        ),
        5386  +
    }
        5387  +
        5388  +
    impl ::std::fmt::Display for ConstraintViolation {
        5389  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        5390  +
            let message = match self {
        5391  +
                Self::Length(length) => {
        5392  +
                    format!("Value with length {} provided for 'com.amazonaws.constraints#ListWithIndirectlyConstrainedList' failed to satisfy constraint: Member must have length between 1 and 10, inclusive", length)
        5393  +
                }
        5394  +
                Self::Member(index, failing_member) => format!(
        5395  +
                    "Value at index {index} failed to satisfy constraint. {}",
        5396  +
                    failing_member
        5397  +
                ),
        5398  +
            };
        5399  +
            write!(f, "{message}")
        5400  +
        }
        5401  +
    }
        5402  +
        5403  +
    impl ::std::error::Error for ConstraintViolation {}
        5404  +
    impl ConstraintViolation {
        5405  +
        pub(crate) fn as_validation_exception_field(
        5406  +
            self,
        5407  +
            path: ::std::string::String,
        5408  +
        ) -> crate::model::ValidationExceptionField {
        5409  +
            match self {
        5410  +
                        Self::Length(length) => crate::model::ValidationExceptionField {
        5411  +
                                message: format!("Value with length {} at '{}' failed to satisfy constraint: Member must have length between 1 and 10, inclusive", length, &path),
        5412  +
                                path,
        5413  +
                            },
        5414  +
    Self::Member(index, member_constraint_violation) =>
        5415  +
                        member_constraint_violation.as_validation_exception_field(path + "/" + &index.to_string())
        5416  +
                    }
        5417  +
        }
        5418  +
    }
        5419  +
}
        5420  +
pub mod indirectly_constrained_list {
        5421  +
        5422  +
    #[allow(clippy::enum_variant_names)]
        5423  +
    #[derive(Debug, PartialEq)]
        5424  +
    pub enum ConstraintViolation {
        5425  +
        /// Constraint violation error when an element doesn't satisfy its own constraints.
        5426  +
        /// The first component of the tuple is the index in the collection where the
        5427  +
        /// first constraint violation was found.
        5428  +
        #[doc(hidden)]
        5429  +
        Member(usize, crate::model::length_string::ConstraintViolation),
        5430  +
    }
        5431  +
        5432  +
    impl ::std::fmt::Display for ConstraintViolation {
        5433  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        5434  +
            let message = match self {
        5435  +
                Self::Member(index, failing_member) => format!(
        5436  +
                    "Value at index {index} failed to satisfy constraint. {}",
        5437  +
                    failing_member
        5438  +
                ),
        5439  +
            };
        5440  +
            write!(f, "{message}")
        5441  +
        }
        5442  +
    }
        5443  +
        5444  +
    impl ::std::error::Error for ConstraintViolation {}
        5445  +
    impl ConstraintViolation {
        5446  +
        pub(crate) fn as_validation_exception_field(
        5447  +
            self,
        5448  +
            path: ::std::string::String,
        5449  +
        ) -> crate::model::ValidationExceptionField {
        5450  +
            match self {
        5451  +
                Self::Member(index, member_constraint_violation) => member_constraint_violation
        5452  +
                    .as_validation_exception_field(path + "/" + &index.to_string()),
        5453  +
            }
        5454  +
        }
        5455  +
    }
        5456  +
}
 5137   5457   
pub mod recursive_list {
 5138   5458   
 5139   5459   
    #[allow(clippy::enum_variant_names)]
 5140   5460   
    #[derive(Debug, PartialEq)]
 5141   5461   
    pub enum ConstraintViolation {
 5142   5462   
        /// Constraint violation error when an element doesn't satisfy its own constraints.
 5143   5463   
        /// The first component of the tuple is the index in the collection where the
 5144   5464   
        /// first constraint violation was found.
 5145   5465   
        #[doc(hidden)]
 5146   5466   
        Member(

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

@@ -1451,1451 +1510,1611 @@
 1471   1471   
                response
 1472   1472   
            },
 1473   1473   
            Err(e) => {
 1474   1474   
                ::tracing::error!(error = %e, "failed to serialize response");
 1475   1475   
                ::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))
 1476   1476   
            }
 1477   1477   
        }
 1478   1478   
    }
 1479   1479   
}
 1480   1480   
        1481  +
const CONTENT_TYPE_CONSTRAINEDLISTWITHINDIRECTLYCONSTRAINEDAGGREGATEOPERATION: ::mime::Mime =
        1482  +
    ::mime::APPLICATION_JSON;
        1483  +
::pin_project_lite::pin_project! {
        1484  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
        1485  +
    /// [`ConstrainedListWithIndirectlyConstrainedAggregateOperationInput`](crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput) using modelled bindings.
        1486  +
    pub struct ConstrainedListWithIndirectlyConstrainedAggregateOperationInputFuture {
        1487  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
        1488  +
    }
        1489  +
}
        1490  +
        1491  +
impl std::future::Future for ConstrainedListWithIndirectlyConstrainedAggregateOperationInputFuture {
        1492  +
    type Output = Result<
        1493  +
        crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput,
        1494  +
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
        1495  +
    >;
        1496  +
        1497  +
    fn poll(
        1498  +
        self: std::pin::Pin<&mut Self>,
        1499  +
        cx: &mut std::task::Context<'_>,
        1500  +
    ) -> std::task::Poll<Self::Output> {
        1501  +
        let this = self.project();
        1502  +
        this.inner.as_mut().poll(cx)
        1503  +
    }
        1504  +
}
        1505  +
        1506  +
impl<B>
        1507  +
    ::aws_smithy_http_server::request::FromRequest<
        1508  +
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
        1509  +
        B,
        1510  +
    > for crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput
        1511  +
where
        1512  +
    B: ::aws_smithy_http_server::body::HttpBody + Send,
        1513  +
    B: 'static,
        1514  +
        1515  +
    B::Data: Send,
        1516  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
        1517  +
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
        1518  +
{
        1519  +
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
        1520  +
    type Future = ConstrainedListWithIndirectlyConstrainedAggregateOperationInputFuture;
        1521  +
        1522  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
        1523  +
        let fut = async move {
        1524  +
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
        1525  +
                request.headers(),
        1526  +
                &CONTENT_TYPE_CONSTRAINEDLISTWITHINDIRECTLYCONSTRAINEDAGGREGATEOPERATION,
        1527  +
            ) {
        1528  +
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
        1529  +
            }
        1530  +
            crate::protocol_serde::shape_constrained_list_with_indirectly_constrained_aggregate_operation::de_constrained_list_with_indirectly_constrained_aggregate_operation_http_request(request)
        1531  +
                            .await
        1532  +
                            .map_err(Into::into)
        1533  +
        };
        1534  +
        use ::futures_util::future::TryFutureExt;
        1535  +
        let fut = fut.map_err(
        1536  +
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
        1537  +
                ::tracing::debug!(error = %e, "failed to deserialize request");
        1538  +
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
        1539  +
                    e,
        1540  +
                )
        1541  +
            },
        1542  +
        );
        1543  +
        ConstrainedListWithIndirectlyConstrainedAggregateOperationInputFuture {
        1544  +
            inner: Box::pin(fut),
        1545  +
        }
        1546  +
    }
        1547  +
}
        1548  +
impl
        1549  +
    ::aws_smithy_http_server::response::IntoResponse<
        1550  +
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
        1551  +
    > for crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput
        1552  +
{
        1553  +
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
        1554  +
        match crate::protocol_serde::shape_constrained_list_with_indirectly_constrained_aggregate_operation::ser_constrained_list_with_indirectly_constrained_aggregate_operation_http_response(self) {
        1555  +
                        Ok(response) => response,
        1556  +
                        Err(e) => {
        1557  +
                            ::tracing::error!(error = %e, "failed to serialize response");
        1558  +
                            ::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))
        1559  +
                        }
        1560  +
                    }
        1561  +
    }
        1562  +
}
        1563  +
impl
        1564  +
    ::aws_smithy_http_server::response::IntoResponse<
        1565  +
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
        1566  +
    > for crate::error::ConstrainedListWithIndirectlyConstrainedAggregateOperationError
        1567  +
{
        1568  +
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
        1569  +
        match crate::protocol_serde::shape_constrained_list_with_indirectly_constrained_aggregate_operation::ser_constrained_list_with_indirectly_constrained_aggregate_operation_http_error(&self) {
        1570  +
            Ok(mut response) => {
        1571  +
                response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
        1572  +
                response
        1573  +
            },
        1574  +
            Err(e) => {
        1575  +
                ::tracing::error!(error = %e, "failed to serialize response");
        1576  +
                ::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))
        1577  +
            }
        1578  +
        }
        1579  +
    }
        1580  +
}
        1581  +
 1481   1582   
const CONTENT_TYPE_CONSTRAINEDRECURSIVESHAPESOPERATION: ::mime::Mime = ::mime::APPLICATION_JSON;
 1482   1583   
::pin_project_lite::pin_project! {
 1483   1584   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1484   1585   
    /// [`ConstrainedRecursiveShapesOperationInput`](crate::input::ConstrainedRecursiveShapesOperationInput) using modelled bindings.
 1485   1586   
    pub struct ConstrainedRecursiveShapesOperationInputFuture {
 1486   1587   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ConstrainedRecursiveShapesOperationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1487   1588   
    }
 1488   1589   
}
 1489   1590   
 1490   1591   
impl std::future::Future for ConstrainedRecursiveShapesOperationInputFuture {

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

@@ -594,594 +653,695 @@
  614    614   
  615    615   
    fn request_fmt() -> Self::RequestFmt {
  616    616   
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
  617    617   
    }
  618    618   
  619    619   
    fn response_fmt() -> Self::ResponseFmt {
  620    620   
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
  621    621   
    }
  622    622   
}
  623    623   
         624  +
#[allow(missing_docs)] // documentation missing in model
         625  +
pub struct ConstrainedListWithIndirectlyConstrainedAggregateOperation;
         626  +
         627  +
impl ::aws_smithy_http_server::operation::OperationShape
         628  +
    for ConstrainedListWithIndirectlyConstrainedAggregateOperation
         629  +
{
         630  +
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
         631  +
        ::aws_smithy_http_server::shape_id::ShapeId::new(
         632  +
            "com.amazonaws.constraints#ConstrainedListWithIndirectlyConstrainedAggregateOperation",
         633  +
            "com.amazonaws.constraints",
         634  +
            "ConstrainedListWithIndirectlyConstrainedAggregateOperation",
         635  +
        );
         636  +
         637  +
    type Input = crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput;
         638  +
    type Output = crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput;
         639  +
    type Error = crate::error::ConstrainedListWithIndirectlyConstrainedAggregateOperationError;
         640  +
}
         641  +
         642  +
impl ::aws_smithy_http_server::instrumentation::sensitivity::Sensitivity
         643  +
    for ConstrainedListWithIndirectlyConstrainedAggregateOperation
         644  +
{
         645  +
    type RequestFmt = ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt<
         646  +
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
         647  +
        ::aws_smithy_http_server::instrumentation::sensitivity::uri::MakeUri<
         648  +
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
         649  +
            ::aws_smithy_http_server::instrumentation::MakeIdentity,
         650  +
        >,
         651  +
    >;
         652  +
    type ResponseFmt = ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt<
         653  +
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
         654  +
        ::aws_smithy_http_server::instrumentation::MakeIdentity,
         655  +
    >;
         656  +
         657  +
    fn request_fmt() -> Self::RequestFmt {
         658  +
        ::aws_smithy_http_server::instrumentation::sensitivity::RequestFmt::new()
         659  +
    }
         660  +
         661  +
    fn response_fmt() -> Self::ResponseFmt {
         662  +
        ::aws_smithy_http_server::instrumentation::sensitivity::ResponseFmt::new()
         663  +
    }
         664  +
}
         665  +
  624    666   
#[allow(missing_docs)] // documentation missing in model
  625    667   
pub struct ConstrainedRecursiveShapesOperation;
  626    668   
  627    669   
impl ::aws_smithy_http_server::operation::OperationShape for ConstrainedRecursiveShapesOperation {
  628    670   
    const ID: ::aws_smithy_http_server::shape_id::ShapeId =
  629    671   
        ::aws_smithy_http_server::shape_id::ShapeId::new(
  630    672   
            "com.amazonaws.constraints#ConstrainedRecursiveShapesOperation",
  631    673   
            "com.amazonaws.constraints",
  632    674   
            "ConstrainedRecursiveShapesOperation",
  633    675   
        );

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

@@ -378,378 +437,462 @@
  398    398   
        self.length_map.as_ref()
  399    399   
    }
  400    400   
}
  401    401   
impl QueryParamsTargetingLengthMapOperationOutput {
  402    402   
    /// Creates a new builder-style object to manufacture [`QueryParamsTargetingLengthMapOperationOutput`](crate::output::QueryParamsTargetingLengthMapOperationOutput).
  403    403   
    pub fn builder() -> crate::output::query_params_targeting_length_map_operation_output::Builder {
  404    404   
        crate::output::query_params_targeting_length_map_operation_output::Builder::default()
  405    405   
    }
  406    406   
}
  407    407   
         408  +
#[allow(missing_docs)] // documentation missing in model
         409  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
         410  +
pub struct ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput {
         411  +
    #[allow(missing_docs)] // documentation missing in model
         412  +
    pub a: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedList>,
         413  +
    #[allow(missing_docs)] // documentation missing in model
         414  +
    pub b: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedMap>,
         415  +
}
         416  +
impl ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput {
         417  +
    #[allow(missing_docs)] // documentation missing in model
         418  +
    pub fn a(&self) -> ::std::option::Option<&crate::model::ListWithIndirectlyConstrainedList> {
         419  +
        self.a.as_ref()
         420  +
    }
         421  +
    #[allow(missing_docs)] // documentation missing in model
         422  +
    pub fn b(&self) -> ::std::option::Option<&crate::model::ListWithIndirectlyConstrainedMap> {
         423  +
        self.b.as_ref()
         424  +
    }
         425  +
}
         426  +
impl ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput {
         427  +
    /// Creates a new builder-style object to manufacture [`ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput`](crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput).
         428  +
    pub fn builder() -> crate::output::constrained_list_with_indirectly_constrained_aggregate_operation_output::Builder{
         429  +
        crate::output::constrained_list_with_indirectly_constrained_aggregate_operation_output::Builder::default()
         430  +
    }
         431  +
}
         432  +
  408    433   
#[allow(missing_docs)] // documentation missing in model
  409    434   
#[derive(
  410    435   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  411    436   
)]
  412    437   
pub struct ConstrainedRecursiveShapesOperationOutput {
  413    438   
    #[allow(missing_docs)] // documentation missing in model
  414    439   
    pub nested: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
  415    440   
    #[allow(missing_docs)] // documentation missing in model
  416    441   
    pub recursive_list: ::std::vec::Vec<crate::model::RecursiveShapesInputOutputNested1>,
  417    442   
}
@@ -1442,1467 +1501,1577 @@
 1462   1487   
        }
 1463   1488   
        fn build_enforcing_all_constraints(
 1464   1489   
            self,
 1465   1490   
        ) -> crate::output::QueryParamsTargetingLengthMapOperationOutput {
 1466   1491   
            crate::output::QueryParamsTargetingLengthMapOperationOutput {
 1467   1492   
                length_map: self.length_map,
 1468   1493   
            }
 1469   1494   
        }
 1470   1495   
    }
 1471   1496   
}
        1497  +
/// See [`ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput`](crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput).
        1498  +
pub mod constrained_list_with_indirectly_constrained_aggregate_operation_output {
        1499  +
        1500  +
    impl ::std::convert::From<Builder>
        1501  +
        for crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput
        1502  +
    {
        1503  +
        fn from(builder: Builder) -> Self {
        1504  +
            builder.build()
        1505  +
        }
        1506  +
    }
        1507  +
    /// A builder for [`ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput`](crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput).
        1508  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1509  +
    pub struct Builder {
        1510  +
        pub(crate) a: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedList>,
        1511  +
        pub(crate) b: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedMap>,
        1512  +
    }
        1513  +
    impl Builder {
        1514  +
        #[allow(missing_docs)] // documentation missing in model
        1515  +
        pub fn a(
        1516  +
            mut self,
        1517  +
            input: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedList>,
        1518  +
        ) -> Self {
        1519  +
            self.a = input;
        1520  +
            self
        1521  +
        }
        1522  +
        #[allow(missing_docs)] // documentation missing in model
        1523  +
        pub fn b(
        1524  +
            mut self,
        1525  +
            input: ::std::option::Option<crate::model::ListWithIndirectlyConstrainedMap>,
        1526  +
        ) -> Self {
        1527  +
            self.b = input;
        1528  +
            self
        1529  +
        }
        1530  +
        /// Consumes the builder and constructs a [`ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput`](crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput).
        1531  +
        pub fn build(
        1532  +
            self,
        1533  +
        ) -> crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput
        1534  +
        {
        1535  +
            self.build_enforcing_all_constraints()
        1536  +
        }
        1537  +
        fn build_enforcing_all_constraints(
        1538  +
            self,
        1539  +
        ) -> crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput
        1540  +
        {
        1541  +
            crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput {
        1542  +
                a: self.a,
        1543  +
                b: self.b,
        1544  +
            }
        1545  +
        }
        1546  +
    }
        1547  +
}
 1472   1548   
/// See [`ConstrainedRecursiveShapesOperationOutput`](crate::output::ConstrainedRecursiveShapesOperationOutput).
 1473   1549   
pub mod constrained_recursive_shapes_operation_output {
 1474   1550   
 1475   1551   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 1476   1552   
    /// Holds one variant for each of the ways the builder can fail.
 1477   1553   
    #[non_exhaustive]
 1478   1554   
    #[allow(clippy::enum_variant_names)]
 1479   1555   
    pub enum ConstraintViolation {
 1480   1556   
        /// `recursive_list` was not provided but it is required when building `ConstrainedRecursiveShapesOperationOutput`.
 1481   1557   
        MissingRecursiveList,

tmp-codegen-diff/codegen-server-test/constraints/rust-server-codegen/src/protocol_serde.rs

@@ -1,1 +155,167 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub(crate) mod shape_constrained_http_bound_shapes_operation;
    3      3   
    4      4   
pub(crate) mod shape_constrained_http_payload_bound_shape_operation;
    5      5   
           6  +
pub(crate) mod shape_constrained_list_with_indirectly_constrained_aggregate_operation;
           7  +
    6      8   
pub(crate) mod shape_constrained_recursive_shapes_operation;
    7      9   
    8     10   
pub(crate) mod shape_constrained_shapes_only_in_output_operation;
    9     11   
   10     12   
pub(crate) mod shape_constrained_shapes_operation;
   11     13   
   12     14   
pub(crate) mod shape_event_streams_operation;
   13     15   
   14     16   
pub(crate) mod shape_http_prefix_headers_targeting_length_map_operation;
   15     17   
   16     18   
pub(crate) mod shape_non_streaming_blob_operation;
   17     19   
   18     20   
pub(crate) mod shape_query_params_targeting_length_map_operation;
   19     21   
   20     22   
pub(crate) mod shape_query_params_targeting_map_of_enum_string_operation;
   21     23   
   22     24   
pub(crate) mod shape_query_params_targeting_map_of_length_list_of_pattern_string_operation;
   23     25   
   24     26   
pub(crate) mod shape_query_params_targeting_map_of_length_pattern_string_operation;
   25     27   
   26     28   
pub(crate) mod shape_query_params_targeting_map_of_length_string_operation;
   27     29   
   28     30   
pub(crate) mod shape_query_params_targeting_map_of_list_of_enum_string_operation;
   29     31   
   30     32   
pub(crate) mod shape_query_params_targeting_map_of_list_of_length_pattern_string_operation;
   31     33   
   32     34   
pub(crate) mod shape_query_params_targeting_map_of_list_of_length_string_operation;
   33     35   
   34     36   
pub(crate) mod shape_query_params_targeting_map_of_list_of_pattern_string_operation;
   35     37   
   36     38   
pub(crate) mod shape_query_params_targeting_map_of_pattern_string_operation;
   37     39   
   38     40   
pub(crate) mod shape_query_params_targeting_map_of_set_of_length_string_operation;
   39     41   
   40     42   
pub(crate) mod shape_streaming_blob_operation;
   41     43   
   42     44   
pub(crate) mod shape_constrained_http_bound_shapes_operation_input;
   43     45   
   44     46   
pub(crate) mod shape_constrained_http_bound_shapes_operation_output;
   45     47   
   46     48   
pub(crate) mod shape_constrained_http_payload_bound_shape_operation_input;
   47     49   
   48     50   
pub(crate) mod shape_constrained_http_payload_bound_shape_operation_output;
   49     51   
   50     52   
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   51     53   
    if data.is_empty() {
   52     54   
        b"{}"
   53     55   
    } else {
   54     56   
        data
   55     57   
    }
   56     58   
}
   57     59   
          60  +
pub(crate) mod shape_constrained_list_with_indirectly_constrained_aggregate_operation_output;
          61  +
   58     62   
pub(crate) mod shape_constrained_recursive_shapes_operation_output;
   59     63   
   60     64   
pub(crate) mod shape_constrained_shapes_only_in_output_operation_output;
   61     65   
   62     66   
pub(crate) mod shape_constrained_shapes_operation_output;
   63     67   
   64     68   
pub(crate) mod shape_event_stream_error_message;
   65     69   
   66     70   
pub(crate) mod shape_event_streams_operation_input;
   67     71   
   68     72   
pub(crate) mod shape_http_prefix_headers_targeting_length_map_operation_input;
   69     73   
   70     74   
pub(crate) mod shape_http_prefix_headers_targeting_length_map_operation_output;
   71     75   
   72     76   
pub(crate) mod shape_non_streaming_blob_operation_input;
   73     77   
   74     78   
pub(crate) mod shape_non_streaming_blob_operation_output;
   75     79   
   76     80   
pub(crate) mod shape_query_params_targeting_length_map_operation_output;
   77     81   
   78     82   
pub(crate) mod shape_query_params_targeting_map_of_enum_string_operation_output;
   79     83   
   80     84   
pub(crate) mod shape_query_params_targeting_map_of_length_list_of_pattern_string_operation_output;
   81     85   
   82     86   
pub(crate) mod shape_query_params_targeting_map_of_length_pattern_string_operation_output;
   83     87   
   84     88   
pub(crate) mod shape_query_params_targeting_map_of_length_string_operation_output;
   85     89   
   86     90   
pub(crate) mod shape_query_params_targeting_map_of_list_of_enum_string_operation_output;
   87     91   
   88     92   
pub(crate) mod shape_query_params_targeting_map_of_list_of_length_pattern_string_operation_output;
   89     93   
   90     94   
pub(crate) mod shape_query_params_targeting_map_of_list_of_length_string_operation_output;
   91     95   
   92     96   
pub(crate) mod shape_query_params_targeting_map_of_list_of_pattern_string_operation_output;
   93     97   
   94     98   
pub(crate) mod shape_query_params_targeting_map_of_pattern_string_operation_output;
   95     99   
   96    100   
pub(crate) mod shape_query_params_targeting_map_of_set_of_length_string_operation_output;
   97    101   
   98    102   
pub(crate) mod shape_streaming_blob_operation_input;
   99    103   
  100    104   
pub(crate) mod shape_streaming_blob_operation_output;
  101    105   
  102    106   
pub(crate) mod shape_validation_exception;
  103    107   
  104    108   
pub(crate) mod shape_con_a;
  105    109   
  106    110   
pub(crate) mod shape_event;
  107    111   
         112  +
pub(crate) mod shape_list_with_indirectly_constrained_list;
         113  +
         114  +
pub(crate) mod shape_list_with_indirectly_constrained_map;
         115  +
  108    116   
pub(crate) mod shape_recursive_list;
  109    117   
  110    118   
pub(crate) mod shape_recursive_shapes_input_output_nested1;
  111    119   
  112    120   
pub(crate) mod shape_con_b;
  113    121   
  114    122   
pub(crate) mod shape_con_b_list;
  115    123   
  116    124   
pub(crate) mod shape_con_b_map;
  117    125   
  118    126   
pub(crate) mod shape_con_b_set;
  119    127   
  120    128   
pub(crate) mod shape_constrained_union;
  121    129   
  122    130   
pub(crate) mod shape_constrained_union_in_output;
  123    131   
  124    132   
pub(crate) mod shape_event_stream_regular_message;
  125    133   
         134  +
pub(crate) mod shape_indirectly_constrained_list;
         135  +
         136  +
pub(crate) mod shape_indirectly_constrained_map;
         137  +
  126    138   
pub(crate) mod shape_length_list;
  127    139   
  128    140   
pub(crate) mod shape_length_list_of_pattern_string;
  129    141   
  130    142   
pub(crate) mod shape_length_map;
  131    143   
  132    144   
pub(crate) mod shape_length_set_of_pattern_string;
  133    145   
  134    146   
pub(crate) mod shape_list_of_length_blob;
  135    147   

tmp-codegen-diff/codegen-server-test/constraints/rust-server-codegen/src/protocol_serde/shape_constrained_list_with_indirectly_constrained_aggregate_operation.rs

@@ -0,1 +0,145 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_constrained_list_with_indirectly_constrained_aggregate_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ConstrainedListWithIndirectlyConstrainedAggregateOperationInput,
           7  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::constrained_list_with_indirectly_constrained_aggregate_operation_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/json"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_constrained_list_with_indirectly_constrained_aggregate_operation::de_constrained_list_with_indirectly_constrained_aggregate_operation(bytes.as_ref(), input)?;
          29  +
        }
          30  +
        input.build()?
          31  +
    })
          32  +
}
          33  +
          34  +
#[allow(clippy::unnecessary_wraps)]
          35  +
pub fn ser_constrained_list_with_indirectly_constrained_aggregate_operation_http_response(
          36  +
    #[allow(unused_variables)]
          37  +
    output: crate::output::ConstrainedListWithIndirectlyConstrainedAggregateOperationOutput,
          38  +
) -> std::result::Result<
          39  +
    ::aws_smithy_http_server::response::Response,
          40  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          41  +
> {
          42  +
    Ok({
          43  +
        #[allow(unused_mut)]
          44  +
        let mut builder = ::http::Response::builder();
          45  +
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          46  +
            builder,
          47  +
            ::http::header::CONTENT_TYPE,
          48  +
            "application/json",
          49  +
        );
          50  +
        let http_status: u16 = 200;
          51  +
        builder = builder.status(http_status);
          52  +
        let payload =
          53  +
            crate::protocol_serde::shape_constrained_list_with_indirectly_constrained_aggregate_operation_output::ser_constrained_list_with_indirectly_constrained_aggregate_operation_output_output_output(&output)?
          54  +
        ;
          55  +
        let content_length = payload.len();
          56  +
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          57  +
            builder,
          58  +
            ::http::header::CONTENT_LENGTH,
          59  +
            content_length,
          60  +
        );
          61  +
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          62  +
        builder.body(body)?
          63  +
    })
          64  +
}
          65  +
          66  +
#[allow(clippy::unnecessary_wraps)]
          67  +
pub fn ser_constrained_list_with_indirectly_constrained_aggregate_operation_http_error(
          68  +
    error: &crate::error::ConstrainedListWithIndirectlyConstrainedAggregateOperationError,
          69  +
) -> std::result::Result<
          70  +
    ::aws_smithy_http_server::response::Response,
          71  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          72  +
> {
          73  +
    Ok({
          74  +
        match error {
          75  +
            crate::error::ConstrainedListWithIndirectlyConstrainedAggregateOperationError::ValidationException(output) => {
          76  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          77  +
                #[allow(unused_mut)]
          78  +
                let mut builder = ::http::Response::builder();
          79  +
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          80  +
                                builder,
          81  +
                                ::http::header::CONTENT_TYPE,
          82  +
                                "application/json",
          83  +
                            );
          84  +
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          85  +
                                builder,
          86  +
                                ::http::header::HeaderName::from_static("x-amzn-errortype"),
          87  +
                                "ValidationException",
          88  +
                            );
          89  +
                let content_length = payload.len();
          90  +
                            builder = ::aws_smithy_http::header::set_response_header_if_absent(builder, ::http::header::CONTENT_LENGTH, content_length);
          91  +
                builder.status(400).body(::aws_smithy_http_server::body::to_boxed(payload))?
          92  +
            }
          93  +
        }
          94  +
    })
          95  +
}
          96  +
          97  +
pub(crate) fn de_constrained_list_with_indirectly_constrained_aggregate_operation(
          98  +
    value: &[u8],
          99  +
    mut builder: crate::input::constrained_list_with_indirectly_constrained_aggregate_operation_input::Builder,
         100  +
) -> Result<
         101  +
    crate::input::constrained_list_with_indirectly_constrained_aggregate_operation_input::Builder,
         102  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
         103  +
> {
         104  +
    let mut tokens_owned =
         105  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
         106  +
            .peekable();
         107  +
    let tokens = &mut tokens_owned;
         108  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    loop {
         110  +
        match tokens.next().transpose()? {
         111  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         112  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         113  +
                match key.to_unescaped()?.as_ref() {
         114  +
                    "a" => {
         115  +
                        builder = builder.set_a(
         116  +
                            crate::protocol_serde::shape_list_with_indirectly_constrained_list::de_list_with_indirectly_constrained_list(tokens)?
         117  +
                        );
         118  +
                    }
         119  +
                    "b" => {
         120  +
                        builder = builder.set_b(
         121  +
                            crate::protocol_serde::shape_list_with_indirectly_constrained_map::de_list_with_indirectly_constrained_map(tokens)?
         122  +
                        );
         123  +
                    }
         124  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         125  +
                }
         126  +
            }
         127  +
            other => {
         128  +
                return Err(
         129  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         130  +
                        "expected object key or end object, found: {:?}",
         131  +
                        other
         132  +
                    )),
         133  +
                )
         134  +
            }
         135  +
        }
         136  +
    }
         137  +
    if tokens.next().is_some() {
         138  +
        return Err(
         139  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         140  +
                "found more JSON tokens after completing parsing",
         141  +
            ),
         142  +
        );
         143  +
    }
         144  +
    Ok(builder)
         145  +
}