Server Test Python

Server Test Python

rev. 0b749be6d000fdc7ef59d1bc26f1dce00358d95c

Files changed:

tmp-codegen-diff/codegen-server-test-python/json_rpc11/rust-server-codegen-python/src/service.rs

@@ -1,1 +57,208 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
/// The service builder for [`JsonProtocol`].
    3      3   
///
    4      4   
/// Constructed via [`JsonProtocol::builder`].
    5      5   
pub struct JsonProtocolBuilder<Body, L, HttpPl, ModelPl> {
           6  +
    content_type_parameters: Option<::aws_smithy_http_server::routing::Route<Body>>,
    6      7   
    datetime_offsets: Option<::aws_smithy_http_server::routing::Route<Body>>,
    7      8   
    empty_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
    8      9   
    endpoint_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
    9     10   
    endpoint_with_host_label_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
   10     11   
    fractional_seconds: Option<::aws_smithy_http_server::routing::Route<Body>>,
   11     12   
    greeting_with_errors: Option<::aws_smithy_http_server::routing::Route<Body>>,
   12     13   
    host_with_path_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
   13     14   
    json_enums: Option<::aws_smithy_http_server::routing::Route<Body>>,
   14     15   
    json_unions: Option<::aws_smithy_http_server::routing::Route<Body>>,
   15     16   
    kitchen_sink_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
   16     17   
    null_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
   17     18   
    operation_with_optional_input_output: Option<::aws_smithy_http_server::routing::Route<Body>>,
   18     19   
    put_and_get_inline_documents: Option<::aws_smithy_http_server::routing::Route<Body>>,
   19     20   
    put_with_content_encoding: Option<::aws_smithy_http_server::routing::Route<Body>>,
   20     21   
    simple_scalar_properties: Option<::aws_smithy_http_server::routing::Route<Body>>,
   21     22   
    sparse_nulls_operation: Option<::aws_smithy_http_server::routing::Route<Body>>,
   22     23   
    layer: L,
   23     24   
    http_plugin: HttpPl,
   24     25   
    model_plugin: ModelPl,
   25     26   
}
   26     27   
   27     28   
impl<Body, L, HttpPl, ModelPl> JsonProtocolBuilder<Body, L, HttpPl, ModelPl> {
          29  +
    /// Sets the [`ContentTypeParameters`](crate::operation_shape::ContentTypeParameters) operation.
          30  +
    ///
          31  +
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
          32  +
    /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
          33  +
    ///
          34  +
    /// # Example
          35  +
    ///
          36  +
    /// ```no_run
          37  +
    /// use json_rpc11::{JsonProtocol, JsonProtocolConfig};
          38  +
    ///
          39  +
    /// use json_rpc11::{input, output, error};
          40  +
    ///
          41  +
    /// async fn handler(input: input::ContentTypeParametersInput) -> Result<output::ContentTypeParametersOutput, error::ContentTypeParametersError> {
          42  +
    ///     todo!()
          43  +
    /// }
          44  +
    ///
          45  +
    /// let config = JsonProtocolConfig::builder().build();
          46  +
    /// let app = JsonProtocol::builder(config)
          47  +
    ///     .content_type_parameters(handler)
          48  +
    ///     /* Set other handlers */
          49  +
    ///     .build()
          50  +
    ///     .unwrap();
          51  +
    /// # let app: JsonProtocol<::aws_smithy_http_server::routing::RoutingService<::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_http_server::routing::Route>, ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
          52  +
    /// ```
          53  +
    ///
          54  +
                    pub fn content_type_parameters<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
          55  +
                    where
          56  +
                        HandlerType: ::aws_smithy_http_server::operation::Handler<crate::operation_shape::ContentTypeParameters, HandlerExtractors>,
          57  +
          58  +
                        ModelPl: ::aws_smithy_http_server::plugin::Plugin<
          59  +
                            JsonProtocol<L>,
          60  +
                            crate::operation_shape::ContentTypeParameters,
          61  +
                            ::aws_smithy_http_server::operation::IntoService<crate::operation_shape::ContentTypeParameters, HandlerType>
          62  +
                        >,
          63  +
                        ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_http_server::plugin::Plugin<
          64  +
                            JsonProtocol<L>,
          65  +
                            crate::operation_shape::ContentTypeParameters,
          66  +
                            ModelPl::Output
          67  +
                        >,
          68  +
                        HttpPl: ::aws_smithy_http_server::plugin::Plugin<
          69  +
                            JsonProtocol<L>,
          70  +
                            crate::operation_shape::ContentTypeParameters,
          71  +
                            <
          72  +
                                ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
          73  +
                                as ::aws_smithy_http_server::plugin::Plugin<
          74  +
                                    JsonProtocol<L>,
          75  +
                                    crate::operation_shape::ContentTypeParameters,
          76  +
                                    ModelPl::Output
          77  +
                                >
          78  +
                            >::Output
          79  +
                        >,
          80  +
          81  +
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
          82  +
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
          83  +
          84  +
                    {
          85  +
        use ::aws_smithy_http_server::operation::OperationShapeExt;
          86  +
        use ::aws_smithy_http_server::plugin::Plugin;
          87  +
        let svc = crate::operation_shape::ContentTypeParameters::from_handler(handler);
          88  +
        let svc = self.model_plugin.apply(svc);
          89  +
        let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
          90  +
            .apply(svc);
          91  +
        let svc = self.http_plugin.apply(svc);
          92  +
        self.content_type_parameters_custom(svc)
          93  +
    }
          94  +
          95  +
    /// Sets the [`ContentTypeParameters`](crate::operation_shape::ContentTypeParameters) operation.
          96  +
    ///
          97  +
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
          98  +
    /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
          99  +
    ///
         100  +
    /// # Example
         101  +
    ///
         102  +
    /// ```no_run
         103  +
    /// use json_rpc11::{JsonProtocol, JsonProtocolConfig};
         104  +
    ///
         105  +
    /// use json_rpc11::{input, output, error};
         106  +
    ///
         107  +
    /// async fn handler(input: input::ContentTypeParametersInput) -> Result<output::ContentTypeParametersOutput, error::ContentTypeParametersError> {
         108  +
    ///     todo!()
         109  +
    /// }
         110  +
    ///
         111  +
    /// let config = JsonProtocolConfig::builder().build();
         112  +
    /// let svc = ::tower::util::service_fn(handler);
         113  +
    /// let app = JsonProtocol::builder(config)
         114  +
    ///     .content_type_parameters_service(svc)
         115  +
    ///     /* Set other handlers */
         116  +
    ///     .build()
         117  +
    ///     .unwrap();
         118  +
    /// # let app: JsonProtocol<::aws_smithy_http_server::routing::RoutingService<::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_http_server::routing::Route>, ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
         119  +
    /// ```
         120  +
    ///
         121  +
                    pub fn content_type_parameters_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
         122  +
                    where
         123  +
                        S: ::aws_smithy_http_server::operation::OperationService<crate::operation_shape::ContentTypeParameters, ServiceExtractors>,
         124  +
         125  +
                        ModelPl: ::aws_smithy_http_server::plugin::Plugin<
         126  +
                            JsonProtocol<L>,
         127  +
                            crate::operation_shape::ContentTypeParameters,
         128  +
                            ::aws_smithy_http_server::operation::Normalize<crate::operation_shape::ContentTypeParameters, S>
         129  +
                        >,
         130  +
                        ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_http_server::plugin::Plugin<
         131  +
                            JsonProtocol<L>,
         132  +
                            crate::operation_shape::ContentTypeParameters,
         133  +
                            ModelPl::Output
         134  +
                        >,
         135  +
                        HttpPl: ::aws_smithy_http_server::plugin::Plugin<
         136  +
                            JsonProtocol<L>,
         137  +
                            crate::operation_shape::ContentTypeParameters,
         138  +
                            <
         139  +
                                ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
         140  +
                                as ::aws_smithy_http_server::plugin::Plugin<
         141  +
                                    JsonProtocol<L>,
         142  +
                                    crate::operation_shape::ContentTypeParameters,
         143  +
                                    ModelPl::Output
         144  +
                                >
         145  +
                            >::Output
         146  +
                        >,
         147  +
         148  +
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
         149  +
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
         150  +
         151  +
                    {
         152  +
        use ::aws_smithy_http_server::operation::OperationShapeExt;
         153  +
        use ::aws_smithy_http_server::plugin::Plugin;
         154  +
        let svc = crate::operation_shape::ContentTypeParameters::from_service(service);
         155  +
        let svc = self.model_plugin.apply(svc);
         156  +
        let svc = ::aws_smithy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
         157  +
            .apply(svc);
         158  +
        let svc = self.http_plugin.apply(svc);
         159  +
        self.content_type_parameters_custom(svc)
         160  +
    }
         161  +
         162  +
    /// Sets the [`ContentTypeParameters`](crate::operation_shape::ContentTypeParameters) to a custom [`Service`](tower::Service).
         163  +
    /// not constrained by the Smithy contract.
         164  +
    fn content_type_parameters_custom<S>(mut self, svc: S) -> Self
         165  +
    where
         166  +
        S: ::tower::Service<
         167  +
                ::http::Request<Body>,
         168  +
                Response = ::http::Response<::aws_smithy_http_server::body::BoxBody>,
         169  +
                Error = ::std::convert::Infallible,
         170  +
            > + Clone
         171  +
            + Send
         172  +
            + 'static,
         173  +
        S::Future: Send + 'static,
         174  +
    {
         175  +
        self.content_type_parameters = Some(::aws_smithy_http_server::routing::Route::new(svc));
         176  +
        self
         177  +
    }
         178  +
   28    179   
    /// Sets the [`DatetimeOffsets`](crate::operation_shape::DatetimeOffsets) operation.
   29    180   
    ///
   30    181   
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_http_server::operation::Handler) trait.
   31    182   
    /// See the [operation module documentation](::aws_smithy_http_server::operation) for more information.
   32    183   
    ///
   33    184   
    /// # Example
   34    185   
    ///
   35    186   
    /// ```no_run
   36    187   
    /// use json_rpc11::{JsonProtocol, JsonProtocolConfig};
   37    188   
    ///
@@ -2426,2577 +2485,2642 @@
 2446   2597   
            >,
 2447   2598   
        >,
 2448   2599   
        MissingOperationsError,
 2449   2600   
    >
 2450   2601   
    where
 2451   2602   
        L: ::tower::Layer<::aws_smithy_http_server::routing::Route<Body>>,
 2452   2603   
    {
 2453   2604   
        let router = {
 2454   2605   
            use ::aws_smithy_http_server::operation::OperationShape;
 2455   2606   
            let mut missing_operation_names = std::collections::HashMap::new();
        2607  +
            if self.content_type_parameters.is_none() {
        2608  +
                missing_operation_names.insert(
        2609  +
                    crate::operation_shape::ContentTypeParameters::ID,
        2610  +
                    ".content_type_parameters()",
        2611  +
                );
        2612  +
            }
 2456   2613   
            if self.datetime_offsets.is_none() {
 2457   2614   
                missing_operation_names.insert(
 2458   2615   
                    crate::operation_shape::DatetimeOffsets::ID,
 2459   2616   
                    ".datetime_offsets()",
 2460   2617   
                );
 2461   2618   
            }
 2462   2619   
            if self.empty_operation.is_none() {
 2463   2620   
                missing_operation_names.insert(
 2464   2621   
                    crate::operation_shape::EmptyOperation::ID,
 2465   2622   
                    ".empty_operation()",
@@ -2526,2683 +2585,2746 @@
 2546   2703   
                );
 2547   2704   
            }
 2548   2705   
            if !missing_operation_names.is_empty() {
 2549   2706   
                return Err(MissingOperationsError {
 2550   2707   
                    operation_names2setter_methods: missing_operation_names,
 2551   2708   
                });
 2552   2709   
            }
 2553   2710   
            let unexpected_error_msg = "this should never panic since we are supposed to check beforehand that a handler has been registered for this operation; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues";
 2554   2711   
 2555   2712   
            ::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter([
        2713  +
                (
        2714  +
                    request_specs::content_type_parameters(),
        2715  +
                    self.content_type_parameters.expect(unexpected_error_msg),
        2716  +
                ),
 2556   2717   
                (
 2557   2718   
                    request_specs::datetime_offsets(),
 2558   2719   
                    self.datetime_offsets.expect(unexpected_error_msg),
 2559   2720   
                ),
 2560   2721   
                (
 2561   2722   
                    request_specs::empty_operation(),
 2562   2723   
                    self.empty_operation.expect(unexpected_error_msg),
 2563   2724   
                ),
 2564   2725   
                (
 2565   2726   
                    request_specs::endpoint_operation(),
@@ -2619,2780 +2678,2848 @@
 2639   2800   
            ::aws_smithy_http_server::routing::RoutingService<
 2640   2801   
                ::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter<
 2641   2802   
                    ::aws_smithy_http_server::routing::Route<Body>,
 2642   2803   
                >,
 2643   2804   
                ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
 2644   2805   
            >,
 2645   2806   
        >,
 2646   2807   
    {
 2647   2808   
        let router =
 2648   2809   
            ::aws_smithy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter([
        2810  +
                (
        2811  +
                    request_specs::content_type_parameters(),
        2812  +
                    self.content_type_parameters.unwrap_or_else(|| {
        2813  +
                        let svc = ::aws_smithy_http_server::operation::MissingFailure::<
        2814  +
                            ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
        2815  +
                        >::default();
        2816  +
                        ::aws_smithy_http_server::routing::Route::new(svc)
        2817  +
                    }),
        2818  +
                ),
 2649   2819   
                (
 2650   2820   
                    request_specs::datetime_offsets(),
 2651   2821   
                    self.datetime_offsets.unwrap_or_else(|| {
 2652   2822   
                        let svc = ::aws_smithy_http_server::operation::MissingFailure::<
 2653   2823   
                            ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
 2654   2824   
                        >::default();
 2655   2825   
                        ::aws_smithy_http_server::routing::Route::new(svc)
 2656   2826   
                    }),
 2657   2827   
                ),
 2658   2828   
                (
@@ -2804,2974 +2863,3036 @@
 2824   2994   
        for setter_name in self.operation_names2setter_methods.values() {
 2825   2995   
            writeln!(f, "- {}", setter_name)?;
 2826   2996   
        }
 2827   2997   
        Ok(())
 2828   2998   
    }
 2829   2999   
}
 2830   3000   
 2831   3001   
impl std::error::Error for MissingOperationsError {}
 2832   3002   
 2833   3003   
mod request_specs {
        3004  +
    pub(super) fn content_type_parameters() -> ::std::string::String {
        3005  +
        String::from("JsonProtocol.ContentTypeParameters")
        3006  +
    }
 2834   3007   
    pub(super) fn datetime_offsets() -> ::std::string::String {
 2835   3008   
        String::from("JsonProtocol.DatetimeOffsets")
 2836   3009   
    }
 2837   3010   
    pub(super) fn empty_operation() -> ::std::string::String {
 2838   3011   
        String::from("JsonProtocol.EmptyOperation")
 2839   3012   
    }
 2840   3013   
    pub(super) fn endpoint_operation() -> ::std::string::String {
 2841   3014   
        String::from("JsonProtocol.EndpointOperation")
 2842   3015   
    }
 2843   3016   
    pub(super) fn endpoint_with_host_label_operation() -> ::std::string::String {
@@ -2883,3056 +2985,3160 @@
 2903   3076   
    /// to the operations in this service.
 2904   3077   
    pub fn builder<
 2905   3078   
        Body,
 2906   3079   
        L,
 2907   3080   
        HttpPl: ::aws_smithy_http_server::plugin::HttpMarker,
 2908   3081   
        ModelPl: ::aws_smithy_http_server::plugin::ModelMarker,
 2909   3082   
    >(
 2910   3083   
        config: JsonProtocolConfig<L, HttpPl, ModelPl>,
 2911   3084   
    ) -> JsonProtocolBuilder<Body, L, HttpPl, ModelPl> {
 2912   3085   
        JsonProtocolBuilder {
        3086  +
            content_type_parameters: None,
 2913   3087   
            datetime_offsets: None,
 2914   3088   
            empty_operation: None,
 2915   3089   
            endpoint_operation: None,
 2916   3090   
            endpoint_with_host_label_operation: None,
 2917   3091   
            fractional_seconds: None,
 2918   3092   
            greeting_with_errors: None,
 2919   3093   
            host_with_path_operation: None,
 2920   3094   
            json_enums: None,
 2921   3095   
            json_unions: None,
 2922   3096   
            kitchen_sink_operation: None,
 2923   3097   
            null_operation: None,
 2924   3098   
            operation_with_optional_input_output: None,
 2925   3099   
            put_and_get_inline_documents: None,
 2926   3100   
            put_with_content_encoding: None,
 2927   3101   
            simple_scalar_properties: None,
 2928   3102   
            sparse_nulls_operation: None,
 2929   3103   
            layer: config.layers,
 2930   3104   
            http_plugin: config.http_plugins,
 2931   3105   
            model_plugin: config.model_plugins,
 2932   3106   
        }
 2933   3107   
    }
 2934   3108   
 2935   3109   
    /// Constructs a builder for [`JsonProtocol`].
 2936   3110   
    /// You must specify what plugins should be applied to the operations in this service.
 2937   3111   
    ///
 2938   3112   
    /// Use [`JsonProtocol::builder_without_plugins`] if you don't need to apply plugins.
 2939   3113   
    ///
 2940   3114   
    /// Check out [`HttpPlugins`](::aws_smithy_http_server::plugin::HttpPlugins) and
 2941   3115   
    /// [`ModelPlugins`](::aws_smithy_http_server::plugin::ModelPlugins) if you need to apply
 2942   3116   
    /// multiple plugins.
 2943   3117   
    #[deprecated(
 2944   3118   
        since = "0.57.0",
 2945   3119   
        note = "please use the `builder` constructor and register plugins on the `JsonProtocolConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
 2946   3120   
    )]
 2947   3121   
    pub fn builder_with_plugins<
 2948   3122   
        Body,
 2949   3123   
        HttpPl: ::aws_smithy_http_server::plugin::HttpMarker,
 2950   3124   
        ModelPl: ::aws_smithy_http_server::plugin::ModelMarker,
 2951   3125   
    >(
 2952   3126   
        http_plugin: HttpPl,
 2953   3127   
        model_plugin: ModelPl,
 2954   3128   
    ) -> JsonProtocolBuilder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
 2955   3129   
        JsonProtocolBuilder {
        3130  +
            content_type_parameters: None,
 2956   3131   
            datetime_offsets: None,
 2957   3132   
            empty_operation: None,
 2958   3133   
            endpoint_operation: None,
 2959   3134   
            endpoint_with_host_label_operation: None,
 2960   3135   
            fractional_seconds: None,
 2961   3136   
            greeting_with_errors: None,
 2962   3137   
            host_with_path_operation: None,
 2963   3138   
            json_enums: None,
 2964   3139   
            json_unions: None,
 2965   3140   
            kitchen_sink_operation: None,
@@ -3064,3239 +3145,3326 @@
 3084   3259   
 3085   3260   
    fn call(&mut self, request: R) -> Self::Future {
 3086   3261   
        self.svc.call(request)
 3087   3262   
    }
 3088   3263   
}
 3089   3264   
 3090   3265   
/// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in JsonProtocol.
 3091   3266   
#[allow(clippy::enum_variant_names)]
 3092   3267   
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
 3093   3268   
pub enum Operation {
        3269  +
    ContentTypeParameters,
 3094   3270   
    DatetimeOffsets,
 3095   3271   
    EmptyOperation,
 3096   3272   
    EndpointOperation,
 3097   3273   
    EndpointWithHostLabelOperation,
 3098   3274   
    FractionalSeconds,
 3099   3275   
    GreetingWithErrors,
 3100   3276   
    HostWithPathOperation,
 3101   3277   
    JsonEnums,
 3102   3278   
    JsonUnions,
 3103   3279   
    KitchenSinkOperation,
 3104   3280   
    NullOperation,
 3105   3281   
    OperationWithOptionalInputOutput,
 3106   3282   
    PutAndGetInlineDocuments,
 3107   3283   
    PutWithContentEncoding,
 3108   3284   
    SimpleScalarProperties,
 3109   3285   
    SparseNullsOperation,
 3110   3286   
}
 3111   3287   
 3112   3288   
impl Operation {
 3113   3289   
    /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_http_server::shape_id::ShapeId).
 3114   3290   
    pub fn shape_id(&self) -> ::aws_smithy_http_server::shape_id::ShapeId {
 3115   3291   
        match self {
        3292  +
            Operation::ContentTypeParameters => ::aws_smithy_http_server::shape_id::ShapeId::new(
        3293  +
                "aws.protocoltests.json#ContentTypeParameters",
        3294  +
                "aws.protocoltests.json",
        3295  +
                "ContentTypeParameters",
        3296  +
            ),
 3116   3297   
            Operation::DatetimeOffsets => ::aws_smithy_http_server::shape_id::ShapeId::new(
 3117   3298   
                "aws.protocoltests.json#DatetimeOffsets",
 3118   3299   
                "aws.protocoltests.json",
 3119   3300   
                "DatetimeOffsets",
 3120   3301   
            ),
 3121   3302   
            Operation::EmptyOperation => ::aws_smithy_http_server::shape_id::ShapeId::new(
 3122   3303   
                "aws.protocoltests.json#EmptyOperation",
 3123   3304   
                "aws.protocoltests.json",
 3124   3305   
                "EmptyOperation",
 3125   3306   
            ),
@@ -3175,3356 +3234,3422 @@
 3195   3376   
                "SimpleScalarProperties",
 3196   3377   
            ),
 3197   3378   
            Operation::SparseNullsOperation => ::aws_smithy_http_server::shape_id::ShapeId::new(
 3198   3379   
                "aws.protocoltests.json#SparseNullsOperation",
 3199   3380   
                "aws.protocoltests.json",
 3200   3381   
                "SparseNullsOperation",
 3201   3382   
            ),
 3202   3383   
        }
 3203   3384   
    }
 3204   3385   
}
        3386  +
impl<L>
        3387  +
    ::aws_smithy_http_server::service::ContainsOperation<
        3388  +
        crate::operation_shape::ContentTypeParameters,
        3389  +
    > for JsonProtocol<L>
        3390  +
{
        3391  +
    const VALUE: Operation = Operation::ContentTypeParameters;
        3392  +
}
 3205   3393   
impl<L>
 3206   3394   
    ::aws_smithy_http_server::service::ContainsOperation<crate::operation_shape::DatetimeOffsets>
 3207   3395   
    for JsonProtocol<L>
 3208   3396   
{
 3209   3397   
    const VALUE: Operation = Operation::DatetimeOffsets;
 3210   3398   
}
 3211   3399   
impl<L> ::aws_smithy_http_server::service::ContainsOperation<crate::operation_shape::EmptyOperation>
 3212   3400   
    for JsonProtocol<L>
 3213   3401   
{
 3214   3402   
    const VALUE: Operation = Operation::EmptyOperation;
@@ -3414,3602 +3517,3714 @@
 3434   3622   
}
 3435   3623   
/// A macro to help with scoping [plugins](::aws_smithy_http_server::plugin) to a subset of all operations.
 3436   3624   
///
 3437   3625   
/// In contrast to [`aws_smithy_http_server::scope`](::aws_smithy_http_server::scope), this macro has knowledge
 3438   3626   
/// of the service and any operations _not_ specified will be placed in the opposing group.
 3439   3627   
///
 3440   3628   
/// # Example
 3441   3629   
///
 3442   3630   
/// ```rust
 3443   3631   
/// scope! {
 3444         -
///     /// Includes [`DatetimeOffsets`], excluding all other operations.
        3632  +
///     /// Includes [`ContentTypeParameters`], excluding all other operations.
 3445   3633   
///     struct ScopeA {
 3446         -
///         includes: [DatetimeOffsets]
        3634  +
///         includes: [ContentTypeParameters]
 3447   3635   
///     }
 3448   3636   
/// }
 3449   3637   
///
 3450   3638   
/// scope! {
 3451         -
///     /// Excludes [`DatetimeOffsets`], excluding all other operations.
        3639  +
///     /// Excludes [`ContentTypeParameters`], excluding all other operations.
 3452   3640   
///     struct ScopeB {
 3453         -
///         excludes: [DatetimeOffsets]
        3641  +
///         excludes: [ContentTypeParameters]
 3454   3642   
///     }
 3455   3643   
/// }
 3456   3644   
///
 3457   3645   
/// # use ::aws_smithy_http_server::plugin::{Plugin, Scoped};
 3458   3646   
/// # use json_rpc11::scope;
 3459   3647   
/// # struct MockPlugin;
 3460   3648   
/// # impl<S, Op, T> Plugin<S, Op, T> for MockPlugin { type Output = u32; fn apply(&self, input: T) -> u32 { 3 } }
 3461   3649   
/// # let scoped_a = Scoped::new::<ScopeA>(MockPlugin);
 3462   3650   
/// # let scoped_b = Scoped::new::<ScopeB>(MockPlugin);
 3463         -
/// # let a = Plugin::<(), json_rpc11::operation_shape::DatetimeOffsets, u64>::apply(&scoped_a, 6);
 3464         -
/// # let b = Plugin::<(), json_rpc11::operation_shape::DatetimeOffsets, u64>::apply(&scoped_b, 6);
        3651  +
/// # let a = Plugin::<(), json_rpc11::operation_shape::ContentTypeParameters, u64>::apply(&scoped_a, 6);
        3652  +
/// # let b = Plugin::<(), json_rpc11::operation_shape::ContentTypeParameters, u64>::apply(&scoped_b, 6);
 3465   3653   
/// # assert_eq!(a, 3_u32);
 3466   3654   
/// # assert_eq!(b, 6_u64);
 3467   3655   
/// ```
 3468   3656   
#[macro_export]
 3469   3657   
macro_rules! scope {
 3470   3658   
                    // Completed, render impls
 3471   3659   
                    (@ $ name: ident, $ contains: ident () ($($ temp: ident)*) ($($ not_member: ident)*)) => {
 3472   3660   
                        $(
 3473   3661   
                            impl ::aws_smithy_http_server::plugin::scoped::Membership<$ temp> for $ name {
 3474   3662   
                                type Contains = ::aws_smithy_http_server::plugin::scoped::$ contains;
 3475   3663   
                            }
 3476   3664   
                        )*
 3477   3665   
                        $(
 3478   3666   
                            impl ::aws_smithy_http_server::plugin::scoped::Membership<$ not_member> for $ name {
 3479   3667   
                                type Contains = ::aws_smithy_http_server::plugin::scoped::$ contains;
 3480   3668   
                            }
 3481   3669   
                        )*
 3482   3670   
                    };
 3483   3671   
                    // All `not_member`s exhausted, move `temp` into `not_member`
 3484   3672   
                    (@ $ name: ident, $ contains: ident ($($ member: ident)*) ($($ temp: ident)*) ()) => {
 3485   3673   
                        scope! { @ $ name, $ contains ($($ member)*) () ($($ temp)*) }
 3486   3674   
                    };
 3487   3675   
        3676  +
                        // ContentTypeParameters match found, pop from both `member` and `not_member`
        3677  +
                        (@ $ name: ident, $ contains: ident (ContentTypeParameters $($ member: ident)*) ($($ temp: ident)*) (ContentTypeParameters $($ not_member: ident)*)) => {
        3678  +
                            scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
        3679  +
                        };
        3680  +
                        // ContentTypeParameters match not found, pop from `not_member` into `temp` stack
        3681  +
                        (@ $ name: ident, $ contains: ident (ContentTypeParameters $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
        3682  +
                            scope! { @ $ name, $ contains (ContentTypeParameters $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
        3683  +
                        };
        3684  +
 3488   3685   
                        // DatetimeOffsets match found, pop from both `member` and `not_member`
 3489   3686   
                        (@ $ name: ident, $ contains: ident (DatetimeOffsets $($ member: ident)*) ($($ temp: ident)*) (DatetimeOffsets $($ not_member: ident)*)) => {
 3490   3687   
                            scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
 3491   3688   
                        };
 3492   3689   
                        // DatetimeOffsets match not found, pop from `not_member` into `temp` stack
 3493   3690   
                        (@ $ name: ident, $ contains: ident (DatetimeOffsets $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
 3494   3691   
                            scope! { @ $ name, $ contains (DatetimeOffsets $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
 3495   3692   
                        };
 3496   3693   
 3497   3694   
                        // EmptyOperation match found, pop from both `member` and `not_member`
@@ -3616,3813 +3665,3862 @@
 3636   3833   
                        }
 3637   3834   
                    ) => {
 3638   3835   
                        use $ crate::operation_shape::*;
 3639   3836   
                        ::aws_smithy_http_server::scope! {
 3640   3837   
                            $(#[$ attrs])*
 3641   3838   
                            $ vis struct $ name {
 3642   3839   
                                includes: [$($ include),*],
 3643   3840   
                                excludes: []
 3644   3841   
                            }
 3645   3842   
                        }
 3646         -
                        scope! { @ $ name, False ($($ include)*) () (DatetimeOffsets EmptyOperation EndpointOperation EndpointWithHostLabelOperation FractionalSeconds GreetingWithErrors HostWithPathOperation JsonEnums JsonUnions KitchenSinkOperation NullOperation OperationWithOptionalInputOutput PutAndGetInlineDocuments PutWithContentEncoding SimpleScalarProperties SparseNullsOperation) }
        3843  +
                        scope! { @ $ name, False ($($ include)*) () (ContentTypeParameters DatetimeOffsets EmptyOperation EndpointOperation EndpointWithHostLabelOperation FractionalSeconds GreetingWithErrors HostWithPathOperation JsonEnums JsonUnions KitchenSinkOperation NullOperation OperationWithOptionalInputOutput PutAndGetInlineDocuments PutWithContentEncoding SimpleScalarProperties SparseNullsOperation) }
 3647   3844   
                    };
 3648   3845   
                    (
 3649   3846   
                        $(#[$ attrs:meta])*
 3650   3847   
                        $ vis:vis struct $ name:ident {
 3651   3848   
                            excludes: [$($ exclude:ident),*]
 3652   3849   
                        }
 3653   3850   
                    ) => {
 3654   3851   
                        use $ crate::operation_shape::*;
 3655   3852   
 3656   3853   
                        ::aws_smithy_http_server::scope! {
 3657   3854   
                            $(#[$ attrs])*
 3658   3855   
                            $ vis struct $ name {
 3659   3856   
                                includes: [],
 3660   3857   
                                excludes: [$($ exclude),*]
 3661   3858   
                            }
 3662   3859   
                        }
 3663         -
                        scope! { @ $ name, True ($($ exclude)*) () (DatetimeOffsets EmptyOperation EndpointOperation EndpointWithHostLabelOperation FractionalSeconds GreetingWithErrors HostWithPathOperation JsonEnums JsonUnions KitchenSinkOperation NullOperation OperationWithOptionalInputOutput PutAndGetInlineDocuments PutWithContentEncoding SimpleScalarProperties SparseNullsOperation) }
        3860  +
                        scope! { @ $ name, True ($($ exclude)*) () (ContentTypeParameters DatetimeOffsets EmptyOperation EndpointOperation EndpointWithHostLabelOperation FractionalSeconds GreetingWithErrors HostWithPathOperation JsonEnums JsonUnions KitchenSinkOperation NullOperation OperationWithOptionalInputOutput PutAndGetInlineDocuments PutWithContentEncoding SimpleScalarProperties SparseNullsOperation) }
 3664   3861   
                    };
 3665   3862   
                }

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/python/rest_json/__init__.pyi

@@ -27,27 +86,92 @@
   47     47   
        raise NotImplementedError
   48     48   
   49     49   
    # This example uses a constant query string parameters and a label.
   50     50   
    # This simply tests that labels and query string parameters are
   51     51   
    # compatible. The fixed query string parameter named "hello" should
   52     52   
    # in no way conflict with the label, `{hello}`.
   53     53   
    @app.constant_query_string
   54     54   
    def constant_query_string(input: input::ConstantQueryStringInput, ctx: Context) -> output::ConstantQueryStringOutput:
   55     55   
        raise NotImplementedError
   56     56   
          57  +
    # The example tests how servers must support requests
          58  +
    # containing a `Content-Type` header with parameters.
          59  +
    @app.content_type_parameters
          60  +
    def content_type_parameters(input: input::ContentTypeParametersInput, ctx: Context) -> output::ContentTypeParametersOutput:
          61  +
        raise NotImplementedError
          62  +
   57     63   
    @app.datetime_offsets
   58     64   
    def datetime_offsets(input: input::DatetimeOffsetsInput, ctx: Context) -> output::DatetimeOffsetsOutput:
   59     65   
        raise NotImplementedError
   60     66   
   61     67   
    # This example serializes a document as part of the payload.
   62     68   
    @app.document_type
   63     69   
    def document_type(input: input::DocumentTypeInput, ctx: Context) -> output::DocumentTypeOutput:
   64     70   
        raise NotImplementedError
   65     71   
   66     72   
    # This example serializes documents as the value of maps.
@@ -388,394 +447,461 @@
  408    414   
    def omits_null_serializes_empty_string(input: input::OmitsNullSerializesEmptyStringInput, ctx: Context) -> output::OmitsNullSerializesEmptyStringOutput:
  409    415   
        raise NotImplementedError
  410    416   
  411    417   
    # Omits serializing empty lists. Because empty strings are serilized as
  412    418   
    # `Foo=`, empty lists cannot also be serialized as `Foo=` and instead
  413    419   
    # must be omitted.
  414    420   
    @app.omits_serializing_empty_lists
  415    421   
    def omits_serializing_empty_lists(input: input::OmitsSerializingEmptyListsInput, ctx: Context) -> output::OmitsSerializingEmptyListsOutput:
  416    422   
        raise NotImplementedError
  417    423   
         424  +
    @app.operation_with_defaults
         425  +
    def operation_with_defaults(input: input::OperationWithDefaultsInput, ctx: Context) -> output::OperationWithDefaultsOutput:
         426  +
        raise NotImplementedError
         427  +
         428  +
    @app.operation_with_nested_structure
         429  +
    def operation_with_nested_structure(input: input::OperationWithNestedStructureInput, ctx: Context) -> output::OperationWithNestedStructureOutput:
         430  +
        raise NotImplementedError
         431  +
  418    432   
    # This operation defines a union with a Unit member.
  419    433   
    @app.post_player_action
  420    434   
    def post_player_action(input: input::PostPlayerActionInput, ctx: Context) -> output::PostPlayerActionOutput:
  421    435   
        raise NotImplementedError
  422    436   
  423    437   
    # This operation defines a union that uses jsonName on some members.
  424    438   
    @app.post_union_with_json_name
  425    439   
    def post_union_with_json_name(input: input::PostUnionWithJsonNameInput, ctx: Context) -> output::PostUnionWithJsonNameOutput:
  426    440   
        raise NotImplementedError
  427    441   
@@ -468,482 +527,551 @@
  488    502   
    # This example operation serializes a structure in the HTTP body.
  489    503   
    #
  490    504   
    # It should ensure Content-Type: application/json is
  491    505   
    # used in all requests and that an "empty" body is
  492    506   
    # an empty JSON document ({}).
  493    507   
    #
  494    508   
    @app.test_body_structure
  495    509   
    def test_body_structure(input: input::TestBodyStructureInput, ctx: Context) -> output::TestBodyStructureOutput:
  496    510   
        raise NotImplementedError
  497    511   
         512  +
    # This example operation has no input and serializes a request without an HTTP body.
         513  +
    #
         514  +
    # These tests are to ensure we do not attach a body or related headers
         515  +
    # (Content-Length, Content-Type) to operations that semantically
         516  +
    # cannot produce an HTTP body.
         517  +
    #
         518  +
    @app.test_no_input_no_payload
         519  +
    def test_no_input_no_payload(input: input::TestNoInputNoPayloadInput, ctx: Context) -> output::TestNoInputNoPayloadOutput:
         520  +
        raise NotImplementedError
         521  +
  498    522   
    # This example operation serializes a request without an HTTP body.
  499    523   
    #
  500    524   
    # These tests are to ensure we do not attach a body or related headers
  501    525   
    # (Content-Length, Content-Type) to operations that semantically
  502    526   
    # cannot produce an HTTP body.
  503    527   
    #
  504    528   
    @app.test_no_payload
  505    529   
    def test_no_payload(input: input::TestNoPayloadInput, ctx: Context) -> output::TestNoPayloadOutput:
  506    530   
        raise NotImplementedError
  507    531   
@@ -540,564 +599,631 @@
  560    584   
  561    585   
  562    586   
    def constant_query_string(self, func: typing.Union[typing.Callable[[rest_json.input.ConstantQueryStringInput, Ctx], typing.Union[rest_json.output.ConstantQueryStringOutput, typing.Awaitable[rest_json.output.ConstantQueryStringOutput]]], typing.Callable[[rest_json.input.ConstantQueryStringInput], typing.Union[rest_json.output.ConstantQueryStringOutput, typing.Awaitable[rest_json.output.ConstantQueryStringOutput]]]]) -> None:
  563    587   
        """
  564    588   
        Method to register `constant_query_string` Python implementation inside the handlers map.
  565    589   
        It can be used as a function decorator in Python.
  566    590   
        """
  567    591   
        ...
  568    592   
  569    593   
         594  +
    def content_type_parameters(self, func: typing.Union[typing.Callable[[rest_json.input.ContentTypeParametersInput, Ctx], typing.Union[rest_json.output.ContentTypeParametersOutput, typing.Awaitable[rest_json.output.ContentTypeParametersOutput]]], typing.Callable[[rest_json.input.ContentTypeParametersInput], typing.Union[rest_json.output.ContentTypeParametersOutput, typing.Awaitable[rest_json.output.ContentTypeParametersOutput]]]]) -> None:
         595  +
        """
         596  +
        Method to register `content_type_parameters` Python implementation inside the handlers map.
         597  +
        It can be used as a function decorator in Python.
         598  +
        """
         599  +
        ...
         600  +
         601  +
  570    602   
    def context(self, context: Ctx) -> None:
  571    603   
        """
  572    604   
        Register a context object that will be shared between handlers.
  573    605   
        """
  574    606   
        ...
  575    607   
  576    608   
  577    609   
    def datetime_offsets(self, func: typing.Union[typing.Callable[[rest_json.input.DatetimeOffsetsInput, Ctx], typing.Union[rest_json.output.DatetimeOffsetsOutput, typing.Awaitable[rest_json.output.DatetimeOffsetsOutput]]], typing.Callable[[rest_json.input.DatetimeOffsetsInput], typing.Union[rest_json.output.DatetimeOffsetsOutput, typing.Awaitable[rest_json.output.DatetimeOffsetsOutput]]]]) -> None:
  578    610   
        """
  579    611   
        Method to register `datetime_offsets` Python implementation inside the handlers map.
@@ -1138,1170 +1197,1245 @@
 1158   1190   
 1159   1191   
 1160   1192   
    def omits_serializing_empty_lists(self, func: typing.Union[typing.Callable[[rest_json.input.OmitsSerializingEmptyListsInput, Ctx], typing.Union[rest_json.output.OmitsSerializingEmptyListsOutput, typing.Awaitable[rest_json.output.OmitsSerializingEmptyListsOutput]]], typing.Callable[[rest_json.input.OmitsSerializingEmptyListsInput], typing.Union[rest_json.output.OmitsSerializingEmptyListsOutput, typing.Awaitable[rest_json.output.OmitsSerializingEmptyListsOutput]]]]) -> None:
 1161   1193   
        """
 1162   1194   
        Method to register `omits_serializing_empty_lists` Python implementation inside the handlers map.
 1163   1195   
        It can be used as a function decorator in Python.
 1164   1196   
        """
 1165   1197   
        ...
 1166   1198   
 1167   1199   
        1200  +
    def operation_with_defaults(self, func: typing.Union[typing.Callable[[rest_json.input.OperationWithDefaultsInput, Ctx], typing.Union[rest_json.output.OperationWithDefaultsOutput, typing.Awaitable[rest_json.output.OperationWithDefaultsOutput]]], typing.Callable[[rest_json.input.OperationWithDefaultsInput], typing.Union[rest_json.output.OperationWithDefaultsOutput, typing.Awaitable[rest_json.output.OperationWithDefaultsOutput]]]]) -> None:
        1201  +
        """
        1202  +
        Method to register `operation_with_defaults` Python implementation inside the handlers map.
        1203  +
        It can be used as a function decorator in Python.
        1204  +
        """
        1205  +
        ...
        1206  +
        1207  +
        1208  +
    def operation_with_nested_structure(self, func: typing.Union[typing.Callable[[rest_json.input.OperationWithNestedStructureInput, Ctx], typing.Union[rest_json.output.OperationWithNestedStructureOutput, typing.Awaitable[rest_json.output.OperationWithNestedStructureOutput]]], typing.Callable[[rest_json.input.OperationWithNestedStructureInput], typing.Union[rest_json.output.OperationWithNestedStructureOutput, typing.Awaitable[rest_json.output.OperationWithNestedStructureOutput]]]]) -> None:
        1209  +
        """
        1210  +
        Method to register `operation_with_nested_structure` Python implementation inside the handlers map.
        1211  +
        It can be used as a function decorator in Python.
        1212  +
        """
        1213  +
        ...
        1214  +
        1215  +
 1168   1216   
    def post_player_action(self, func: typing.Union[typing.Callable[[rest_json.input.PostPlayerActionInput, Ctx], typing.Union[rest_json.output.PostPlayerActionOutput, typing.Awaitable[rest_json.output.PostPlayerActionOutput]]], typing.Callable[[rest_json.input.PostPlayerActionInput], typing.Union[rest_json.output.PostPlayerActionOutput, typing.Awaitable[rest_json.output.PostPlayerActionOutput]]]]) -> None:
 1169   1217   
        """
 1170   1218   
        Method to register `post_player_action` Python implementation inside the handlers map.
 1171   1219   
        It can be used as a function decorator in Python.
 1172   1220   
        """
 1173   1221   
        ...
 1174   1222   
 1175   1223   
 1176   1224   
    def post_union_with_json_name(self, func: typing.Union[typing.Callable[[rest_json.input.PostUnionWithJsonNameInput, Ctx], typing.Union[rest_json.output.PostUnionWithJsonNameOutput, typing.Awaitable[rest_json.output.PostUnionWithJsonNameOutput]]], typing.Callable[[rest_json.input.PostUnionWithJsonNameInput], typing.Union[rest_json.output.PostUnionWithJsonNameOutput, typing.Awaitable[rest_json.output.PostUnionWithJsonNameOutput]]]]) -> None:
 1177   1225   
        """
@@ -1271,1319 +1330,1386 @@
 1291   1339   
 1292   1340   
 1293   1341   
    def test_body_structure(self, func: typing.Union[typing.Callable[[rest_json.input.TestBodyStructureInput, Ctx], typing.Union[rest_json.output.TestBodyStructureOutput, typing.Awaitable[rest_json.output.TestBodyStructureOutput]]], typing.Callable[[rest_json.input.TestBodyStructureInput], typing.Union[rest_json.output.TestBodyStructureOutput, typing.Awaitable[rest_json.output.TestBodyStructureOutput]]]]) -> None:
 1294   1342   
        """
 1295   1343   
        Method to register `test_body_structure` Python implementation inside the handlers map.
 1296   1344   
        It can be used as a function decorator in Python.
 1297   1345   
        """
 1298   1346   
        ...
 1299   1347   
 1300   1348   
        1349  +
    def test_no_input_no_payload(self, func: typing.Union[typing.Callable[[rest_json.input.TestNoInputNoPayloadInput, Ctx], typing.Union[rest_json.output.TestNoInputNoPayloadOutput, typing.Awaitable[rest_json.output.TestNoInputNoPayloadOutput]]], typing.Callable[[rest_json.input.TestNoInputNoPayloadInput], typing.Union[rest_json.output.TestNoInputNoPayloadOutput, typing.Awaitable[rest_json.output.TestNoInputNoPayloadOutput]]]]) -> None:
        1350  +
        """
        1351  +
        Method to register `test_no_input_no_payload` Python implementation inside the handlers map.
        1352  +
        It can be used as a function decorator in Python.
        1353  +
        """
        1354  +
        ...
        1355  +
        1356  +
 1301   1357   
    def test_no_payload(self, func: typing.Union[typing.Callable[[rest_json.input.TestNoPayloadInput, Ctx], typing.Union[rest_json.output.TestNoPayloadOutput, typing.Awaitable[rest_json.output.TestNoPayloadOutput]]], typing.Callable[[rest_json.input.TestNoPayloadInput], typing.Union[rest_json.output.TestNoPayloadOutput, typing.Awaitable[rest_json.output.TestNoPayloadOutput]]]]) -> None:
 1302   1358   
        """
 1303   1359   
        Method to register `test_no_payload` Python implementation inside the handlers map.
 1304   1360   
        It can be used as a function decorator in Python.
 1305   1361   
        """
 1306   1362   
        ...
 1307   1363   
 1308   1364   
 1309   1365   
    def test_payload_blob(self, func: typing.Union[typing.Callable[[rest_json.input.TestPayloadBlobInput, Ctx], typing.Union[rest_json.output.TestPayloadBlobOutput, typing.Awaitable[rest_json.output.TestPayloadBlobOutput]]], typing.Callable[[rest_json.input.TestPayloadBlobInput], typing.Union[rest_json.output.TestPayloadBlobOutput, typing.Awaitable[rest_json.output.TestPayloadBlobOutput]]]]) -> None:
 1310   1366   
        """

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/python/rest_json/input/__init__.pyi

@@ -38,38 +97,104 @@
   58     58   
        ...
   59     59   
   60     60   
   61     61   
class ConstantQueryStringInput:
   62     62   
    hello: str
   63     63   
   64     64   
    def __init__(self, hello: str) -> None:
   65     65   
        ...
   66     66   
   67     67   
          68  +
class ContentTypeParametersInput:
          69  +
    value: typing.Optional[int]
          70  +
          71  +
    def __init__(self, value: typing.Optional[int] = ...) -> None:
          72  +
        ...
          73  +
          74  +
   68     75   
class DatetimeOffsetsInput:
   69     76   
    def __init__(self) -> None:
   70     77   
        ...
   71     78   
   72     79   
   73     80   
class DocumentTypeAsMapValueInput:
   74     81   
    doc_valued_map: typing.Optional[typing.Dict[str, rest_json.types.Document]]
   75     82   
   76     83   
    def __init__(self, doc_valued_map: typing.Optional[typing.Dict[str, rest_json.types.Document]] = ...) -> None:
   77     84   
        ...
@@ -729,736 +788,815 @@
  749    756   
    query_integer_list: typing.Optional[typing.List[int]]
  750    757   
  751    758   
    query_string_list: typing.Optional[typing.List[str]]
  752    759   
  753    760   
    query_timestamp_list: typing.Optional[typing.List[rest_json.types.DateTime]]
  754    761   
  755    762   
    def __init__(self, query_string_list: typing.Optional[typing.List[str]] = ..., query_integer_list: typing.Optional[typing.List[int]] = ..., query_double_list: typing.Optional[typing.List[float]] = ..., query_boolean_list: typing.Optional[typing.List[bool]] = ..., query_timestamp_list: typing.Optional[typing.List[rest_json.types.DateTime]] = ..., query_enum_list: typing.Optional[typing.List[rest_json.model.FooEnum]] = ..., query_integer_enum_list: typing.Optional[typing.List[int]] = ...) -> None:
  756    763   
        ...
  757    764   
  758    765   
         766  +
class OperationWithDefaultsInput:
         767  +
    client_optional_defaults: typing.Optional[rest_json.model.ClientOptionalDefaults]
         768  +
         769  +
    defaults: typing.Optional[rest_json.model.Defaults]
         770  +
         771  +
    other_top_level_default: int
         772  +
         773  +
    top_level_default: str
         774  +
         775  +
    def __init__(self, defaults: typing.Optional[rest_json.model.Defaults] = ..., client_optional_defaults: typing.Optional[rest_json.model.ClientOptionalDefaults] = ..., top_level_default: str, other_top_level_default: int) -> None:
         776  +
        ...
         777  +
         778  +
         779  +
class OperationWithNestedStructureInput:
         780  +
    top_level: rest_json.model.TopLevel
         781  +
         782  +
    def __init__(self, top_level: rest_json.model.TopLevel) -> None:
         783  +
        ...
         784  +
         785  +
  759    786   
class PostPlayerActionInput:
  760    787   
    action: typing.Optional[rest_json.model.PlayerAction]
  761    788   
  762    789   
    def __init__(self, action: typing.Optional[rest_json.model.PlayerAction] = ...) -> None:
  763    790   
        ...
  764    791   
  765    792   
  766    793   
class PostUnionWithJsonNameInput:
  767    794   
    value: typing.Optional[rest_json.model.UnionWithJsonName]
  768    795   
@@ -867,894 +926,958 @@
  887    914   
  888    915   
class TestBodyStructureInput:
  889    916   
    test_config: typing.Optional[rest_json.model.TestConfig]
  890    917   
  891    918   
    test_id: typing.Optional[str]
  892    919   
  893    920   
    def __init__(self, test_id: typing.Optional[str] = ..., test_config: typing.Optional[rest_json.model.TestConfig] = ...) -> None:
  894    921   
        ...
  895    922   
  896    923   
         924  +
class TestNoInputNoPayloadInput:
         925  +
    def __init__(self) -> None:
         926  +
        ...
         927  +
         928  +
  897    929   
class TestNoPayloadInput:
  898    930   
    test_id: typing.Optional[str]
  899    931   
  900    932   
    def __init__(self, test_id: typing.Optional[str] = ...) -> None:
  901    933   
        ...
  902    934   
  903    935   
  904    936   
class TestPayloadBlobInput:
  905    937   
    content_type: typing.Optional[str]
  906    938   

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/python/rest_json/model/__init__.pyi

@@ -1,1 +41,127 @@
    1      1   
import rest_json.model
    2      2   
import rest_json.types
    3      3   
import typing
    4      4   
           5  +
class ClientOptionalDefaults:
           6  +
    member: int
           7  +
           8  +
    def __init__(self, member: int) -> None:
           9  +
        ...
          10  +
          11  +
    5     12   
class ComplexNestedErrorData:
    6     13   
    foo: typing.Optional[str]
    7     14   
    8     15   
    def __init__(self, foo: typing.Optional[str] = ...) -> None:
    9     16   
        ...
   10     17   
   11     18   
          19  +
class Defaults:
          20  +
    default_blob: rest_json.types.Blob
          21  +
          22  +
    default_boolean: bool
          23  +
          24  +
    default_byte: int
          25  +
          26  +
    default_document_boolean: rest_json.types.Document
          27  +
          28  +
    default_document_list: rest_json.types.Document
          29  +
          30  +
    default_document_map: rest_json.types.Document
          31  +
          32  +
    default_document_string: rest_json.types.Document
          33  +
          34  +
    default_double: float
          35  +
          36  +
    default_enum: rest_json.model.TestEnum
          37  +
          38  +
    default_float: float
          39  +
          40  +
    default_int_enum: int
          41  +
          42  +
    default_integer: int
          43  +
          44  +
    default_list: typing.List[str]
          45  +
          46  +
    default_long: int
          47  +
          48  +
    default_map: typing.Dict[str, str]
          49  +
          50  +
    default_null_document: typing.Optional[rest_json.types.Document]
          51  +
          52  +
    default_short: int
          53  +
          54  +
    default_string: str
          55  +
          56  +
    default_timestamp: rest_json.types.DateTime
          57  +
          58  +
    empty_blob: rest_json.types.Blob
          59  +
          60  +
    empty_string: str
          61  +
          62  +
    false_boolean: bool
          63  +
          64  +
    zero_byte: int
          65  +
          66  +
    zero_double: float
          67  +
          68  +
    zero_float: float
          69  +
          70  +
    zero_integer: int
          71  +
          72  +
    zero_long: int
          73  +
          74  +
    zero_short: int
          75  +
          76  +
    def __init__(self, default_string: str, default_boolean: bool, default_list: typing.List[str], default_document_map: rest_json.types.Document, default_document_string: rest_json.types.Document, default_document_boolean: rest_json.types.Document, default_document_list: rest_json.types.Document, default_null_document: typing.Optional[rest_json.types.Document] = ..., default_timestamp: rest_json.types.DateTime, default_blob: rest_json.types.Blob, default_byte: int, default_short: int, default_integer: int, default_long: int, default_float: float, default_double: float, default_map: typing.Dict[str, str], default_enum: rest_json.model.TestEnum, default_int_enum: int, empty_string: str, false_boolean: bool, empty_blob: rest_json.types.Blob, zero_byte: int, zero_short: int, zero_integer: int, zero_long: int, zero_float: float, zero_double: float) -> None:
          77  +
        ...
          78  +
          79  +
          80  +
class Dialog:
          81  +
    farewell: typing.Optional[rest_json.model.Farewell]
          82  +
          83  +
    greeting: str
          84  +
          85  +
    language: typing.Optional[str]
          86  +
          87  +
    def __init__(self, language: typing.Optional[str] = ..., greeting: str, farewell: typing.Optional[rest_json.model.Farewell] = ...) -> None:
          88  +
        ...
          89  +
          90  +
          91  +
class Farewell:
          92  +
    phrase: str
          93  +
          94  +
    def __init__(self, phrase: str) -> None:
          95  +
        ...
          96  +
          97  +
   12     98   
class FooEnum:
   13     99   
    Bar: FooEnum
   14    100   
   15    101   
    Baz: FooEnum
   16    102   
   17    103   
    Foo: FooEnum
   18    104   
   19    105   
    One: FooEnum
   20    106   
   21    107   
    Zero: FooEnum
@@ -350,436 +409,517 @@
  370    456   
        ...
  371    457   
  372    458   
  373    459   
class TestConfig:
  374    460   
    timeout: typing.Optional[int]
  375    461   
  376    462   
    def __init__(self, timeout: typing.Optional[int] = ...) -> None:
  377    463   
        ...
  378    464   
  379    465   
         466  +
class TestEnum:
         467  +
    Bar: TestEnum
         468  +
         469  +
    Baz: TestEnum
         470  +
         471  +
    Foo: TestEnum
         472  +
         473  +
    name: typing.Any
         474  +
         475  +
    value: typing.Any
         476  +
         477  +
class TopLevel:
         478  +
    dialog: rest_json.model.Dialog
         479  +
         480  +
    dialog_list: typing.List[rest_json.model.Dialog]
         481  +
         482  +
    dialog_map: typing.Dict[str, rest_json.model.Dialog]
         483  +
         484  +
    def __init__(self, dialog: rest_json.model.Dialog, dialog_list: typing.List[rest_json.model.Dialog], dialog_map: typing.Dict[str, rest_json.model.Dialog]) -> None:
         485  +
        ...
         486  +
         487  +
  380    488   
class UnionPayload:
  381    489   
    def as_greeting(self) -> str:
  382    490   
        """
  383    491   
        Tries to convert the enum instance into [`Greeting`](crate::model::UnionPayload::Greeting), extracting the inner [`String`](::std::string::String).
  384    492   
        """
  385    493   
        ...
  386    494   
  387    495   
  388    496   
    @staticmethod
  389    497   
    def greeting(data: str) -> UnionPayload:

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/python/rest_json/output/__init__.pyi

@@ -1,1 +49,54 @@
   10     10   
class ConstantAndVariableQueryStringOutput:
   11     11   
    def __init__(self) -> None:
   12     12   
        ...
   13     13   
   14     14   
   15     15   
class ConstantQueryStringOutput:
   16     16   
    def __init__(self) -> None:
   17     17   
        ...
   18     18   
   19     19   
          20  +
class ContentTypeParametersOutput:
          21  +
    def __init__(self) -> None:
          22  +
        ...
          23  +
          24  +
   20     25   
class DatetimeOffsetsOutput:
   21     26   
    datetime: typing.Optional[rest_json.types.DateTime]
   22     27   
   23     28   
    def __init__(self, datetime: typing.Optional[rest_json.types.DateTime] = ...) -> None:
   24     29   
        ...
   25     30   
   26     31   
   27     32   
class DocumentTypeAsMapValueOutput:
   28     33   
    doc_valued_map: typing.Optional[typing.Dict[str, rest_json.types.Document]]
   29     34   
@@ -533,538 +592,669 @@
  553    558   
class OmitsNullSerializesEmptyStringOutput:
  554    559   
    def __init__(self) -> None:
  555    560   
        ...
  556    561   
  557    562   
  558    563   
class OmitsSerializingEmptyListsOutput:
  559    564   
    def __init__(self) -> None:
  560    565   
        ...
  561    566   
  562    567   
         568  +
class OperationWithDefaultsOutput:
         569  +
    default_blob: rest_json.types.Blob
         570  +
         571  +
    default_boolean: bool
         572  +
         573  +
    default_byte: int
         574  +
         575  +
    default_document_boolean: rest_json.types.Document
         576  +
         577  +
    default_document_list: rest_json.types.Document
         578  +
         579  +
    default_document_map: rest_json.types.Document
         580  +
         581  +
    default_document_string: rest_json.types.Document
         582  +
         583  +
    default_double: float
         584  +
         585  +
    default_enum: rest_json.model.TestEnum
         586  +
         587  +
    default_float: float
         588  +
         589  +
    default_int_enum: int
         590  +
         591  +
    default_integer: int
         592  +
         593  +
    default_list: typing.List[str]
         594  +
         595  +
    default_long: int
         596  +
         597  +
    default_map: typing.Dict[str, str]
         598  +
         599  +
    default_null_document: typing.Optional[rest_json.types.Document]
         600  +
         601  +
    default_short: int
         602  +
         603  +
    default_string: str
         604  +
         605  +
    default_timestamp: rest_json.types.DateTime
         606  +
         607  +
    empty_blob: rest_json.types.Blob
         608  +
         609  +
    empty_string: str
         610  +
         611  +
    false_boolean: bool
         612  +
         613  +
    zero_byte: int
         614  +
         615  +
    zero_double: float
         616  +
         617  +
    zero_float: float
         618  +
         619  +
    zero_integer: int
         620  +
         621  +
    zero_long: int
         622  +
         623  +
    zero_short: int
         624  +
         625  +
    def __init__(self, default_string: str, default_boolean: bool, default_list: typing.List[str], default_document_map: rest_json.types.Document, default_document_string: rest_json.types.Document, default_document_boolean: rest_json.types.Document, default_document_list: rest_json.types.Document, default_null_document: typing.Optional[rest_json.types.Document] = ..., default_timestamp: rest_json.types.DateTime, default_blob: rest_json.types.Blob, default_byte: int, default_short: int, default_integer: int, default_long: int, default_float: float, default_double: float, default_map: typing.Dict[str, str], default_enum: rest_json.model.TestEnum, default_int_enum: int, empty_string: str, false_boolean: bool, empty_blob: rest_json.types.Blob, zero_byte: int, zero_short: int, zero_integer: int, zero_long: int, zero_float: float, zero_double: float) -> None:
         626  +
        ...
         627  +
         628  +
         629  +
class OperationWithNestedStructureOutput:
         630  +
    dialog: rest_json.model.Dialog
         631  +
         632  +
    dialog_list: typing.List[rest_json.model.Dialog]
         633  +
         634  +
    dialog_map: typing.Dict[str, rest_json.model.Dialog]
         635  +
         636  +
    def __init__(self, dialog: rest_json.model.Dialog, dialog_list: typing.List[rest_json.model.Dialog], dialog_map: typing.Dict[str, rest_json.model.Dialog]) -> None:
         637  +
        ...
         638  +
         639  +
  563    640   
class PostPlayerActionOutput:
  564    641   
    action: rest_json.model.PlayerAction
  565    642   
  566    643   
    def __init__(self, action: rest_json.model.PlayerAction) -> None:
  567    644   
        ...
  568    645   
  569    646   
  570    647   
class PostUnionWithJsonNameOutput:
  571    648   
    value: rest_json.model.UnionWithJsonName
  572    649   
@@ -653,730 +712,796 @@
  673    750   
  674    751   
class TestBodyStructureOutput:
  675    752   
    test_config: typing.Optional[rest_json.model.TestConfig]
  676    753   
  677    754   
    test_id: typing.Optional[str]
  678    755   
  679    756   
    def __init__(self, test_id: typing.Optional[str] = ..., test_config: typing.Optional[rest_json.model.TestConfig] = ...) -> None:
  680    757   
        ...
  681    758   
  682    759   
         760  +
class TestNoInputNoPayloadOutput:
         761  +
    test_id: typing.Optional[str]
         762  +
         763  +
    def __init__(self, test_id: typing.Optional[str] = ...) -> None:
         764  +
        ...
         765  +
         766  +
  683    767   
class TestNoPayloadOutput:
  684    768   
    test_id: typing.Optional[str]
  685    769   
  686    770   
    def __init__(self, test_id: typing.Optional[str] = ...) -> None:
  687    771   
        ...
  688    772   
  689    773   
  690    774   
class TestPayloadBlobOutput:
  691    775   
    content_type: typing.Optional[str]
  692    776   

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

@@ -1,1 +79,105 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
/// Error type for the `PutWithContentEncoding` operation.
    3         -
/// Each variant represents an error that can occur for the `PutWithContentEncoding` operation.
           2  +
/// Error type for the `OperationWithNestedStructure` operation.
           3  +
/// Each variant represents an error that can occur for the `OperationWithNestedStructure` operation.
    4      4   
#[derive(::std::fmt::Debug)]
    5         -
pub enum PutWithContentEncodingError {
           5  +
pub enum OperationWithNestedStructureError {
           6  +
    /// 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.
           7  +
    ValidationException(crate::error::ValidationException),
    6      8   
    #[allow(missing_docs)] // documentation missing in model
    7      9   
    InternalServerError(crate::error::InternalServerError),
    8     10   
}
    9         -
impl ::std::fmt::Display for PutWithContentEncodingError {
          11  +
impl ::std::fmt::Display for OperationWithNestedStructureError {
   10     12   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   11     13   
        match &self {
   12         -
            PutWithContentEncodingError::InternalServerError(_inner) => _inner.fmt(f),
          14  +
            OperationWithNestedStructureError::ValidationException(_inner) => _inner.fmt(f),
          15  +
            OperationWithNestedStructureError::InternalServerError(_inner) => _inner.fmt(f),
   13     16   
        }
   14     17   
    }
   15     18   
}
   16         -
impl PutWithContentEncodingError {
   17         -
    /// Returns `true` if the error kind is `PutWithContentEncodingError::InternalServerError`.
          19  +
impl OperationWithNestedStructureError {
          20  +
    /// Returns `true` if the error kind is `OperationWithNestedStructureError::ValidationException`.
          21  +
    pub fn is_validation_exception(&self) -> bool {
          22  +
        matches!(
          23  +
            &self,
          24  +
            OperationWithNestedStructureError::ValidationException(_)
          25  +
        )
          26  +
    }
          27  +
    /// Returns `true` if the error kind is `OperationWithNestedStructureError::InternalServerError`.
   18     28   
    pub fn is_internal_server_error(&self) -> bool {
   19         -
        matches!(&self, PutWithContentEncodingError::InternalServerError(_))
          29  +
        matches!(
          30  +
            &self,
          31  +
            OperationWithNestedStructureError::InternalServerError(_)
          32  +
        )
   20     33   
    }
   21     34   
    /// Returns the error name string by matching the correct variant.
   22     35   
    pub fn name(&self) -> &'static str {
   23     36   
        match &self {
   24         -
            PutWithContentEncodingError::InternalServerError(_inner) => _inner.name(),
          37  +
            OperationWithNestedStructureError::ValidationException(_inner) => _inner.name(),
          38  +
            OperationWithNestedStructureError::InternalServerError(_inner) => _inner.name(),
   25     39   
        }
   26     40   
    }
   27     41   
}
   28         -
impl ::std::error::Error for PutWithContentEncodingError {
          42  +
impl ::std::error::Error for OperationWithNestedStructureError {
   29     43   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
   30     44   
        match &self {
   31         -
            PutWithContentEncodingError::InternalServerError(_inner) => Some(_inner),
          45  +
            OperationWithNestedStructureError::ValidationException(_inner) => Some(_inner),
          46  +
            OperationWithNestedStructureError::InternalServerError(_inner) => Some(_inner),
   32     47   
        }
   33     48   
    }
   34     49   
}
          50  +
impl ::std::convert::From<crate::error::ValidationException>
          51  +
    for crate::error::OperationWithNestedStructureError
          52  +
{
          53  +
    fn from(
          54  +
        variant: crate::error::ValidationException,
          55  +
    ) -> crate::error::OperationWithNestedStructureError {
          56  +
        Self::ValidationException(variant)
          57  +
    }
          58  +
}
   35     59   
impl ::std::convert::From<crate::error::InternalServerError>
   36         -
    for crate::error::PutWithContentEncodingError
          60  +
    for crate::error::OperationWithNestedStructureError
   37     61   
{
   38     62   
    fn from(
   39     63   
        variant: crate::error::InternalServerError,
   40         -
    ) -> crate::error::PutWithContentEncodingError {
          64  +
    ) -> crate::error::OperationWithNestedStructureError {
   41     65   
        Self::InternalServerError(variant)
   42     66   
    }
   43     67   
}
   44     68   
   45         -
impl ::std::convert::From<::pyo3::PyErr> for crate::error::PutWithContentEncodingError {
   46         -
    fn from(variant: ::pyo3::PyErr) -> crate::error::PutWithContentEncodingError {
          69  +
impl ::std::convert::From<::pyo3::PyErr> for crate::error::OperationWithNestedStructureError {
          70  +
    fn from(variant: ::pyo3::PyErr) -> crate::error::OperationWithNestedStructureError {
   47     71   
        ::pyo3::Python::with_gil(|py| {
   48     72   
            let error = variant.value(py);
   49         -
          73  +
            if let Ok(error) = error.extract::<crate::error::ValidationException>() {
          74  +
                return error.into();
          75  +
            }
   50     76   
            crate::error::InternalServerError {
   51     77   
                message: error.to_string(),
   52     78   
            }
   53     79   
            .into()
   54     80   
        })
   55     81   
    }
   56     82   
}
   57     83   
   58     84   
#[::pyo3::pyclass(extends = ::pyo3::exceptions::PyException)]
   59     85   
/// :param message str:
@@ -84,110 +143,430 @@
  104    130   
    }
  105    131   
}
  106    132   
impl ::std::error::Error for InternalServerError {}
  107    133   
impl InternalServerError {
  108    134   
    /// Creates a new builder-style object to manufacture [`InternalServerError`](crate::error::InternalServerError).
  109    135   
    pub fn builder() -> crate::error::internal_server_error::Builder {
  110    136   
        crate::error::internal_server_error::Builder::default()
  111    137   
    }
  112    138   
}
  113    139   
         140  +
#[::pyo3::pyclass(extends = ::pyo3::exceptions::PyException)]
         141  +
/// :param message str:
         142  +
/// :param field_list typing.Optional\[typing.List\[rest_json.model.ValidationExceptionField\]\]:
         143  +
/// :rtype None:
         144  +
/// 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.
         145  +
#[derive(
         146  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         147  +
)]
         148  +
pub struct ValidationException {
         149  +
    #[pyo3(get, set)]
         150  +
    /// :type str:
         151  +
    /// A summary of the validation failure.
         152  +
    pub message: ::std::string::String,
         153  +
    #[pyo3(get, set)]
         154  +
    /// :type typing.Optional\[typing.List\[rest_json.model.ValidationExceptionField\]\]:
         155  +
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         156  +
    pub field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         157  +
}
         158  +
impl ValidationException {
         159  +
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         160  +
    pub fn field_list(&self) -> ::std::option::Option<&[crate::model::ValidationExceptionField]> {
         161  +
        self.field_list.as_deref()
         162  +
    }
         163  +
}
         164  +
#[allow(clippy::new_without_default)]
         165  +
#[allow(clippy::too_many_arguments)]
         166  +
#[::pyo3::pymethods]
         167  +
impl ValidationException {
         168  +
    #[new]
         169  +
    pub fn new(
         170  +
        message: ::std::string::String,
         171  +
        field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         172  +
    ) -> Self {
         173  +
        Self {
         174  +
            message,
         175  +
            field_list,
         176  +
        }
         177  +
    }
         178  +
    fn __repr__(&self) -> String {
         179  +
        format!("{self:?}")
         180  +
    }
         181  +
    fn __str__(&self) -> String {
         182  +
        format!("{self:?}")
         183  +
    }
         184  +
}
         185  +
impl ValidationException {
         186  +
    /// Returns the error message.
         187  +
    pub fn message(&self) -> &str {
         188  +
        &self.message
         189  +
    }
         190  +
    #[doc(hidden)]
         191  +
    /// Returns the error name.
         192  +
    pub fn name(&self) -> &'static str {
         193  +
        "ValidationException"
         194  +
    }
         195  +
}
         196  +
impl ::std::fmt::Display for ValidationException {
         197  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         198  +
        ::std::write!(f, "ValidationException")?;
         199  +
        {
         200  +
            ::std::write!(f, ": {}", &self.message)?;
         201  +
        }
         202  +
        Ok(())
         203  +
    }
         204  +
}
         205  +
impl ::std::error::Error for ValidationException {}
         206  +
impl ValidationException {
         207  +
    /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
         208  +
    pub fn builder() -> crate::error::validation_exception::Builder {
         209  +
        crate::error::validation_exception::Builder::default()
         210  +
    }
         211  +
}
         212  +
         213  +
/// Error type for the `OperationWithDefaults` operation.
         214  +
/// Each variant represents an error that can occur for the `OperationWithDefaults` operation.
         215  +
#[derive(::std::fmt::Debug)]
         216  +
pub enum OperationWithDefaultsError {
         217  +
    /// 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.
         218  +
    ValidationException(crate::error::ValidationException),
         219  +
    #[allow(missing_docs)] // documentation missing in model
         220  +
    InternalServerError(crate::error::InternalServerError),
         221  +
}
         222  +
impl ::std::fmt::Display for OperationWithDefaultsError {
         223  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         224  +
        match &self {
         225  +
            OperationWithDefaultsError::ValidationException(_inner) => _inner.fmt(f),
         226  +
            OperationWithDefaultsError::InternalServerError(_inner) => _inner.fmt(f),
         227  +
        }
         228  +
    }
         229  +
}
         230  +
impl OperationWithDefaultsError {
         231  +
    /// Returns `true` if the error kind is `OperationWithDefaultsError::ValidationException`.
         232  +
    pub fn is_validation_exception(&self) -> bool {
         233  +
        matches!(&self, OperationWithDefaultsError::ValidationException(_))
         234  +
    }
         235  +
    /// Returns `true` if the error kind is `OperationWithDefaultsError::InternalServerError`.
         236  +
    pub fn is_internal_server_error(&self) -> bool {
         237  +
        matches!(&self, OperationWithDefaultsError::InternalServerError(_))
         238  +
    }
         239  +
    /// Returns the error name string by matching the correct variant.
         240  +
    pub fn name(&self) -> &'static str {
         241  +
        match &self {
         242  +
            OperationWithDefaultsError::ValidationException(_inner) => _inner.name(),
         243  +
            OperationWithDefaultsError::InternalServerError(_inner) => _inner.name(),
         244  +
        }
         245  +
    }
         246  +
}
         247  +
impl ::std::error::Error for OperationWithDefaultsError {
         248  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         249  +
        match &self {
         250  +
            OperationWithDefaultsError::ValidationException(_inner) => Some(_inner),
         251  +
            OperationWithDefaultsError::InternalServerError(_inner) => Some(_inner),
         252  +
        }
         253  +
    }
         254  +
}
         255  +
impl ::std::convert::From<crate::error::ValidationException>
         256  +
    for crate::error::OperationWithDefaultsError
         257  +
{
         258  +
    fn from(
         259  +
        variant: crate::error::ValidationException,
         260  +
    ) -> crate::error::OperationWithDefaultsError {
         261  +
        Self::ValidationException(variant)
         262  +
    }
         263  +
}
         264  +
impl ::std::convert::From<crate::error::InternalServerError>
         265  +
    for crate::error::OperationWithDefaultsError
         266  +
{
         267  +
    fn from(
         268  +
        variant: crate::error::InternalServerError,
         269  +
    ) -> crate::error::OperationWithDefaultsError {
         270  +
        Self::InternalServerError(variant)
         271  +
    }
         272  +
}
         273  +
         274  +
impl ::std::convert::From<::pyo3::PyErr> for crate::error::OperationWithDefaultsError {
         275  +
    fn from(variant: ::pyo3::PyErr) -> crate::error::OperationWithDefaultsError {
         276  +
        ::pyo3::Python::with_gil(|py| {
         277  +
            let error = variant.value(py);
         278  +
            if let Ok(error) = error.extract::<crate::error::ValidationException>() {
         279  +
                return error.into();
         280  +
            }
         281  +
            crate::error::InternalServerError {
         282  +
                message: error.to_string(),
         283  +
            }
         284  +
            .into()
         285  +
        })
         286  +
    }
         287  +
}
         288  +
         289  +
/// Error type for the `ContentTypeParameters` operation.
         290  +
/// Each variant represents an error that can occur for the `ContentTypeParameters` operation.
         291  +
#[derive(::std::fmt::Debug)]
         292  +
pub enum ContentTypeParametersError {
         293  +
    #[allow(missing_docs)] // documentation missing in model
         294  +
    InternalServerError(crate::error::InternalServerError),
         295  +
}
         296  +
impl ::std::fmt::Display for ContentTypeParametersError {
         297  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         298  +
        match &self {
         299  +
            ContentTypeParametersError::InternalServerError(_inner) => _inner.fmt(f),
         300  +
        }
         301  +
    }
         302  +
}
         303  +
impl ContentTypeParametersError {
         304  +
    /// Returns `true` if the error kind is `ContentTypeParametersError::InternalServerError`.
         305  +
    pub fn is_internal_server_error(&self) -> bool {
         306  +
        matches!(&self, ContentTypeParametersError::InternalServerError(_))
         307  +
    }
         308  +
    /// Returns the error name string by matching the correct variant.
         309  +
    pub fn name(&self) -> &'static str {
         310  +
        match &self {
         311  +
            ContentTypeParametersError::InternalServerError(_inner) => _inner.name(),
         312  +
        }
         313  +
    }
         314  +
}
         315  +
impl ::std::error::Error for ContentTypeParametersError {
         316  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         317  +
        match &self {
         318  +
            ContentTypeParametersError::InternalServerError(_inner) => Some(_inner),
         319  +
        }
         320  +
    }
         321  +
}
         322  +
impl ::std::convert::From<crate::error::InternalServerError>
         323  +
    for crate::error::ContentTypeParametersError
         324  +
{
         325  +
    fn from(
         326  +
        variant: crate::error::InternalServerError,
         327  +
    ) -> crate::error::ContentTypeParametersError {
         328  +
        Self::InternalServerError(variant)
         329  +
    }
         330  +
}
         331  +
         332  +
impl ::std::convert::From<::pyo3::PyErr> for crate::error::ContentTypeParametersError {
         333  +
    fn from(variant: ::pyo3::PyErr) -> crate::error::ContentTypeParametersError {
         334  +
        ::pyo3::Python::with_gil(|py| {
         335  +
            let error = variant.value(py);
         336  +
         337  +
            crate::error::InternalServerError {
         338  +
                message: error.to_string(),
         339  +
            }
         340  +
            .into()
         341  +
        })
         342  +
    }
         343  +
}
         344  +
         345  +
/// Error type for the `PutWithContentEncoding` operation.
         346  +
/// Each variant represents an error that can occur for the `PutWithContentEncoding` operation.
         347  +
#[derive(::std::fmt::Debug)]
         348  +
pub enum PutWithContentEncodingError {
         349  +
    #[allow(missing_docs)] // documentation missing in model
         350  +
    InternalServerError(crate::error::InternalServerError),
         351  +
}
         352  +
impl ::std::fmt::Display for PutWithContentEncodingError {
         353  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         354  +
        match &self {
         355  +
            PutWithContentEncodingError::InternalServerError(_inner) => _inner.fmt(f),
         356  +
        }
         357  +
    }
         358  +
}
         359  +
impl PutWithContentEncodingError {
         360  +
    /// Returns `true` if the error kind is `PutWithContentEncodingError::InternalServerError`.
         361  +
    pub fn is_internal_server_error(&self) -> bool {
         362  +
        matches!(&self, PutWithContentEncodingError::InternalServerError(_))
         363  +
    }
         364  +
    /// Returns the error name string by matching the correct variant.
         365  +
    pub fn name(&self) -> &'static str {
         366  +
        match &self {
         367  +
            PutWithContentEncodingError::InternalServerError(_inner) => _inner.name(),
         368  +
        }
         369  +
    }
         370  +
}
         371  +
impl ::std::error::Error for PutWithContentEncodingError {
         372  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         373  +
        match &self {
         374  +
            PutWithContentEncodingError::InternalServerError(_inner) => Some(_inner),
         375  +
        }
         376  +
    }
         377  +
}
         378  +
impl ::std::convert::From<crate::error::InternalServerError>
         379  +
    for crate::error::PutWithContentEncodingError
         380  +
{
         381  +
    fn from(
         382  +
        variant: crate::error::InternalServerError,
         383  +
    ) -> crate::error::PutWithContentEncodingError {
         384  +
        Self::InternalServerError(variant)
         385  +
    }
         386  +
}
         387  +
         388  +
impl ::std::convert::From<::pyo3::PyErr> for crate::error::PutWithContentEncodingError {
         389  +
    fn from(variant: ::pyo3::PyErr) -> crate::error::PutWithContentEncodingError {
         390  +
        ::pyo3::Python::with_gil(|py| {
         391  +
            let error = variant.value(py);
         392  +
         393  +
            crate::error::InternalServerError {
         394  +
                message: error.to_string(),
         395  +
            }
         396  +
            .into()
         397  +
        })
         398  +
    }
         399  +
}
         400  +
  114    401   
/// Error type for the `FractionalSeconds` operation.
  115    402   
/// Each variant represents an error that can occur for the `FractionalSeconds` operation.
  116    403   
#[derive(::std::fmt::Debug)]
  117    404   
pub enum FractionalSecondsError {
  118    405   
    #[allow(missing_docs)] // documentation missing in model
  119    406   
    InternalServerError(crate::error::InternalServerError),
  120    407   
}
  121    408   
impl ::std::fmt::Display for FractionalSecondsError {
  122    409   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  123    410   
        match &self {
@@ -192,479 +251,592 @@
  212    499   
            let error = variant.value(py);
  213    500   
  214    501   
            crate::error::InternalServerError {
  215    502   
                message: error.to_string(),
  216    503   
            }
  217    504   
            .into()
  218    505   
        })
  219    506   
    }
  220    507   
}
  221    508   
         509  +
/// Error type for the `TestNoInputNoPayload` operation.
         510  +
/// Each variant represents an error that can occur for the `TestNoInputNoPayload` operation.
         511  +
#[derive(::std::fmt::Debug)]
         512  +
pub enum TestNoInputNoPayloadError {
         513  +
    #[allow(missing_docs)] // documentation missing in model
         514  +
    InternalServerError(crate::error::InternalServerError),
         515  +
}
         516  +
impl ::std::fmt::Display for TestNoInputNoPayloadError {
         517  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         518  +
        match &self {
         519  +
            TestNoInputNoPayloadError::InternalServerError(_inner) => _inner.fmt(f),
         520  +
        }
         521  +
    }
         522  +
}
         523  +
impl TestNoInputNoPayloadError {
         524  +
    /// Returns `true` if the error kind is `TestNoInputNoPayloadError::InternalServerError`.
         525  +
    pub fn is_internal_server_error(&self) -> bool {
         526  +
        matches!(&self, TestNoInputNoPayloadError::InternalServerError(_))
         527  +
    }
         528  +
    /// Returns the error name string by matching the correct variant.
         529  +
    pub fn name(&self) -> &'static str {
         530  +
        match &self {
         531  +
            TestNoInputNoPayloadError::InternalServerError(_inner) => _inner.name(),
         532  +
        }
         533  +
    }
         534  +
}
         535  +
impl ::std::error::Error for TestNoInputNoPayloadError {
         536  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         537  +
        match &self {
         538  +
            TestNoInputNoPayloadError::InternalServerError(_inner) => Some(_inner),
         539  +
        }
         540  +
    }
         541  +
}
         542  +
impl ::std::convert::From<crate::error::InternalServerError>
         543  +
    for crate::error::TestNoInputNoPayloadError
         544  +
{
         545  +
    fn from(variant: crate::error::InternalServerError) -> crate::error::TestNoInputNoPayloadError {
         546  +
        Self::InternalServerError(variant)
         547  +
    }
         548  +
}
         549  +
         550  +
impl ::std::convert::From<::pyo3::PyErr> for crate::error::TestNoInputNoPayloadError {
         551  +
    fn from(variant: ::pyo3::PyErr) -> crate::error::TestNoInputNoPayloadError {
         552  +
        ::pyo3::Python::with_gil(|py| {
         553  +
            let error = variant.value(py);
         554  +
         555  +
            crate::error::InternalServerError {
         556  +
                message: error.to_string(),
         557  +
            }
         558  +
            .into()
         559  +
        })
         560  +
    }
         561  +
}
         562  +
  222    563   
/// Error type for the `TestNoPayload` operation.
  223    564   
/// Each variant represents an error that can occur for the `TestNoPayload` operation.
  224    565   
#[derive(::std::fmt::Debug)]
  225    566   
pub enum TestNoPayloadError {
  226    567   
    #[allow(missing_docs)] // documentation missing in model
  227    568   
    InternalServerError(crate::error::InternalServerError),
  228    569   
}
  229    570   
impl ::std::fmt::Display for TestNoPayloadError {
  230    571   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  231    572   
        match &self {
@@ -904,1245 +1036,1304 @@
  924   1265   
                return error.into();
  925   1266   
            }
  926   1267   
            crate::error::InternalServerError {
  927   1268   
                message: error.to_string(),
  928   1269   
            }
  929   1270   
            .into()
  930   1271   
        })
  931   1272   
    }
  932   1273   
}
  933   1274   
  934         -
#[::pyo3::pyclass(extends = ::pyo3::exceptions::PyException)]
  935         -
/// :param message str:
  936         -
/// :param field_list typing.Optional\[typing.List\[rest_json.model.ValidationExceptionField\]\]:
  937         -
/// :rtype None:
  938         -
/// 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.
  939         -
#[derive(
  940         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  941         -
)]
  942         -
pub struct ValidationException {
  943         -
    #[pyo3(get, set)]
  944         -
    /// :type str:
  945         -
    /// A summary of the validation failure.
  946         -
    pub message: ::std::string::String,
  947         -
    #[pyo3(get, set)]
  948         -
    /// :type typing.Optional\[typing.List\[rest_json.model.ValidationExceptionField\]\]:
  949         -
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
  950         -
    pub field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
  951         -
}
  952         -
impl ValidationException {
  953         -
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
  954         -
    pub fn field_list(&self) -> ::std::option::Option<&[crate::model::ValidationExceptionField]> {
  955         -
        self.field_list.as_deref()
  956         -
    }
  957         -
}
  958         -
#[allow(clippy::new_without_default)]
  959         -
#[allow(clippy::too_many_arguments)]
  960         -
#[::pyo3::pymethods]
  961         -
impl ValidationException {
  962         -
    #[new]
  963         -
    pub fn new(
  964         -
        message: ::std::string::String,
  965         -
        field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
  966         -
    ) -> Self {
  967         -
        Self {
  968         -
            message,
  969         -
            field_list,
  970         -
        }
  971         -
    }
  972         -
    fn __repr__(&self) -> String {
  973         -
        format!("{self:?}")
  974         -
    }
  975         -
    fn __str__(&self) -> String {
  976         -
        format!("{self:?}")
  977         -
    }
  978         -
}
  979         -
impl ValidationException {
  980         -
    /// Returns the error message.
  981         -
    pub fn message(&self) -> &str {
  982         -
        &self.message
  983         -
    }
  984         -
    #[doc(hidden)]
  985         -
    /// Returns the error name.
  986         -
    pub fn name(&self) -> &'static str {
  987         -
        "ValidationException"
  988         -
    }
  989         -
}
  990         -
impl ::std::fmt::Display for ValidationException {
  991         -
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  992         -
        ::std::write!(f, "ValidationException")?;
  993         -
        {
  994         -
            ::std::write!(f, ": {}", &self.message)?;
  995         -
        }
  996         -
        Ok(())
  997         -
    }
  998         -
}
  999         -
impl ::std::error::Error for ValidationException {}
 1000         -
impl ValidationException {
 1001         -
    /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
 1002         -
    pub fn builder() -> crate::error::validation_exception::Builder {
 1003         -
        crate::error::validation_exception::Builder::default()
 1004         -
    }
 1005         -
}
 1006         -
 1007   1275   
/// Error type for the `MalformedTimestampBodyDateTime` operation.
 1008   1276   
/// Each variant represents an error that can occur for the `MalformedTimestampBodyDateTime` operation.
 1009   1277   
#[derive(::std::fmt::Debug)]
 1010   1278   
pub enum MalformedTimestampBodyDateTimeError {
 1011   1279   
    /// 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.
 1012   1280   
    ValidationException(crate::error::ValidationException),
 1013   1281   
    #[allow(missing_docs)] // documentation missing in model
 1014   1282   
    InternalServerError(crate::error::InternalServerError),
 1015   1283   
}
 1016   1284   
impl ::std::fmt::Display for MalformedTimestampBodyDateTimeError {

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

@@ -1,1 +31,233 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[::pyo3::pyclass]
           3  +
/// :param top_level rest_json.model.TopLevel:
           4  +
/// :rtype None:
           5  +
#[allow(missing_docs)] // documentation missing in model
           6  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           7  +
pub struct OperationWithNestedStructureInput {
           8  +
    #[pyo3(get, set)]
           9  +
    /// :type rest_json.model.TopLevel:
          10  +
    #[allow(missing_docs)] // documentation missing in model
          11  +
    pub top_level: crate::model::TopLevel,
          12  +
}
          13  +
impl OperationWithNestedStructureInput {
          14  +
    #[allow(missing_docs)] // documentation missing in model
          15  +
    pub fn top_level(&self) -> &crate::model::TopLevel {
          16  +
        &self.top_level
          17  +
    }
          18  +
}
          19  +
#[allow(clippy::new_without_default)]
          20  +
#[allow(clippy::too_many_arguments)]
          21  +
#[::pyo3::pymethods]
          22  +
impl OperationWithNestedStructureInput {
          23  +
    #[new]
          24  +
    pub fn new(top_level: crate::model::TopLevel) -> Self {
          25  +
        Self { top_level }
          26  +
    }
          27  +
    fn __repr__(&self) -> String {
          28  +
        format!("{self:?}")
          29  +
    }
          30  +
    fn __str__(&self) -> String {
          31  +
        format!("{self:?}")
          32  +
    }
          33  +
}
          34  +
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<OperationWithNestedStructureInput> {
          35  +
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
          36  +
        ob.extract::<OperationWithNestedStructureInput>()
          37  +
            .map(Box::new)
          38  +
    }
          39  +
}
          40  +
          41  +
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<OperationWithNestedStructureInput> {
          42  +
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
          43  +
        (*self).into_py(py)
          44  +
    }
          45  +
}
          46  +
impl crate::constrained::Constrained for crate::input::OperationWithNestedStructureInput {
          47  +
    type Unconstrained = crate::input::operation_with_nested_structure_input_internal::Builder;
          48  +
}
          49  +
impl OperationWithNestedStructureInput {
          50  +
    /// Creates a new builder-style object to manufacture [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
          51  +
    pub fn builder() -> crate::input::operation_with_nested_structure_input::Builder {
          52  +
        crate::input::operation_with_nested_structure_input::Builder::default()
          53  +
    }
          54  +
}
          55  +
          56  +
#[::pyo3::pyclass]
          57  +
/// :param defaults typing.Optional\[rest_json.model.Defaults\]:
          58  +
/// :param client_optional_defaults typing.Optional\[rest_json.model.ClientOptionalDefaults\]:
          59  +
/// :param top_level_default str:
          60  +
/// :param other_top_level_default int:
          61  +
/// :rtype None:
          62  +
#[allow(missing_docs)] // documentation missing in model
          63  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
          64  +
pub struct OperationWithDefaultsInput {
          65  +
    #[pyo3(get, set)]
          66  +
    /// :type typing.Optional\[rest_json.model.Defaults\]:
          67  +
    #[allow(missing_docs)] // documentation missing in model
          68  +
    pub defaults: ::std::option::Option<crate::model::Defaults>,
          69  +
    #[pyo3(get, set)]
          70  +
    /// :type typing.Optional\[rest_json.model.ClientOptionalDefaults\]:
          71  +
    #[allow(missing_docs)] // documentation missing in model
          72  +
    pub client_optional_defaults: ::std::option::Option<crate::model::ClientOptionalDefaults>,
          73  +
    #[pyo3(get, set)]
          74  +
    /// :type str:
          75  +
    #[allow(missing_docs)] // documentation missing in model
          76  +
    pub top_level_default: ::std::string::String,
          77  +
    #[pyo3(get, set)]
          78  +
    /// :type int:
          79  +
    #[allow(missing_docs)] // documentation missing in model
          80  +
    pub other_top_level_default: i32,
          81  +
}
          82  +
impl OperationWithDefaultsInput {
          83  +
    #[allow(missing_docs)] // documentation missing in model
          84  +
    pub fn defaults(&self) -> ::std::option::Option<&crate::model::Defaults> {
          85  +
        self.defaults.as_ref()
          86  +
    }
          87  +
    #[allow(missing_docs)] // documentation missing in model
          88  +
    pub fn client_optional_defaults(
          89  +
        &self,
          90  +
    ) -> ::std::option::Option<&crate::model::ClientOptionalDefaults> {
          91  +
        self.client_optional_defaults.as_ref()
          92  +
    }
          93  +
    #[allow(missing_docs)] // documentation missing in model
          94  +
    pub fn top_level_default(&self) -> &str {
          95  +
        use std::ops::Deref;
          96  +
        self.top_level_default.deref()
          97  +
    }
          98  +
    #[allow(missing_docs)] // documentation missing in model
          99  +
    pub fn other_top_level_default(&self) -> i32 {
         100  +
        self.other_top_level_default
         101  +
    }
         102  +
}
         103  +
#[allow(clippy::new_without_default)]
         104  +
#[allow(clippy::too_many_arguments)]
         105  +
#[::pyo3::pymethods]
         106  +
impl OperationWithDefaultsInput {
         107  +
    #[new]
         108  +
    pub fn new(
         109  +
        defaults: ::std::option::Option<crate::model::Defaults>,
         110  +
        client_optional_defaults: ::std::option::Option<crate::model::ClientOptionalDefaults>,
         111  +
        top_level_default: ::std::string::String,
         112  +
        other_top_level_default: i32,
         113  +
    ) -> Self {
         114  +
        Self {
         115  +
            defaults,
         116  +
            client_optional_defaults,
         117  +
            top_level_default,
         118  +
            other_top_level_default,
         119  +
        }
         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> for std::boxed::Box<OperationWithDefaultsInput> {
         129  +
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
         130  +
        ob.extract::<OperationWithDefaultsInput>().map(Box::new)
         131  +
    }
         132  +
}
         133  +
         134  +
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<OperationWithDefaultsInput> {
         135  +
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
         136  +
        (*self).into_py(py)
         137  +
    }
         138  +
}
         139  +
impl crate::constrained::Constrained for crate::input::OperationWithDefaultsInput {
         140  +
    type Unconstrained = crate::input::operation_with_defaults_input_internal::Builder;
         141  +
}
         142  +
impl OperationWithDefaultsInput {
         143  +
    /// Creates a new builder-style object to manufacture [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
         144  +
    pub fn builder() -> crate::input::operation_with_defaults_input::Builder {
         145  +
        crate::input::operation_with_defaults_input::Builder::default()
         146  +
    }
         147  +
}
         148  +
         149  +
#[::pyo3::pyclass]
         150  +
/// :param value typing.Optional\[int\]:
         151  +
/// :rtype None:
         152  +
#[allow(missing_docs)] // documentation missing in model
         153  +
#[derive(
         154  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         155  +
)]
         156  +
pub struct ContentTypeParametersInput {
         157  +
    #[pyo3(get, set)]
         158  +
    /// :type typing.Optional\[int\]:
         159  +
    #[allow(missing_docs)] // documentation missing in model
         160  +
    pub value: ::std::option::Option<i32>,
         161  +
}
         162  +
impl ContentTypeParametersInput {
         163  +
    #[allow(missing_docs)] // documentation missing in model
         164  +
    pub fn value(&self) -> ::std::option::Option<i32> {
         165  +
        self.value
         166  +
    }
         167  +
}
         168  +
#[allow(clippy::new_without_default)]
         169  +
#[allow(clippy::too_many_arguments)]
         170  +
#[::pyo3::pymethods]
         171  +
impl ContentTypeParametersInput {
         172  +
    #[new]
         173  +
    pub fn new(value: ::std::option::Option<i32>) -> Self {
         174  +
        Self { value }
         175  +
    }
         176  +
    fn __repr__(&self) -> String {
         177  +
        format!("{self:?}")
         178  +
    }
         179  +
    fn __str__(&self) -> String {
         180  +
        format!("{self:?}")
         181  +
    }
         182  +
}
         183  +
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ContentTypeParametersInput> {
         184  +
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
         185  +
        ob.extract::<ContentTypeParametersInput>().map(Box::new)
         186  +
    }
         187  +
}
         188  +
         189  +
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ContentTypeParametersInput> {
         190  +
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
         191  +
        (*self).into_py(py)
         192  +
    }
         193  +
}
         194  +
impl crate::constrained::Constrained for crate::input::ContentTypeParametersInput {
         195  +
    type Unconstrained = crate::input::content_type_parameters_input_internal::Builder;
         196  +
}
         197  +
impl ContentTypeParametersInput {
         198  +
    /// Creates a new builder-style object to manufacture [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
         199  +
    pub fn builder() -> crate::input::content_type_parameters_input::Builder {
         200  +
        crate::input::content_type_parameters_input::Builder::default()
         201  +
    }
         202  +
}
         203  +
    2    204   
#[::pyo3::pyclass]
    3    205   
/// :param encoding typing.Optional\[str\]:
    4    206   
/// :param data typing.Optional\[str\]:
    5    207   
/// :rtype None:
    6    208   
#[allow(missing_docs)] // documentation missing in model
    7    209   
#[derive(
    8    210   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    9    211   
)]
   10    212   
pub struct PutWithContentEncodingInput {
   11    213   
    #[pyo3(get, set)]
@@ -125,327 +184,429 @@
  145    347   
impl crate::constrained::Constrained for crate::input::DatetimeOffsetsInput {
  146    348   
    type Unconstrained = crate::input::datetime_offsets_input_internal::Builder;
  147    349   
}
  148    350   
impl DatetimeOffsetsInput {
  149    351   
    /// Creates a new builder-style object to manufacture [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput).
  150    352   
    pub fn builder() -> crate::input::datetime_offsets_input::Builder {
  151    353   
        crate::input::datetime_offsets_input::Builder::default()
  152    354   
    }
  153    355   
}
  154    356   
         357  +
#[::pyo3::pyclass]
         358  +
/// :rtype None:
         359  +
#[allow(missing_docs)] // documentation missing in model
         360  +
#[derive(
         361  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         362  +
)]
         363  +
pub struct TestNoInputNoPayloadInput {}
         364  +
#[allow(clippy::new_without_default)]
         365  +
#[allow(clippy::too_many_arguments)]
         366  +
#[::pyo3::pymethods]
         367  +
impl TestNoInputNoPayloadInput {
         368  +
    #[new]
         369  +
    pub fn new() -> Self {
         370  +
        Self {}
         371  +
    }
         372  +
    fn __repr__(&self) -> String {
         373  +
        format!("{self:?}")
         374  +
    }
         375  +
    fn __str__(&self) -> String {
         376  +
        format!("{self:?}")
         377  +
    }
         378  +
}
         379  +
impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<TestNoInputNoPayloadInput> {
         380  +
    fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
         381  +
        ob.extract::<TestNoInputNoPayloadInput>().map(Box::new)
         382  +
    }
         383  +
}
         384  +
         385  +
impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<TestNoInputNoPayloadInput> {
         386  +
    fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
         387  +
        (*self).into_py(py)
         388  +
    }
         389  +
}
         390  +
impl crate::constrained::Constrained for crate::input::TestNoInputNoPayloadInput {
         391  +
    type Unconstrained = crate::input::test_no_input_no_payload_input_internal::Builder;
         392  +
}
         393  +
impl TestNoInputNoPayloadInput {
         394  +
    /// Creates a new builder-style object to manufacture [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
         395  +
    pub fn builder() -> crate::input::test_no_input_no_payload_input::Builder {
         396  +
        crate::input::test_no_input_no_payload_input::Builder::default()
         397  +
    }
         398  +
}
         399  +
  155    400   
#[::pyo3::pyclass]
  156    401   
/// :param test_id typing.Optional\[str\]:
  157    402   
/// :rtype None:
  158    403   
#[allow(missing_docs)] // documentation missing in model
  159    404   
#[derive(
  160    405   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  161    406   
)]
  162    407   
pub struct TestNoPayloadInput {
  163    408   
    #[pyo3(get, set)]
  164    409   
    /// :type typing.Optional\[str\]:
@@ -7026,7271 +7085,7764 @@
 7046   7291   
}
 7047   7292   
impl crate::constrained::Constrained for crate::input::NoInputAndNoOutputInput {
 7048   7293   
    type Unconstrained = crate::input::no_input_and_no_output_input_internal::Builder;
 7049   7294   
}
 7050   7295   
impl NoInputAndNoOutputInput {
 7051   7296   
    /// Creates a new builder-style object to manufacture [`NoInputAndNoOutputInput`](crate::input::NoInputAndNoOutputInput).
 7052   7297   
    pub fn builder() -> crate::input::no_input_and_no_output_input::Builder {
 7053   7298   
        crate::input::no_input_and_no_output_input::Builder::default()
 7054   7299   
    }
 7055   7300   
}
        7301  +
/// See [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        7302  +
///
        7303  +
pub(crate) mod operation_with_nested_structure_input_internal {
        7304  +
        7305  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        7306  +
    /// Holds one variant for each of the ways the builder can fail.
        7307  +
    #[non_exhaustive]
        7308  +
    #[allow(clippy::enum_variant_names)]
        7309  +
    pub(crate) enum ConstraintViolation {
        7310  +
        /// `top_level` was not provided but it is required when building `OperationWithNestedStructureInput`.
        7311  +
        MissingTopLevel,
        7312  +
        /// Constraint violation occurred building member `top_level` when building `OperationWithNestedStructureInput`.
        7313  +
        #[doc(hidden)]
        7314  +
        TopLevel(crate::model::top_level_internal::ConstraintViolation),
        7315  +
    }
        7316  +
    impl ::std::fmt::Display for ConstraintViolation {
        7317  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        7318  +
            match self {
        7319  +
                ConstraintViolation::MissingTopLevel => write!(f, "`top_level` was not provided but it is required when building `OperationWithNestedStructureInput`"),
        7320  +
                ConstraintViolation::TopLevel(_) => write!(f, "constraint violation occurred building member `top_level` when building `OperationWithNestedStructureInput`"),
        7321  +
            }
        7322  +
        }
        7323  +
    }
        7324  +
    impl ::std::error::Error for ConstraintViolation {}
        7325  +
    impl ConstraintViolation {
        7326  +
        pub(crate) fn as_validation_exception_field(
        7327  +
            self,
        7328  +
            path: ::std::string::String,
        7329  +
        ) -> crate::model::ValidationExceptionField {
        7330  +
            match self {
        7331  +
            ConstraintViolation::MissingTopLevel => crate::model::ValidationExceptionField {
        7332  +
                                                message: format!("Value at '{}/topLevel' failed to satisfy constraint: Member must not be null", path),
        7333  +
                                                path: path + "/topLevel",
        7334  +
                                            },
        7335  +
            ConstraintViolation::TopLevel(inner) => inner.as_validation_exception_field(path + "/topLevel"),
        7336  +
        }
        7337  +
        }
        7338  +
    }
        7339  +
    impl ::std::convert::From<ConstraintViolation>
        7340  +
        for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
        7341  +
    {
        7342  +
        fn from(constraint_violation: ConstraintViolation) -> Self {
        7343  +
            let first_validation_exception_field =
        7344  +
                constraint_violation.as_validation_exception_field("".to_owned());
        7345  +
            let validation_exception = crate::error::ValidationException {
        7346  +
                message: format!(
        7347  +
                    "1 validation error detected. {}",
        7348  +
                    &first_validation_exception_field.message
        7349  +
                ),
        7350  +
                field_list: Some(vec![first_validation_exception_field]),
        7351  +
            };
        7352  +
            Self::ConstraintViolation(
        7353  +
                                crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
        7354  +
                                    .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
        7355  +
                            )
        7356  +
        }
        7357  +
    }
        7358  +
    impl ::std::convert::From<Builder>
        7359  +
        for crate::constrained::MaybeConstrained<crate::input::OperationWithNestedStructureInput>
        7360  +
    {
        7361  +
        fn from(builder: Builder) -> Self {
        7362  +
            Self::Unconstrained(builder)
        7363  +
        }
        7364  +
    }
        7365  +
    impl ::std::convert::TryFrom<Builder> for crate::input::OperationWithNestedStructureInput {
        7366  +
        type Error = ConstraintViolation;
        7367  +
        7368  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        7369  +
            builder.build()
        7370  +
        }
        7371  +
    }
        7372  +
    /// A builder for [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        7373  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        7374  +
    pub(crate) struct Builder {
        7375  +
        pub(crate) top_level:
        7376  +
            ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TopLevel>>,
        7377  +
    }
        7378  +
    impl Builder {
        7379  +
        #[allow(missing_docs)] // documentation missing in model
        7380  +
        pub(crate) fn set_top_level(
        7381  +
            mut self,
        7382  +
            input: impl ::std::convert::Into<
        7383  +
                crate::constrained::MaybeConstrained<crate::model::TopLevel>,
        7384  +
            >,
        7385  +
        ) -> Self {
        7386  +
            self.top_level = Some(input.into());
        7387  +
            self
        7388  +
        }
        7389  +
        /// Consumes the builder and constructs a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        7390  +
        ///
        7391  +
        /// The builder fails to construct a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput) if a [`ConstraintViolation`] occurs.
        7392  +
        ///
        7393  +
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
        7394  +
        pub fn build(
        7395  +
            self,
        7396  +
        ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
        7397  +
            self.build_enforcing_all_constraints()
        7398  +
        }
        7399  +
        fn build_enforcing_all_constraints(
        7400  +
            self,
        7401  +
        ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
        7402  +
            Ok(crate::input::OperationWithNestedStructureInput {
        7403  +
                top_level: self
        7404  +
                    .top_level
        7405  +
                    .map(|v| match v {
        7406  +
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        7407  +
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        7408  +
                    })
        7409  +
                    .map(|res| res.map_err(ConstraintViolation::TopLevel))
        7410  +
                    .transpose()?
        7411  +
                    .ok_or(ConstraintViolation::MissingTopLevel)?,
        7412  +
            })
        7413  +
        }
        7414  +
    }
        7415  +
}
        7416  +
/// See [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        7417  +
///
        7418  +
pub mod operation_with_nested_structure_input {
        7419  +
        7420  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        7421  +
    /// Holds one variant for each of the ways the builder can fail.
        7422  +
        7423  +
    #[allow(clippy::enum_variant_names)]
        7424  +
    pub enum ConstraintViolation {
        7425  +
        /// `top_level` was not provided but it is required when building `OperationWithNestedStructureInput`.
        7426  +
        MissingTopLevel,
        7427  +
    }
        7428  +
    impl ::std::fmt::Display for ConstraintViolation {
        7429  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        7430  +
            match self {
        7431  +
                ConstraintViolation::MissingTopLevel => write!(f, "`top_level` was not provided but it is required when building `OperationWithNestedStructureInput`"),
        7432  +
            }
        7433  +
        }
        7434  +
    }
        7435  +
    impl ::std::error::Error for ConstraintViolation {}
        7436  +
    impl ::std::convert::TryFrom<Builder> for crate::input::OperationWithNestedStructureInput {
        7437  +
        type Error = ConstraintViolation;
        7438  +
        7439  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        7440  +
            builder.build()
        7441  +
        }
        7442  +
    }
        7443  +
    /// A builder for [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        7444  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        7445  +
    pub struct Builder {
        7446  +
        pub(crate) top_level: ::std::option::Option<crate::model::TopLevel>,
        7447  +
    }
        7448  +
    impl Builder {
        7449  +
        #[allow(missing_docs)] // documentation missing in model
        7450  +
        pub fn top_level(mut self, input: crate::model::TopLevel) -> Self {
        7451  +
            self.top_level = Some(input);
        7452  +
            self
        7453  +
        }
        7454  +
        /// Consumes the builder and constructs a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        7455  +
        ///
        7456  +
        /// The builder fails to construct a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput) if you do not provide a value for all non-`Option`al members.
        7457  +
        ///
        7458  +
        pub fn build(
        7459  +
            self,
        7460  +
        ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
        7461  +
            self.build_enforcing_required_and_enum_traits()
        7462  +
        }
        7463  +
        fn build_enforcing_required_and_enum_traits(
        7464  +
            self,
        7465  +
        ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
        7466  +
            Ok(crate::input::OperationWithNestedStructureInput {
        7467  +
                top_level: self.top_level.ok_or(ConstraintViolation::MissingTopLevel)?,
        7468  +
            })
        7469  +
        }
        7470  +
    }
        7471  +
}
        7472  +
/// See [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        7473  +
///
        7474  +
pub(crate) mod operation_with_defaults_input_internal {
        7475  +
        7476  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        7477  +
    /// Holds one variant for each of the ways the builder can fail.
        7478  +
    #[non_exhaustive]
        7479  +
    #[allow(clippy::enum_variant_names)]
        7480  +
    pub(crate) enum ConstraintViolation {
        7481  +
        /// Constraint violation occurred building member `defaults` when building `OperationWithDefaultsInput`.
        7482  +
        #[doc(hidden)]
        7483  +
        Defaults(crate::model::defaults_internal::ConstraintViolation),
        7484  +
    }
        7485  +
    impl ::std::fmt::Display for ConstraintViolation {
        7486  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        7487  +
            match self {
        7488  +
                ConstraintViolation::Defaults(_) => write!(f, "constraint violation occurred building member `defaults` when building `OperationWithDefaultsInput`"),
        7489  +
            }
        7490  +
        }
        7491  +
    }
        7492  +
    impl ::std::error::Error for ConstraintViolation {}
        7493  +
    impl ConstraintViolation {
        7494  +
        pub(crate) fn as_validation_exception_field(
        7495  +
            self,
        7496  +
            path: ::std::string::String,
        7497  +
        ) -> crate::model::ValidationExceptionField {
        7498  +
            match self {
        7499  +
                ConstraintViolation::Defaults(inner) => {
        7500  +
                    inner.as_validation_exception_field(path + "/defaults")
        7501  +
                }
        7502  +
            }
        7503  +
        }
        7504  +
    }
        7505  +
    impl ::std::convert::From<ConstraintViolation>
        7506  +
        for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
        7507  +
    {
        7508  +
        fn from(constraint_violation: ConstraintViolation) -> Self {
        7509  +
            let first_validation_exception_field =
        7510  +
                constraint_violation.as_validation_exception_field("".to_owned());
        7511  +
            let validation_exception = crate::error::ValidationException {
        7512  +
                message: format!(
        7513  +
                    "1 validation error detected. {}",
        7514  +
                    &first_validation_exception_field.message
        7515  +
                ),
        7516  +
                field_list: Some(vec![first_validation_exception_field]),
        7517  +
            };
        7518  +
            Self::ConstraintViolation(
        7519  +
                                crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
        7520  +
                                    .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
        7521  +
                            )
        7522  +
        }
        7523  +
    }
        7524  +
    impl ::std::convert::From<Builder>
        7525  +
        for crate::constrained::MaybeConstrained<crate::input::OperationWithDefaultsInput>
        7526  +
    {
        7527  +
        fn from(builder: Builder) -> Self {
        7528  +
            Self::Unconstrained(builder)
        7529  +
        }
        7530  +
    }
        7531  +
    impl ::std::convert::TryFrom<Builder> for crate::input::OperationWithDefaultsInput {
        7532  +
        type Error = ConstraintViolation;
        7533  +
        7534  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        7535  +
            builder.build()
        7536  +
        }
        7537  +
    }
        7538  +
    /// A builder for [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        7539  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        7540  +
    pub(crate) struct Builder {
        7541  +
        pub(crate) defaults:
        7542  +
            ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Defaults>>,
        7543  +
        pub(crate) client_optional_defaults:
        7544  +
            ::std::option::Option<crate::model::ClientOptionalDefaults>,
        7545  +
        pub(crate) top_level_default: ::std::option::Option<::std::string::String>,
        7546  +
        pub(crate) other_top_level_default: ::std::option::Option<i32>,
        7547  +
    }
        7548  +
    impl Builder {
        7549  +
        #[allow(missing_docs)] // documentation missing in model
        7550  +
        pub(crate) fn set_defaults(
        7551  +
            mut self,
        7552  +
            input: Option<
        7553  +
                impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Defaults>>,
        7554  +
            >,
        7555  +
        ) -> Self {
        7556  +
            self.defaults = input.map(|v| v.into());
        7557  +
            self
        7558  +
        }
        7559  +
        #[allow(missing_docs)] // documentation missing in model
        7560  +
        pub(crate) fn set_client_optional_defaults(
        7561  +
            mut self,
        7562  +
            input: Option<impl ::std::convert::Into<crate::model::ClientOptionalDefaults>>,
        7563  +
        ) -> Self {
        7564  +
            self.client_optional_defaults = input.map(|v| v.into());
        7565  +
            self
        7566  +
        }
        7567  +
        #[allow(missing_docs)] // documentation missing in model
        7568  +
        pub(crate) fn set_top_level_default(
        7569  +
            mut self,
        7570  +
            input: impl ::std::convert::Into<::std::string::String>,
        7571  +
        ) -> Self {
        7572  +
            self.top_level_default = Some(input.into());
        7573  +
            self
        7574  +
        }
        7575  +
        #[allow(missing_docs)] // documentation missing in model
        7576  +
        pub(crate) fn set_other_top_level_default(
        7577  +
            mut self,
        7578  +
            input: impl ::std::convert::Into<i32>,
        7579  +
        ) -> Self {
        7580  +
            self.other_top_level_default = Some(input.into());
        7581  +
            self
        7582  +
        }
        7583  +
        /// Consumes the builder and constructs a [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        7584  +
        ///
        7585  +
        /// The builder fails to construct a [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput) if a [`ConstraintViolation`] occurs.
        7586  +
        ///
        7587  +
        pub fn build(
        7588  +
            self,
        7589  +
        ) -> Result<crate::input::OperationWithDefaultsInput, ConstraintViolation> {
        7590  +
            self.build_enforcing_all_constraints()
        7591  +
        }
        7592  +
        fn build_enforcing_all_constraints(
        7593  +
            self,
        7594  +
        ) -> Result<crate::input::OperationWithDefaultsInput, ConstraintViolation> {
        7595  +
            Ok(crate::input::OperationWithDefaultsInput {
        7596  +
                defaults: self
        7597  +
                    .defaults
        7598  +
                    .map(|v| match v {
        7599  +
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        7600  +
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        7601  +
                    })
        7602  +
                    .map(|res| res.map_err(ConstraintViolation::Defaults))
        7603  +
                    .transpose()?,
        7604  +
                client_optional_defaults: self.client_optional_defaults,
        7605  +
                top_level_default: self.top_level_default.unwrap_or_else(
        7606  +
                    #[allow(clippy::redundant_closure)]
        7607  +
                    || String::from("hi"),
        7608  +
                ),
        7609  +
                other_top_level_default: self.other_top_level_default.unwrap_or(0i32),
        7610  +
            })
        7611  +
        }
        7612  +
    }
        7613  +
}
        7614  +
/// See [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        7615  +
///
        7616  +
pub mod operation_with_defaults_input {
        7617  +
        7618  +
    impl ::std::convert::From<Builder> for crate::input::OperationWithDefaultsInput {
        7619  +
        fn from(builder: Builder) -> Self {
        7620  +
            builder.build()
        7621  +
        }
        7622  +
    }
        7623  +
    /// A builder for [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        7624  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        7625  +
    pub struct Builder {
        7626  +
        pub(crate) defaults: ::std::option::Option<crate::model::Defaults>,
        7627  +
        pub(crate) client_optional_defaults:
        7628  +
            ::std::option::Option<crate::model::ClientOptionalDefaults>,
        7629  +
        pub(crate) top_level_default: ::std::option::Option<::std::string::String>,
        7630  +
        pub(crate) other_top_level_default: ::std::option::Option<i32>,
        7631  +
    }
        7632  +
    impl Builder {
        7633  +
        #[allow(missing_docs)] // documentation missing in model
        7634  +
        pub fn defaults(mut self, input: ::std::option::Option<crate::model::Defaults>) -> Self {
        7635  +
            self.defaults = input;
        7636  +
            self
        7637  +
        }
        7638  +
        #[allow(missing_docs)] // documentation missing in model
        7639  +
        pub fn client_optional_defaults(
        7640  +
            mut self,
        7641  +
            input: ::std::option::Option<crate::model::ClientOptionalDefaults>,
        7642  +
        ) -> Self {
        7643  +
            self.client_optional_defaults = input;
        7644  +
            self
        7645  +
        }
        7646  +
        #[allow(missing_docs)] // documentation missing in model
        7647  +
        pub fn top_level_default(mut self, input: ::std::string::String) -> Self {
        7648  +
            self.top_level_default = Some(input);
        7649  +
            self
        7650  +
        }
        7651  +
        #[allow(missing_docs)] // documentation missing in model
        7652  +
        pub fn other_top_level_default(mut self, input: i32) -> Self {
        7653  +
            self.other_top_level_default = Some(input);
        7654  +
            self
        7655  +
        }
        7656  +
        /// Consumes the builder and constructs a [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        7657  +
        pub fn build(self) -> crate::input::OperationWithDefaultsInput {
        7658  +
            self.build_enforcing_required_and_enum_traits()
        7659  +
        }
        7660  +
        fn build_enforcing_required_and_enum_traits(
        7661  +
            self,
        7662  +
        ) -> crate::input::OperationWithDefaultsInput {
        7663  +
            crate::input::OperationWithDefaultsInput {
        7664  +
                defaults: self.defaults,
        7665  +
                client_optional_defaults: self.client_optional_defaults,
        7666  +
                top_level_default: self.top_level_default.unwrap_or_else(
        7667  +
                    #[allow(clippy::redundant_closure)]
        7668  +
                    || String::from("hi"),
        7669  +
                ),
        7670  +
                other_top_level_default: self.other_top_level_default.unwrap_or(0i32),
        7671  +
            }
        7672  +
        }
        7673  +
    }
        7674  +
}
        7675  +
/// See [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        7676  +
///
        7677  +
pub(crate) mod content_type_parameters_input_internal {
        7678  +
        7679  +
    impl ::std::convert::From<Builder> for crate::input::ContentTypeParametersInput {
        7680  +
        fn from(builder: Builder) -> Self {
        7681  +
            builder.build()
        7682  +
        }
        7683  +
    }
        7684  +
    /// A builder for [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        7685  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        7686  +
    pub(crate) struct Builder {
        7687  +
        pub(crate) value: ::std::option::Option<i32>,
        7688  +
    }
        7689  +
    impl Builder {
        7690  +
        #[allow(missing_docs)] // documentation missing in model
        7691  +
        pub(crate) fn set_value(mut self, input: Option<impl ::std::convert::Into<i32>>) -> Self {
        7692  +
            self.value = input.map(|v| v.into());
        7693  +
            self
        7694  +
        }
        7695  +
        /// Consumes the builder and constructs a [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        7696  +
        pub fn build(self) -> crate::input::ContentTypeParametersInput {
        7697  +
            self.build_enforcing_all_constraints()
        7698  +
        }
        7699  +
        fn build_enforcing_all_constraints(self) -> crate::input::ContentTypeParametersInput {
        7700  +
            crate::input::ContentTypeParametersInput { value: self.value }
        7701  +
        }
        7702  +
    }
        7703  +
}
        7704  +
/// See [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        7705  +
///
        7706  +
pub mod content_type_parameters_input {
        7707  +
        7708  +
    impl ::std::convert::From<Builder> for crate::input::ContentTypeParametersInput {
        7709  +
        fn from(builder: Builder) -> Self {
        7710  +
            builder.build()
        7711  +
        }
        7712  +
    }
        7713  +
    /// A builder for [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        7714  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        7715  +
    pub struct Builder {
        7716  +
        pub(crate) value: ::std::option::Option<i32>,
        7717  +
    }
        7718  +
    impl Builder {
        7719  +
        #[allow(missing_docs)] // documentation missing in model
        7720  +
        pub fn value(mut self, input: ::std::option::Option<i32>) -> Self {
        7721  +
            self.value = input;
        7722  +
            self
        7723  +
        }
        7724  +
        /// Consumes the builder and constructs a [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        7725  +
        pub fn build(self) -> crate::input::ContentTypeParametersInput {
        7726  +
            self.build_enforcing_required_and_enum_traits()
        7727  +
        }
        7728  +
        fn build_enforcing_required_and_enum_traits(
        7729  +
            self,
        7730  +
        ) -> crate::input::ContentTypeParametersInput {
        7731  +
            crate::input::ContentTypeParametersInput { value: self.value }
        7732  +
        }
        7733  +
    }
        7734  +
}
 7056   7735   
/// See [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
 7057   7736   
///
 7058   7737   
pub(crate) mod put_with_content_encoding_input_internal {
 7059   7738   
 7060   7739   
    impl ::std::convert::From<Builder> for crate::input::PutWithContentEncodingInput {
 7061   7740   
        fn from(builder: Builder) -> Self {
 7062   7741   
            builder.build()
 7063   7742   
        }
 7064   7743   
    }
 7065   7744   
    /// A builder for [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
@@ -7198,7877 +7257,7982 @@
 7218   7897   
    impl Builder {
 7219   7898   
        /// Consumes the builder and constructs a [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput).
 7220   7899   
        pub fn build(self) -> crate::input::DatetimeOffsetsInput {
 7221   7900   
            self.build_enforcing_required_and_enum_traits()
 7222   7901   
        }
 7223   7902   
        fn build_enforcing_required_and_enum_traits(self) -> crate::input::DatetimeOffsetsInput {
 7224   7903   
            crate::input::DatetimeOffsetsInput {}
 7225   7904   
        }
 7226   7905   
    }
 7227   7906   
}
        7907  +
/// See [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        7908  +
///
        7909  +
pub(crate) mod test_no_input_no_payload_input_internal {
        7910  +
        7911  +
    impl ::std::convert::From<Builder> for crate::input::TestNoInputNoPayloadInput {
        7912  +
        fn from(builder: Builder) -> Self {
        7913  +
            builder.build()
        7914  +
        }
        7915  +
    }
        7916  +
    /// A builder for [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        7917  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        7918  +
    pub(crate) struct Builder {}
        7919  +
    impl Builder {
        7920  +
        /// Consumes the builder and constructs a [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        7921  +
        pub fn build(self) -> crate::input::TestNoInputNoPayloadInput {
        7922  +
            self.build_enforcing_all_constraints()
        7923  +
        }
        7924  +
        fn build_enforcing_all_constraints(self) -> crate::input::TestNoInputNoPayloadInput {
        7925  +
            crate::input::TestNoInputNoPayloadInput {}
        7926  +
        }
        7927  +
    }
        7928  +
}
        7929  +
/// See [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        7930  +
///
        7931  +
pub mod test_no_input_no_payload_input {
        7932  +
        7933  +
    impl ::std::convert::From<Builder> for crate::input::TestNoInputNoPayloadInput {
        7934  +
        fn from(builder: Builder) -> Self {
        7935  +
            builder.build()
        7936  +
        }
        7937  +
    }
        7938  +
    /// A builder for [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        7939  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        7940  +
    pub struct Builder {}
        7941  +
    impl Builder {
        7942  +
        /// Consumes the builder and constructs a [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        7943  +
        pub fn build(self) -> crate::input::TestNoInputNoPayloadInput {
        7944  +
            self.build_enforcing_required_and_enum_traits()
        7945  +
        }
        7946  +
        fn build_enforcing_required_and_enum_traits(
        7947  +
            self,
        7948  +
        ) -> crate::input::TestNoInputNoPayloadInput {
        7949  +
            crate::input::TestNoInputNoPayloadInput {}
        7950  +
        }
        7951  +
    }
        7952  +
}
 7228   7953   
/// See [`TestNoPayloadInput`](crate::input::TestNoPayloadInput).
 7229   7954   
///
 7230   7955   
pub(crate) mod test_no_payload_input_internal {
 7231   7956   
 7232   7957   
    impl ::std::convert::From<Builder> for crate::input::TestNoPayloadInput {
 7233   7958   
        fn from(builder: Builder) -> Self {
 7234   7959   
            builder.build()
 7235   7960   
        }
 7236   7961   
    }
 7237   7962   
    /// A builder for [`TestNoPayloadInput`](crate::input::TestNoPayloadInput).