Server Test

Server Test

rev. 0b749be6d000fdc7ef59d1bc26f1dce00358d95c

Files changed:

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

@@ -1,1 +75,79 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) mod shape_content_type_parameters;
           3  +
    2      4   
pub(crate) mod shape_datetime_offsets;
    3      5   
    4      6   
pub(crate) mod shape_empty_operation;
    5      7   
    6      8   
pub(crate) mod shape_endpoint_operation;
    7      9   
    8     10   
pub(crate) mod shape_endpoint_with_host_label_operation;
    9     11   
   10     12   
pub(crate) mod shape_fractional_seconds;
   11     13   
   12     14   
pub(crate) mod shape_greeting_with_errors;
   13     15   
   14     16   
pub(crate) mod shape_host_with_path_operation;
   15     17   
   16     18   
pub(crate) mod shape_json_enums;
   17     19   
   18     20   
pub(crate) mod shape_json_unions;
   19     21   
   20     22   
pub(crate) mod shape_kitchen_sink_operation;
   21     23   
   22     24   
pub(crate) mod shape_null_operation;
   23     25   
   24     26   
pub(crate) mod shape_operation_with_optional_input_output;
   25     27   
   26     28   
pub(crate) mod shape_put_and_get_inline_documents;
   27     29   
   28     30   
pub(crate) mod shape_put_with_content_encoding;
   29     31   
   30     32   
pub(crate) mod shape_simple_scalar_properties;
   31     33   
   32     34   
pub(crate) mod shape_sparse_nulls_operation;
   33     35   
   34     36   
pub(crate) mod shape_complex_error;
   35     37   
   36         -
pub(crate) mod shape_datetime_offsets_output;
   37         -
   38     38   
pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] {
   39     39   
    if data.is_empty() {
   40     40   
        b"{}"
   41     41   
    } else {
   42     42   
        data
   43     43   
    }
   44     44   
}
   45     45   
          46  +
pub(crate) mod shape_content_type_parameters_output;
          47  +
          48  +
pub(crate) mod shape_datetime_offsets_output;
          49  +
   46     50   
pub(crate) mod shape_error_with_members;
   47     51   
   48     52   
pub(crate) mod shape_error_without_members;
   49     53   
   50     54   
pub(crate) mod shape_foo_error;
   51     55   
   52     56   
pub(crate) mod shape_fractional_seconds_output;
   53     57   
   54     58   
pub(crate) mod shape_greeting_with_errors_output;
   55     59   

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

@@ -0,1 +0,116 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_content_type_parameters_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::ContentTypeParametersInput,
           7  +
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::content_type_parameters_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/x-amz-json-1.1"),
          27  +
            )?;
          28  +
            input =
          29  +
                crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters(
          30  +
                    bytes.as_ref(),
          31  +
                    input,
          32  +
                )?;
          33  +
        }
          34  +
        input.build()
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn ser_content_type_parameters_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::ContentTypeParametersOutput,
          41  +
) -> std::result::Result<
          42  +
    ::aws_smithy_http_server::response::Response,
          43  +
    ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
          44  +
> {
          45  +
    Ok({
          46  +
        #[allow(unused_mut)]
          47  +
        let mut builder = ::http::Response::builder();
          48  +
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          49  +
            builder,
          50  +
            ::http::header::CONTENT_TYPE,
          51  +
            "application/x-amz-json-1.1",
          52  +
        );
          53  +
        let http_status: u16 = 200;
          54  +
        builder = builder.status(http_status);
          55  +
        let payload =
          56  +
            crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_output_output_output(&output)?
          57  +
        ;
          58  +
        let content_length = payload.len();
          59  +
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          60  +
            builder,
          61  +
            ::http::header::CONTENT_LENGTH,
          62  +
            content_length,
          63  +
        );
          64  +
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          65  +
        builder.body(body)?
          66  +
    })
          67  +
}
          68  +
          69  +
pub(crate) fn de_content_type_parameters(
          70  +
    value: &[u8],
          71  +
    mut builder: crate::input::content_type_parameters_input::Builder,
          72  +
) -> Result<
          73  +
    crate::input::content_type_parameters_input::Builder,
          74  +
    ::aws_smithy_json::deserialize::error::DeserializeError,
          75  +
> {
          76  +
    let mut tokens_owned =
          77  +
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
          78  +
            .peekable();
          79  +
    let tokens = &mut tokens_owned;
          80  +
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          81  +
    loop {
          82  +
        match tokens.next().transpose()? {
          83  +
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          84  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          85  +
                match key.to_unescaped()?.as_ref() {
          86  +
                    "value" => {
          87  +
                        builder = builder.set_value(
          88  +
                            ::aws_smithy_json::deserialize::token::expect_number_or_null(
          89  +
                                tokens.next(),
          90  +
                            )?
          91  +
                            .map(i32::try_from)
          92  +
                            .transpose()?,
          93  +
                        );
          94  +
                    }
          95  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          96  +
                }
          97  +
            }
          98  +
            other => {
          99  +
                return Err(
         100  +
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
         101  +
                        "expected object key or end object, found: {:?}",
         102  +
                        other
         103  +
                    )),
         104  +
                )
         105  +
            }
         106  +
        }
         107  +
    }
         108  +
    if tokens.next().is_some() {
         109  +
        return Err(
         110  +
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
         111  +
                "found more JSON tokens after completing parsing",
         112  +
            ),
         113  +
        );
         114  +
    }
         115  +
    Ok(builder)
         116  +
}

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

@@ -0,1 +0,17 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_content_type_parameters_output_output_output(
           3  +
    value: &crate::output::ContentTypeParametersOutput,
           4  +
) -> Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           5  +
    let mut out = String::new();
           6  +
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           7  +
    crate::protocol_serde::shape_content_type_parameters_output::ser_content_type_parameters_output_output(&mut object, value)?;
           8  +
    object.finish();
           9  +
    Ok(out)
          10  +
}
          11  +
          12  +
pub fn ser_content_type_parameters_output_output(
          13  +
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
          14  +
    #[allow(unused_variables)] input: &crate::output::ContentTypeParametersOutput,
          15  +
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          16  +
    Ok(())
          17  +
}

tmp-codegen-diff/codegen-server-test/json_rpc11/rust-server-codegen/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) -> output::ContentTypeParametersOutput {
          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, std::convert::Infallible> {
         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/rest_json/rust-server-codegen/src/error.rs

@@ -1,1 +122,210 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// Error type for the `MalformedTimestampBodyHttpDate` operation.
    4         -
/// Each variant represents an error that can occur for the `MalformedTimestampBodyHttpDate` operation.
           2  +
/// Error type for the `OperationWithNestedStructure` operation.
           3  +
/// Each variant represents an error that can occur for the `OperationWithNestedStructure` operation.
    5      4   
#[derive(::std::fmt::Debug)]
    6         -
pub enum MalformedTimestampBodyHttpDateError {
           5  +
pub enum OperationWithNestedStructureError {
    7      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.
    8      7   
    ValidationException(crate::error::ValidationException),
    9      8   
}
   10         -
impl ::std::fmt::Display for MalformedTimestampBodyHttpDateError {
           9  +
impl ::std::fmt::Display for OperationWithNestedStructureError {
   11     10   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   12     11   
        match &self {
   13         -
            MalformedTimestampBodyHttpDateError::ValidationException(_inner) => _inner.fmt(f),
          12  +
            OperationWithNestedStructureError::ValidationException(_inner) => _inner.fmt(f),
   14     13   
        }
   15     14   
    }
   16     15   
}
   17         -
impl MalformedTimestampBodyHttpDateError {
   18         -
    /// Returns `true` if the error kind is `MalformedTimestampBodyHttpDateError::ValidationException`.
          16  +
impl OperationWithNestedStructureError {
          17  +
    /// Returns `true` if the error kind is `OperationWithNestedStructureError::ValidationException`.
   19     18   
    pub fn is_validation_exception(&self) -> bool {
   20     19   
        matches!(
   21     20   
            &self,
   22         -
            MalformedTimestampBodyHttpDateError::ValidationException(_)
          21  +
            OperationWithNestedStructureError::ValidationException(_)
   23     22   
        )
   24     23   
    }
   25     24   
    /// Returns the error name string by matching the correct variant.
   26     25   
    pub fn name(&self) -> &'static str {
   27     26   
        match &self {
   28         -
            MalformedTimestampBodyHttpDateError::ValidationException(_inner) => _inner.name(),
          27  +
            OperationWithNestedStructureError::ValidationException(_inner) => _inner.name(),
   29     28   
        }
   30     29   
    }
   31     30   
}
   32         -
impl ::std::error::Error for MalformedTimestampBodyHttpDateError {
          31  +
impl ::std::error::Error for OperationWithNestedStructureError {
   33     32   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
   34     33   
        match &self {
   35         -
            MalformedTimestampBodyHttpDateError::ValidationException(_inner) => Some(_inner),
          34  +
            OperationWithNestedStructureError::ValidationException(_inner) => Some(_inner),
   36     35   
        }
   37     36   
    }
   38     37   
}
   39     38   
impl ::std::convert::From<crate::error::ValidationException>
   40         -
    for crate::error::MalformedTimestampBodyHttpDateError
          39  +
    for crate::error::OperationWithNestedStructureError
   41     40   
{
   42     41   
    fn from(
   43     42   
        variant: crate::error::ValidationException,
   44         -
    ) -> crate::error::MalformedTimestampBodyHttpDateError {
          43  +
    ) -> crate::error::OperationWithNestedStructureError {
   45     44   
        Self::ValidationException(variant)
   46     45   
    }
   47     46   
}
   48     47   
   49     48   
/// 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.
   50     49   
#[derive(
   51     50   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   52     51   
)]
   53     52   
pub struct ValidationException {
   54     53   
    /// A summary of the validation failure.
   55     54   
    pub message: ::std::string::String,
   56     55   
    /// 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.
   57     56   
    pub field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
   58     57   
}
   59     58   
impl ValidationException {
   60     59   
    /// 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.
   61     60   
    pub fn field_list(&self) -> ::std::option::Option<&[crate::model::ValidationExceptionField]> {
   62     61   
        self.field_list.as_deref()
   63     62   
    }
   64     63   
}
   65     64   
impl ValidationException {
   66     65   
    /// Returns the error message.
   67     66   
    pub fn message(&self) -> &str {
   68     67   
        &self.message
   69     68   
    }
   70     69   
    #[doc(hidden)]
   71     70   
    /// Returns the error name.
   72     71   
    pub fn name(&self) -> &'static str {
   73     72   
        "ValidationException"
   74     73   
    }
   75     74   
}
   76     75   
impl ::std::fmt::Display for ValidationException {
   77     76   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   78     77   
        ::std::write!(f, "ValidationException")?;
   79     78   
        {
   80     79   
            ::std::write!(f, ": {}", &self.message)?;
   81     80   
        }
   82     81   
        Ok(())
   83     82   
    }
   84     83   
}
   85     84   
impl ::std::error::Error for ValidationException {}
   86     85   
impl ValidationException {
   87     86   
    /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
   88     87   
    pub fn builder() -> crate::error::validation_exception::Builder {
   89     88   
        crate::error::validation_exception::Builder::default()
   90     89   
    }
   91     90   
}
   92     91   
          92  +
/// Error type for the `OperationWithDefaults` operation.
          93  +
/// Each variant represents an error that can occur for the `OperationWithDefaults` operation.
          94  +
#[derive(::std::fmt::Debug)]
          95  +
pub enum OperationWithDefaultsError {
          96  +
    /// 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.
          97  +
    ValidationException(crate::error::ValidationException),
          98  +
}
          99  +
impl ::std::fmt::Display for OperationWithDefaultsError {
         100  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         101  +
        match &self {
         102  +
            OperationWithDefaultsError::ValidationException(_inner) => _inner.fmt(f),
         103  +
        }
         104  +
    }
         105  +
}
         106  +
impl OperationWithDefaultsError {
         107  +
    /// Returns `true` if the error kind is `OperationWithDefaultsError::ValidationException`.
         108  +
    pub fn is_validation_exception(&self) -> bool {
         109  +
        matches!(&self, OperationWithDefaultsError::ValidationException(_))
         110  +
    }
         111  +
    /// Returns the error name string by matching the correct variant.
         112  +
    pub fn name(&self) -> &'static str {
         113  +
        match &self {
         114  +
            OperationWithDefaultsError::ValidationException(_inner) => _inner.name(),
         115  +
        }
         116  +
    }
         117  +
}
         118  +
impl ::std::error::Error for OperationWithDefaultsError {
         119  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         120  +
        match &self {
         121  +
            OperationWithDefaultsError::ValidationException(_inner) => Some(_inner),
         122  +
        }
         123  +
    }
         124  +
}
         125  +
impl ::std::convert::From<crate::error::ValidationException>
         126  +
    for crate::error::OperationWithDefaultsError
         127  +
{
         128  +
    fn from(
         129  +
        variant: crate::error::ValidationException,
         130  +
    ) -> crate::error::OperationWithDefaultsError {
         131  +
        Self::ValidationException(variant)
         132  +
    }
         133  +
}
         134  +
         135  +
/// Error type for the `MalformedTimestampBodyHttpDate` operation.
         136  +
/// Each variant represents an error that can occur for the `MalformedTimestampBodyHttpDate` operation.
         137  +
#[derive(::std::fmt::Debug)]
         138  +
pub enum MalformedTimestampBodyHttpDateError {
         139  +
    /// 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.
         140  +
    ValidationException(crate::error::ValidationException),
         141  +
}
         142  +
impl ::std::fmt::Display for MalformedTimestampBodyHttpDateError {
         143  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         144  +
        match &self {
         145  +
            MalformedTimestampBodyHttpDateError::ValidationException(_inner) => _inner.fmt(f),
         146  +
        }
         147  +
    }
         148  +
}
         149  +
impl MalformedTimestampBodyHttpDateError {
         150  +
    /// Returns `true` if the error kind is `MalformedTimestampBodyHttpDateError::ValidationException`.
         151  +
    pub fn is_validation_exception(&self) -> bool {
         152  +
        matches!(
         153  +
            &self,
         154  +
            MalformedTimestampBodyHttpDateError::ValidationException(_)
         155  +
        )
         156  +
    }
         157  +
    /// Returns the error name string by matching the correct variant.
         158  +
    pub fn name(&self) -> &'static str {
         159  +
        match &self {
         160  +
            MalformedTimestampBodyHttpDateError::ValidationException(_inner) => _inner.name(),
         161  +
        }
         162  +
    }
         163  +
}
         164  +
impl ::std::error::Error for MalformedTimestampBodyHttpDateError {
         165  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         166  +
        match &self {
         167  +
            MalformedTimestampBodyHttpDateError::ValidationException(_inner) => Some(_inner),
         168  +
        }
         169  +
    }
         170  +
}
         171  +
impl ::std::convert::From<crate::error::ValidationException>
         172  +
    for crate::error::MalformedTimestampBodyHttpDateError
         173  +
{
         174  +
    fn from(
         175  +
        variant: crate::error::ValidationException,
         176  +
    ) -> crate::error::MalformedTimestampBodyHttpDateError {
         177  +
        Self::ValidationException(variant)
         178  +
    }
         179  +
}
         180  +
   93    181   
/// Error type for the `MalformedTimestampBodyDateTime` operation.
   94    182   
/// Each variant represents an error that can occur for the `MalformedTimestampBodyDateTime` operation.
   95    183   
#[derive(::std::fmt::Debug)]
   96    184   
pub enum MalformedTimestampBodyDateTimeError {
   97    185   
    /// 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.
   98    186   
    ValidationException(crate::error::ValidationException),
   99    187   
}
  100    188   
impl ::std::fmt::Display for MalformedTimestampBodyDateTimeError {
  101    189   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  102    190   
        match &self {

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

@@ -1,1 +91,195 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
           4  +
pub struct OperationWithNestedStructureInput {
           5  +
    #[allow(missing_docs)] // documentation missing in model
           6  +
    pub top_level: crate::model::TopLevel,
           7  +
}
           8  +
impl OperationWithNestedStructureInput {
           9  +
    #[allow(missing_docs)] // documentation missing in model
          10  +
    pub fn top_level(&self) -> &crate::model::TopLevel {
          11  +
        &self.top_level
          12  +
    }
          13  +
}
          14  +
impl OperationWithNestedStructureInput {
          15  +
    /// Creates a new builder-style object to manufacture [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
          16  +
    pub fn builder() -> crate::input::operation_with_nested_structure_input::Builder {
          17  +
        crate::input::operation_with_nested_structure_input::Builder::default()
          18  +
    }
          19  +
}
          20  +
impl crate::constrained::Constrained for crate::input::OperationWithNestedStructureInput {
          21  +
    type Unconstrained = crate::input::operation_with_nested_structure_input::Builder;
          22  +
}
          23  +
          24  +
#[allow(missing_docs)] // documentation missing in model
          25  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
          26  +
pub struct OperationWithDefaultsInput {
          27  +
    #[allow(missing_docs)] // documentation missing in model
          28  +
    pub defaults: ::std::option::Option<crate::model::Defaults>,
          29  +
    #[allow(missing_docs)] // documentation missing in model
          30  +
    pub client_optional_defaults: ::std::option::Option<crate::model::ClientOptionalDefaults>,
          31  +
    #[allow(missing_docs)] // documentation missing in model
          32  +
    pub top_level_default: ::std::string::String,
          33  +
    #[allow(missing_docs)] // documentation missing in model
          34  +
    pub other_top_level_default: i32,
          35  +
}
          36  +
impl OperationWithDefaultsInput {
          37  +
    #[allow(missing_docs)] // documentation missing in model
          38  +
    pub fn defaults(&self) -> ::std::option::Option<&crate::model::Defaults> {
          39  +
        self.defaults.as_ref()
          40  +
    }
          41  +
    #[allow(missing_docs)] // documentation missing in model
          42  +
    pub fn client_optional_defaults(
          43  +
        &self,
          44  +
    ) -> ::std::option::Option<&crate::model::ClientOptionalDefaults> {
          45  +
        self.client_optional_defaults.as_ref()
          46  +
    }
          47  +
    #[allow(missing_docs)] // documentation missing in model
          48  +
    pub fn top_level_default(&self) -> &str {
          49  +
        use std::ops::Deref;
          50  +
        self.top_level_default.deref()
          51  +
    }
          52  +
    #[allow(missing_docs)] // documentation missing in model
          53  +
    pub fn other_top_level_default(&self) -> i32 {
          54  +
        self.other_top_level_default
          55  +
    }
          56  +
}
          57  +
impl OperationWithDefaultsInput {
          58  +
    /// Creates a new builder-style object to manufacture [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
          59  +
    pub fn builder() -> crate::input::operation_with_defaults_input::Builder {
          60  +
        crate::input::operation_with_defaults_input::Builder::default()
          61  +
    }
          62  +
}
          63  +
impl crate::constrained::Constrained for crate::input::OperationWithDefaultsInput {
          64  +
    type Unconstrained = crate::input::operation_with_defaults_input::Builder;
          65  +
}
          66  +
          67  +
#[allow(missing_docs)] // documentation missing in model
          68  +
#[derive(
          69  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
          70  +
)]
          71  +
pub struct ContentTypeParametersInput {
          72  +
    #[allow(missing_docs)] // documentation missing in model
          73  +
    pub value: ::std::option::Option<i32>,
          74  +
}
          75  +
impl ContentTypeParametersInput {
          76  +
    #[allow(missing_docs)] // documentation missing in model
          77  +
    pub fn value(&self) -> ::std::option::Option<i32> {
          78  +
        self.value
          79  +
    }
          80  +
}
          81  +
impl ContentTypeParametersInput {
          82  +
    /// Creates a new builder-style object to manufacture [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
          83  +
    pub fn builder() -> crate::input::content_type_parameters_input::Builder {
          84  +
        crate::input::content_type_parameters_input::Builder::default()
          85  +
    }
          86  +
}
          87  +
impl crate::constrained::Constrained for crate::input::ContentTypeParametersInput {
          88  +
    type Unconstrained = crate::input::content_type_parameters_input::Builder;
          89  +
}
          90  +
    2     91   
#[allow(missing_docs)] // documentation missing in model
    3     92   
#[derive(
    4     93   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    5     94   
)]
    6     95   
pub struct PutWithContentEncodingInput {
    7     96   
    #[allow(missing_docs)] // documentation missing in model
    8     97   
    pub encoding: ::std::option::Option<::std::string::String>,
    9     98   
    #[allow(missing_docs)] // documentation missing in model
   10     99   
    pub data: ::std::option::Option<::std::string::String>,
   11    100   
}
   12    101   
impl PutWithContentEncodingInput {
   13    102   
    #[allow(missing_docs)] // documentation missing in model
   14    103   
    pub fn encoding(&self) -> ::std::option::Option<&str> {
   15    104   
        self.encoding.as_deref()
   16    105   
    }
   17    106   
    #[allow(missing_docs)] // documentation missing in model
   18    107   
    pub fn data(&self) -> ::std::option::Option<&str> {
   19    108   
        self.data.as_deref()
   20    109   
    }
   21    110   
}
   22    111   
impl PutWithContentEncodingInput {
   23    112   
    /// Creates a new builder-style object to manufacture [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
   24    113   
    pub fn builder() -> crate::input::put_with_content_encoding_input::Builder {
   25    114   
        crate::input::put_with_content_encoding_input::Builder::default()
   26    115   
    }
   27    116   
}
   28    117   
impl crate::constrained::Constrained for crate::input::PutWithContentEncodingInput {
   29    118   
    type Unconstrained = crate::input::put_with_content_encoding_input::Builder;
   30    119   
}
   31    120   
   32    121   
#[allow(missing_docs)] // documentation missing in model
   33    122   
#[derive(
   34    123   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   35    124   
)]
   36    125   
pub struct FractionalSecondsInput {}
   37    126   
impl FractionalSecondsInput {
   38    127   
    /// Creates a new builder-style object to manufacture [`FractionalSecondsInput`](crate::input::FractionalSecondsInput).
   39    128   
    pub fn builder() -> crate::input::fractional_seconds_input::Builder {
   40    129   
        crate::input::fractional_seconds_input::Builder::default()
   41    130   
    }
   42    131   
}
   43    132   
impl crate::constrained::Constrained for crate::input::FractionalSecondsInput {
   44    133   
    type Unconstrained = crate::input::fractional_seconds_input::Builder;
   45    134   
}
   46    135   
   47    136   
#[allow(missing_docs)] // documentation missing in model
   48    137   
#[derive(
   49    138   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   50    139   
)]
   51    140   
pub struct DatetimeOffsetsInput {}
   52    141   
impl DatetimeOffsetsInput {
   53    142   
    /// Creates a new builder-style object to manufacture [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput).
   54    143   
    pub fn builder() -> crate::input::datetime_offsets_input::Builder {
   55    144   
        crate::input::datetime_offsets_input::Builder::default()
   56    145   
    }
   57    146   
}
   58    147   
impl crate::constrained::Constrained for crate::input::DatetimeOffsetsInput {
   59    148   
    type Unconstrained = crate::input::datetime_offsets_input::Builder;
   60    149   
}
   61    150   
         151  +
#[allow(missing_docs)] // documentation missing in model
         152  +
#[derive(
         153  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         154  +
)]
         155  +
pub struct TestNoInputNoPayloadInput {}
         156  +
impl TestNoInputNoPayloadInput {
         157  +
    /// Creates a new builder-style object to manufacture [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
         158  +
    pub fn builder() -> crate::input::test_no_input_no_payload_input::Builder {
         159  +
        crate::input::test_no_input_no_payload_input::Builder::default()
         160  +
    }
         161  +
}
         162  +
impl crate::constrained::Constrained for crate::input::TestNoInputNoPayloadInput {
         163  +
    type Unconstrained = crate::input::test_no_input_no_payload_input::Builder;
         164  +
}
         165  +
   62    166   
#[allow(missing_docs)] // documentation missing in model
   63    167   
#[derive(
   64    168   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   65    169   
)]
   66    170   
pub struct TestNoPayloadInput {
   67    171   
    #[allow(missing_docs)] // documentation missing in model
   68    172   
    pub test_id: ::std::option::Option<::std::string::String>,
   69    173   
}
   70    174   
impl TestNoPayloadInput {
   71    175   
    #[allow(missing_docs)] // documentation missing in model
@@ -3068,3172 +3127,3553 @@
 3088   3192   
pub struct NoInputAndNoOutputInput {}
 3089   3193   
impl NoInputAndNoOutputInput {
 3090   3194   
    /// Creates a new builder-style object to manufacture [`NoInputAndNoOutputInput`](crate::input::NoInputAndNoOutputInput).
 3091   3195   
    pub fn builder() -> crate::input::no_input_and_no_output_input::Builder {
 3092   3196   
        crate::input::no_input_and_no_output_input::Builder::default()
 3093   3197   
    }
 3094   3198   
}
 3095   3199   
impl crate::constrained::Constrained for crate::input::NoInputAndNoOutputInput {
 3096   3200   
    type Unconstrained = crate::input::no_input_and_no_output_input::Builder;
 3097   3201   
}
        3202  +
/// See [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        3203  +
///
        3204  +
pub mod operation_with_nested_structure_input {
        3205  +
        3206  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        3207  +
    /// Holds one variant for each of the ways the builder can fail.
        3208  +
    #[non_exhaustive]
        3209  +
    #[allow(clippy::enum_variant_names)]
        3210  +
    pub enum ConstraintViolation {
        3211  +
        /// `top_level` was not provided but it is required when building `OperationWithNestedStructureInput`.
        3212  +
        MissingTopLevel,
        3213  +
        /// Constraint violation occurred building member `top_level` when building `OperationWithNestedStructureInput`.
        3214  +
        #[doc(hidden)]
        3215  +
        TopLevel(crate::model::top_level::ConstraintViolation),
        3216  +
    }
        3217  +
    impl ::std::fmt::Display for ConstraintViolation {
        3218  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        3219  +
            match self {
        3220  +
                ConstraintViolation::MissingTopLevel => write!(f, "`top_level` was not provided but it is required when building `OperationWithNestedStructureInput`"),
        3221  +
                ConstraintViolation::TopLevel(_) => write!(f, "constraint violation occurred building member `top_level` when building `OperationWithNestedStructureInput`"),
        3222  +
            }
        3223  +
        }
        3224  +
    }
        3225  +
    impl ::std::error::Error for ConstraintViolation {}
        3226  +
    impl ConstraintViolation {
        3227  +
        pub(crate) fn as_validation_exception_field(
        3228  +
            self,
        3229  +
            path: ::std::string::String,
        3230  +
        ) -> crate::model::ValidationExceptionField {
        3231  +
            match self {
        3232  +
            ConstraintViolation::MissingTopLevel => crate::model::ValidationExceptionField {
        3233  +
                                                message: format!("Value at '{}/topLevel' failed to satisfy constraint: Member must not be null", path),
        3234  +
                                                path: path + "/topLevel",
        3235  +
                                            },
        3236  +
            ConstraintViolation::TopLevel(inner) => inner.as_validation_exception_field(path + "/topLevel"),
        3237  +
        }
        3238  +
        }
        3239  +
    }
        3240  +
    impl ::std::convert::From<ConstraintViolation>
        3241  +
        for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
        3242  +
    {
        3243  +
        fn from(constraint_violation: ConstraintViolation) -> Self {
        3244  +
            let first_validation_exception_field =
        3245  +
                constraint_violation.as_validation_exception_field("".to_owned());
        3246  +
            let validation_exception = crate::error::ValidationException {
        3247  +
                message: format!(
        3248  +
                    "1 validation error detected. {}",
        3249  +
                    &first_validation_exception_field.message
        3250  +
                ),
        3251  +
                field_list: Some(vec![first_validation_exception_field]),
        3252  +
            };
        3253  +
            Self::ConstraintViolation(
        3254  +
                                crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
        3255  +
                                    .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
        3256  +
                            )
        3257  +
        }
        3258  +
    }
        3259  +
    impl ::std::convert::From<Builder>
        3260  +
        for crate::constrained::MaybeConstrained<crate::input::OperationWithNestedStructureInput>
        3261  +
    {
        3262  +
        fn from(builder: Builder) -> Self {
        3263  +
            Self::Unconstrained(builder)
        3264  +
        }
        3265  +
    }
        3266  +
    impl ::std::convert::TryFrom<Builder> for crate::input::OperationWithNestedStructureInput {
        3267  +
        type Error = ConstraintViolation;
        3268  +
        3269  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        3270  +
            builder.build()
        3271  +
        }
        3272  +
    }
        3273  +
    /// A builder for [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        3274  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        3275  +
    pub struct Builder {
        3276  +
        pub(crate) top_level:
        3277  +
            ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TopLevel>>,
        3278  +
    }
        3279  +
    impl Builder {
        3280  +
        #[allow(missing_docs)] // documentation missing in model
        3281  +
        pub fn top_level(mut self, input: crate::model::TopLevel) -> Self {
        3282  +
            self.top_level = Some(crate::constrained::MaybeConstrained::Constrained(input));
        3283  +
            self
        3284  +
        }
        3285  +
        #[allow(missing_docs)] // documentation missing in model
        3286  +
        pub(crate) fn set_top_level(
        3287  +
            mut self,
        3288  +
            input: impl ::std::convert::Into<
        3289  +
                crate::constrained::MaybeConstrained<crate::model::TopLevel>,
        3290  +
            >,
        3291  +
        ) -> Self {
        3292  +
            self.top_level = Some(input.into());
        3293  +
            self
        3294  +
        }
        3295  +
        /// Consumes the builder and constructs a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput).
        3296  +
        ///
        3297  +
        /// The builder fails to construct a [`OperationWithNestedStructureInput`](crate::input::OperationWithNestedStructureInput) if a [`ConstraintViolation`] occurs.
        3298  +
        ///
        3299  +
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
        3300  +
        pub fn build(
        3301  +
            self,
        3302  +
        ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
        3303  +
            self.build_enforcing_all_constraints()
        3304  +
        }
        3305  +
        fn build_enforcing_all_constraints(
        3306  +
            self,
        3307  +
        ) -> Result<crate::input::OperationWithNestedStructureInput, ConstraintViolation> {
        3308  +
            Ok(crate::input::OperationWithNestedStructureInput {
        3309  +
                top_level: self
        3310  +
                    .top_level
        3311  +
                    .map(|v| match v {
        3312  +
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        3313  +
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        3314  +
                    })
        3315  +
                    .map(|res| res.map_err(ConstraintViolation::TopLevel))
        3316  +
                    .transpose()?
        3317  +
                    .ok_or(ConstraintViolation::MissingTopLevel)?,
        3318  +
            })
        3319  +
        }
        3320  +
    }
        3321  +
}
        3322  +
/// See [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        3323  +
///
        3324  +
pub mod operation_with_defaults_input {
        3325  +
        3326  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        3327  +
    /// Holds one variant for each of the ways the builder can fail.
        3328  +
    #[non_exhaustive]
        3329  +
    #[allow(clippy::enum_variant_names)]
        3330  +
    pub enum ConstraintViolation {
        3331  +
        /// Constraint violation occurred building member `defaults` when building `OperationWithDefaultsInput`.
        3332  +
        #[doc(hidden)]
        3333  +
        Defaults(crate::model::defaults::ConstraintViolation),
        3334  +
    }
        3335  +
    impl ::std::fmt::Display for ConstraintViolation {
        3336  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        3337  +
            match self {
        3338  +
                ConstraintViolation::Defaults(_) => write!(f, "constraint violation occurred building member `defaults` when building `OperationWithDefaultsInput`"),
        3339  +
            }
        3340  +
        }
        3341  +
    }
        3342  +
    impl ::std::error::Error for ConstraintViolation {}
        3343  +
    impl ConstraintViolation {
        3344  +
        pub(crate) fn as_validation_exception_field(
        3345  +
            self,
        3346  +
            path: ::std::string::String,
        3347  +
        ) -> crate::model::ValidationExceptionField {
        3348  +
            match self {
        3349  +
                ConstraintViolation::Defaults(inner) => {
        3350  +
                    inner.as_validation_exception_field(path + "/defaults")
        3351  +
                }
        3352  +
            }
        3353  +
        }
        3354  +
    }
        3355  +
    impl ::std::convert::From<ConstraintViolation>
        3356  +
        for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
        3357  +
    {
        3358  +
        fn from(constraint_violation: ConstraintViolation) -> Self {
        3359  +
            let first_validation_exception_field =
        3360  +
                constraint_violation.as_validation_exception_field("".to_owned());
        3361  +
            let validation_exception = crate::error::ValidationException {
        3362  +
                message: format!(
        3363  +
                    "1 validation error detected. {}",
        3364  +
                    &first_validation_exception_field.message
        3365  +
                ),
        3366  +
                field_list: Some(vec![first_validation_exception_field]),
        3367  +
            };
        3368  +
            Self::ConstraintViolation(
        3369  +
                                crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
        3370  +
                                    .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
        3371  +
                            )
        3372  +
        }
        3373  +
    }
        3374  +
    impl ::std::convert::From<Builder>
        3375  +
        for crate::constrained::MaybeConstrained<crate::input::OperationWithDefaultsInput>
        3376  +
    {
        3377  +
        fn from(builder: Builder) -> Self {
        3378  +
            Self::Unconstrained(builder)
        3379  +
        }
        3380  +
    }
        3381  +
    impl ::std::convert::TryFrom<Builder> for crate::input::OperationWithDefaultsInput {
        3382  +
        type Error = ConstraintViolation;
        3383  +
        3384  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        3385  +
            builder.build()
        3386  +
        }
        3387  +
    }
        3388  +
    /// A builder for [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        3389  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        3390  +
    pub struct Builder {
        3391  +
        pub(crate) defaults:
        3392  +
            ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::Defaults>>,
        3393  +
        pub(crate) client_optional_defaults:
        3394  +
            ::std::option::Option<crate::model::ClientOptionalDefaults>,
        3395  +
        pub(crate) top_level_default: ::std::option::Option<::std::string::String>,
        3396  +
        pub(crate) other_top_level_default: ::std::option::Option<i32>,
        3397  +
    }
        3398  +
    impl Builder {
        3399  +
        #[allow(missing_docs)] // documentation missing in model
        3400  +
        pub fn defaults(mut self, input: ::std::option::Option<crate::model::Defaults>) -> Self {
        3401  +
            self.defaults = input.map(
        3402  +
                #[allow(clippy::redundant_closure)]
        3403  +
                |v| crate::constrained::MaybeConstrained::Constrained(v),
        3404  +
            );
        3405  +
            self
        3406  +
        }
        3407  +
        #[allow(missing_docs)] // documentation missing in model
        3408  +
        pub(crate) fn set_defaults(
        3409  +
            mut self,
        3410  +
            input: Option<
        3411  +
                impl ::std::convert::Into<crate::constrained::MaybeConstrained<crate::model::Defaults>>,
        3412  +
            >,
        3413  +
        ) -> Self {
        3414  +
            self.defaults = input.map(|v| v.into());
        3415  +
            self
        3416  +
        }
        3417  +
        #[allow(missing_docs)] // documentation missing in model
        3418  +
        pub fn client_optional_defaults(
        3419  +
            mut self,
        3420  +
            input: ::std::option::Option<crate::model::ClientOptionalDefaults>,
        3421  +
        ) -> Self {
        3422  +
            self.client_optional_defaults = input;
        3423  +
            self
        3424  +
        }
        3425  +
        #[allow(missing_docs)] // documentation missing in model
        3426  +
        pub(crate) fn set_client_optional_defaults(
        3427  +
            mut self,
        3428  +
            input: Option<impl ::std::convert::Into<crate::model::ClientOptionalDefaults>>,
        3429  +
        ) -> Self {
        3430  +
            self.client_optional_defaults = input.map(|v| v.into());
        3431  +
            self
        3432  +
        }
        3433  +
        #[allow(missing_docs)] // documentation missing in model
        3434  +
        pub fn top_level_default(mut self, input: ::std::string::String) -> Self {
        3435  +
            self.top_level_default = Some(input);
        3436  +
            self
        3437  +
        }
        3438  +
        #[allow(missing_docs)] // documentation missing in model
        3439  +
        pub(crate) fn set_top_level_default(
        3440  +
            mut self,
        3441  +
            input: impl ::std::convert::Into<::std::string::String>,
        3442  +
        ) -> Self {
        3443  +
            self.top_level_default = Some(input.into());
        3444  +
            self
        3445  +
        }
        3446  +
        #[allow(missing_docs)] // documentation missing in model
        3447  +
        pub fn other_top_level_default(mut self, input: i32) -> Self {
        3448  +
            self.other_top_level_default = Some(input);
        3449  +
            self
        3450  +
        }
        3451  +
        #[allow(missing_docs)] // documentation missing in model
        3452  +
        pub(crate) fn set_other_top_level_default(
        3453  +
            mut self,
        3454  +
            input: impl ::std::convert::Into<i32>,
        3455  +
        ) -> Self {
        3456  +
            self.other_top_level_default = Some(input.into());
        3457  +
            self
        3458  +
        }
        3459  +
        /// Consumes the builder and constructs a [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput).
        3460  +
        ///
        3461  +
        /// The builder fails to construct a [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput) if a [`ConstraintViolation`] occurs.
        3462  +
        ///
        3463  +
        pub fn build(
        3464  +
            self,
        3465  +
        ) -> Result<crate::input::OperationWithDefaultsInput, ConstraintViolation> {
        3466  +
            self.build_enforcing_all_constraints()
        3467  +
        }
        3468  +
        fn build_enforcing_all_constraints(
        3469  +
            self,
        3470  +
        ) -> Result<crate::input::OperationWithDefaultsInput, ConstraintViolation> {
        3471  +
            Ok(crate::input::OperationWithDefaultsInput {
        3472  +
                defaults: self
        3473  +
                    .defaults
        3474  +
                    .map(|v| match v {
        3475  +
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        3476  +
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        3477  +
                    })
        3478  +
                    .map(|res| res.map_err(ConstraintViolation::Defaults))
        3479  +
                    .transpose()?,
        3480  +
                client_optional_defaults: self.client_optional_defaults,
        3481  +
                top_level_default: self.top_level_default.unwrap_or_else(
        3482  +
                    #[allow(clippy::redundant_closure)]
        3483  +
                    || String::from("hi"),
        3484  +
                ),
        3485  +
                other_top_level_default: self.other_top_level_default.unwrap_or(0i32),
        3486  +
            })
        3487  +
        }
        3488  +
    }
        3489  +
}
        3490  +
/// See [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        3491  +
///
        3492  +
pub mod content_type_parameters_input {
        3493  +
        3494  +
    impl ::std::convert::From<Builder> for crate::input::ContentTypeParametersInput {
        3495  +
        fn from(builder: Builder) -> Self {
        3496  +
            builder.build()
        3497  +
        }
        3498  +
    }
        3499  +
    /// A builder for [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        3500  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        3501  +
    pub struct Builder {
        3502  +
        pub(crate) value: ::std::option::Option<i32>,
        3503  +
    }
        3504  +
    impl Builder {
        3505  +
        #[allow(missing_docs)] // documentation missing in model
        3506  +
        pub fn value(mut self, input: ::std::option::Option<i32>) -> Self {
        3507  +
            self.value = input;
        3508  +
            self
        3509  +
        }
        3510  +
        #[allow(missing_docs)] // documentation missing in model
        3511  +
        pub(crate) fn set_value(mut self, input: Option<impl ::std::convert::Into<i32>>) -> Self {
        3512  +
            self.value = input.map(|v| v.into());
        3513  +
            self
        3514  +
        }
        3515  +
        /// Consumes the builder and constructs a [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput).
        3516  +
        pub fn build(self) -> crate::input::ContentTypeParametersInput {
        3517  +
            self.build_enforcing_all_constraints()
        3518  +
        }
        3519  +
        fn build_enforcing_all_constraints(self) -> crate::input::ContentTypeParametersInput {
        3520  +
            crate::input::ContentTypeParametersInput { value: self.value }
        3521  +
        }
        3522  +
    }
        3523  +
}
 3098   3524   
/// See [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
 3099   3525   
///
 3100   3526   
pub mod put_with_content_encoding_input {
 3101   3527   
 3102   3528   
    impl ::std::convert::From<Builder> for crate::input::PutWithContentEncodingInput {
 3103   3529   
        fn from(builder: Builder) -> Self {
 3104   3530   
            builder.build()
 3105   3531   
        }
 3106   3532   
    }
 3107   3533   
    /// A builder for [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput).
@@ -3166,3592 +3225,3673 @@
 3186   3612   
    impl Builder {
 3187   3613   
        /// Consumes the builder and constructs a [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput).
 3188   3614   
        pub fn build(self) -> crate::input::DatetimeOffsetsInput {
 3189   3615   
            self.build_enforcing_all_constraints()
 3190   3616   
        }
 3191   3617   
        fn build_enforcing_all_constraints(self) -> crate::input::DatetimeOffsetsInput {
 3192   3618   
            crate::input::DatetimeOffsetsInput {}
 3193   3619   
        }
 3194   3620   
    }
 3195   3621   
}
        3622  +
/// See [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        3623  +
///
        3624  +
pub mod test_no_input_no_payload_input {
        3625  +
        3626  +
    impl ::std::convert::From<Builder> for crate::input::TestNoInputNoPayloadInput {
        3627  +
        fn from(builder: Builder) -> Self {
        3628  +
            builder.build()
        3629  +
        }
        3630  +
    }
        3631  +
    /// A builder for [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        3632  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        3633  +
    pub struct Builder {}
        3634  +
    impl Builder {
        3635  +
        /// Consumes the builder and constructs a [`TestNoInputNoPayloadInput`](crate::input::TestNoInputNoPayloadInput).
        3636  +
        pub fn build(self) -> crate::input::TestNoInputNoPayloadInput {
        3637  +
            self.build_enforcing_all_constraints()
        3638  +
        }
        3639  +
        fn build_enforcing_all_constraints(self) -> crate::input::TestNoInputNoPayloadInput {
        3640  +
            crate::input::TestNoInputNoPayloadInput {}
        3641  +
        }
        3642  +
    }
        3643  +
}
 3196   3644   
/// See [`TestNoPayloadInput`](crate::input::TestNoPayloadInput).
 3197   3645   
///
 3198   3646   
pub mod test_no_payload_input {
 3199   3647   
 3200   3648   
    impl ::std::convert::From<Builder> for crate::input::TestNoPayloadInput {
 3201   3649   
        fn from(builder: Builder) -> Self {
 3202   3650   
            builder.build()
 3203   3651   
        }
 3204   3652   
    }
 3205   3653   
    /// A builder for [`TestNoPayloadInput`](crate::input::TestNoPayloadInput).

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

@@ -133,133 +192,193 @@
  153    153   
//! # use std::net::SocketAddr;
  154    154   
//! use rest_json::{RestJson, RestJsonConfig};
  155    155   
//!
  156    156   
//! #[::tokio::main]
  157    157   
//! pub async fn main() {
  158    158   
//!    let config = RestJsonConfig::builder().build();
  159    159   
//!    let app = RestJson::builder(config)
  160    160   
//!        .all_query_string_types(all_query_string_types)
  161    161   
//!        .constant_and_variable_query_string(constant_and_variable_query_string)
  162    162   
//!        .constant_query_string(constant_query_string)
         163  +
//!        .content_type_parameters(content_type_parameters)
  163    164   
//!        .datetime_offsets(datetime_offsets)
  164    165   
//!        .document_type(document_type)
  165    166   
//!        .document_type_as_map_value(document_type_as_map_value)
  166    167   
//!        .document_type_as_payload(document_type_as_payload)
  167    168   
//!        .empty_input_and_empty_output(empty_input_and_empty_output)
  168    169   
//!        .endpoint_operation(endpoint_operation)
  169    170   
//!        .endpoint_with_host_label_operation(endpoint_with_host_label_operation)
  170    171   
//!        .fractional_seconds(fractional_seconds)
  171    172   
//!        .greeting_with_errors(greeting_with_errors)
  172    173   
//!        .host_with_path_operation(host_with_path_operation)
@@ -206,207 +312,320 @@
  226    227   
//!        .malformed_timestamp_query_epoch(malformed_timestamp_query_epoch)
  227    228   
//!        .malformed_timestamp_query_http_date(malformed_timestamp_query_http_date)
  228    229   
//!        .malformed_union(malformed_union)
  229    230   
//!        .media_type_header(media_type_header)
  230    231   
//!        .no_input_and_no_output(no_input_and_no_output)
  231    232   
//!        .no_input_and_output(no_input_and_output)
  232    233   
//!        .null_and_empty_headers_client(null_and_empty_headers_client)
  233    234   
//!        .null_and_empty_headers_server(null_and_empty_headers_server)
  234    235   
//!        .omits_null_serializes_empty_string(omits_null_serializes_empty_string)
  235    236   
//!        .omits_serializing_empty_lists(omits_serializing_empty_lists)
         237  +
//!        .operation_with_defaults(operation_with_defaults)
         238  +
//!        .operation_with_nested_structure(operation_with_nested_structure)
  236    239   
//!        .post_player_action(post_player_action)
  237    240   
//!        .post_union_with_json_name(post_union_with_json_name)
  238    241   
//!        .put_with_content_encoding(put_with_content_encoding)
  239    242   
//!        .query_idempotency_token_auto_fill(query_idempotency_token_auto_fill)
  240    243   
//!        .query_params_as_string_list_map(query_params_as_string_list_map)
  241    244   
//!        .query_precedence(query_precedence)
  242    245   
//!        .recursive_shapes(recursive_shapes)
  243    246   
//!        .simple_scalar_properties(simple_scalar_properties)
  244    247   
//!        .sparse_json_lists(sparse_json_lists)
  245    248   
//!        .sparse_json_maps(sparse_json_maps)
  246    249   
//!        .streaming_traits(streaming_traits)
  247    250   
//!        .streaming_traits_require_length(streaming_traits_require_length)
  248    251   
//!        .streaming_traits_with_media_type(streaming_traits_with_media_type)
  249    252   
//!        .test_body_structure(test_body_structure)
         253  +
//!        .test_no_input_no_payload(test_no_input_no_payload)
  250    254   
//!        .test_no_payload(test_no_payload)
  251    255   
//!        .test_payload_blob(test_payload_blob)
  252    256   
//!        .test_payload_structure(test_payload_structure)
  253    257   
//!        .timestamp_format_headers(timestamp_format_headers)
  254    258   
//!        .unit_input_and_output(unit_input_and_output)
  255    259   
//!        .build()
  256    260   
//!        .expect("failed to build an instance of RestJson");
  257    261   
//!
  258    262   
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
  259    263   
//!        .expect("unable to parse the server bind address and port");
  260    264   
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
  261    265   
//!    # let server = async { Ok::<_, ()>(()) };
  262    266   
//!
  263    267   
//!    // Run your service!
  264    268   
//!    if let Err(err) = server.await {
  265    269   
//!        eprintln!("server error: {:?}", err);
  266    270   
//!    }
  267    271   
//! }
  268    272   
//!
  269    273   
//! use rest_json::{input, output, error};
  270    274   
//!
  271    275   
//! async fn all_query_string_types(input: input::AllQueryStringTypesInput) -> Result<output::AllQueryStringTypesOutput, error::AllQueryStringTypesError> {
  272    276   
//!     todo!()
  273    277   
//! }
  274    278   
//!
  275    279   
//! async fn constant_and_variable_query_string(input: input::ConstantAndVariableQueryStringInput) -> output::ConstantAndVariableQueryStringOutput {
  276    280   
//!     todo!()
  277    281   
//! }
  278    282   
//!
  279    283   
//! async fn constant_query_string(input: input::ConstantQueryStringInput) -> Result<output::ConstantQueryStringOutput, error::ConstantQueryStringError> {
  280    284   
//!     todo!()
  281    285   
//! }
  282    286   
//!
         287  +
//! async fn content_type_parameters(input: input::ContentTypeParametersInput) -> output::ContentTypeParametersOutput {
         288  +
//!     todo!()
         289  +
//! }
         290  +
//!
  283    291   
//! async fn datetime_offsets(input: input::DatetimeOffsetsInput) -> output::DatetimeOffsetsOutput {
  284    292   
//!     todo!()
  285    293   
//! }
  286    294   
//!
  287    295   
//! async fn document_type(input: input::DocumentTypeInput) -> output::DocumentTypeOutput {
  288    296   
//!     todo!()
  289    297   
//! }
  290    298   
//!
  291    299   
//! async fn document_type_as_map_value(input: input::DocumentTypeAsMapValueInput) -> output::DocumentTypeAsMapValueOutput {
  292    300   
//!     todo!()
@@ -545,553 +660,680 @@
  565    573   
//! }
  566    574   
//!
  567    575   
//! async fn omits_null_serializes_empty_string(input: input::OmitsNullSerializesEmptyStringInput) -> output::OmitsNullSerializesEmptyStringOutput {
  568    576   
//!     todo!()
  569    577   
//! }
  570    578   
//!
  571    579   
//! async fn omits_serializing_empty_lists(input: input::OmitsSerializingEmptyListsInput) -> Result<output::OmitsSerializingEmptyListsOutput, error::OmitsSerializingEmptyListsError> {
  572    580   
//!     todo!()
  573    581   
//! }
  574    582   
//!
         583  +
//! async fn operation_with_defaults(input: input::OperationWithDefaultsInput) -> Result<output::OperationWithDefaultsOutput, error::OperationWithDefaultsError> {
         584  +
//!     todo!()
         585  +
//! }
         586  +
//!
         587  +
//! async fn operation_with_nested_structure(input: input::OperationWithNestedStructureInput) -> Result<output::OperationWithNestedStructureOutput, error::OperationWithNestedStructureError> {
         588  +
//!     todo!()
         589  +
//! }
         590  +
//!
  575    591   
//! async fn post_player_action(input: input::PostPlayerActionInput) -> output::PostPlayerActionOutput {
  576    592   
//!     todo!()
  577    593   
//! }
  578    594   
//!
  579    595   
//! async fn post_union_with_json_name(input: input::PostUnionWithJsonNameInput) -> output::PostUnionWithJsonNameOutput {
  580    596   
//!     todo!()
  581    597   
//! }
  582    598   
//!
  583    599   
//! async fn put_with_content_encoding(input: input::PutWithContentEncodingInput) -> output::PutWithContentEncodingOutput {
  584    600   
//!     todo!()
  585    601   
//! }
  586    602   
//!
  587    603   
//! async fn query_idempotency_token_auto_fill(input: input::QueryIdempotencyTokenAutoFillInput) -> output::QueryIdempotencyTokenAutoFillOutput {
  588    604   
//!     todo!()
  589    605   
//! }
  590    606   
//!
  591    607   
//! async fn query_params_as_string_list_map(input: input::QueryParamsAsStringListMapInput) -> output::QueryParamsAsStringListMapOutput {
  592    608   
//!     todo!()
  593    609   
//! }
  594    610   
//!
  595    611   
//! async fn query_precedence(input: input::QueryPrecedenceInput) -> output::QueryPrecedenceOutput {
  596    612   
//!     todo!()
  597    613   
//! }
  598    614   
//!
  599    615   
//! async fn recursive_shapes(input: input::RecursiveShapesInput) -> output::RecursiveShapesOutput {
  600    616   
//!     todo!()
  601    617   
//! }
  602    618   
//!
  603    619   
//! async fn simple_scalar_properties(input: input::SimpleScalarPropertiesInput) -> output::SimpleScalarPropertiesOutput {
  604    620   
//!     todo!()
  605    621   
//! }
  606    622   
//!
  607    623   
//! async fn sparse_json_lists(input: input::SparseJsonListsInput) -> output::SparseJsonListsOutput {
  608    624   
//!     todo!()
  609    625   
//! }
  610    626   
//!
  611    627   
//! async fn sparse_json_maps(input: input::SparseJsonMapsInput) -> Result<output::SparseJsonMapsOutput, error::SparseJsonMapsError> {
  612    628   
//!     todo!()
  613    629   
//! }
  614    630   
//!
  615    631   
//! async fn streaming_traits(input: input::StreamingTraitsInput) -> output::StreamingTraitsOutput {
  616    632   
//!     todo!()
  617    633   
//! }
  618    634   
//!
  619    635   
//! async fn streaming_traits_require_length(input: input::StreamingTraitsRequireLengthInput) -> output::StreamingTraitsRequireLengthOutput {
  620    636   
//!     todo!()
  621    637   
//! }
  622    638   
//!
  623    639   
//! async fn streaming_traits_with_media_type(input: input::StreamingTraitsWithMediaTypeInput) -> output::StreamingTraitsWithMediaTypeOutput {
  624    640   
//!     todo!()
  625    641   
//! }
  626    642   
//!
  627    643   
//! async fn test_body_structure(input: input::TestBodyStructureInput) -> output::TestBodyStructureOutput {
  628    644   
//!     todo!()
  629    645   
//! }
  630    646   
//!
         647  +
//! async fn test_no_input_no_payload(input: input::TestNoInputNoPayloadInput) -> output::TestNoInputNoPayloadOutput {
         648  +
//!     todo!()
         649  +
//! }
         650  +
//!
  631    651   
//! async fn test_no_payload(input: input::TestNoPayloadInput) -> output::TestNoPayloadOutput {
  632    652   
//!     todo!()
  633    653   
//! }
  634    654   
//!
  635    655   
//! async fn test_payload_blob(input: input::TestPayloadBlobInput) -> output::TestPayloadBlobOutput {
  636    656   
//!     todo!()
  637    657   
//! }
  638    658   
//!
  639    659   
//! async fn test_payload_structure(input: input::TestPayloadStructureInput) -> output::TestPayloadStructureOutput {
  640    660   
//!     todo!()

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

@@ -1,1 +1139,2407 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(missing_docs)] // documentation missing in model
    3         -
#[derive(
    4         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
    5         -
)]
    6         -
pub struct PayloadConfig {
    7         -
    #[allow(missing_docs)] // documentation missing in model
    8         -
    pub data: ::std::option::Option<i32>,
    9         -
}
   10         -
impl PayloadConfig {
   11         -
    #[allow(missing_docs)] // documentation missing in model
   12         -
    pub fn data(&self) -> ::std::option::Option<i32> {
   13         -
        self.data
   14         -
    }
   15         -
}
   16         -
impl PayloadConfig {
   17         -
    /// Creates a new builder-style object to manufacture [`PayloadConfig`](crate::model::PayloadConfig).
   18         -
    pub fn builder() -> crate::model::payload_config::Builder {
   19         -
        crate::model::payload_config::Builder::default()
   20         -
    }
   21         -
}
   22         -
impl crate::constrained::Constrained for crate::model::PayloadConfig {
   23         -
    type Unconstrained = crate::model::payload_config::Builder;
   24         -
}
   25         -
   26         -
#[allow(missing_docs)] // documentation missing in model
   27         -
#[derive(
   28         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   29         -
)]
   30         -
pub struct TestConfig {
   31         -
    #[allow(missing_docs)] // documentation missing in model
   32         -
    pub timeout: ::std::option::Option<i32>,
   33         -
}
   34         -
impl TestConfig {
   35         -
    #[allow(missing_docs)] // documentation missing in model
   36         -
    pub fn timeout(&self) -> ::std::option::Option<i32> {
   37         -
        self.timeout
   38         -
    }
   39         -
}
   40         -
impl TestConfig {
   41         -
    /// Creates a new builder-style object to manufacture [`TestConfig`](crate::model::TestConfig).
   42         -
    pub fn builder() -> crate::model::test_config::Builder {
   43         -
        crate::model::test_config::Builder::default()
   44         -
    }
   45         -
}
   46         -
impl crate::constrained::Constrained for crate::model::TestConfig {
   47         -
    type Unconstrained = crate::model::test_config::Builder;
   48         -
}
   49      2   
   50      3   
/// Describes one specific validation failure for an input member.
   51      4   
#[derive(
   52      5   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   53      6   
)]
   54      7   
pub struct ValidationExceptionField {
   55      8   
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
   56      9   
    pub path: ::std::string::String,
   57     10   
    /// A detailed description of the validation failure.
   58     11   
    pub message: ::std::string::String,
   59     12   
}
   60     13   
impl ValidationExceptionField {
   61     14   
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
   62     15   
    pub fn path(&self) -> &str {
   63     16   
        use std::ops::Deref;
   64     17   
        self.path.deref()
   65     18   
    }
   66     19   
    /// A detailed description of the validation failure.
   67     20   
    pub fn message(&self) -> &str {
   68     21   
        use std::ops::Deref;
   69     22   
        self.message.deref()
   70     23   
    }
   71     24   
}
   72     25   
impl ValidationExceptionField {
   73     26   
    /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
   74     27   
    pub fn builder() -> crate::model::validation_exception_field::Builder {
   75     28   
        crate::model::validation_exception_field::Builder::default()
   76     29   
    }
   77     30   
}
   78     31   
   79     32   
#[allow(missing_docs)] // documentation missing in model
   80     33   
#[derive(
   81     34   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   82     35   
)]
   83         -
pub enum SimpleUnion {
          36  +
pub struct Dialog {
   84     37   
    #[allow(missing_docs)] // documentation missing in model
   85         -
    Int(i32),
          38  +
    pub language: ::std::option::Option<::std::string::String>,
   86     39   
    #[allow(missing_docs)] // documentation missing in model
   87         -
    String(::std::string::String),
          40  +
    pub greeting: ::std::string::String,
          41  +
    #[allow(missing_docs)] // documentation missing in model
          42  +
    pub farewell: ::std::option::Option<crate::model::Farewell>,
   88     43   
}
   89         -
impl SimpleUnion {
   90         -
    /// Tries to convert the enum instance into [`Int`](crate::model::SimpleUnion::Int), extracting the inner [`i32`](i32).
   91         -
    /// Returns `Err(&Self)` if it can't be converted.
   92         -
    pub fn as_int(&self) -> ::std::result::Result<&i32, &Self> {
   93         -
        if let SimpleUnion::Int(val) = &self {
   94         -
            ::std::result::Result::Ok(val)
   95         -
        } else {
   96         -
            ::std::result::Result::Err(self)
   97         -
        }
          44  +
impl Dialog {
          45  +
    #[allow(missing_docs)] // documentation missing in model
          46  +
    pub fn language(&self) -> ::std::option::Option<&str> {
          47  +
        self.language.as_deref()
   98     48   
    }
   99         -
    /// Returns true if this is a [`Int`](crate::model::SimpleUnion::Int).
  100         -
    pub fn is_int(&self) -> bool {
  101         -
        self.as_int().is_ok()
          49  +
    #[allow(missing_docs)] // documentation missing in model
          50  +
    pub fn greeting(&self) -> &str {
          51  +
        use std::ops::Deref;
          52  +
        self.greeting.deref()
  102     53   
    }
  103         -
    /// Tries to convert the enum instance into [`String`](crate::model::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
  104         -
    /// Returns `Err(&Self)` if it can't be converted.
  105         -
    pub fn as_string(&self) -> ::std::result::Result<&::std::string::String, &Self> {
  106         -
        if let SimpleUnion::String(val) = &self {
  107         -
            ::std::result::Result::Ok(val)
  108         -
        } else {
  109         -
            ::std::result::Result::Err(self)
  110         -
        }
          54  +
    #[allow(missing_docs)] // documentation missing in model
          55  +
    pub fn farewell(&self) -> ::std::option::Option<&crate::model::Farewell> {
          56  +
        self.farewell.as_ref()
  111     57   
    }
  112         -
    /// Returns true if this is a [`String`](crate::model::SimpleUnion::String).
  113         -
    pub fn is_string(&self) -> bool {
  114         -
        self.as_string().is_ok()
          58  +
}
          59  +
impl Dialog {
          60  +
    /// Creates a new builder-style object to manufacture [`Dialog`](crate::model::Dialog).
          61  +
    pub fn builder() -> crate::model::dialog::Builder {
          62  +
        crate::model::dialog::Builder::default()
  115     63   
    }
  116     64   
}
          65  +
impl crate::constrained::Constrained for crate::model::Dialog {
          66  +
    type Unconstrained = crate::model::dialog::Builder;
          67  +
}
  117     68   
  118     69   
#[allow(missing_docs)] // documentation missing in model
  119     70   
#[derive(
  120     71   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  121     72   
)]
  122         -
pub enum UnionWithJsonName {
  123         -
    #[allow(missing_docs)] // documentation missing in model
  124         -
    Bar(::std::string::String),
  125         -
    #[allow(missing_docs)] // documentation missing in model
  126         -
    Baz(::std::string::String),
          73  +
pub struct Farewell {
  127     74   
    #[allow(missing_docs)] // documentation missing in model
  128         -
    Foo(::std::string::String),
          75  +
    pub phrase: ::std::string::String,
  129     76   
}
  130         -
impl UnionWithJsonName {
  131         -
    /// Tries to convert the enum instance into [`Bar`](crate::model::UnionWithJsonName::Bar), extracting the inner [`String`](::std::string::String).
  132         -
    /// Returns `Err(&Self)` if it can't be converted.
  133         -
    pub fn as_bar(&self) -> ::std::result::Result<&::std::string::String, &Self> {
  134         -
        if let UnionWithJsonName::Bar(val) = &self {
  135         -
            ::std::result::Result::Ok(val)
  136         -
        } else {
  137         -
            ::std::result::Result::Err(self)
  138         -
        }
          77  +
impl Farewell {
          78  +
    #[allow(missing_docs)] // documentation missing in model
          79  +
    pub fn phrase(&self) -> &str {
          80  +
        use std::ops::Deref;
          81  +
        self.phrase.deref()
  139     82   
    }
  140         -
    /// Returns true if this is a [`Bar`](crate::model::UnionWithJsonName::Bar).
  141         -
    pub fn is_bar(&self) -> bool {
  142         -
        self.as_bar().is_ok()
          83  +
}
          84  +
impl Farewell {
          85  +
    /// Creates a new builder-style object to manufacture [`Farewell`](crate::model::Farewell).
          86  +
    pub fn builder() -> crate::model::farewell::Builder {
          87  +
        crate::model::farewell::Builder::default()
  143     88   
    }
  144         -
    /// Tries to convert the enum instance into [`Baz`](crate::model::UnionWithJsonName::Baz), extracting the inner [`String`](::std::string::String).
  145         -
    /// Returns `Err(&Self)` if it can't be converted.
  146         -
    pub fn as_baz(&self) -> ::std::result::Result<&::std::string::String, &Self> {
  147         -
        if let UnionWithJsonName::Baz(val) = &self {
  148         -
            ::std::result::Result::Ok(val)
  149         -
        } else {
  150         -
            ::std::result::Result::Err(self)
  151         -
        }
          89  +
}
          90  +
impl crate::constrained::Constrained for crate::model::Farewell {
          91  +
    type Unconstrained = crate::model::farewell::Builder;
          92  +
}
          93  +
          94  +
#[allow(missing_docs)] // documentation missing in model
          95  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
          96  +
pub struct TopLevel {
          97  +
    #[allow(missing_docs)] // documentation missing in model
          98  +
    pub dialog: crate::model::Dialog,
          99  +
    #[allow(missing_docs)] // documentation missing in model
         100  +
    pub dialog_list: ::std::vec::Vec<crate::model::Dialog>,
         101  +
    #[allow(missing_docs)] // documentation missing in model
         102  +
    pub dialog_map: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
         103  +
}
         104  +
impl TopLevel {
         105  +
    #[allow(missing_docs)] // documentation missing in model
         106  +
    pub fn dialog(&self) -> &crate::model::Dialog {
         107  +
        &self.dialog
  152    108   
    }
  153         -
    /// Returns true if this is a [`Baz`](crate::model::UnionWithJsonName::Baz).
  154         -
    pub fn is_baz(&self) -> bool {
  155         -
        self.as_baz().is_ok()
         109  +
    #[allow(missing_docs)] // documentation missing in model
         110  +
    pub fn dialog_list(&self) -> &[crate::model::Dialog] {
         111  +
        use std::ops::Deref;
         112  +
        self.dialog_list.deref()
  156    113   
    }
  157         -
    /// Tries to convert the enum instance into [`Foo`](crate::model::UnionWithJsonName::Foo), extracting the inner [`String`](::std::string::String).
  158         -
    /// Returns `Err(&Self)` if it can't be converted.
  159         -
    pub fn as_foo(&self) -> ::std::result::Result<&::std::string::String, &Self> {
  160         -
        if let UnionWithJsonName::Foo(val) = &self {
  161         -
            ::std::result::Result::Ok(val)
  162         -
        } else {
  163         -
            ::std::result::Result::Err(self)
  164         -
        }
         114  +
    #[allow(missing_docs)] // documentation missing in model
         115  +
    pub fn dialog_map(
         116  +
        &self,
         117  +
    ) -> &::std::collections::HashMap<::std::string::String, crate::model::Dialog> {
         118  +
        &self.dialog_map
  165    119   
    }
  166         -
    /// Returns true if this is a [`Foo`](crate::model::UnionWithJsonName::Foo).
  167         -
    pub fn is_foo(&self) -> bool {
  168         -
        self.as_foo().is_ok()
         120  +
}
         121  +
impl TopLevel {
         122  +
    /// Creates a new builder-style object to manufacture [`TopLevel`](crate::model::TopLevel).
         123  +
    pub fn builder() -> crate::model::top_level::Builder {
         124  +
        crate::model::top_level::Builder::default()
  169    125   
    }
  170    126   
}
         127  +
impl crate::constrained::Constrained for crate::model::TopLevel {
         128  +
    type Unconstrained = crate::model::top_level::Builder;
         129  +
}
  171    130   
  172    131   
#[allow(missing_docs)] // documentation missing in model
  173    132   
#[derive(
  174         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         133  +
    ::std::clone::Clone,
         134  +
    ::std::cmp::Eq,
         135  +
    ::std::cmp::Ord,
         136  +
    ::std::cmp::PartialEq,
         137  +
    ::std::cmp::PartialOrd,
         138  +
    ::std::fmt::Debug,
         139  +
    ::std::hash::Hash,
  175    140   
)]
  176         -
pub enum PlayerAction {
  177         -
    /// Quit the game.
  178         -
    Quit,
         141  +
pub enum TestEnum {
         142  +
    #[allow(missing_docs)] // documentation missing in model
         143  +
    Bar,
         144  +
    #[allow(missing_docs)] // documentation missing in model
         145  +
    Baz,
         146  +
    #[allow(missing_docs)] // documentation missing in model
         147  +
    Foo,
  179    148   
}
  180         -
impl PlayerAction {
  181         -
    #[allow(irrefutable_let_patterns)]
  182         -
    /// Tries to convert the enum instance into [`Quit`](crate::model::PlayerAction::Quit), extracting the inner `()`.
  183         -
    /// Returns `Err(&Self)` if it can't be converted.
  184         -
    pub fn as_quit(&self) -> ::std::result::Result<(), &Self> {
  185         -
        if let PlayerAction::Quit = &self {
  186         -
            ::std::result::Result::Ok(())
  187         -
        } else {
  188         -
            ::std::result::Result::Err(self)
         149  +
/// See [`TestEnum`](crate::model::TestEnum).
         150  +
pub mod test_enum {
         151  +
    #[derive(Debug, PartialEq)]
         152  +
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
         153  +
         154  +
    impl ::std::fmt::Display for ConstraintViolation {
         155  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         156  +
            write!(
         157  +
                f,
         158  +
                r#"Value provided for 'aws.protocoltests.restjson#TestEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
         159  +
            )
  189    160   
        }
  190    161   
    }
  191         -
    /// Returns true if this is a [`Quit`](crate::model::PlayerAction::Quit).
  192         -
    pub fn is_quit(&self) -> bool {
  193         -
        self.as_quit().is_ok()
         162  +
         163  +
    impl ::std::error::Error for ConstraintViolation {}
         164  +
    impl ConstraintViolation {
         165  +
        pub(crate) fn as_validation_exception_field(
         166  +
            self,
         167  +
            path: ::std::string::String,
         168  +
        ) -> crate::model::ValidationExceptionField {
         169  +
            crate::model::ValidationExceptionField {
         170  +
                message: format!(
         171  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
         172  +
                    &path
         173  +
                ),
         174  +
                path,
         175  +
            }
         176  +
        }
         177  +
    }
         178  +
}
         179  +
impl ::std::convert::TryFrom<&str> for TestEnum {
         180  +
    type Error = crate::model::test_enum::ConstraintViolation;
         181  +
    fn try_from(
         182  +
        s: &str,
         183  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
         184  +
        match s {
         185  +
            "BAR" => Ok(TestEnum::Bar),
         186  +
            "BAZ" => Ok(TestEnum::Baz),
         187  +
            "FOO" => Ok(TestEnum::Foo),
         188  +
            _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
         189  +
        }
         190  +
    }
         191  +
}
         192  +
impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
         193  +
    type Error = crate::model::test_enum::ConstraintViolation;
         194  +
    fn try_from(
         195  +
        s: ::std::string::String,
         196  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
         197  +
    {
         198  +
        s.as_str().try_into()
         199  +
    }
         200  +
}
         201  +
impl std::str::FromStr for TestEnum {
         202  +
    type Err = crate::model::test_enum::ConstraintViolation;
         203  +
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
         204  +
        Self::try_from(s)
         205  +
    }
         206  +
}
         207  +
impl TestEnum {
         208  +
    /// Returns the `&str` value of the enum member.
         209  +
    pub fn as_str(&self) -> &str {
         210  +
        match self {
         211  +
            TestEnum::Bar => "BAR",
         212  +
            TestEnum::Baz => "BAZ",
         213  +
            TestEnum::Foo => "FOO",
         214  +
        }
         215  +
    }
         216  +
    /// Returns all the `&str` representations of the enum members.
         217  +
    pub const fn values() -> &'static [&'static str] {
         218  +
        &["BAR", "BAZ", "FOO"]
         219  +
    }
         220  +
}
         221  +
impl ::std::convert::AsRef<str> for TestEnum {
         222  +
    fn as_ref(&self) -> &str {
         223  +
        self.as_str()
         224  +
    }
         225  +
}
         226  +
impl crate::constrained::Constrained for TestEnum {
         227  +
    type Unconstrained = ::std::string::String;
         228  +
}
         229  +
         230  +
impl ::std::convert::From<::std::string::String>
         231  +
    for crate::constrained::MaybeConstrained<crate::model::TestEnum>
         232  +
{
         233  +
    fn from(value: ::std::string::String) -> Self {
         234  +
        Self::Unconstrained(value)
  194    235   
    }
  195    236   
}
  196    237   
  197    238   
#[allow(missing_docs)] // documentation missing in model
  198    239   
#[derive(
  199    240   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  200    241   
)]
  201         -
pub struct Unit {}
  202         -
impl Unit {
  203         -
    /// Creates a new builder-style object to manufacture [`Unit`](crate::model::Unit).
  204         -
    pub fn builder() -> crate::model::unit::Builder {
  205         -
        crate::model::unit::Builder::default()
         242  +
pub struct ClientOptionalDefaults {
         243  +
    #[allow(missing_docs)] // documentation missing in model
         244  +
    pub member: i32,
         245  +
}
         246  +
impl ClientOptionalDefaults {
         247  +
    #[allow(missing_docs)] // documentation missing in model
         248  +
    pub fn member(&self) -> i32 {
         249  +
        self.member
  206    250   
    }
  207    251   
}
  208         -
impl crate::constrained::Constrained for crate::model::Unit {
  209         -
    type Unconstrained = crate::model::unit::Builder;
         252  +
impl ClientOptionalDefaults {
         253  +
    /// Creates a new builder-style object to manufacture [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
         254  +
    pub fn builder() -> crate::model::client_optional_defaults::Builder {
         255  +
        crate::model::client_optional_defaults::Builder::default()
         256  +
    }
         257  +
}
         258  +
impl crate::constrained::Constrained for crate::model::ClientOptionalDefaults {
         259  +
    type Unconstrained = crate::model::client_optional_defaults::Builder;
  210    260   
}
  211    261   
  212         -
/// A union with a representative set of types for members.
  213         -
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
  214         -
pub enum MyUnion {
         262  +
#[allow(missing_docs)] // documentation missing in model
         263  +
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
         264  +
pub struct Defaults {
  215    265   
    #[allow(missing_docs)] // documentation missing in model
  216         -
    BlobValue(::aws_smithy_types::Blob),
         266  +
    pub default_string: ::std::string::String,
  217    267   
    #[allow(missing_docs)] // documentation missing in model
  218         -
    BooleanValue(bool),
         268  +
    pub default_boolean: bool,
  219    269   
    #[allow(missing_docs)] // documentation missing in model
  220         -
    EnumValue(crate::model::FooEnum),
         270  +
    pub default_list: ::std::vec::Vec<::std::string::String>,
  221    271   
    #[allow(missing_docs)] // documentation missing in model
  222         -
    ListValue(::std::vec::Vec<::std::string::String>),
         272  +
    pub default_document_map: ::aws_smithy_types::Document,
  223    273   
    #[allow(missing_docs)] // documentation missing in model
  224         -
    MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
         274  +
    pub default_document_string: ::aws_smithy_types::Document,
  225    275   
    #[allow(missing_docs)] // documentation missing in model
  226         -
    NumberValue(i32),
         276  +
    pub default_document_boolean: ::aws_smithy_types::Document,
  227    277   
    #[allow(missing_docs)] // documentation missing in model
  228         -
    RenamedStructureValue(crate::model::RenamedGreeting),
         278  +
    pub default_document_list: ::aws_smithy_types::Document,
  229    279   
    #[allow(missing_docs)] // documentation missing in model
  230         -
    StringValue(::std::string::String),
         280  +
    pub default_null_document: ::std::option::Option<::aws_smithy_types::Document>,
  231    281   
    #[allow(missing_docs)] // documentation missing in model
  232         -
    StructureValue(crate::model::GreetingStruct),
         282  +
    pub default_timestamp: ::aws_smithy_types::DateTime,
  233    283   
    #[allow(missing_docs)] // documentation missing in model
  234         -
    TimestampValue(::aws_smithy_types::DateTime),
         284  +
    pub default_blob: ::aws_smithy_types::Blob,
         285  +
    #[allow(missing_docs)] // documentation missing in model
         286  +
    pub default_byte: i8,
         287  +
    #[allow(missing_docs)] // documentation missing in model
         288  +
    pub default_short: i16,
         289  +
    #[allow(missing_docs)] // documentation missing in model
         290  +
    pub default_integer: i32,
         291  +
    #[allow(missing_docs)] // documentation missing in model
         292  +
    pub default_long: i64,
         293  +
    #[allow(missing_docs)] // documentation missing in model
         294  +
    pub default_float: f32,
         295  +
    #[allow(missing_docs)] // documentation missing in model
         296  +
    pub default_double: f64,
         297  +
    #[allow(missing_docs)] // documentation missing in model
         298  +
    pub default_map: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
         299  +
    #[allow(missing_docs)] // documentation missing in model
         300  +
    pub default_enum: crate::model::TestEnum,
         301  +
    #[allow(missing_docs)] // documentation missing in model
         302  +
    pub default_int_enum: i32,
         303  +
    #[allow(missing_docs)] // documentation missing in model
         304  +
    pub empty_string: ::std::string::String,
         305  +
    #[allow(missing_docs)] // documentation missing in model
         306  +
    pub false_boolean: bool,
         307  +
    #[allow(missing_docs)] // documentation missing in model
         308  +
    pub empty_blob: ::aws_smithy_types::Blob,
         309  +
    #[allow(missing_docs)] // documentation missing in model
         310  +
    pub zero_byte: i8,
         311  +
    #[allow(missing_docs)] // documentation missing in model
         312  +
    pub zero_short: i16,
         313  +
    #[allow(missing_docs)] // documentation missing in model
         314  +
    pub zero_integer: i32,
         315  +
    #[allow(missing_docs)] // documentation missing in model
         316  +
    pub zero_long: i64,
         317  +
    #[allow(missing_docs)] // documentation missing in model
         318  +
    pub zero_float: f32,
         319  +
    #[allow(missing_docs)] // documentation missing in model
         320  +
    pub zero_double: f64,
  235    321   
}
  236         -
impl MyUnion {
  237         -
    /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_types::Blob).
  238         -
    /// Returns `Err(&Self)` if it can't be converted.
  239         -
    pub fn as_blob_value(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
  240         -
        if let MyUnion::BlobValue(val) = &self {
  241         -
            ::std::result::Result::Ok(val)
  242         -
        } else {
  243         -
            ::std::result::Result::Err(self)
  244         -
        }
         322  +
impl Defaults {
         323  +
    #[allow(missing_docs)] // documentation missing in model
         324  +
    pub fn default_string(&self) -> &str {
         325  +
        use std::ops::Deref;
         326  +
        self.default_string.deref()
  245    327   
    }
  246         -
    /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
  247         -
    pub fn is_blob_value(&self) -> bool {
  248         -
        self.as_blob_value().is_ok()
         328  +
    #[allow(missing_docs)] // documentation missing in model
         329  +
    pub fn default_boolean(&self) -> bool {
         330  +
        self.default_boolean
  249    331   
    }
  250         -
    /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
  251         -
    /// Returns `Err(&Self)` if it can't be converted.
  252         -
    pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
  253         -
        if let MyUnion::BooleanValue(val) = &self {
  254         -
            ::std::result::Result::Ok(val)
  255         -
        } else {
  256         -
            ::std::result::Result::Err(self)
  257         -
        }
         332  +
    #[allow(missing_docs)] // documentation missing in model
         333  +
    pub fn default_list(&self) -> &[::std::string::String] {
         334  +
        use std::ops::Deref;
         335  +
        self.default_list.deref()
  258    336   
    }
  259         -
    /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
  260         -
    pub fn is_boolean_value(&self) -> bool {
  261         -
        self.as_boolean_value().is_ok()
         337  +
    #[allow(missing_docs)] // documentation missing in model
         338  +
    pub fn default_document_map(&self) -> &::aws_smithy_types::Document {
         339  +
        &self.default_document_map
  262    340   
    }
  263         -
    /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
  264         -
    /// Returns `Err(&Self)` if it can't be converted.
  265         -
    pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
  266         -
        if let MyUnion::EnumValue(val) = &self {
  267         -
            ::std::result::Result::Ok(val)
  268         -
        } else {
  269         -
            ::std::result::Result::Err(self)
  270         -
        }
         341  +
    #[allow(missing_docs)] // documentation missing in model
         342  +
    pub fn default_document_string(&self) -> &::aws_smithy_types::Document {
         343  +
        &self.default_document_string
  271    344   
    }
  272         -
    /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
  273         -
    pub fn is_enum_value(&self) -> bool {
  274         -
        self.as_enum_value().is_ok()
         345  +
    #[allow(missing_docs)] // documentation missing in model
         346  +
    pub fn default_document_boolean(&self) -> &::aws_smithy_types::Document {
         347  +
        &self.default_document_boolean
  275    348   
    }
  276         -
    /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
  277         -
    /// Returns `Err(&Self)` if it can't be converted.
  278         -
    pub fn as_list_value(
  279         -
        &self,
  280         -
    ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
  281         -
        if let MyUnion::ListValue(val) = &self {
  282         -
            ::std::result::Result::Ok(val)
  283         -
        } else {
  284         -
            ::std::result::Result::Err(self)
  285         -
        }
         349  +
    #[allow(missing_docs)] // documentation missing in model
         350  +
    pub fn default_document_list(&self) -> &::aws_smithy_types::Document {
         351  +
        &self.default_document_list
  286    352   
    }
  287         -
    /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
  288         -
    pub fn is_list_value(&self) -> bool {
  289         -
        self.as_list_value().is_ok()
         353  +
    #[allow(missing_docs)] // documentation missing in model
         354  +
    pub fn default_null_document(&self) -> ::std::option::Option<&::aws_smithy_types::Document> {
         355  +
        self.default_null_document.as_ref()
  290    356   
    }
  291         -
    /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
  292         -
    /// Returns `Err(&Self)` if it can't be converted.
  293         -
    pub fn as_map_value(
  294         -
        &self,
  295         -
    ) -> ::std::result::Result<
  296         -
        &::std::collections::HashMap<::std::string::String, ::std::string::String>,
  297         -
        &Self,
  298         -
    > {
  299         -
        if let MyUnion::MapValue(val) = &self {
  300         -
            ::std::result::Result::Ok(val)
  301         -
        } else {
  302         -
            ::std::result::Result::Err(self)
  303         -
        }
         357  +
    #[allow(missing_docs)] // documentation missing in model
         358  +
    pub fn default_timestamp(&self) -> &::aws_smithy_types::DateTime {
         359  +
        &self.default_timestamp
  304    360   
    }
  305         -
    /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
  306         -
    pub fn is_map_value(&self) -> bool {
  307         -
        self.as_map_value().is_ok()
         361  +
    #[allow(missing_docs)] // documentation missing in model
         362  +
    pub fn default_blob(&self) -> &::aws_smithy_types::Blob {
         363  +
        &self.default_blob
  308    364   
    }
  309         -
    /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
  310         -
    /// Returns `Err(&Self)` if it can't be converted.
  311         -
    pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
  312         -
        if let MyUnion::NumberValue(val) = &self {
  313         -
            ::std::result::Result::Ok(val)
  314         -
        } else {
  315         -
            ::std::result::Result::Err(self)
  316         -
        }
         365  +
    #[allow(missing_docs)] // documentation missing in model
         366  +
    pub fn default_byte(&self) -> i8 {
         367  +
        self.default_byte
  317    368   
    }
  318         -
    /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
  319         -
    pub fn is_number_value(&self) -> bool {
  320         -
        self.as_number_value().is_ok()
         369  +
    #[allow(missing_docs)] // documentation missing in model
         370  +
    pub fn default_short(&self) -> i16 {
         371  +
        self.default_short
  321    372   
    }
  322         -
    /// Tries to convert the enum instance into [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue), extracting the inner [`RenamedGreeting`](crate::model::RenamedGreeting).
  323         -
    /// Returns `Err(&Self)` if it can't be converted.
  324         -
    pub fn as_renamed_structure_value(
  325         -
        &self,
  326         -
    ) -> ::std::result::Result<&crate::model::RenamedGreeting, &Self> {
  327         -
        if let MyUnion::RenamedStructureValue(val) = &self {
  328         -
            ::std::result::Result::Ok(val)
  329         -
        } else {
  330         -
            ::std::result::Result::Err(self)
  331         -
        }
         373  +
    #[allow(missing_docs)] // documentation missing in model
         374  +
    pub fn default_integer(&self) -> i32 {
         375  +
        self.default_integer
  332    376   
    }
  333         -
    /// Returns true if this is a [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue).
  334         -
    pub fn is_renamed_structure_value(&self) -> bool {
  335         -
        self.as_renamed_structure_value().is_ok()
         377  +
    #[allow(missing_docs)] // documentation missing in model
         378  +
    pub fn default_long(&self) -> i64 {
         379  +
        self.default_long
  336    380   
    }
  337         -
    /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
  338         -
    /// Returns `Err(&Self)` if it can't be converted.
  339         -
    pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
  340         -
        if let MyUnion::StringValue(val) = &self {
  341         -
            ::std::result::Result::Ok(val)
  342         -
        } else {
  343         -
            ::std::result::Result::Err(self)
  344         -
        }
         381  +
    #[allow(missing_docs)] // documentation missing in model
         382  +
    pub fn default_float(&self) -> f32 {
         383  +
        self.default_float
  345    384   
    }
  346         -
    /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
  347         -
    pub fn is_string_value(&self) -> bool {
  348         -
        self.as_string_value().is_ok()
         385  +
    #[allow(missing_docs)] // documentation missing in model
         386  +
    pub fn default_double(&self) -> f64 {
         387  +
        self.default_double
  349    388   
    }
  350         -
    /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
  351         -
    /// Returns `Err(&Self)` if it can't be converted.
  352         -
    pub fn as_structure_value(
         389  +
    #[allow(missing_docs)] // documentation missing in model
         390  +
    pub fn default_map(
  353    391   
        &self,
  354         -
    ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
  355         -
        if let MyUnion::StructureValue(val) = &self {
  356         -
            ::std::result::Result::Ok(val)
  357         -
        } else {
  358         -
            ::std::result::Result::Err(self)
  359         -
        }
         392  +
    ) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> {
         393  +
        &self.default_map
  360    394   
    }
  361         -
    /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
  362         -
    pub fn is_structure_value(&self) -> bool {
  363         -
        self.as_structure_value().is_ok()
         395  +
    #[allow(missing_docs)] // documentation missing in model
         396  +
    pub fn default_enum(&self) -> &crate::model::TestEnum {
         397  +
        &self.default_enum
  364    398   
    }
  365         -
    /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_types::DateTime).
  366         -
    /// Returns `Err(&Self)` if it can't be converted.
  367         -
    pub fn as_timestamp_value(
  368         -
        &self,
  369         -
    ) -> ::std::result::Result<&::aws_smithy_types::DateTime, &Self> {
  370         -
        if let MyUnion::TimestampValue(val) = &self {
  371         -
            ::std::result::Result::Ok(val)
  372         -
        } else {
  373         -
            ::std::result::Result::Err(self)
  374         -
        }
         399  +
    #[allow(missing_docs)] // documentation missing in model
         400  +
    pub fn default_int_enum(&self) -> i32 {
         401  +
        self.default_int_enum
  375    402   
    }
  376         -
    /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
  377         -
    pub fn is_timestamp_value(&self) -> bool {
  378         -
        self.as_timestamp_value().is_ok()
         403  +
    #[allow(missing_docs)] // documentation missing in model
         404  +
    pub fn empty_string(&self) -> &str {
         405  +
        use std::ops::Deref;
         406  +
        self.empty_string.deref()
         407  +
    }
         408  +
    #[allow(missing_docs)] // documentation missing in model
         409  +
    pub fn false_boolean(&self) -> bool {
         410  +
        self.false_boolean
         411  +
    }
         412  +
    #[allow(missing_docs)] // documentation missing in model
         413  +
    pub fn empty_blob(&self) -> &::aws_smithy_types::Blob {
         414  +
        &self.empty_blob
         415  +
    }
         416  +
    #[allow(missing_docs)] // documentation missing in model
         417  +
    pub fn zero_byte(&self) -> i8 {
         418  +
        self.zero_byte
         419  +
    }
         420  +
    #[allow(missing_docs)] // documentation missing in model
         421  +
    pub fn zero_short(&self) -> i16 {
         422  +
        self.zero_short
         423  +
    }
         424  +
    #[allow(missing_docs)] // documentation missing in model
         425  +
    pub fn zero_integer(&self) -> i32 {
         426  +
        self.zero_integer
         427  +
    }
         428  +
    #[allow(missing_docs)] // documentation missing in model
         429  +
    pub fn zero_long(&self) -> i64 {
         430  +
        self.zero_long
         431  +
    }
         432  +
    #[allow(missing_docs)] // documentation missing in model
         433  +
    pub fn zero_float(&self) -> f32 {
         434  +
        self.zero_float
         435  +
    }
         436  +
    #[allow(missing_docs)] // documentation missing in model
         437  +
    pub fn zero_double(&self) -> f64 {
         438  +
        self.zero_double
  379    439   
    }
  380    440   
}
         441  +
impl Defaults {
         442  +
    /// Creates a new builder-style object to manufacture [`Defaults`](crate::model::Defaults).
         443  +
    pub fn builder() -> crate::model::defaults::Builder {
         444  +
        crate::model::defaults::Builder::default()
         445  +
    }
         446  +
}
         447  +
impl crate::constrained::Constrained for crate::model::Defaults {
         448  +
    type Unconstrained = crate::model::defaults::Builder;
         449  +
}
  381    450   
  382    451   
#[allow(missing_docs)] // documentation missing in model
  383    452   
#[derive(
  384    453   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  385    454   
)]
  386         -
pub struct RenamedGreeting {
         455  +
pub struct PayloadConfig {
  387    456   
    #[allow(missing_docs)] // documentation missing in model
  388         -
    pub salutation: ::std::option::Option<::std::string::String>,
         457  +
    pub data: ::std::option::Option<i32>,
  389    458   
}
  390         -
impl RenamedGreeting {
         459  +
impl PayloadConfig {
  391    460   
    #[allow(missing_docs)] // documentation missing in model
  392         -
    pub fn salutation(&self) -> ::std::option::Option<&str> {
  393         -
        self.salutation.as_deref()
         461  +
    pub fn data(&self) -> ::std::option::Option<i32> {
         462  +
        self.data
  394    463   
    }
  395    464   
}
  396         -
impl RenamedGreeting {
  397         -
    /// Creates a new builder-style object to manufacture [`RenamedGreeting`](crate::model::RenamedGreeting).
  398         -
    pub fn builder() -> crate::model::renamed_greeting::Builder {
  399         -
        crate::model::renamed_greeting::Builder::default()
         465  +
impl PayloadConfig {
         466  +
    /// Creates a new builder-style object to manufacture [`PayloadConfig`](crate::model::PayloadConfig).
         467  +
    pub fn builder() -> crate::model::payload_config::Builder {
         468  +
        crate::model::payload_config::Builder::default()
  400    469   
    }
  401    470   
}
  402         -
impl crate::constrained::Constrained for crate::model::RenamedGreeting {
  403         -
    type Unconstrained = crate::model::renamed_greeting::Builder;
         471  +
impl crate::constrained::Constrained for crate::model::PayloadConfig {
         472  +
    type Unconstrained = crate::model::payload_config::Builder;
  404    473   
}
  405    474   
  406    475   
#[allow(missing_docs)] // documentation missing in model
  407    476   
#[derive(
  408    477   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  409    478   
)]
  410         -
pub struct GreetingStruct {
         479  +
pub struct TestConfig {
  411    480   
    #[allow(missing_docs)] // documentation missing in model
  412         -
    pub hi: ::std::option::Option<::std::string::String>,
         481  +
    pub timeout: ::std::option::Option<i32>,
  413    482   
}
  414         -
impl GreetingStruct {
         483  +
impl TestConfig {
  415    484   
    #[allow(missing_docs)] // documentation missing in model
  416         -
    pub fn hi(&self) -> ::std::option::Option<&str> {
  417         -
        self.hi.as_deref()
         485  +
    pub fn timeout(&self) -> ::std::option::Option<i32> {
         486  +
        self.timeout
  418    487   
    }
  419    488   
}
  420         -
impl GreetingStruct {
  421         -
    /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
  422         -
    pub fn builder() -> crate::model::greeting_struct::Builder {
  423         -
        crate::model::greeting_struct::Builder::default()
         489  +
impl TestConfig {
         490  +
    /// Creates a new builder-style object to manufacture [`TestConfig`](crate::model::TestConfig).
         491  +
    pub fn builder() -> crate::model::test_config::Builder {
         492  +
        crate::model::test_config::Builder::default()
  424    493   
    }
  425    494   
}
  426         -
impl crate::constrained::Constrained for crate::model::GreetingStruct {
  427         -
    type Unconstrained = crate::model::greeting_struct::Builder;
         495  +
impl crate::constrained::Constrained for crate::model::TestConfig {
         496  +
    type Unconstrained = crate::model::test_config::Builder;
  428    497   
}
  429    498   
  430    499   
#[allow(missing_docs)] // documentation missing in model
  431    500   
#[derive(
  432         -
    ::std::clone::Clone,
  433         -
    ::std::cmp::Eq,
  434         -
    ::std::cmp::Ord,
  435         -
    ::std::cmp::PartialEq,
  436         -
    ::std::cmp::PartialOrd,
  437         -
    ::std::fmt::Debug,
  438         -
    ::std::hash::Hash,
         501  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  439    502   
)]
  440         -
pub enum FooEnum {
  441         -
    #[allow(missing_docs)] // documentation missing in model
  442         -
    Zero,
  443         -
    #[allow(missing_docs)] // documentation missing in model
  444         -
    One,
  445         -
    #[allow(missing_docs)] // documentation missing in model
  446         -
    Bar,
         503  +
pub enum SimpleUnion {
  447    504   
    #[allow(missing_docs)] // documentation missing in model
  448         -
    Baz,
         505  +
    Int(i32),
  449    506   
    #[allow(missing_docs)] // documentation missing in model
  450         -
    Foo,
         507  +
    String(::std::string::String),
  451    508   
}
  452         -
/// See [`FooEnum`](crate::model::FooEnum).
  453         -
pub mod foo_enum {
  454         -
    #[derive(Debug, PartialEq)]
  455         -
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
  456         -
  457         -
    impl ::std::fmt::Display for ConstraintViolation {
  458         -
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  459         -
            write!(
  460         -
                f,
  461         -
                r#"Value provided for 'aws.protocoltests.shared#FooEnum' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#
  462         -
            )
  463         -
        }
  464         -
    }
  465         -
  466         -
    impl ::std::error::Error for ConstraintViolation {}
  467         -
    impl ConstraintViolation {
  468         -
        pub(crate) fn as_validation_exception_field(
  469         -
            self,
  470         -
            path: ::std::string::String,
  471         -
        ) -> crate::model::ValidationExceptionField {
  472         -
            crate::model::ValidationExceptionField {
  473         -
                message: format!(
  474         -
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
  475         -
                    &path
  476         -
                ),
  477         -
                path,
  478         -
            }
  479         -
        }
  480         -
    }
  481         -
}
  482         -
impl ::std::convert::TryFrom<&str> for FooEnum {
  483         -
    type Error = crate::model::foo_enum::ConstraintViolation;
  484         -
    fn try_from(
  485         -
        s: &str,
  486         -
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  487         -
        match s {
  488         -
            "0" => Ok(FooEnum::Zero),
  489         -
            "1" => Ok(FooEnum::One),
  490         -
            "Bar" => Ok(FooEnum::Bar),
  491         -
            "Baz" => Ok(FooEnum::Baz),
  492         -
            "Foo" => Ok(FooEnum::Foo),
  493         -
            _ => Err(crate::model::foo_enum::ConstraintViolation(s.to_owned())),
         509  +
impl SimpleUnion {
         510  +
    /// Tries to convert the enum instance into [`Int`](crate::model::SimpleUnion::Int), extracting the inner [`i32`](i32).
         511  +
    /// Returns `Err(&Self)` if it can't be converted.
         512  +
    pub fn as_int(&self) -> ::std::result::Result<&i32, &Self> {
         513  +
        if let SimpleUnion::Int(val) = &self {
         514  +
            ::std::result::Result::Ok(val)
         515  +
        } else {
         516  +
            ::std::result::Result::Err(self)
  494    517   
        }
  495    518   
    }
  496         -
}
  497         -
impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
  498         -
    type Error = crate::model::foo_enum::ConstraintViolation;
  499         -
    fn try_from(
  500         -
        s: ::std::string::String,
  501         -
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  502         -
    {
  503         -
        s.as_str().try_into()
  504         -
    }
  505         -
}
  506         -
impl std::str::FromStr for FooEnum {
  507         -
    type Err = crate::model::foo_enum::ConstraintViolation;
  508         -
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  509         -
        Self::try_from(s)
         519  +
    /// Returns true if this is a [`Int`](crate::model::SimpleUnion::Int).
         520  +
    pub fn is_int(&self) -> bool {
         521  +
        self.as_int().is_ok()
  510    522   
    }
  511         -
}
  512         -
impl FooEnum {
  513         -
    /// Returns the `&str` value of the enum member.
  514         -
    pub fn as_str(&self) -> &str {
  515         -
        match self {
  516         -
            FooEnum::Zero => "0",
  517         -
            FooEnum::One => "1",
  518         -
            FooEnum::Bar => "Bar",
  519         -
            FooEnum::Baz => "Baz",
  520         -
            FooEnum::Foo => "Foo",
         523  +
    /// Tries to convert the enum instance into [`String`](crate::model::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
         524  +
    /// Returns `Err(&Self)` if it can't be converted.
         525  +
    pub fn as_string(&self) -> ::std::result::Result<&::std::string::String, &Self> {
         526  +
        if let SimpleUnion::String(val) = &self {
         527  +
            ::std::result::Result::Ok(val)
         528  +
        } else {
         529  +
            ::std::result::Result::Err(self)
  521    530   
        }
  522    531   
    }
  523         -
    /// Returns all the `&str` representations of the enum members.
  524         -
    pub const fn values() -> &'static [&'static str] {
  525         -
        &["0", "1", "Bar", "Baz", "Foo"]
  526         -
    }
  527         -
}
  528         -
impl ::std::convert::AsRef<str> for FooEnum {
  529         -
    fn as_ref(&self) -> &str {
  530         -
        self.as_str()
  531         -
    }
  532         -
}
  533         -
impl crate::constrained::Constrained for FooEnum {
  534         -
    type Unconstrained = ::std::string::String;
  535         -
}
  536         -
  537         -
impl ::std::convert::From<::std::string::String>
  538         -
    for crate::constrained::MaybeConstrained<crate::model::FooEnum>
  539         -
{
  540         -
    fn from(value: ::std::string::String) -> Self {
  541         -
        Self::Unconstrained(value)
         532  +
    /// Returns true if this is a [`String`](crate::model::SimpleUnion::String).
         533  +
    pub fn is_string(&self) -> bool {
         534  +
        self.as_string().is_ok()
  542    535   
    }
  543    536   
}
  544    537   
  545    538   
#[allow(missing_docs)] // documentation missing in model
  546         -
///
  547         -
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
  548         -
/// [constraint traits]. Use [`StringSet::try_from`] to construct values of this type.
  549         -
///
  550         -
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
  551         -
///
  552    539   
#[derive(
  553    540   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  554    541   
)]
  555         -
pub struct StringSet(pub(crate) ::std::vec::Vec<::std::string::String>);
  556         -
impl StringSet {
  557         -
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::string::String>`].
  558         -
    pub fn inner(&self) -> &::std::vec::Vec<::std::string::String> {
  559         -
        &self.0
         542  +
pub enum UnionWithJsonName {
         543  +
    #[allow(missing_docs)] // documentation missing in model
         544  +
    Bar(::std::string::String),
         545  +
    #[allow(missing_docs)] // documentation missing in model
         546  +
    Baz(::std::string::String),
         547  +
    #[allow(missing_docs)] // documentation missing in model
         548  +
    Foo(::std::string::String),
         549  +
}
         550  +
impl UnionWithJsonName {
         551  +
    /// Tries to convert the enum instance into [`Bar`](crate::model::UnionWithJsonName::Bar), extracting the inner [`String`](::std::string::String).
         552  +
    /// Returns `Err(&Self)` if it can't be converted.
         553  +
    pub fn as_bar(&self) -> ::std::result::Result<&::std::string::String, &Self> {
         554  +
        if let UnionWithJsonName::Bar(val) = &self {
         555  +
            ::std::result::Result::Ok(val)
         556  +
        } else {
         557  +
            ::std::result::Result::Err(self)
         558  +
        }
  560    559   
    }
  561         -
    /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::string::String>`].
  562         -
    pub fn into_inner(self) -> ::std::vec::Vec<::std::string::String> {
  563         -
        self.0
         560  +
    /// Returns true if this is a [`Bar`](crate::model::UnionWithJsonName::Bar).
         561  +
    pub fn is_bar(&self) -> bool {
         562  +
        self.as_bar().is_ok()
  564    563   
    }
  565         -
  566         -
    fn check_unique_items(
  567         -
        items: ::std::vec::Vec<::std::string::String>,
  568         -
    ) -> Result<::std::vec::Vec<::std::string::String>, crate::model::string_set::ConstraintViolation>
  569         -
    {
  570         -
        let mut seen = ::std::collections::HashMap::new();
  571         -
        let mut duplicate_indices = ::std::vec::Vec::new();
  572         -
        for (idx, item) in items.iter().enumerate() {
  573         -
            if let Some(prev_idx) = seen.insert(item, idx) {
  574         -
                duplicate_indices.push(prev_idx);
  575         -
            }
  576         -
        }
  577         -
  578         -
        let mut last_duplicate_indices = ::std::vec::Vec::new();
  579         -
        for idx in &duplicate_indices {
  580         -
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
  581         -
                last_duplicate_indices.push(prev_idx);
  582         -
            }
  583         -
        }
  584         -
        duplicate_indices.extend(last_duplicate_indices);
  585         -
  586         -
        if !duplicate_indices.is_empty() {
  587         -
            debug_assert!(duplicate_indices.len() >= 2);
  588         -
            Err(crate::model::string_set::ConstraintViolation::UniqueItems {
  589         -
                duplicate_indices,
  590         -
                original: items,
  591         -
            })
         564  +
    /// Tries to convert the enum instance into [`Baz`](crate::model::UnionWithJsonName::Baz), extracting the inner [`String`](::std::string::String).
         565  +
    /// Returns `Err(&Self)` if it can't be converted.
         566  +
    pub fn as_baz(&self) -> ::std::result::Result<&::std::string::String, &Self> {
         567  +
        if let UnionWithJsonName::Baz(val) = &self {
         568  +
            ::std::result::Result::Ok(val)
  592    569   
        } else {
  593         -
            Ok(items)
         570  +
            ::std::result::Result::Err(self)
  594    571   
        }
  595    572   
    }
  596         -
}
  597         -
impl ::std::convert::TryFrom<::std::vec::Vec<::std::string::String>> for StringSet {
  598         -
    type Error = crate::model::string_set::ConstraintViolation;
  599         -
  600         -
    /// Constructs a `StringSet` from an [`::std::vec::Vec<::std::string::String>`], failing when the provided value does not satisfy the modeled constraints.
  601         -
    fn try_from(value: ::std::vec::Vec<::std::string::String>) -> Result<Self, Self::Error> {
  602         -
        let value = Self::check_unique_items(value)?;
  603         -
  604         -
        Ok(Self(value))
         573  +
    /// Returns true if this is a [`Baz`](crate::model::UnionWithJsonName::Baz).
         574  +
    pub fn is_baz(&self) -> bool {
         575  +
        self.as_baz().is_ok()
  605    576   
    }
  606         -
}
  607         -
  608         -
impl ::std::convert::From<StringSet> for ::std::vec::Vec<::std::string::String> {
  609         -
    fn from(value: StringSet) -> Self {
  610         -
        value.into_inner()
         577  +
    /// Tries to convert the enum instance into [`Foo`](crate::model::UnionWithJsonName::Foo), extracting the inner [`String`](::std::string::String).
         578  +
    /// Returns `Err(&Self)` if it can't be converted.
         579  +
    pub fn as_foo(&self) -> ::std::result::Result<&::std::string::String, &Self> {
         580  +
        if let UnionWithJsonName::Foo(val) = &self {
         581  +
            ::std::result::Result::Ok(val)
         582  +
        } else {
         583  +
            ::std::result::Result::Err(self)
         584  +
        }
         585  +
    }
         586  +
    /// Returns true if this is a [`Foo`](crate::model::UnionWithJsonName::Foo).
         587  +
    pub fn is_foo(&self) -> bool {
         588  +
        self.as_foo().is_ok()
  611    589   
    }
  612         -
}
  613         -
impl crate::constrained::Constrained for StringSet {
  614         -
    type Unconstrained = crate::unconstrained::string_set_unconstrained::StringSetUnconstrained;
  615    590   
}
  616    591   
  617    592   
#[allow(missing_docs)] // documentation missing in model
  618    593   
#[derive(
  619    594   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  620    595   
)]
  621         -
pub struct StructureListMember {
  622         -
    #[allow(missing_docs)] // documentation missing in model
  623         -
    pub a: ::std::option::Option<::std::string::String>,
  624         -
    #[allow(missing_docs)] // documentation missing in model
  625         -
    pub b: ::std::option::Option<::std::string::String>,
         596  +
pub enum PlayerAction {
         597  +
    /// Quit the game.
         598  +
    Quit,
  626    599   
}
  627         -
impl StructureListMember {
  628         -
    #[allow(missing_docs)] // documentation missing in model
  629         -
    pub fn a(&self) -> ::std::option::Option<&str> {
  630         -
        self.a.as_deref()
  631         -
    }
  632         -
    #[allow(missing_docs)] // documentation missing in model
  633         -
    pub fn b(&self) -> ::std::option::Option<&str> {
  634         -
        self.b.as_deref()
         600  +
impl PlayerAction {
         601  +
    #[allow(irrefutable_let_patterns)]
         602  +
    /// Tries to convert the enum instance into [`Quit`](crate::model::PlayerAction::Quit), extracting the inner `()`.
         603  +
    /// Returns `Err(&Self)` if it can't be converted.
         604  +
    pub fn as_quit(&self) -> ::std::result::Result<(), &Self> {
         605  +
        if let PlayerAction::Quit = &self {
         606  +
            ::std::result::Result::Ok(())
         607  +
        } else {
         608  +
            ::std::result::Result::Err(self)
         609  +
        }
  635    610   
    }
  636         -
}
  637         -
impl StructureListMember {
  638         -
    /// Creates a new builder-style object to manufacture [`StructureListMember`](crate::model::StructureListMember).
  639         -
    pub fn builder() -> crate::model::structure_list_member::Builder {
  640         -
        crate::model::structure_list_member::Builder::default()
         611  +
    /// Returns true if this is a [`Quit`](crate::model::PlayerAction::Quit).
         612  +
    pub fn is_quit(&self) -> bool {
         613  +
        self.as_quit().is_ok()
  641    614   
    }
  642    615   
}
  643         -
impl crate::constrained::Constrained for crate::model::StructureListMember {
  644         -
    type Unconstrained = crate::model::structure_list_member::Builder;
  645         -
}
  646    616   
  647    617   
#[allow(missing_docs)] // documentation missing in model
  648    618   
#[derive(
  649    619   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  650    620   
)]
  651         -
pub struct RecursiveShapesInputOutputNested1 {
         621  +
pub struct Unit {}
         622  +
impl Unit {
         623  +
    /// Creates a new builder-style object to manufacture [`Unit`](crate::model::Unit).
         624  +
    pub fn builder() -> crate::model::unit::Builder {
         625  +
        crate::model::unit::Builder::default()
         626  +
    }
         627  +
}
         628  +
impl crate::constrained::Constrained for crate::model::Unit {
         629  +
    type Unconstrained = crate::model::unit::Builder;
         630  +
}
         631  +
         632  +
/// A union with a representative set of types for members.
         633  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
         634  +
pub enum MyUnion {
  652    635   
    #[allow(missing_docs)] // documentation missing in model
  653         -
    pub foo: ::std::option::Option<::std::string::String>,
         636  +
    BlobValue(::aws_smithy_types::Blob),
  654    637   
    #[allow(missing_docs)] // documentation missing in model
  655         -
    pub nested:
  656         -
        ::std::option::Option<::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>>,
  657         -
}
  658         -
impl RecursiveShapesInputOutputNested1 {
         638  +
    BooleanValue(bool),
  659    639   
    #[allow(missing_docs)] // documentation missing in model
  660         -
    pub fn foo(&self) -> ::std::option::Option<&str> {
  661         -
        self.foo.as_deref()
  662         -
    }
         640  +
    EnumValue(crate::model::FooEnum),
  663    641   
    #[allow(missing_docs)] // documentation missing in model
  664         -
    pub fn nested(
         642  +
    ListValue(::std::vec::Vec<::std::string::String>),
         643  +
    #[allow(missing_docs)] // documentation missing in model
         644  +
    MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
         645  +
    #[allow(missing_docs)] // documentation missing in model
         646  +
    NumberValue(i32),
         647  +
    #[allow(missing_docs)] // documentation missing in model
         648  +
    RenamedStructureValue(crate::model::RenamedGreeting),
         649  +
    #[allow(missing_docs)] // documentation missing in model
         650  +
    StringValue(::std::string::String),
         651  +
    #[allow(missing_docs)] // documentation missing in model
         652  +
    StructureValue(crate::model::GreetingStruct),
         653  +
    #[allow(missing_docs)] // documentation missing in model
         654  +
    TimestampValue(::aws_smithy_types::DateTime),
         655  +
}
         656  +
impl MyUnion {
         657  +
    /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_types::Blob).
         658  +
    /// Returns `Err(&Self)` if it can't be converted.
         659  +
    pub fn as_blob_value(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
         660  +
        if let MyUnion::BlobValue(val) = &self {
         661  +
            ::std::result::Result::Ok(val)
         662  +
        } else {
         663  +
            ::std::result::Result::Err(self)
         664  +
        }
         665  +
    }
         666  +
    /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
         667  +
    pub fn is_blob_value(&self) -> bool {
         668  +
        self.as_blob_value().is_ok()
         669  +
    }
         670  +
    /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
         671  +
    /// Returns `Err(&Self)` if it can't be converted.
         672  +
    pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
         673  +
        if let MyUnion::BooleanValue(val) = &self {
         674  +
            ::std::result::Result::Ok(val)
         675  +
        } else {
         676  +
            ::std::result::Result::Err(self)
         677  +
        }
         678  +
    }
         679  +
    /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
         680  +
    pub fn is_boolean_value(&self) -> bool {
         681  +
        self.as_boolean_value().is_ok()
         682  +
    }
         683  +
    /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
         684  +
    /// Returns `Err(&Self)` if it can't be converted.
         685  +
    pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
         686  +
        if let MyUnion::EnumValue(val) = &self {
         687  +
            ::std::result::Result::Ok(val)
         688  +
        } else {
         689  +
            ::std::result::Result::Err(self)
         690  +
        }
         691  +
    }
         692  +
    /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
         693  +
    pub fn is_enum_value(&self) -> bool {
         694  +
        self.as_enum_value().is_ok()
         695  +
    }
         696  +
    /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
         697  +
    /// Returns `Err(&Self)` if it can't be converted.
         698  +
    pub fn as_list_value(
  665    699   
        &self,
  666         -
    ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested2> {
  667         -
        self.nested.as_deref()
         700  +
    ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
         701  +
        if let MyUnion::ListValue(val) = &self {
         702  +
            ::std::result::Result::Ok(val)
         703  +
        } else {
         704  +
            ::std::result::Result::Err(self)
         705  +
        }
  668    706   
    }
  669         -
}
  670         -
impl RecursiveShapesInputOutputNested1 {
  671         -
    /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
  672         -
    pub fn builder() -> crate::model::recursive_shapes_input_output_nested1::Builder {
  673         -
        crate::model::recursive_shapes_input_output_nested1::Builder::default()
         707  +
    /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
         708  +
    pub fn is_list_value(&self) -> bool {
         709  +
        self.as_list_value().is_ok()
         710  +
    }
         711  +
    /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
         712  +
    /// Returns `Err(&Self)` if it can't be converted.
         713  +
    pub fn as_map_value(
         714  +
        &self,
         715  +
    ) -> ::std::result::Result<
         716  +
        &::std::collections::HashMap<::std::string::String, ::std::string::String>,
         717  +
        &Self,
         718  +
    > {
         719  +
        if let MyUnion::MapValue(val) = &self {
         720  +
            ::std::result::Result::Ok(val)
         721  +
        } else {
         722  +
            ::std::result::Result::Err(self)
         723  +
        }
         724  +
    }
         725  +
    /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
         726  +
    pub fn is_map_value(&self) -> bool {
         727  +
        self.as_map_value().is_ok()
         728  +
    }
         729  +
    /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
         730  +
    /// Returns `Err(&Self)` if it can't be converted.
         731  +
    pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
         732  +
        if let MyUnion::NumberValue(val) = &self {
         733  +
            ::std::result::Result::Ok(val)
         734  +
        } else {
         735  +
            ::std::result::Result::Err(self)
         736  +
        }
         737  +
    }
         738  +
    /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
         739  +
    pub fn is_number_value(&self) -> bool {
         740  +
        self.as_number_value().is_ok()
         741  +
    }
         742  +
    /// Tries to convert the enum instance into [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue), extracting the inner [`RenamedGreeting`](crate::model::RenamedGreeting).
         743  +
    /// Returns `Err(&Self)` if it can't be converted.
         744  +
    pub fn as_renamed_structure_value(
         745  +
        &self,
         746  +
    ) -> ::std::result::Result<&crate::model::RenamedGreeting, &Self> {
         747  +
        if let MyUnion::RenamedStructureValue(val) = &self {
         748  +
            ::std::result::Result::Ok(val)
         749  +
        } else {
         750  +
            ::std::result::Result::Err(self)
         751  +
        }
         752  +
    }
         753  +
    /// Returns true if this is a [`RenamedStructureValue`](crate::model::MyUnion::RenamedStructureValue).
         754  +
    pub fn is_renamed_structure_value(&self) -> bool {
         755  +
        self.as_renamed_structure_value().is_ok()
         756  +
    }
         757  +
    /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
         758  +
    /// Returns `Err(&Self)` if it can't be converted.
         759  +
    pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
         760  +
        if let MyUnion::StringValue(val) = &self {
         761  +
            ::std::result::Result::Ok(val)
         762  +
        } else {
         763  +
            ::std::result::Result::Err(self)
         764  +
        }
         765  +
    }
         766  +
    /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
         767  +
    pub fn is_string_value(&self) -> bool {
         768  +
        self.as_string_value().is_ok()
         769  +
    }
         770  +
    /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
         771  +
    /// Returns `Err(&Self)` if it can't be converted.
         772  +
    pub fn as_structure_value(
         773  +
        &self,
         774  +
    ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
         775  +
        if let MyUnion::StructureValue(val) = &self {
         776  +
            ::std::result::Result::Ok(val)
         777  +
        } else {
         778  +
            ::std::result::Result::Err(self)
         779  +
        }
         780  +
    }
         781  +
    /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
         782  +
    pub fn is_structure_value(&self) -> bool {
         783  +
        self.as_structure_value().is_ok()
         784  +
    }
         785  +
    /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_types::DateTime).
         786  +
    /// Returns `Err(&Self)` if it can't be converted.
         787  +
    pub fn as_timestamp_value(
         788  +
        &self,
         789  +
    ) -> ::std::result::Result<&::aws_smithy_types::DateTime, &Self> {
         790  +
        if let MyUnion::TimestampValue(val) = &self {
         791  +
            ::std::result::Result::Ok(val)
         792  +
        } else {
         793  +
            ::std::result::Result::Err(self)
         794  +
        }
         795  +
    }
         796  +
    /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
         797  +
    pub fn is_timestamp_value(&self) -> bool {
         798  +
        self.as_timestamp_value().is_ok()
  674    799   
    }
  675         -
}
  676         -
impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested1 {
  677         -
    type Unconstrained = crate::model::recursive_shapes_input_output_nested1::Builder;
  678    800   
}
  679    801   
  680    802   
#[allow(missing_docs)] // documentation missing in model
  681    803   
#[derive(
  682    804   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  683    805   
)]
  684         -
pub struct RecursiveShapesInputOutputNested2 {
  685         -
    #[allow(missing_docs)] // documentation missing in model
  686         -
    pub bar: ::std::option::Option<::std::string::String>,
         806  +
pub struct RenamedGreeting {
  687    807   
    #[allow(missing_docs)] // documentation missing in model
  688         -
    pub recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
         808  +
    pub salutation: ::std::option::Option<::std::string::String>,
  689    809   
}
  690         -
impl RecursiveShapesInputOutputNested2 {
  691         -
    #[allow(missing_docs)] // documentation missing in model
  692         -
    pub fn bar(&self) -> ::std::option::Option<&str> {
  693         -
        self.bar.as_deref()
  694         -
    }
         810  +
impl RenamedGreeting {
  695    811   
    #[allow(missing_docs)] // documentation missing in model
  696         -
    pub fn recursive_member(
  697         -
        &self,
  698         -
    ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested1> {
  699         -
        self.recursive_member.as_ref()
         812  +
    pub fn salutation(&self) -> ::std::option::Option<&str> {
         813  +
        self.salutation.as_deref()
  700    814   
    }
  701    815   
}
  702         -
impl RecursiveShapesInputOutputNested2 {
  703         -
    /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
  704         -
    pub fn builder() -> crate::model::recursive_shapes_input_output_nested2::Builder {
  705         -
        crate::model::recursive_shapes_input_output_nested2::Builder::default()
         816  +
impl RenamedGreeting {
         817  +
    /// Creates a new builder-style object to manufacture [`RenamedGreeting`](crate::model::RenamedGreeting).
         818  +
    pub fn builder() -> crate::model::renamed_greeting::Builder {
         819  +
        crate::model::renamed_greeting::Builder::default()
  706    820   
    }
  707    821   
}
  708         -
impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested2 {
  709         -
    type Unconstrained = crate::model::recursive_shapes_input_output_nested2::Builder;
         822  +
impl crate::constrained::Constrained for crate::model::RenamedGreeting {
         823  +
    type Unconstrained = crate::model::renamed_greeting::Builder;
  710    824   
}
  711    825   
  712    826   
#[allow(missing_docs)] // documentation missing in model
  713         -
///
  714         -
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
  715         -
/// [constraint traits]. Use [`IntegerEnumSet::try_from`] to construct values of this type.
  716         -
///
  717         -
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
  718         -
///
  719    827   
#[derive(
  720    828   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  721    829   
)]
  722         -
pub struct IntegerEnumSet(pub(crate) ::std::vec::Vec<i32>);
  723         -
impl IntegerEnumSet {
  724         -
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<i32>`].
  725         -
    pub fn inner(&self) -> &::std::vec::Vec<i32> {
  726         -
        &self.0
         830  +
pub struct GreetingStruct {
         831  +
    #[allow(missing_docs)] // documentation missing in model
         832  +
    pub hi: ::std::option::Option<::std::string::String>,
         833  +
}
         834  +
impl GreetingStruct {
         835  +
    #[allow(missing_docs)] // documentation missing in model
         836  +
    pub fn hi(&self) -> ::std::option::Option<&str> {
         837  +
        self.hi.as_deref()
  727    838   
    }
  728         -
    /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
  729         -
    pub fn into_inner(self) -> ::std::vec::Vec<i32> {
  730         -
        self.0
         839  +
}
         840  +
impl GreetingStruct {
         841  +
    /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
         842  +
    pub fn builder() -> crate::model::greeting_struct::Builder {
         843  +
        crate::model::greeting_struct::Builder::default()
  731    844   
    }
         845  +
}
         846  +
impl crate::constrained::Constrained for crate::model::GreetingStruct {
         847  +
    type Unconstrained = crate::model::greeting_struct::Builder;
         848  +
}
  732    849   
  733         -
    fn check_unique_items(
  734         -
        items: ::std::vec::Vec<i32>,
  735         -
    ) -> Result<::std::vec::Vec<i32>, crate::model::integer_enum_set::ConstraintViolation> {
  736         -
        let mut seen = ::std::collections::HashMap::new();
  737         -
        let mut duplicate_indices = ::std::vec::Vec::new();
  738         -
        for (idx, item) in items.iter().enumerate() {
  739         -
            if let Some(prev_idx) = seen.insert(item, idx) {
  740         -
                duplicate_indices.push(prev_idx);
  741         -
            }
  742         -
        }
  743         -
  744         -
        let mut last_duplicate_indices = ::std::vec::Vec::new();
  745         -
        for idx in &duplicate_indices {
  746         -
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
  747         -
                last_duplicate_indices.push(prev_idx);
  748         -
            }
  749         -
        }
  750         -
        duplicate_indices.extend(last_duplicate_indices);
  751         -
  752         -
        if !duplicate_indices.is_empty() {
  753         -
            debug_assert!(duplicate_indices.len() >= 2);
  754         -
            Err(
  755         -
                crate::model::integer_enum_set::ConstraintViolation::UniqueItems {
  756         -
                    duplicate_indices,
  757         -
                    original: items,
  758         -
                },
         850  +
#[allow(missing_docs)] // documentation missing in model
         851  +
#[derive(
         852  +
    ::std::clone::Clone,
         853  +
    ::std::cmp::Eq,
         854  +
    ::std::cmp::Ord,
         855  +
    ::std::cmp::PartialEq,
         856  +
    ::std::cmp::PartialOrd,
         857  +
    ::std::fmt::Debug,
         858  +
    ::std::hash::Hash,
         859  +
)]
         860  +
pub enum FooEnum {
         861  +
    #[allow(missing_docs)] // documentation missing in model
         862  +
    Zero,
         863  +
    #[allow(missing_docs)] // documentation missing in model
         864  +
    One,
         865  +
    #[allow(missing_docs)] // documentation missing in model
         866  +
    Bar,
         867  +
    #[allow(missing_docs)] // documentation missing in model
         868  +
    Baz,
         869  +
    #[allow(missing_docs)] // documentation missing in model
         870  +
    Foo,
         871  +
}
         872  +
/// See [`FooEnum`](crate::model::FooEnum).
         873  +
pub mod foo_enum {
         874  +
    #[derive(Debug, PartialEq)]
         875  +
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
         876  +
         877  +
    impl ::std::fmt::Display for ConstraintViolation {
         878  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         879  +
            write!(
         880  +
                f,
         881  +
                r#"Value provided for 'aws.protocoltests.shared#FooEnum' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#
  759    882   
            )
  760         -
        } else {
  761         -
            Ok(items)
  762    883   
        }
  763    884   
    }
  764         -
}
  765         -
impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerEnumSet {
  766         -
    type Error = crate::model::integer_enum_set::ConstraintViolation;
  767         -
  768         -
    /// Constructs a `IntegerEnumSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
  769         -
    fn try_from(value: ::std::vec::Vec<i32>) -> Result<Self, Self::Error> {
  770         -
        let value = Self::check_unique_items(value)?;
  771    885   
  772         -
        Ok(Self(value))
         886  +
    impl ::std::error::Error for ConstraintViolation {}
         887  +
    impl ConstraintViolation {
         888  +
        pub(crate) fn as_validation_exception_field(
         889  +
            self,
         890  +
            path: ::std::string::String,
         891  +
        ) -> crate::model::ValidationExceptionField {
         892  +
            crate::model::ValidationExceptionField {
         893  +
                message: format!(
         894  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
         895  +
                    &path
         896  +
                ),
         897  +
                path,
         898  +
            }
         899  +
        }
  773    900   
    }
  774    901   
}
  775         -
  776         -
impl ::std::convert::From<IntegerEnumSet> for ::std::vec::Vec<i32> {
  777         -
    fn from(value: IntegerEnumSet) -> Self {
  778         -
        value.into_inner()
         902  +
impl ::std::convert::TryFrom<&str> for FooEnum {
         903  +
    type Error = crate::model::foo_enum::ConstraintViolation;
         904  +
    fn try_from(
         905  +
        s: &str,
         906  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
         907  +
        match s {
         908  +
            "0" => Ok(FooEnum::Zero),
         909  +
            "1" => Ok(FooEnum::One),
         910  +
            "Bar" => Ok(FooEnum::Bar),
         911  +
            "Baz" => Ok(FooEnum::Baz),
         912  +
            "Foo" => Ok(FooEnum::Foo),
         913  +
            _ => Err(crate::model::foo_enum::ConstraintViolation(s.to_owned())),
         914  +
        }
  779    915   
    }
  780    916   
}
  781         -
impl crate::constrained::Constrained for IntegerEnumSet {
  782         -
    type Unconstrained =
  783         -
        crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained;
         917  +
impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
         918  +
    type Error = crate::model::foo_enum::ConstraintViolation;
         919  +
    fn try_from(
         920  +
        s: ::std::string::String,
         921  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
         922  +
    {
         923  +
        s.as_str().try_into()
         924  +
    }
         925  +
}
         926  +
impl std::str::FromStr for FooEnum {
         927  +
    type Err = crate::model::foo_enum::ConstraintViolation;
         928  +
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
         929  +
        Self::try_from(s)
         930  +
    }
         931  +
}
         932  +
impl FooEnum {
         933  +
    /// Returns the `&str` value of the enum member.
         934  +
    pub fn as_str(&self) -> &str {
         935  +
        match self {
         936  +
            FooEnum::Zero => "0",
         937  +
            FooEnum::One => "1",
         938  +
            FooEnum::Bar => "Bar",
         939  +
            FooEnum::Baz => "Baz",
         940  +
            FooEnum::Foo => "Foo",
         941  +
        }
         942  +
    }
         943  +
    /// Returns all the `&str` representations of the enum members.
         944  +
    pub const fn values() -> &'static [&'static str] {
         945  +
        &["0", "1", "Bar", "Baz", "Foo"]
         946  +
    }
         947  +
}
         948  +
impl ::std::convert::AsRef<str> for FooEnum {
         949  +
    fn as_ref(&self) -> &str {
         950  +
        self.as_str()
         951  +
    }
         952  +
}
         953  +
impl crate::constrained::Constrained for FooEnum {
         954  +
    type Unconstrained = ::std::string::String;
         955  +
}
         956  +
         957  +
impl ::std::convert::From<::std::string::String>
         958  +
    for crate::constrained::MaybeConstrained<crate::model::FooEnum>
         959  +
{
         960  +
    fn from(value: ::std::string::String) -> Self {
         961  +
        Self::Unconstrained(value)
         962  +
    }
  784    963   
}
  785    964   
  786    965   
#[allow(missing_docs)] // documentation missing in model
  787    966   
///
  788    967   
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
  789         -
/// [constraint traits]. Use [`FooEnumSet::try_from`] to construct values of this type.
         968  +
/// [constraint traits]. Use [`StringSet::try_from`] to construct values of this type.
  790    969   
///
  791    970   
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
  792    971   
///
  793    972   
#[derive(
  794    973   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  795    974   
)]
  796         -
pub struct FooEnumSet(pub(crate) ::std::vec::Vec<crate::model::FooEnum>);
  797         -
impl FooEnumSet {
  798         -
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<crate::model::FooEnum>`].
  799         -
    pub fn inner(&self) -> &::std::vec::Vec<crate::model::FooEnum> {
         975  +
pub struct StringSet(pub(crate) ::std::vec::Vec<::std::string::String>);
         976  +
impl StringSet {
         977  +
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::string::String>`].
         978  +
    pub fn inner(&self) -> &::std::vec::Vec<::std::string::String> {
  800    979   
        &self.0
  801    980   
    }
  802         -
    /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::FooEnum>`].
  803         -
    pub fn into_inner(self) -> ::std::vec::Vec<crate::model::FooEnum> {
         981  +
    /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::string::String>`].
         982  +
    pub fn into_inner(self) -> ::std::vec::Vec<::std::string::String> {
  804    983   
        self.0
  805    984   
    }
  806    985   
  807    986   
    fn check_unique_items(
  808         -
        items: ::std::vec::Vec<crate::model::FooEnum>,
  809         -
    ) -> Result<
  810         -
        ::std::vec::Vec<crate::model::FooEnum>,
  811         -
        crate::model::foo_enum_set::ConstraintViolation,
  812         -
    > {
         987  +
        items: ::std::vec::Vec<::std::string::String>,
         988  +
    ) -> Result<::std::vec::Vec<::std::string::String>, crate::model::string_set::ConstraintViolation>
         989  +
    {
  813    990   
        let mut seen = ::std::collections::HashMap::new();
  814    991   
        let mut duplicate_indices = ::std::vec::Vec::new();
  815    992   
        for (idx, item) in items.iter().enumerate() {
  816    993   
            if let Some(prev_idx) = seen.insert(item, idx) {
  817    994   
                duplicate_indices.push(prev_idx);
  818    995   
            }
  819    996   
        }
  820    997   
  821    998   
        let mut last_duplicate_indices = ::std::vec::Vec::new();
  822    999   
        for idx in &duplicate_indices {
  823   1000   
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
  824   1001   
                last_duplicate_indices.push(prev_idx);
  825   1002   
            }
  826   1003   
        }
  827   1004   
        duplicate_indices.extend(last_duplicate_indices);
  828   1005   
  829   1006   
        if !duplicate_indices.is_empty() {
  830   1007   
            debug_assert!(duplicate_indices.len() >= 2);
  831         -
            Err(
  832         -
                crate::model::foo_enum_set::ConstraintViolation::UniqueItems {
  833         -
                    duplicate_indices,
  834         -
                    original: items,
  835         -
                },
  836         -
            )
        1008  +
            Err(crate::model::string_set::ConstraintViolation::UniqueItems {
        1009  +
                duplicate_indices,
        1010  +
                original: items,
        1011  +
            })
  837   1012   
        } else {
  838   1013   
            Ok(items)
  839   1014   
        }
  840   1015   
    }
  841   1016   
}
  842         -
impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::FooEnum>> for FooEnumSet {
  843         -
    type Error = crate::model::foo_enum_set::ConstraintViolation;
        1017  +
impl ::std::convert::TryFrom<::std::vec::Vec<::std::string::String>> for StringSet {
        1018  +
    type Error = crate::model::string_set::ConstraintViolation;
  844   1019   
  845         -
    /// Constructs a `FooEnumSet` from an [`::std::vec::Vec<crate::model::FooEnum>`], failing when the provided value does not satisfy the modeled constraints.
  846         -
    fn try_from(value: ::std::vec::Vec<crate::model::FooEnum>) -> Result<Self, Self::Error> {
        1020  +
    /// Constructs a `StringSet` from an [`::std::vec::Vec<::std::string::String>`], failing when the provided value does not satisfy the modeled constraints.
        1021  +
    fn try_from(value: ::std::vec::Vec<::std::string::String>) -> Result<Self, Self::Error> {
  847   1022   
        let value = Self::check_unique_items(value)?;
  848   1023   
  849   1024   
        Ok(Self(value))
  850   1025   
    }
  851   1026   
}
  852   1027   
  853         -
impl ::std::convert::From<FooEnumSet> for ::std::vec::Vec<crate::model::FooEnum> {
  854         -
    fn from(value: FooEnumSet) -> Self {
        1028  +
impl ::std::convert::From<StringSet> for ::std::vec::Vec<::std::string::String> {
        1029  +
    fn from(value: StringSet) -> Self {
  855   1030   
        value.into_inner()
  856   1031   
    }
  857   1032   
}
  858         -
impl crate::constrained::Constrained for FooEnumSet {
  859         -
    type Unconstrained = crate::unconstrained::foo_enum_set_unconstrained::FooEnumSetUnconstrained;
        1033  +
impl crate::constrained::Constrained for StringSet {
        1034  +
    type Unconstrained = crate::unconstrained::string_set_unconstrained::StringSetUnconstrained;
  860   1035   
}
  861   1036   
  862   1037   
#[allow(missing_docs)] // documentation missing in model
  863   1038   
#[derive(
  864   1039   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  865   1040   
)]
  866         -
pub struct ComplexNestedErrorData {
        1041  +
pub struct StructureListMember {
  867   1042   
    #[allow(missing_docs)] // documentation missing in model
  868         -
    pub foo: ::std::option::Option<::std::string::String>,
        1043  +
    pub a: ::std::option::Option<::std::string::String>,
        1044  +
    #[allow(missing_docs)] // documentation missing in model
        1045  +
    pub b: ::std::option::Option<::std::string::String>,
  869   1046   
}
  870         -
impl ComplexNestedErrorData {
        1047  +
impl StructureListMember {
  871   1048   
    #[allow(missing_docs)] // documentation missing in model
  872         -
    pub fn foo(&self) -> ::std::option::Option<&str> {
  873         -
        self.foo.as_deref()
        1049  +
    pub fn a(&self) -> ::std::option::Option<&str> {
        1050  +
        self.a.as_deref()
        1051  +
    }
        1052  +
    #[allow(missing_docs)] // documentation missing in model
        1053  +
    pub fn b(&self) -> ::std::option::Option<&str> {
        1054  +
        self.b.as_deref()
  874   1055   
    }
  875   1056   
}
  876         -
impl ComplexNestedErrorData {
  877         -
    /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
  878         -
    pub fn builder() -> crate::model::complex_nested_error_data::Builder {
  879         -
        crate::model::complex_nested_error_data::Builder::default()
        1057  +
impl StructureListMember {
        1058  +
    /// Creates a new builder-style object to manufacture [`StructureListMember`](crate::model::StructureListMember).
        1059  +
    pub fn builder() -> crate::model::structure_list_member::Builder {
        1060  +
        crate::model::structure_list_member::Builder::default()
  880   1061   
    }
  881   1062   
}
        1063  +
impl crate::constrained::Constrained for crate::model::StructureListMember {
        1064  +
    type Unconstrained = crate::model::structure_list_member::Builder;
        1065  +
}
  882   1066   
  883   1067   
#[allow(missing_docs)] // documentation missing in model
  884   1068   
#[derive(
  885   1069   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  886   1070   
)]
  887         -
pub enum UnionPayload {
        1071  +
pub struct RecursiveShapesInputOutputNested1 {
  888   1072   
    #[allow(missing_docs)] // documentation missing in model
  889         -
    Greeting(::std::string::String),
        1073  +
    pub foo: ::std::option::Option<::std::string::String>,
        1074  +
    #[allow(missing_docs)] // documentation missing in model
        1075  +
    pub nested:
        1076  +
        ::std::option::Option<::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>>,
  890   1077   
}
  891         -
impl UnionPayload {
  892         -
    #[allow(irrefutable_let_patterns)]
  893         -
    /// Tries to convert the enum instance into [`Greeting`](crate::model::UnionPayload::Greeting), extracting the inner [`String`](::std::string::String).
  894         -
    /// Returns `Err(&Self)` if it can't be converted.
  895         -
    pub fn as_greeting(&self) -> ::std::result::Result<&::std::string::String, &Self> {
  896         -
        if let UnionPayload::Greeting(val) = &self {
  897         -
            ::std::result::Result::Ok(val)
  898         -
        } else {
  899         -
            ::std::result::Result::Err(self)
  900         -
        }
        1078  +
impl RecursiveShapesInputOutputNested1 {
        1079  +
    #[allow(missing_docs)] // documentation missing in model
        1080  +
    pub fn foo(&self) -> ::std::option::Option<&str> {
        1081  +
        self.foo.as_deref()
  901   1082   
    }
  902         -
    /// Returns true if this is a [`Greeting`](crate::model::UnionPayload::Greeting).
  903         -
    pub fn is_greeting(&self) -> bool {
  904         -
        self.as_greeting().is_ok()
        1083  +
    #[allow(missing_docs)] // documentation missing in model
        1084  +
    pub fn nested(
        1085  +
        &self,
        1086  +
    ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested2> {
        1087  +
        self.nested.as_deref()
        1088  +
    }
        1089  +
}
        1090  +
impl RecursiveShapesInputOutputNested1 {
        1091  +
    /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
        1092  +
    pub fn builder() -> crate::model::recursive_shapes_input_output_nested1::Builder {
        1093  +
        crate::model::recursive_shapes_input_output_nested1::Builder::default()
  905   1094   
    }
  906   1095   
}
        1096  +
impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested1 {
        1097  +
    type Unconstrained = crate::model::recursive_shapes_input_output_nested1::Builder;
        1098  +
}
  907   1099   
  908   1100   
#[allow(missing_docs)] // documentation missing in model
  909   1101   
#[derive(
  910         -
    ::std::clone::Clone,
  911         -
    ::std::cmp::Eq,
  912         -
    ::std::cmp::Ord,
  913         -
    ::std::cmp::PartialEq,
  914         -
    ::std::cmp::PartialOrd,
  915         -
    ::std::fmt::Debug,
  916         -
    ::std::hash::Hash,
        1102  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  917   1103   
)]
  918         -
pub enum StringEnum {
        1104  +
pub struct RecursiveShapesInputOutputNested2 {
  919   1105   
    #[allow(missing_docs)] // documentation missing in model
  920         -
    V,
        1106  +
    pub bar: ::std::option::Option<::std::string::String>,
        1107  +
    #[allow(missing_docs)] // documentation missing in model
        1108  +
    pub recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
  921   1109   
}
  922         -
/// See [`StringEnum`](crate::model::StringEnum).
  923         -
pub mod string_enum {
  924         -
    #[derive(Debug, PartialEq)]
  925         -
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
  926         -
  927         -
    impl ::std::fmt::Display for ConstraintViolation {
        1110  +
impl RecursiveShapesInputOutputNested2 {
        1111  +
    #[allow(missing_docs)] // documentation missing in model
        1112  +
    pub fn bar(&self) -> ::std::option::Option<&str> {
        1113  +
        self.bar.as_deref()
        1114  +
    }
        1115  +
    #[allow(missing_docs)] // documentation missing in model
        1116  +
    pub fn recursive_member(
        1117  +
        &self,
        1118  +
    ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested1> {
        1119  +
        self.recursive_member.as_ref()
        1120  +
    }
        1121  +
}
        1122  +
impl RecursiveShapesInputOutputNested2 {
        1123  +
    /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
        1124  +
    pub fn builder() -> crate::model::recursive_shapes_input_output_nested2::Builder {
        1125  +
        crate::model::recursive_shapes_input_output_nested2::Builder::default()
        1126  +
    }
        1127  +
}
        1128  +
impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested2 {
        1129  +
    type Unconstrained = crate::model::recursive_shapes_input_output_nested2::Builder;
        1130  +
}
        1131  +
        1132  +
#[allow(missing_docs)] // documentation missing in model
        1133  +
///
        1134  +
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
        1135  +
/// [constraint traits]. Use [`IntegerEnumSet::try_from`] to construct values of this type.
        1136  +
///
        1137  +
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
        1138  +
///
        1139  +
#[derive(
        1140  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
        1141  +
)]
        1142  +
pub struct IntegerEnumSet(pub(crate) ::std::vec::Vec<i32>);
        1143  +
impl IntegerEnumSet {
        1144  +
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<i32>`].
        1145  +
    pub fn inner(&self) -> &::std::vec::Vec<i32> {
        1146  +
        &self.0
        1147  +
    }
        1148  +
    /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
        1149  +
    pub fn into_inner(self) -> ::std::vec::Vec<i32> {
        1150  +
        self.0
        1151  +
    }
        1152  +
        1153  +
    fn check_unique_items(
        1154  +
        items: ::std::vec::Vec<i32>,
        1155  +
    ) -> Result<::std::vec::Vec<i32>, crate::model::integer_enum_set::ConstraintViolation> {
        1156  +
        let mut seen = ::std::collections::HashMap::new();
        1157  +
        let mut duplicate_indices = ::std::vec::Vec::new();
        1158  +
        for (idx, item) in items.iter().enumerate() {
        1159  +
            if let Some(prev_idx) = seen.insert(item, idx) {
        1160  +
                duplicate_indices.push(prev_idx);
        1161  +
            }
        1162  +
        }
        1163  +
        1164  +
        let mut last_duplicate_indices = ::std::vec::Vec::new();
        1165  +
        for idx in &duplicate_indices {
        1166  +
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
        1167  +
                last_duplicate_indices.push(prev_idx);
        1168  +
            }
        1169  +
        }
        1170  +
        duplicate_indices.extend(last_duplicate_indices);
        1171  +
        1172  +
        if !duplicate_indices.is_empty() {
        1173  +
            debug_assert!(duplicate_indices.len() >= 2);
        1174  +
            Err(
        1175  +
                crate::model::integer_enum_set::ConstraintViolation::UniqueItems {
        1176  +
                    duplicate_indices,
        1177  +
                    original: items,
        1178  +
                },
        1179  +
            )
        1180  +
        } else {
        1181  +
            Ok(items)
        1182  +
        }
        1183  +
    }
        1184  +
}
        1185  +
impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerEnumSet {
        1186  +
    type Error = crate::model::integer_enum_set::ConstraintViolation;
        1187  +
        1188  +
    /// Constructs a `IntegerEnumSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
        1189  +
    fn try_from(value: ::std::vec::Vec<i32>) -> Result<Self, Self::Error> {
        1190  +
        let value = Self::check_unique_items(value)?;
        1191  +
        1192  +
        Ok(Self(value))
        1193  +
    }
        1194  +
}
        1195  +
        1196  +
impl ::std::convert::From<IntegerEnumSet> for ::std::vec::Vec<i32> {
        1197  +
    fn from(value: IntegerEnumSet) -> Self {
        1198  +
        value.into_inner()
        1199  +
    }
        1200  +
}
        1201  +
impl crate::constrained::Constrained for IntegerEnumSet {
        1202  +
    type Unconstrained =
        1203  +
        crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained;
        1204  +
}
        1205  +
        1206  +
#[allow(missing_docs)] // documentation missing in model
        1207  +
///
        1208  +
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
        1209  +
/// [constraint traits]. Use [`FooEnumSet::try_from`] to construct values of this type.
        1210  +
///
        1211  +
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
        1212  +
///
        1213  +
#[derive(
        1214  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
        1215  +
)]
        1216  +
pub struct FooEnumSet(pub(crate) ::std::vec::Vec<crate::model::FooEnum>);
        1217  +
impl FooEnumSet {
        1218  +
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<crate::model::FooEnum>`].
        1219  +
    pub fn inner(&self) -> &::std::vec::Vec<crate::model::FooEnum> {
        1220  +
        &self.0
        1221  +
    }
        1222  +
    /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::FooEnum>`].
        1223  +
    pub fn into_inner(self) -> ::std::vec::Vec<crate::model::FooEnum> {
        1224  +
        self.0
        1225  +
    }
        1226  +
        1227  +
    fn check_unique_items(
        1228  +
        items: ::std::vec::Vec<crate::model::FooEnum>,
        1229  +
    ) -> Result<
        1230  +
        ::std::vec::Vec<crate::model::FooEnum>,
        1231  +
        crate::model::foo_enum_set::ConstraintViolation,
        1232  +
    > {
        1233  +
        let mut seen = ::std::collections::HashMap::new();
        1234  +
        let mut duplicate_indices = ::std::vec::Vec::new();
        1235  +
        for (idx, item) in items.iter().enumerate() {
        1236  +
            if let Some(prev_idx) = seen.insert(item, idx) {
        1237  +
                duplicate_indices.push(prev_idx);
        1238  +
            }
        1239  +
        }
        1240  +
        1241  +
        let mut last_duplicate_indices = ::std::vec::Vec::new();
        1242  +
        for idx in &duplicate_indices {
        1243  +
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
        1244  +
                last_duplicate_indices.push(prev_idx);
        1245  +
            }
        1246  +
        }
        1247  +
        duplicate_indices.extend(last_duplicate_indices);
        1248  +
        1249  +
        if !duplicate_indices.is_empty() {
        1250  +
            debug_assert!(duplicate_indices.len() >= 2);
        1251  +
            Err(
        1252  +
                crate::model::foo_enum_set::ConstraintViolation::UniqueItems {
        1253  +
                    duplicate_indices,
        1254  +
                    original: items,
        1255  +
                },
        1256  +
            )
        1257  +
        } else {
        1258  +
            Ok(items)
        1259  +
        }
        1260  +
    }
        1261  +
}
        1262  +
impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::FooEnum>> for FooEnumSet {
        1263  +
    type Error = crate::model::foo_enum_set::ConstraintViolation;
        1264  +
        1265  +
    /// Constructs a `FooEnumSet` from an [`::std::vec::Vec<crate::model::FooEnum>`], failing when the provided value does not satisfy the modeled constraints.
        1266  +
    fn try_from(value: ::std::vec::Vec<crate::model::FooEnum>) -> Result<Self, Self::Error> {
        1267  +
        let value = Self::check_unique_items(value)?;
        1268  +
        1269  +
        Ok(Self(value))
        1270  +
    }
        1271  +
}
        1272  +
        1273  +
impl ::std::convert::From<FooEnumSet> for ::std::vec::Vec<crate::model::FooEnum> {
        1274  +
    fn from(value: FooEnumSet) -> Self {
        1275  +
        value.into_inner()
        1276  +
    }
        1277  +
}
        1278  +
impl crate::constrained::Constrained for FooEnumSet {
        1279  +
    type Unconstrained = crate::unconstrained::foo_enum_set_unconstrained::FooEnumSetUnconstrained;
        1280  +
}
        1281  +
        1282  +
#[allow(missing_docs)] // documentation missing in model
        1283  +
#[derive(
        1284  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
        1285  +
)]
        1286  +
pub struct ComplexNestedErrorData {
        1287  +
    #[allow(missing_docs)] // documentation missing in model
        1288  +
    pub foo: ::std::option::Option<::std::string::String>,
        1289  +
}
        1290  +
impl ComplexNestedErrorData {
        1291  +
    #[allow(missing_docs)] // documentation missing in model
        1292  +
    pub fn foo(&self) -> ::std::option::Option<&str> {
        1293  +
        self.foo.as_deref()
        1294  +
    }
        1295  +
}
        1296  +
impl ComplexNestedErrorData {
        1297  +
    /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
        1298  +
    pub fn builder() -> crate::model::complex_nested_error_data::Builder {
        1299  +
        crate::model::complex_nested_error_data::Builder::default()
        1300  +
    }
        1301  +
}
        1302  +
        1303  +
#[allow(missing_docs)] // documentation missing in model
        1304  +
#[derive(
        1305  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
        1306  +
)]
        1307  +
pub enum UnionPayload {
        1308  +
    #[allow(missing_docs)] // documentation missing in model
        1309  +
    Greeting(::std::string::String),
        1310  +
}
        1311  +
impl UnionPayload {
        1312  +
    #[allow(irrefutable_let_patterns)]
        1313  +
    /// Tries to convert the enum instance into [`Greeting`](crate::model::UnionPayload::Greeting), extracting the inner [`String`](::std::string::String).
        1314  +
    /// Returns `Err(&Self)` if it can't be converted.
        1315  +
    pub fn as_greeting(&self) -> ::std::result::Result<&::std::string::String, &Self> {
        1316  +
        if let UnionPayload::Greeting(val) = &self {
        1317  +
            ::std::result::Result::Ok(val)
        1318  +
        } else {
        1319  +
            ::std::result::Result::Err(self)
        1320  +
        }
        1321  +
    }
        1322  +
    /// Returns true if this is a [`Greeting`](crate::model::UnionPayload::Greeting).
        1323  +
    pub fn is_greeting(&self) -> bool {
        1324  +
        self.as_greeting().is_ok()
        1325  +
    }
        1326  +
}
        1327  +
        1328  +
#[allow(missing_docs)] // documentation missing in model
        1329  +
#[derive(
        1330  +
    ::std::clone::Clone,
        1331  +
    ::std::cmp::Eq,
        1332  +
    ::std::cmp::Ord,
        1333  +
    ::std::cmp::PartialEq,
        1334  +
    ::std::cmp::PartialOrd,
        1335  +
    ::std::fmt::Debug,
        1336  +
    ::std::hash::Hash,
        1337  +
)]
        1338  +
pub enum StringEnum {
        1339  +
    #[allow(missing_docs)] // documentation missing in model
        1340  +
    V,
        1341  +
}
        1342  +
/// See [`StringEnum`](crate::model::StringEnum).
        1343  +
pub mod string_enum {
        1344  +
    #[derive(Debug, PartialEq)]
        1345  +
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
        1346  +
        1347  +
    impl ::std::fmt::Display for ConstraintViolation {
  928   1348   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  929   1349   
            write!(
  930   1350   
                f,
  931   1351   
                r#"Value provided for 'aws.protocoltests.restjson#StringEnum' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#
  932   1352   
            )
  933   1353   
        }
  934   1354   
    }
  935   1355   
  936   1356   
    impl ::std::error::Error for ConstraintViolation {}
  937   1357   
    impl ConstraintViolation {
  938   1358   
        pub(crate) fn as_validation_exception_field(
  939   1359   
            self,
  940   1360   
            path: ::std::string::String,
  941   1361   
        ) -> crate::model::ValidationExceptionField {
  942   1362   
            crate::model::ValidationExceptionField {
  943   1363   
                message: format!(
  944   1364   
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [enumvalue]"#,
  945   1365   
                    &path
  946   1366   
                ),
  947   1367   
                path,
  948   1368   
            }
  949   1369   
        }
  950         -
    }
  951         -
}
  952         -
impl ::std::convert::TryFrom<&str> for StringEnum {
  953         -
    type Error = crate::model::string_enum::ConstraintViolation;
  954         -
    fn try_from(
  955         -
        s: &str,
  956         -
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  957         -
        match s {
  958         -
            "enumvalue" => Ok(StringEnum::V),
  959         -
            _ => Err(crate::model::string_enum::ConstraintViolation(s.to_owned())),
        1370  +
    }
        1371  +
}
        1372  +
impl ::std::convert::TryFrom<&str> for StringEnum {
        1373  +
    type Error = crate::model::string_enum::ConstraintViolation;
        1374  +
    fn try_from(
        1375  +
        s: &str,
        1376  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
        1377  +
        match s {
        1378  +
            "enumvalue" => Ok(StringEnum::V),
        1379  +
            _ => Err(crate::model::string_enum::ConstraintViolation(s.to_owned())),
        1380  +
        }
        1381  +
    }
        1382  +
}
        1383  +
impl ::std::convert::TryFrom<::std::string::String> for StringEnum {
        1384  +
    type Error = crate::model::string_enum::ConstraintViolation;
        1385  +
    fn try_from(
        1386  +
        s: ::std::string::String,
        1387  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
        1388  +
    {
        1389  +
        s.as_str().try_into()
        1390  +
    }
        1391  +
}
        1392  +
impl std::str::FromStr for StringEnum {
        1393  +
    type Err = crate::model::string_enum::ConstraintViolation;
        1394  +
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
        1395  +
        Self::try_from(s)
        1396  +
    }
        1397  +
}
        1398  +
impl StringEnum {
        1399  +
    /// Returns the `&str` value of the enum member.
        1400  +
    pub fn as_str(&self) -> &str {
        1401  +
        match self {
        1402  +
            StringEnum::V => "enumvalue",
        1403  +
        }
        1404  +
    }
        1405  +
    /// Returns all the `&str` representations of the enum members.
        1406  +
    pub const fn values() -> &'static [&'static str] {
        1407  +
        &["enumvalue"]
        1408  +
    }
        1409  +
}
        1410  +
impl ::std::convert::AsRef<str> for StringEnum {
        1411  +
    fn as_ref(&self) -> &str {
        1412  +
        self.as_str()
        1413  +
    }
        1414  +
}
        1415  +
impl crate::constrained::Constrained for StringEnum {
        1416  +
    type Unconstrained = ::std::string::String;
        1417  +
}
        1418  +
        1419  +
impl ::std::convert::From<::std::string::String>
        1420  +
    for crate::constrained::MaybeConstrained<crate::model::StringEnum>
        1421  +
{
        1422  +
    fn from(value: ::std::string::String) -> Self {
        1423  +
        Self::Unconstrained(value)
        1424  +
    }
        1425  +
}
        1426  +
        1427  +
#[allow(missing_docs)] // documentation missing in model
        1428  +
#[derive(
        1429  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
        1430  +
)]
        1431  +
pub struct NestedPayload {
        1432  +
    #[allow(missing_docs)] // documentation missing in model
        1433  +
    pub greeting: ::std::option::Option<::std::string::String>,
        1434  +
    #[allow(missing_docs)] // documentation missing in model
        1435  +
    pub name: ::std::option::Option<::std::string::String>,
        1436  +
}
        1437  +
impl NestedPayload {
        1438  +
    #[allow(missing_docs)] // documentation missing in model
        1439  +
    pub fn greeting(&self) -> ::std::option::Option<&str> {
        1440  +
        self.greeting.as_deref()
        1441  +
    }
        1442  +
    #[allow(missing_docs)] // documentation missing in model
        1443  +
    pub fn name(&self) -> ::std::option::Option<&str> {
        1444  +
        self.name.as_deref()
        1445  +
    }
        1446  +
}
        1447  +
impl NestedPayload {
        1448  +
    /// Creates a new builder-style object to manufacture [`NestedPayload`](crate::model::NestedPayload).
        1449  +
    pub fn builder() -> crate::model::nested_payload::Builder {
        1450  +
        crate::model::nested_payload::Builder::default()
        1451  +
    }
        1452  +
}
        1453  +
impl crate::constrained::Constrained for crate::model::NestedPayload {
        1454  +
    type Unconstrained = crate::model::nested_payload::Builder;
        1455  +
}
        1456  +
        1457  +
#[allow(missing_docs)] // documentation missing in model
        1458  +
///
        1459  +
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
        1460  +
/// [constraint traits]. Use [`IntegerSet::try_from`] to construct values of this type.
        1461  +
///
        1462  +
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
        1463  +
///
        1464  +
#[derive(
        1465  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
        1466  +
)]
        1467  +
pub struct IntegerSet(pub(crate) ::std::vec::Vec<i32>);
        1468  +
impl IntegerSet {
        1469  +
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<i32>`].
        1470  +
    pub fn inner(&self) -> &::std::vec::Vec<i32> {
        1471  +
        &self.0
        1472  +
    }
        1473  +
    /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
        1474  +
    pub fn into_inner(self) -> ::std::vec::Vec<i32> {
        1475  +
        self.0
        1476  +
    }
        1477  +
        1478  +
    fn check_unique_items(
        1479  +
        items: ::std::vec::Vec<i32>,
        1480  +
    ) -> Result<::std::vec::Vec<i32>, crate::model::integer_set::ConstraintViolation> {
        1481  +
        let mut seen = ::std::collections::HashMap::new();
        1482  +
        let mut duplicate_indices = ::std::vec::Vec::new();
        1483  +
        for (idx, item) in items.iter().enumerate() {
        1484  +
            if let Some(prev_idx) = seen.insert(item, idx) {
        1485  +
                duplicate_indices.push(prev_idx);
        1486  +
            }
        1487  +
        }
        1488  +
        1489  +
        let mut last_duplicate_indices = ::std::vec::Vec::new();
        1490  +
        for idx in &duplicate_indices {
        1491  +
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
        1492  +
                last_duplicate_indices.push(prev_idx);
        1493  +
            }
        1494  +
        }
        1495  +
        duplicate_indices.extend(last_duplicate_indices);
        1496  +
        1497  +
        if !duplicate_indices.is_empty() {
        1498  +
            debug_assert!(duplicate_indices.len() >= 2);
        1499  +
            Err(
        1500  +
                crate::model::integer_set::ConstraintViolation::UniqueItems {
        1501  +
                    duplicate_indices,
        1502  +
                    original: items,
        1503  +
                },
        1504  +
            )
        1505  +
        } else {
        1506  +
            Ok(items)
        1507  +
        }
        1508  +
    }
        1509  +
}
        1510  +
impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerSet {
        1511  +
    type Error = crate::model::integer_set::ConstraintViolation;
        1512  +
        1513  +
    /// Constructs a `IntegerSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
        1514  +
    fn try_from(value: ::std::vec::Vec<i32>) -> Result<Self, Self::Error> {
        1515  +
        let value = Self::check_unique_items(value)?;
        1516  +
        1517  +
        Ok(Self(value))
        1518  +
    }
        1519  +
}
        1520  +
        1521  +
impl ::std::convert::From<IntegerSet> for ::std::vec::Vec<i32> {
        1522  +
    fn from(value: IntegerSet) -> Self {
        1523  +
        value.into_inner()
        1524  +
    }
        1525  +
}
        1526  +
impl crate::constrained::Constrained for IntegerSet {
        1527  +
    type Unconstrained = crate::unconstrained::integer_set_unconstrained::IntegerSetUnconstrained;
        1528  +
}
        1529  +
        1530  +
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
        1531  +
///
        1532  +
pub mod validation_exception_field {
        1533  +
        1534  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        1535  +
    /// Holds one variant for each of the ways the builder can fail.
        1536  +
    #[non_exhaustive]
        1537  +
    #[allow(clippy::enum_variant_names)]
        1538  +
    pub enum ConstraintViolation {
        1539  +
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
        1540  +
        MissingPath,
        1541  +
        /// `message` was not provided but it is required when building `ValidationExceptionField`.
        1542  +
        MissingMessage,
        1543  +
    }
        1544  +
    impl ::std::fmt::Display for ConstraintViolation {
        1545  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1546  +
            match self {
        1547  +
                ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
        1548  +
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
        1549  +
            }
        1550  +
        }
        1551  +
    }
        1552  +
    impl ::std::error::Error for ConstraintViolation {}
        1553  +
    impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
        1554  +
        type Error = ConstraintViolation;
        1555  +
        1556  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        1557  +
            builder.build()
        1558  +
        }
        1559  +
    }
        1560  +
    /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
        1561  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1562  +
    pub struct Builder {
        1563  +
        pub(crate) path: ::std::option::Option<::std::string::String>,
        1564  +
        pub(crate) message: ::std::option::Option<::std::string::String>,
        1565  +
    }
        1566  +
    impl Builder {
        1567  +
        /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
        1568  +
        pub fn path(mut self, input: ::std::string::String) -> Self {
        1569  +
            self.path = Some(input);
        1570  +
            self
        1571  +
        }
        1572  +
        /// A detailed description of the validation failure.
        1573  +
        pub fn message(mut self, input: ::std::string::String) -> Self {
        1574  +
            self.message = Some(input);
        1575  +
            self
        1576  +
        }
        1577  +
        /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
        1578  +
        ///
        1579  +
        /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
        1580  +
        ///
        1581  +
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
        1582  +
        pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
        1583  +
            self.build_enforcing_all_constraints()
        1584  +
        }
        1585  +
        fn build_enforcing_all_constraints(
        1586  +
            self,
        1587  +
        ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
        1588  +
            Ok(crate::model::ValidationExceptionField {
        1589  +
                path: self.path.ok_or(ConstraintViolation::MissingPath)?,
        1590  +
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
        1591  +
            })
        1592  +
        }
        1593  +
    }
        1594  +
}
        1595  +
/// See [`Dialog`](crate::model::Dialog).
        1596  +
///
        1597  +
pub mod dialog {
        1598  +
        1599  +
    impl ::std::convert::From<Builder> for crate::model::Dialog {
        1600  +
        fn from(builder: Builder) -> Self {
        1601  +
            builder.build()
        1602  +
        }
        1603  +
    }
        1604  +
    /// A builder for [`Dialog`](crate::model::Dialog).
        1605  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1606  +
    pub struct Builder {
        1607  +
        pub(crate) language: ::std::option::Option<::std::string::String>,
        1608  +
        pub(crate) greeting: ::std::option::Option<::std::string::String>,
        1609  +
        pub(crate) farewell: ::std::option::Option<crate::model::Farewell>,
        1610  +
    }
        1611  +
    impl Builder {
        1612  +
        #[allow(missing_docs)] // documentation missing in model
        1613  +
        pub fn language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        1614  +
            self.language = input;
        1615  +
            self
        1616  +
        }
        1617  +
        #[allow(missing_docs)] // documentation missing in model
        1618  +
        pub(crate) fn set_language(
        1619  +
            mut self,
        1620  +
            input: Option<impl ::std::convert::Into<::std::string::String>>,
        1621  +
        ) -> Self {
        1622  +
            self.language = input.map(|v| v.into());
        1623  +
            self
        1624  +
        }
        1625  +
        #[allow(missing_docs)] // documentation missing in model
        1626  +
        pub fn greeting(mut self, input: ::std::string::String) -> Self {
        1627  +
            self.greeting = Some(input);
        1628  +
            self
        1629  +
        }
        1630  +
        #[allow(missing_docs)] // documentation missing in model
        1631  +
        pub(crate) fn set_greeting(
        1632  +
            mut self,
        1633  +
            input: impl ::std::convert::Into<::std::string::String>,
        1634  +
        ) -> Self {
        1635  +
            self.greeting = Some(input.into());
        1636  +
            self
        1637  +
        }
        1638  +
        #[allow(missing_docs)] // documentation missing in model
        1639  +
        pub fn farewell(mut self, input: ::std::option::Option<crate::model::Farewell>) -> Self {
        1640  +
            self.farewell = input;
        1641  +
            self
        1642  +
        }
        1643  +
        #[allow(missing_docs)] // documentation missing in model
        1644  +
        pub(crate) fn set_farewell(
        1645  +
            mut self,
        1646  +
            input: Option<impl ::std::convert::Into<crate::model::Farewell>>,
        1647  +
        ) -> Self {
        1648  +
            self.farewell = input.map(|v| v.into());
        1649  +
            self
        1650  +
        }
        1651  +
        /// Consumes the builder and constructs a [`Dialog`](crate::model::Dialog).
        1652  +
        pub fn build(self) -> crate::model::Dialog {
        1653  +
            self.build_enforcing_all_constraints()
        1654  +
        }
        1655  +
        fn build_enforcing_all_constraints(self) -> crate::model::Dialog {
        1656  +
            crate::model::Dialog {
        1657  +
                language: self.language,
        1658  +
                greeting: self.greeting.unwrap_or_else(
        1659  +
                    #[allow(clippy::redundant_closure)]
        1660  +
                    || String::from("hi"),
        1661  +
                ),
        1662  +
                farewell: self.farewell,
        1663  +
            }
        1664  +
        }
        1665  +
    }
        1666  +
}
        1667  +
/// See [`Farewell`](crate::model::Farewell).
        1668  +
///
        1669  +
pub mod farewell {
        1670  +
        1671  +
    impl ::std::convert::From<Builder> for crate::model::Farewell {
        1672  +
        fn from(builder: Builder) -> Self {
        1673  +
            builder.build()
        1674  +
        }
        1675  +
    }
        1676  +
    /// A builder for [`Farewell`](crate::model::Farewell).
        1677  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1678  +
    pub struct Builder {
        1679  +
        pub(crate) phrase: ::std::option::Option<::std::string::String>,
        1680  +
    }
        1681  +
    impl Builder {
        1682  +
        #[allow(missing_docs)] // documentation missing in model
        1683  +
        pub fn phrase(mut self, input: ::std::string::String) -> Self {
        1684  +
            self.phrase = Some(input);
        1685  +
            self
        1686  +
        }
        1687  +
        #[allow(missing_docs)] // documentation missing in model
        1688  +
        pub(crate) fn set_phrase(
        1689  +
            mut self,
        1690  +
            input: impl ::std::convert::Into<::std::string::String>,
        1691  +
        ) -> Self {
        1692  +
            self.phrase = Some(input.into());
        1693  +
            self
        1694  +
        }
        1695  +
        /// Consumes the builder and constructs a [`Farewell`](crate::model::Farewell).
        1696  +
        pub fn build(self) -> crate::model::Farewell {
        1697  +
            self.build_enforcing_all_constraints()
        1698  +
        }
        1699  +
        fn build_enforcing_all_constraints(self) -> crate::model::Farewell {
        1700  +
            crate::model::Farewell {
        1701  +
                phrase: self.phrase.unwrap_or_else(
        1702  +
                    #[allow(clippy::redundant_closure)]
        1703  +
                    || String::from("bye"),
        1704  +
                ),
        1705  +
            }
        1706  +
        }
        1707  +
    }
        1708  +
}
        1709  +
/// See [`TopLevel`](crate::model::TopLevel).
        1710  +
///
        1711  +
pub mod top_level {
        1712  +
        1713  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        1714  +
    /// Holds one variant for each of the ways the builder can fail.
        1715  +
    #[non_exhaustive]
        1716  +
    #[allow(clippy::enum_variant_names)]
        1717  +
    pub enum ConstraintViolation {
        1718  +
        /// `dialog` was not provided but it is required when building `TopLevel`.
        1719  +
        MissingDialog,
        1720  +
    }
        1721  +
    impl ::std::fmt::Display for ConstraintViolation {
        1722  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1723  +
            match self {
        1724  +
                ConstraintViolation::MissingDialog => write!(
        1725  +
                    f,
        1726  +
                    "`dialog` was not provided but it is required when building `TopLevel`"
        1727  +
                ),
        1728  +
            }
        1729  +
        }
        1730  +
    }
        1731  +
    impl ::std::error::Error for ConstraintViolation {}
        1732  +
    impl ConstraintViolation {
        1733  +
        pub(crate) fn as_validation_exception_field(
        1734  +
            self,
        1735  +
            path: ::std::string::String,
        1736  +
        ) -> crate::model::ValidationExceptionField {
        1737  +
            match self {
        1738  +
            ConstraintViolation::MissingDialog => crate::model::ValidationExceptionField {
        1739  +
                                                message: format!("Value at '{}/dialog' failed to satisfy constraint: Member must not be null", path),
        1740  +
                                                path: path + "/dialog",
        1741  +
                                            },
        1742  +
        }
        1743  +
        }
        1744  +
    }
        1745  +
    impl ::std::convert::From<Builder>
        1746  +
        for crate::constrained::MaybeConstrained<crate::model::TopLevel>
        1747  +
    {
        1748  +
        fn from(builder: Builder) -> Self {
        1749  +
            Self::Unconstrained(builder)
        1750  +
        }
        1751  +
    }
        1752  +
    impl ::std::convert::TryFrom<Builder> for crate::model::TopLevel {
        1753  +
        type Error = ConstraintViolation;
        1754  +
        1755  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        1756  +
            builder.build()
        1757  +
        }
        1758  +
    }
        1759  +
    /// A builder for [`TopLevel`](crate::model::TopLevel).
        1760  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1761  +
    pub struct Builder {
        1762  +
        pub(crate) dialog: ::std::option::Option<crate::model::Dialog>,
        1763  +
        pub(crate) dialog_list: ::std::option::Option<::std::vec::Vec<crate::model::Dialog>>,
        1764  +
        pub(crate) dialog_map: ::std::option::Option<
        1765  +
            ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
        1766  +
        >,
        1767  +
    }
        1768  +
    impl Builder {
        1769  +
        #[allow(missing_docs)] // documentation missing in model
        1770  +
        pub fn dialog(mut self, input: crate::model::Dialog) -> Self {
        1771  +
            self.dialog = Some(input);
        1772  +
            self
        1773  +
        }
        1774  +
        #[allow(missing_docs)] // documentation missing in model
        1775  +
        pub(crate) fn set_dialog(
        1776  +
            mut self,
        1777  +
            input: impl ::std::convert::Into<crate::model::Dialog>,
        1778  +
        ) -> Self {
        1779  +
            self.dialog = Some(input.into());
        1780  +
            self
        1781  +
        }
        1782  +
        #[allow(missing_docs)] // documentation missing in model
        1783  +
        pub fn dialog_list(mut self, input: ::std::vec::Vec<crate::model::Dialog>) -> Self {
        1784  +
            self.dialog_list = Some(input);
        1785  +
            self
        1786  +
        }
        1787  +
        #[allow(missing_docs)] // documentation missing in model
        1788  +
        pub(crate) fn set_dialog_list(
        1789  +
            mut self,
        1790  +
            input: impl ::std::convert::Into<::std::vec::Vec<crate::model::Dialog>>,
        1791  +
        ) -> Self {
        1792  +
            self.dialog_list = Some(input.into());
        1793  +
            self
        1794  +
        }
        1795  +
        #[allow(missing_docs)] // documentation missing in model
        1796  +
        pub fn dialog_map(
        1797  +
            mut self,
        1798  +
            input: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
        1799  +
        ) -> Self {
        1800  +
            self.dialog_map = Some(input);
        1801  +
            self
        1802  +
        }
        1803  +
        #[allow(missing_docs)] // documentation missing in model
        1804  +
        pub(crate) fn set_dialog_map(
        1805  +
            mut self,
        1806  +
            input: impl ::std::convert::Into<
        1807  +
                ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
        1808  +
            >,
        1809  +
        ) -> Self {
        1810  +
            self.dialog_map = Some(input.into());
        1811  +
            self
        1812  +
        }
        1813  +
        /// Consumes the builder and constructs a [`TopLevel`](crate::model::TopLevel).
        1814  +
        ///
        1815  +
        /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if a [`ConstraintViolation`] occurs.
        1816  +
        ///
        1817  +
        pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
        1818  +
            self.build_enforcing_all_constraints()
        1819  +
        }
        1820  +
        fn build_enforcing_all_constraints(
        1821  +
            self,
        1822  +
        ) -> Result<crate::model::TopLevel, ConstraintViolation> {
        1823  +
            Ok(crate::model::TopLevel {
        1824  +
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
        1825  +
                dialog_list: self.dialog_list.unwrap_or_else(
        1826  +
                    #[allow(clippy::redundant_closure)]
        1827  +
                    || ::std::vec::Vec::new(),
        1828  +
                ),
        1829  +
                dialog_map: self.dialog_map.unwrap_or_else(
        1830  +
                    #[allow(clippy::redundant_closure)]
        1831  +
                    || ::std::collections::HashMap::new(),
        1832  +
                ),
        1833  +
            })
        1834  +
        }
        1835  +
    }
        1836  +
}
        1837  +
/// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
        1838  +
///
        1839  +
pub mod client_optional_defaults {
        1840  +
        1841  +
    impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
        1842  +
        fn from(builder: Builder) -> Self {
        1843  +
            builder.build()
        1844  +
        }
        1845  +
    }
        1846  +
    /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
        1847  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1848  +
    pub struct Builder {
        1849  +
        pub(crate) member: ::std::option::Option<i32>,
        1850  +
    }
        1851  +
    impl Builder {
        1852  +
        #[allow(missing_docs)] // documentation missing in model
        1853  +
        pub fn member(mut self, input: i32) -> Self {
        1854  +
            self.member = Some(input);
        1855  +
            self
        1856  +
        }
        1857  +
        #[allow(missing_docs)] // documentation missing in model
        1858  +
        pub(crate) fn set_member(mut self, input: impl ::std::convert::Into<i32>) -> Self {
        1859  +
            self.member = Some(input.into());
        1860  +
            self
        1861  +
        }
        1862  +
        /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
        1863  +
        pub fn build(self) -> crate::model::ClientOptionalDefaults {
        1864  +
            self.build_enforcing_all_constraints()
        1865  +
        }
        1866  +
        fn build_enforcing_all_constraints(self) -> crate::model::ClientOptionalDefaults {
        1867  +
            crate::model::ClientOptionalDefaults {
        1868  +
                member: self.member.unwrap_or(0i32),
        1869  +
            }
        1870  +
        }
        1871  +
    }
        1872  +
}
        1873  +
/// See [`Defaults`](crate::model::Defaults).
        1874  +
///
        1875  +
pub mod defaults {
        1876  +
        1877  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        1878  +
    /// Holds one variant for each of the ways the builder can fail.
        1879  +
    #[non_exhaustive]
        1880  +
    #[allow(clippy::enum_variant_names)]
        1881  +
    pub enum ConstraintViolation {
        1882  +
        /// Constraint violation occurred building member `default_enum` when building `Defaults`.
        1883  +
        #[doc(hidden)]
        1884  +
        DefaultEnum(crate::model::test_enum::ConstraintViolation),
        1885  +
    }
        1886  +
    impl ::std::fmt::Display for ConstraintViolation {
        1887  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1888  +
            match self {
        1889  +
                ConstraintViolation::DefaultEnum(_) => write!(f, "constraint violation occurred building member `default_enum` when building `Defaults`"),
        1890  +
            }
        1891  +
        }
        1892  +
    }
        1893  +
    impl ::std::error::Error for ConstraintViolation {}
        1894  +
    impl ConstraintViolation {
        1895  +
        pub(crate) fn as_validation_exception_field(
        1896  +
            self,
        1897  +
            path: ::std::string::String,
        1898  +
        ) -> crate::model::ValidationExceptionField {
        1899  +
            match self {
        1900  +
                ConstraintViolation::DefaultEnum(inner) => {
        1901  +
                    inner.as_validation_exception_field(path + "/defaultEnum")
        1902  +
                }
        1903  +
            }
        1904  +
        }
        1905  +
    }
        1906  +
    impl ::std::convert::From<Builder>
        1907  +
        for crate::constrained::MaybeConstrained<crate::model::Defaults>
        1908  +
    {
        1909  +
        fn from(builder: Builder) -> Self {
        1910  +
            Self::Unconstrained(builder)
        1911  +
        }
        1912  +
    }
        1913  +
    impl ::std::convert::TryFrom<Builder> for crate::model::Defaults {
        1914  +
        type Error = ConstraintViolation;
        1915  +
        1916  +
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
        1917  +
            builder.build()
        1918  +
        }
        1919  +
    }
        1920  +
    /// A builder for [`Defaults`](crate::model::Defaults).
        1921  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1922  +
    pub struct Builder {
        1923  +
        pub(crate) default_string: ::std::option::Option<::std::string::String>,
        1924  +
        pub(crate) default_boolean: ::std::option::Option<bool>,
        1925  +
        pub(crate) default_list: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
        1926  +
        pub(crate) default_document_map: ::std::option::Option<::aws_smithy_types::Document>,
        1927  +
        pub(crate) default_document_string: ::std::option::Option<::aws_smithy_types::Document>,
        1928  +
        pub(crate) default_document_boolean: ::std::option::Option<::aws_smithy_types::Document>,
        1929  +
        pub(crate) default_document_list: ::std::option::Option<::aws_smithy_types::Document>,
        1930  +
        pub(crate) default_null_document: ::std::option::Option<::aws_smithy_types::Document>,
        1931  +
        pub(crate) default_timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
        1932  +
        pub(crate) default_blob: ::std::option::Option<::aws_smithy_types::Blob>,
        1933  +
        pub(crate) default_byte: ::std::option::Option<i8>,
        1934  +
        pub(crate) default_short: ::std::option::Option<i16>,
        1935  +
        pub(crate) default_integer: ::std::option::Option<i32>,
        1936  +
        pub(crate) default_long: ::std::option::Option<i64>,
        1937  +
        pub(crate) default_float: ::std::option::Option<f32>,
        1938  +
        pub(crate) default_double: ::std::option::Option<f64>,
        1939  +
        pub(crate) default_map: ::std::option::Option<
        1940  +
            ::std::collections::HashMap<::std::string::String, ::std::string::String>,
        1941  +
        >,
        1942  +
        pub(crate) default_enum:
        1943  +
            ::std::option::Option<crate::constrained::MaybeConstrained<crate::model::TestEnum>>,
        1944  +
        pub(crate) default_int_enum: ::std::option::Option<i32>,
        1945  +
        pub(crate) empty_string: ::std::option::Option<::std::string::String>,
        1946  +
        pub(crate) false_boolean: ::std::option::Option<bool>,
        1947  +
        pub(crate) empty_blob: ::std::option::Option<::aws_smithy_types::Blob>,
        1948  +
        pub(crate) zero_byte: ::std::option::Option<i8>,
        1949  +
        pub(crate) zero_short: ::std::option::Option<i16>,
        1950  +
        pub(crate) zero_integer: ::std::option::Option<i32>,
        1951  +
        pub(crate) zero_long: ::std::option::Option<i64>,
        1952  +
        pub(crate) zero_float: ::std::option::Option<f32>,
        1953  +
        pub(crate) zero_double: ::std::option::Option<f64>,
        1954  +
    }
        1955  +
    impl Builder {
        1956  +
        #[allow(missing_docs)] // documentation missing in model
        1957  +
        pub fn default_string(mut self, input: ::std::string::String) -> Self {
        1958  +
            self.default_string = Some(input);
        1959  +
            self
        1960  +
        }
        1961  +
        #[allow(missing_docs)] // documentation missing in model
        1962  +
        pub(crate) fn set_default_string(
        1963  +
            mut self,
        1964  +
            input: impl ::std::convert::Into<::std::string::String>,
        1965  +
        ) -> Self {
        1966  +
            self.default_string = Some(input.into());
        1967  +
            self
        1968  +
        }
        1969  +
        #[allow(missing_docs)] // documentation missing in model
        1970  +
        pub fn default_boolean(mut self, input: bool) -> Self {
        1971  +
            self.default_boolean = Some(input);
        1972  +
            self
        1973  +
        }
        1974  +
        #[allow(missing_docs)] // documentation missing in model
        1975  +
        pub(crate) fn set_default_boolean(
        1976  +
            mut self,
        1977  +
            input: impl ::std::convert::Into<bool>,
        1978  +
        ) -> Self {
        1979  +
            self.default_boolean = Some(input.into());
        1980  +
            self
        1981  +
        }
        1982  +
        #[allow(missing_docs)] // documentation missing in model
        1983  +
        pub fn default_list(mut self, input: ::std::vec::Vec<::std::string::String>) -> Self {
        1984  +
            self.default_list = Some(input);
        1985  +
            self
        1986  +
        }
        1987  +
        #[allow(missing_docs)] // documentation missing in model
        1988  +
        pub(crate) fn set_default_list(
        1989  +
            mut self,
        1990  +
            input: impl ::std::convert::Into<::std::vec::Vec<::std::string::String>>,
        1991  +
        ) -> Self {
        1992  +
            self.default_list = Some(input.into());
        1993  +
            self
        1994  +
        }
        1995  +
        #[allow(missing_docs)] // documentation missing in model
        1996  +
        pub fn default_document_map(mut self, input: ::aws_smithy_types::Document) -> Self {
        1997  +
            self.default_document_map = Some(input);
        1998  +
            self
        1999  +
        }
        2000  +
        #[allow(missing_docs)] // documentation missing in model
        2001  +
        pub(crate) fn set_default_document_map(
        2002  +
            mut self,
        2003  +
            input: impl ::std::convert::Into<::aws_smithy_types::Document>,
        2004  +
        ) -> Self {
        2005  +
            self.default_document_map = Some(input.into());
        2006  +
            self
        2007  +
        }
        2008  +
        #[allow(missing_docs)] // documentation missing in model
        2009  +
        pub fn default_document_string(mut self, input: ::aws_smithy_types::Document) -> Self {
        2010  +
            self.default_document_string = Some(input);
        2011  +
            self
        2012  +
        }
        2013  +
        #[allow(missing_docs)] // documentation missing in model
        2014  +
        pub(crate) fn set_default_document_string(
        2015  +
            mut self,
        2016  +
            input: impl ::std::convert::Into<::aws_smithy_types::Document>,
        2017  +
        ) -> Self {
        2018  +
            self.default_document_string = Some(input.into());
        2019  +
            self
        2020  +
        }
        2021  +
        #[allow(missing_docs)] // documentation missing in model
        2022  +
        pub fn default_document_boolean(mut self, input: ::aws_smithy_types::Document) -> Self {
        2023  +
            self.default_document_boolean = Some(input);
        2024  +
            self
        2025  +
        }
        2026  +
        #[allow(missing_docs)] // documentation missing in model
        2027  +
        pub(crate) fn set_default_document_boolean(
        2028  +
            mut self,
        2029  +
            input: impl ::std::convert::Into<::aws_smithy_types::Document>,
        2030  +
        ) -> Self {
        2031  +
            self.default_document_boolean = Some(input.into());
        2032  +
            self
        2033  +
        }
        2034  +
        #[allow(missing_docs)] // documentation missing in model
        2035  +
        pub fn default_document_list(mut self, input: ::aws_smithy_types::Document) -> Self {
        2036  +
            self.default_document_list = Some(input);
        2037  +
            self
        2038  +
        }
        2039  +
        #[allow(missing_docs)] // documentation missing in model
        2040  +
        pub(crate) fn set_default_document_list(
        2041  +
            mut self,
        2042  +
            input: impl ::std::convert::Into<::aws_smithy_types::Document>,
        2043  +
        ) -> Self {
        2044  +
            self.default_document_list = Some(input.into());
        2045  +
            self
        2046  +
        }
        2047  +
        #[allow(missing_docs)] // documentation missing in model
        2048  +
        pub fn default_null_document(
        2049  +
            mut self,
        2050  +
            input: ::std::option::Option<::aws_smithy_types::Document>,
        2051  +
        ) -> Self {
        2052  +
            self.default_null_document = input;
        2053  +
            self
        2054  +
        }
        2055  +
        #[allow(missing_docs)] // documentation missing in model
        2056  +
        pub(crate) fn set_default_null_document(
        2057  +
            mut self,
        2058  +
            input: Option<impl ::std::convert::Into<::aws_smithy_types::Document>>,
        2059  +
        ) -> Self {
        2060  +
            self.default_null_document = input.map(|v| v.into());
        2061  +
            self
        2062  +
        }
        2063  +
        #[allow(missing_docs)] // documentation missing in model
        2064  +
        pub fn default_timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        2065  +
            self.default_timestamp = Some(input);
        2066  +
            self
        2067  +
        }
        2068  +
        #[allow(missing_docs)] // documentation missing in model
        2069  +
        pub(crate) fn set_default_timestamp(
        2070  +
            mut self,
        2071  +
            input: impl ::std::convert::Into<::aws_smithy_types::DateTime>,
        2072  +
        ) -> Self {
        2073  +
            self.default_timestamp = Some(input.into());
        2074  +
            self
        2075  +
        }
        2076  +
        #[allow(missing_docs)] // documentation missing in model
        2077  +
        pub fn default_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
        2078  +
            self.default_blob = Some(input);
        2079  +
            self
        2080  +
        }
        2081  +
        #[allow(missing_docs)] // documentation missing in model
        2082  +
        pub(crate) fn set_default_blob(
        2083  +
            mut self,
        2084  +
            input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
        2085  +
        ) -> Self {
        2086  +
            self.default_blob = Some(input.into());
        2087  +
            self
        2088  +
        }
        2089  +
        #[allow(missing_docs)] // documentation missing in model
        2090  +
        pub fn default_byte(mut self, input: i8) -> Self {
        2091  +
            self.default_byte = Some(input);
        2092  +
            self
        2093  +
        }
        2094  +
        #[allow(missing_docs)] // documentation missing in model
        2095  +
        pub(crate) fn set_default_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
        2096  +
            self.default_byte = Some(input.into());
        2097  +
            self
        2098  +
        }
        2099  +
        #[allow(missing_docs)] // documentation missing in model
        2100  +
        pub fn default_short(mut self, input: i16) -> Self {
        2101  +
            self.default_short = Some(input);
        2102  +
            self
        2103  +
        }
        2104  +
        #[allow(missing_docs)] // documentation missing in model
        2105  +
        pub(crate) fn set_default_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
        2106  +
            self.default_short = Some(input.into());
        2107  +
            self
        2108  +
        }
        2109  +
        #[allow(missing_docs)] // documentation missing in model
        2110  +
        pub fn default_integer(mut self, input: i32) -> Self {
        2111  +
            self.default_integer = Some(input);
        2112  +
            self
        2113  +
        }
        2114  +
        #[allow(missing_docs)] // documentation missing in model
        2115  +
        pub(crate) fn set_default_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
        2116  +
            self.default_integer = Some(input.into());
        2117  +
            self
        2118  +
        }
        2119  +
        #[allow(missing_docs)] // documentation missing in model
        2120  +
        pub fn default_long(mut self, input: i64) -> Self {
        2121  +
            self.default_long = Some(input);
        2122  +
            self
        2123  +
        }
        2124  +
        #[allow(missing_docs)] // documentation missing in model
        2125  +
        pub(crate) fn set_default_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
        2126  +
            self.default_long = Some(input.into());
        2127  +
            self
        2128  +
        }
        2129  +
        #[allow(missing_docs)] // documentation missing in model
        2130  +
        pub fn default_float(mut self, input: f32) -> Self {
        2131  +
            self.default_float = Some(input);
        2132  +
            self
        2133  +
        }
        2134  +
        #[allow(missing_docs)] // documentation missing in model
        2135  +
        pub(crate) fn set_default_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
        2136  +
            self.default_float = Some(input.into());
        2137  +
            self
        2138  +
        }
        2139  +
        #[allow(missing_docs)] // documentation missing in model
        2140  +
        pub fn default_double(mut self, input: f64) -> Self {
        2141  +
            self.default_double = Some(input);
        2142  +
            self
        2143  +
        }
        2144  +
        #[allow(missing_docs)] // documentation missing in model
        2145  +
        pub(crate) fn set_default_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
        2146  +
            self.default_double = Some(input.into());
        2147  +
            self
        2148  +
        }
        2149  +
        #[allow(missing_docs)] // documentation missing in model
        2150  +
        pub fn default_map(
        2151  +
            mut self,
        2152  +
            input: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
        2153  +
        ) -> Self {
        2154  +
            self.default_map = Some(input);
        2155  +
            self
        2156  +
        }
        2157  +
        #[allow(missing_docs)] // documentation missing in model
        2158  +
        pub(crate) fn set_default_map(
        2159  +
            mut self,
        2160  +
            input: impl ::std::convert::Into<
        2161  +
                ::std::collections::HashMap<::std::string::String, ::std::string::String>,
        2162  +
            >,
        2163  +
        ) -> Self {
        2164  +
            self.default_map = Some(input.into());
        2165  +
            self
        2166  +
        }
        2167  +
        #[allow(missing_docs)] // documentation missing in model
        2168  +
        pub fn default_enum(mut self, input: crate::model::TestEnum) -> Self {
        2169  +
            self.default_enum = Some(crate::constrained::MaybeConstrained::Constrained(input));
        2170  +
            self
        2171  +
        }
        2172  +
        #[allow(missing_docs)] // documentation missing in model
        2173  +
        pub(crate) fn set_default_enum(
        2174  +
            mut self,
        2175  +
            input: impl ::std::convert::Into<
        2176  +
                crate::constrained::MaybeConstrained<crate::model::TestEnum>,
        2177  +
            >,
        2178  +
        ) -> Self {
        2179  +
            self.default_enum = Some(input.into());
        2180  +
            self
        2181  +
        }
        2182  +
        #[allow(missing_docs)] // documentation missing in model
        2183  +
        pub fn default_int_enum(mut self, input: i32) -> Self {
        2184  +
            self.default_int_enum = Some(input);
        2185  +
            self
        2186  +
        }
        2187  +
        #[allow(missing_docs)] // documentation missing in model
        2188  +
        pub(crate) fn set_default_int_enum(
        2189  +
            mut self,
        2190  +
            input: impl ::std::convert::Into<i32>,
        2191  +
        ) -> Self {
        2192  +
            self.default_int_enum = Some(input.into());
        2193  +
            self
        2194  +
        }
        2195  +
        #[allow(missing_docs)] // documentation missing in model
        2196  +
        pub fn empty_string(mut self, input: ::std::string::String) -> Self {
        2197  +
            self.empty_string = Some(input);
        2198  +
            self
        2199  +
        }
        2200  +
        #[allow(missing_docs)] // documentation missing in model
        2201  +
        pub(crate) fn set_empty_string(
        2202  +
            mut self,
        2203  +
            input: impl ::std::convert::Into<::std::string::String>,
        2204  +
        ) -> Self {
        2205  +
            self.empty_string = Some(input.into());
        2206  +
            self
        2207  +
        }
        2208  +
        #[allow(missing_docs)] // documentation missing in model
        2209  +
        pub fn false_boolean(mut self, input: bool) -> Self {
        2210  +
            self.false_boolean = Some(input);
        2211  +
            self
        2212  +
        }
        2213  +
        #[allow(missing_docs)] // documentation missing in model
        2214  +
        pub(crate) fn set_false_boolean(mut self, input: impl ::std::convert::Into<bool>) -> Self {
        2215  +
            self.false_boolean = Some(input.into());
        2216  +
            self
        2217  +
        }
        2218  +
        #[allow(missing_docs)] // documentation missing in model
        2219  +
        pub fn empty_blob(mut self, input: ::aws_smithy_types::Blob) -> Self {
        2220  +
            self.empty_blob = Some(input);
        2221  +
            self
        2222  +
        }
        2223  +
        #[allow(missing_docs)] // documentation missing in model
        2224  +
        pub(crate) fn set_empty_blob(
        2225  +
            mut self,
        2226  +
            input: impl ::std::convert::Into<::aws_smithy_types::Blob>,
        2227  +
        ) -> Self {
        2228  +
            self.empty_blob = Some(input.into());
        2229  +
            self
        2230  +
        }
        2231  +
        #[allow(missing_docs)] // documentation missing in model
        2232  +
        pub fn zero_byte(mut self, input: i8) -> Self {
        2233  +
            self.zero_byte = Some(input);
        2234  +
            self
        2235  +
        }
        2236  +
        #[allow(missing_docs)] // documentation missing in model
        2237  +
        pub(crate) fn set_zero_byte(mut self, input: impl ::std::convert::Into<i8>) -> Self {
        2238  +
            self.zero_byte = Some(input.into());
        2239  +
            self
        2240  +
        }
        2241  +
        #[allow(missing_docs)] // documentation missing in model
        2242  +
        pub fn zero_short(mut self, input: i16) -> Self {
        2243  +
            self.zero_short = Some(input);
        2244  +
            self
        2245  +
        }
        2246  +
        #[allow(missing_docs)] // documentation missing in model
        2247  +
        pub(crate) fn set_zero_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
        2248  +
            self.zero_short = Some(input.into());
        2249  +
            self
        2250  +
        }
        2251  +
        #[allow(missing_docs)] // documentation missing in model
        2252  +
        pub fn zero_integer(mut self, input: i32) -> Self {
        2253  +
            self.zero_integer = Some(input);
        2254  +
            self
  960   2255   
        }
  961         -
    }
  962         -
}
  963         -
impl ::std::convert::TryFrom<::std::string::String> for StringEnum {
  964         -
    type Error = crate::model::string_enum::ConstraintViolation;
  965         -
    fn try_from(
  966         -
        s: ::std::string::String,
  967         -
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  968         -
    {
  969         -
        s.as_str().try_into()
  970         -
    }
  971         -
}
  972         -
impl std::str::FromStr for StringEnum {
  973         -
    type Err = crate::model::string_enum::ConstraintViolation;
  974         -
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  975         -
        Self::try_from(s)
  976         -
    }
  977         -
}
  978         -
impl StringEnum {
  979         -
    /// Returns the `&str` value of the enum member.
  980         -
    pub fn as_str(&self) -> &str {
  981         -
        match self {
  982         -
            StringEnum::V => "enumvalue",
        2256  +
        #[allow(missing_docs)] // documentation missing in model
        2257  +
        pub(crate) fn set_zero_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
        2258  +
            self.zero_integer = Some(input.into());
        2259  +
            self
  983   2260   
        }
  984         -
    }
  985         -
    /// Returns all the `&str` representations of the enum members.
  986         -
    pub const fn values() -> &'static [&'static str] {
  987         -
        &["enumvalue"]
  988         -
    }
  989         -
}
  990         -
impl ::std::convert::AsRef<str> for StringEnum {
  991         -
    fn as_ref(&self) -> &str {
  992         -
        self.as_str()
  993         -
    }
  994         -
}
  995         -
impl crate::constrained::Constrained for StringEnum {
  996         -
    type Unconstrained = ::std::string::String;
  997         -
}
  998         -
  999         -
impl ::std::convert::From<::std::string::String>
 1000         -
    for crate::constrained::MaybeConstrained<crate::model::StringEnum>
 1001         -
{
 1002         -
    fn from(value: ::std::string::String) -> Self {
 1003         -
        Self::Unconstrained(value)
 1004         -
    }
 1005         -
}
 1006         -
 1007         -
#[allow(missing_docs)] // documentation missing in model
 1008         -
#[derive(
 1009         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
 1010         -
)]
 1011         -
pub struct NestedPayload {
 1012         -
    #[allow(missing_docs)] // documentation missing in model
 1013         -
    pub greeting: ::std::option::Option<::std::string::String>,
 1014         -
    #[allow(missing_docs)] // documentation missing in model
 1015         -
    pub name: ::std::option::Option<::std::string::String>,
 1016         -
}
 1017         -
impl NestedPayload {
 1018         -
    #[allow(missing_docs)] // documentation missing in model
 1019         -
    pub fn greeting(&self) -> ::std::option::Option<&str> {
 1020         -
        self.greeting.as_deref()
 1021         -
    }
 1022         -
    #[allow(missing_docs)] // documentation missing in model
 1023         -
    pub fn name(&self) -> ::std::option::Option<&str> {
 1024         -
        self.name.as_deref()
 1025         -
    }
 1026         -
}
 1027         -
impl NestedPayload {
 1028         -
    /// Creates a new builder-style object to manufacture [`NestedPayload`](crate::model::NestedPayload).
 1029         -
    pub fn builder() -> crate::model::nested_payload::Builder {
 1030         -
        crate::model::nested_payload::Builder::default()
 1031         -
    }
 1032         -
}
 1033         -
impl crate::constrained::Constrained for crate::model::NestedPayload {
 1034         -
    type Unconstrained = crate::model::nested_payload::Builder;
 1035         -
}
 1036         -
 1037         -
#[allow(missing_docs)] // documentation missing in model
 1038         -
///
 1039         -
/// This is a constrained type because its corresponding modeled Smithy shape has one or more
 1040         -
/// [constraint traits]. Use [`IntegerSet::try_from`] to construct values of this type.
 1041         -
///
 1042         -
/// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
 1043         -
///
 1044         -
#[derive(
 1045         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
 1046         -
)]
 1047         -
pub struct IntegerSet(pub(crate) ::std::vec::Vec<i32>);
 1048         -
impl IntegerSet {
 1049         -
    /// Returns an immutable reference to the underlying [`::std::vec::Vec<i32>`].
 1050         -
    pub fn inner(&self) -> &::std::vec::Vec<i32> {
 1051         -
        &self.0
 1052         -
    }
 1053         -
    /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
 1054         -
    pub fn into_inner(self) -> ::std::vec::Vec<i32> {
 1055         -
        self.0
 1056         -
    }
 1057         -
 1058         -
    fn check_unique_items(
 1059         -
        items: ::std::vec::Vec<i32>,
 1060         -
    ) -> Result<::std::vec::Vec<i32>, crate::model::integer_set::ConstraintViolation> {
 1061         -
        let mut seen = ::std::collections::HashMap::new();
 1062         -
        let mut duplicate_indices = ::std::vec::Vec::new();
 1063         -
        for (idx, item) in items.iter().enumerate() {
 1064         -
            if let Some(prev_idx) = seen.insert(item, idx) {
 1065         -
                duplicate_indices.push(prev_idx);
 1066         -
            }
        2261  +
        #[allow(missing_docs)] // documentation missing in model
        2262  +
        pub fn zero_long(mut self, input: i64) -> Self {
        2263  +
            self.zero_long = Some(input);
        2264  +
            self
 1067   2265   
        }
 1068         -
 1069         -
        let mut last_duplicate_indices = ::std::vec::Vec::new();
 1070         -
        for idx in &duplicate_indices {
 1071         -
            if let Some(prev_idx) = seen.remove(&items[*idx]) {
 1072         -
                last_duplicate_indices.push(prev_idx);
 1073         -
            }
        2266  +
        #[allow(missing_docs)] // documentation missing in model
        2267  +
        pub(crate) fn set_zero_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
        2268  +
            self.zero_long = Some(input.into());
        2269  +
            self
 1074   2270   
        }
 1075         -
        duplicate_indices.extend(last_duplicate_indices);
 1076         -
 1077         -
        if !duplicate_indices.is_empty() {
 1078         -
            debug_assert!(duplicate_indices.len() >= 2);
 1079         -
            Err(
 1080         -
                crate::model::integer_set::ConstraintViolation::UniqueItems {
 1081         -
                    duplicate_indices,
 1082         -
                    original: items,
 1083         -
                },
 1084         -
            )
 1085         -
        } else {
 1086         -
            Ok(items)
        2271  +
        #[allow(missing_docs)] // documentation missing in model
        2272  +
        pub fn zero_float(mut self, input: f32) -> Self {
        2273  +
            self.zero_float = Some(input);
        2274  +
            self
        2275  +
        }
        2276  +
        #[allow(missing_docs)] // documentation missing in model
        2277  +
        pub(crate) fn set_zero_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
        2278  +
            self.zero_float = Some(input.into());
        2279  +
            self
        2280  +
        }
        2281  +
        #[allow(missing_docs)] // documentation missing in model
        2282  +
        pub fn zero_double(mut self, input: f64) -> Self {
        2283  +
            self.zero_double = Some(input);
        2284  +
            self
        2285  +
        }
        2286  +
        #[allow(missing_docs)] // documentation missing in model
        2287  +
        pub(crate) fn set_zero_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
        2288  +
            self.zero_double = Some(input.into());
        2289  +
            self
        2290  +
        }
        2291  +
        /// Consumes the builder and constructs a [`Defaults`](crate::model::Defaults).
        2292  +
        ///
        2293  +
        /// The builder fails to construct a [`Defaults`](crate::model::Defaults) if a [`ConstraintViolation`] occurs.
        2294  +
        ///
        2295  +
        pub fn build(self) -> Result<crate::model::Defaults, ConstraintViolation> {
        2296  +
            self.build_enforcing_all_constraints()
        2297  +
        }
        2298  +
        fn build_enforcing_all_constraints(
        2299  +
            self,
        2300  +
        ) -> Result<crate::model::Defaults, ConstraintViolation> {
        2301  +
            Ok(crate::model::Defaults {
        2302  +
                default_string: self.default_string.unwrap_or_else(
        2303  +
                    #[allow(clippy::redundant_closure)]
        2304  +
                    || String::from("hi"),
        2305  +
                ),
        2306  +
                default_boolean: self.default_boolean.unwrap_or(true),
        2307  +
                default_list: self.default_list.unwrap_or_else(
        2308  +
                    #[allow(clippy::redundant_closure)]
        2309  +
                    || ::std::vec::Vec::new(),
        2310  +
                ),
        2311  +
                default_document_map: self.default_document_map.unwrap_or_else(
        2312  +
                    #[allow(clippy::redundant_closure)]
        2313  +
                    || ::aws_smithy_types::Document::Object(::std::collections::HashMap::new()),
        2314  +
                ),
        2315  +
                default_document_string: self.default_document_string.unwrap_or_else(
        2316  +
                    #[allow(clippy::redundant_closure)]
        2317  +
                    || ::aws_smithy_types::Document::String(::std::string::String::from("hi")),
        2318  +
                ),
        2319  +
                default_document_boolean: self
        2320  +
                    .default_document_boolean
        2321  +
                    .unwrap_or(::aws_smithy_types::Document::Bool(true)),
        2322  +
                default_document_list: self.default_document_list.unwrap_or_else(
        2323  +
                    #[allow(clippy::redundant_closure)]
        2324  +
                    || ::aws_smithy_types::Document::Array(::std::vec::Vec::new()),
        2325  +
                ),
        2326  +
                default_null_document: self.default_null_document,
        2327  +
                default_timestamp: self.default_timestamp.unwrap_or_else(
        2328  +
                    #[allow(clippy::redundant_closure)]
        2329  +
                    || ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64),
        2330  +
                ),
        2331  +
                default_blob: self.default_blob.unwrap_or_else(
        2332  +
                    #[allow(clippy::redundant_closure)]
        2333  +
                    || ::aws_smithy_types::Blob::new("abc"),
        2334  +
                ),
        2335  +
                default_byte: self.default_byte.unwrap_or(1i8),
        2336  +
                default_short: self.default_short.unwrap_or(1i16),
        2337  +
                default_integer: self.default_integer.unwrap_or(10i32),
        2338  +
                default_long: self.default_long.unwrap_or(100i64),
        2339  +
                default_float: self.default_float.unwrap_or(1.0f32),
        2340  +
                default_double: self.default_double.unwrap_or(1.0f64),
        2341  +
                default_map: self.default_map.unwrap_or_else(
        2342  +
                    #[allow(clippy::redundant_closure)]
        2343  +
                    || ::std::collections::HashMap::new(),
        2344  +
                ),
        2345  +
                default_enum: self
        2346  +
                    .default_enum
        2347  +
                    .map(|v| match v {
        2348  +
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        2349  +
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        2350  +
                    })
        2351  +
                    .map(|res| res.map_err(ConstraintViolation::DefaultEnum))
        2352  +
                    .transpose()?
        2353  +
                    .unwrap_or(
        2354  +
                        "FOO"
        2355  +
                            .parse::<crate::model::TestEnum>()
        2356  +
                            .expect("static value validated to member"),
        2357  +
                    ),
        2358  +
                default_int_enum: self.default_int_enum.unwrap_or(1i32),
        2359  +
                empty_string: self.empty_string.unwrap_or_else(
        2360  +
                    #[allow(clippy::redundant_closure)]
        2361  +
                    || String::from(""),
        2362  +
                ),
        2363  +
                false_boolean: self.false_boolean.unwrap_or(false),
        2364  +
                empty_blob: self.empty_blob.unwrap_or_else(
        2365  +
                    #[allow(clippy::redundant_closure)]
        2366  +
                    || ::aws_smithy_types::Blob::new(""),
        2367  +
                ),
        2368  +
                zero_byte: self.zero_byte.unwrap_or(0i8),
        2369  +
                zero_short: self.zero_short.unwrap_or(0i16),
        2370  +
                zero_integer: self.zero_integer.unwrap_or(0i32),
        2371  +
                zero_long: self.zero_long.unwrap_or(0i64),
        2372  +
                zero_float: self.zero_float.unwrap_or(0.0f32),
        2373  +
                zero_double: self.zero_double.unwrap_or(0.0f64),
        2374  +
            })
 1087   2375   
        }
 1088   2376   
    }
 1089   2377   
}
 1090         -
impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerSet {
 1091         -
    type Error = crate::model::integer_set::ConstraintViolation;
 1092         -
 1093         -
    /// Constructs a `IntegerSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
 1094         -
    fn try_from(value: ::std::vec::Vec<i32>) -> Result<Self, Self::Error> {
 1095         -
        let value = Self::check_unique_items(value)?;
 1096         -
 1097         -
        Ok(Self(value))
 1098         -
    }
 1099         -
}
 1100         -
 1101         -
impl ::std::convert::From<IntegerSet> for ::std::vec::Vec<i32> {
 1102         -
    fn from(value: IntegerSet) -> Self {
 1103         -
        value.into_inner()
 1104         -
    }
 1105         -
}
 1106         -
impl crate::constrained::Constrained for IntegerSet {
 1107         -
    type Unconstrained = crate::unconstrained::integer_set_unconstrained::IntegerSetUnconstrained;
 1108         -
}
 1109         -
 1110   2378   
/// See [`PayloadConfig`](crate::model::PayloadConfig).
 1111   2379   
///
 1112   2380   
pub mod payload_config {
 1113   2381   
 1114   2382   
    impl ::std::convert::From<Builder> for crate::model::PayloadConfig {
 1115   2383   
        fn from(builder: Builder) -> Self {
 1116   2384   
            builder.build()
 1117   2385   
        }
 1118   2386   
    }
 1119   2387   
    /// A builder for [`PayloadConfig`](crate::model::PayloadConfig).
@@ -1150,2418 +1274,2477 @@
 1170   2438   
        pub fn build(self) -> crate::model::TestConfig {
 1171   2439   
            self.build_enforcing_all_constraints()
 1172   2440   
        }
 1173   2441   
        fn build_enforcing_all_constraints(self) -> crate::model::TestConfig {
 1174   2442   
            crate::model::TestConfig {
 1175   2443   
                timeout: self.timeout,
 1176   2444   
            }
 1177   2445   
        }
 1178   2446   
    }
 1179   2447   
}
 1180         -
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
 1181         -
///
 1182         -
pub mod validation_exception_field {
 1183         -
 1184         -
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 1185         -
    /// Holds one variant for each of the ways the builder can fail.
 1186         -
    #[non_exhaustive]
 1187         -
    #[allow(clippy::enum_variant_names)]
 1188         -
    pub enum ConstraintViolation {
 1189         -
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
 1190         -
        MissingPath,
 1191         -
        /// `message` was not provided but it is required when building `ValidationExceptionField`.
 1192         -
        MissingMessage,
 1193         -
    }
 1194         -
    impl ::std::fmt::Display for ConstraintViolation {
 1195         -
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 1196         -
            match self {
 1197         -
                ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
 1198         -
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
 1199         -
            }
 1200         -
        }
 1201         -
    }
 1202         -
    impl ::std::error::Error for ConstraintViolation {}
 1203         -
    impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
 1204         -
        type Error = ConstraintViolation;
 1205         -
 1206         -
        fn try_from(builder: Builder) -> Result<Self, Self::Error> {
 1207         -
            builder.build()
 1208         -
        }
 1209         -
    }
 1210         -
    /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
 1211         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
 1212         -
    pub struct Builder {
 1213         -
        pub(crate) path: ::std::option::Option<::std::string::String>,
 1214         -
        pub(crate) message: ::std::option::Option<::std::string::String>,
 1215         -
    }
 1216         -
    impl Builder {
 1217         -
        /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
 1218         -
        pub fn path(mut self, input: ::std::string::String) -> Self {
 1219         -
            self.path = Some(input);
 1220         -
            self
 1221         -
        }
 1222         -
        /// A detailed description of the validation failure.
 1223         -
        pub fn message(mut self, input: ::std::string::String) -> Self {
 1224         -
            self.message = Some(input);
 1225         -
            self
 1226         -
        }
 1227         -
        /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
 1228         -
        ///
 1229         -
        /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
 1230         -
        ///
 1231         -
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
 1232         -
        pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
 1233         -
            self.build_enforcing_all_constraints()
 1234         -
        }
 1235         -
        fn build_enforcing_all_constraints(
 1236         -
            self,
 1237         -
        ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
 1238         -
            Ok(crate::model::ValidationExceptionField {
 1239         -
                path: self.path.ok_or(ConstraintViolation::MissingPath)?,
 1240         -
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
 1241         -
            })
 1242         -
        }
 1243         -
    }
 1244         -
}
 1245   2448   
/// See [`Unit`](crate::model::Unit).
 1246   2449   
///
 1247   2450   
pub mod unit {
 1248   2451   
 1249   2452   
    impl ::std::convert::From<Builder> for crate::model::Unit {
 1250   2453   
        fn from(builder: Builder) -> Self {
 1251   2454   
            builder.build()
 1252   2455   
        }
 1253   2456   
    }
 1254   2457   
    /// A builder for [`Unit`](crate::model::Unit).