Server Test

Server Test

rev. 7254d43655ed63111c94f599437f2b0d3f55446e

Files changed:

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

@@ -1,1 +383,218 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(missing_docs)] // documentation missing in model
    3         -
#[derive(
    4         -
    ::std::clone::Clone,
    5         -
    ::std::cmp::Eq,
    6         -
    ::std::cmp::Ord,
    7         -
    ::std::cmp::PartialEq,
    8         -
    ::std::cmp::PartialOrd,
    9         -
    ::std::fmt::Debug,
   10         -
    ::std::hash::Hash,
   11         -
)]
   12         -
pub enum RequiredEnum {
   13         -
    #[allow(missing_docs)] // documentation missing in model
   14         -
    Bar,
   15         -
    #[allow(missing_docs)] // documentation missing in model
   16         -
    Baz,
   17         -
    #[allow(missing_docs)] // documentation missing in model
   18         -
    Foo,
   19         -
}
   20         -
/// See [`RequiredEnum`](crate::model::RequiredEnum).
   21         -
pub mod required_enum {
   22         -
    #[derive(Debug, PartialEq)]
   23         -
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
   24         -
   25         -
    impl ::std::fmt::Display for ConstraintViolation {
   26         -
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
   27         -
            write!(
   28         -
                f,
   29         -
                r#"Value provided for 'aws.protocoltests.json10#RequiredEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
   30         -
            )
   31         -
        }
   32         -
    }
   33         -
   34         -
    impl ::std::error::Error for ConstraintViolation {}
   35         -
}
   36         -
impl ::std::convert::TryFrom<&str> for RequiredEnum {
   37         -
    type Error = crate::model::required_enum::ConstraintViolation;
   38         -
    fn try_from(
   39         -
        s: &str,
   40         -
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
   41         -
        match s {
   42         -
            "BAR" => Ok(RequiredEnum::Bar),
   43         -
            "BAZ" => Ok(RequiredEnum::Baz),
   44         -
            "FOO" => Ok(RequiredEnum::Foo),
   45         -
            _ => Err(crate::model::required_enum::ConstraintViolation(
   46         -
                s.to_owned(),
   47         -
            )),
   48         -
        }
   49         -
    }
   50         -
}
   51         -
impl ::std::convert::TryFrom<::std::string::String> for RequiredEnum {
   52         -
    type Error = crate::model::required_enum::ConstraintViolation;
   53         -
    fn try_from(
   54         -
        s: ::std::string::String,
   55         -
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
   56         -
    {
   57         -
        s.as_str().try_into()
   58         -
    }
   59         -
}
   60         -
impl std::str::FromStr for RequiredEnum {
   61         -
    type Err = crate::model::required_enum::ConstraintViolation;
   62         -
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
   63         -
        Self::try_from(s)
   64         -
    }
   65         -
}
   66         -
impl RequiredEnum {
   67         -
    /// Returns the `&str` value of the enum member.
   68         -
    pub fn as_str(&self) -> &str {
   69         -
        match self {
   70         -
            RequiredEnum::Bar => "BAR",
   71         -
            RequiredEnum::Baz => "BAZ",
   72         -
            RequiredEnum::Foo => "FOO",
   73         -
        }
   74         -
    }
   75         -
    /// Returns all the `&str` representations of the enum members.
   76         -
    pub const fn values() -> &'static [&'static str] {
   77         -
        &["BAR", "BAZ", "FOO"]
   78         -
    }
   79         -
}
   80         -
impl ::std::convert::AsRef<str> for RequiredEnum {
   81         -
    fn as_ref(&self) -> &str {
   82         -
        self.as_str()
   83         -
    }
   84         -
}
   85         -
impl crate::constrained::Constrained for RequiredEnum {
   86         -
    type Unconstrained = ::std::string::String;
   87         -
}
   88         -
   89         -
impl ::std::convert::From<::std::string::String>
   90         -
    for crate::constrained::MaybeConstrained<crate::model::RequiredEnum>
   91         -
{
   92         -
    fn from(value: ::std::string::String) -> Self {
   93         -
        Self::Unconstrained(value)
   94         -
    }
   95         -
}
   96         -
   97         -
/// Describes one specific validation failure for an input member.
   98      3   
#[derive(
   99      4   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  100      5   
)]
  101         -
pub struct ValidationExceptionField {
  102         -
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
  103         -
    pub path: ::std::string::String,
  104         -
    /// A detailed description of the validation failure.
  105         -
    pub message: ::std::string::String,
           6  +
pub struct ComplexNestedErrorData {
           7  +
    #[allow(missing_docs)] // documentation missing in model
           8  +
    pub foo: ::std::option::Option<::std::string::String>,
  106      9   
}
  107         -
impl ValidationExceptionField {
  108         -
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
  109         -
    pub fn path(&self) -> &str {
  110         -
        use std::ops::Deref;
  111         -
        self.path.deref()
  112         -
    }
  113         -
    /// A detailed description of the validation failure.
  114         -
    pub fn message(&self) -> &str {
  115         -
        use std::ops::Deref;
  116         -
        self.message.deref()
          10  +
impl ComplexNestedErrorData {
          11  +
    #[allow(missing_docs)] // documentation missing in model
          12  +
    pub fn foo(&self) -> ::std::option::Option<&str> {
          13  +
        self.foo.as_deref()
  117     14   
    }
  118     15   
}
  119         -
impl ValidationExceptionField {
  120         -
    /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
  121         -
    pub fn builder() -> crate::model::validation_exception_field::Builder {
  122         -
        crate::model::validation_exception_field::Builder::default()
          16  +
impl ComplexNestedErrorData {
          17  +
    /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
          18  +
    pub fn builder() -> crate::model::complex_nested_error_data::Builder {
          19  +
        crate::model::complex_nested_error_data::Builder::default()
  123     20   
    }
  124     21   
}
  125     22   
  126         -
#[allow(missing_docs)] // documentation missing in model
  127         -
#[derive(
  128         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  129         -
)]
  130         -
pub struct Dialog {
  131         -
    #[allow(missing_docs)] // documentation missing in model
  132         -
    pub language: ::std::option::Option<::std::string::String>,
          23  +
/// A union with a representative set of types for members.
          24  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
          25  +
pub enum MyUnion {
  133     26   
    #[allow(missing_docs)] // documentation missing in model
  134         -
    pub greeting: ::std::string::String,
          27  +
    BlobValue(::aws_smithy_types::Blob),
  135     28   
    #[allow(missing_docs)] // documentation missing in model
  136         -
    pub farewell: ::std::option::Option<crate::model::Farewell>,
  137         -
}
  138         -
impl Dialog {
          29  +
    BooleanValue(bool),
  139     30   
    #[allow(missing_docs)] // documentation missing in model
  140         -
    pub fn language(&self) -> ::std::option::Option<&str> {
  141         -
        self.language.as_deref()
  142         -
    }
          31  +
    EnumValue(crate::model::FooEnum),
  143     32   
    #[allow(missing_docs)] // documentation missing in model
  144         -
    pub fn greeting(&self) -> &str {
  145         -
        use std::ops::Deref;
  146         -
        self.greeting.deref()
  147         -
    }
          33  +
    IntEnumValue(i32),
  148     34   
    #[allow(missing_docs)] // documentation missing in model
  149         -
    pub fn farewell(&self) -> ::std::option::Option<&crate::model::Farewell> {
  150         -
        self.farewell.as_ref()
  151         -
    }
  152         -
}
  153         -
impl Dialog {
  154         -
    /// Creates a new builder-style object to manufacture [`Dialog`](crate::model::Dialog).
  155         -
    pub fn builder() -> crate::model::dialog::Builder {
  156         -
        crate::model::dialog::Builder::default()
  157         -
    }
  158         -
}
  159         -
impl crate::constrained::Constrained for crate::model::Dialog {
  160         -
    type Unconstrained = crate::model::dialog::Builder;
  161         -
}
  162         -
  163         -
#[allow(missing_docs)] // documentation missing in model
  164         -
#[derive(
  165         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  166         -
)]
  167         -
pub struct Farewell {
          35  +
    ListValue(::std::vec::Vec<::std::string::String>),
  168     36   
    #[allow(missing_docs)] // documentation missing in model
  169         -
    pub phrase: ::std::string::String,
  170         -
}
  171         -
impl Farewell {
          37  +
    MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
  172     38   
    #[allow(missing_docs)] // documentation missing in model
  173         -
    pub fn phrase(&self) -> &str {
  174         -
        use std::ops::Deref;
  175         -
        self.phrase.deref()
  176         -
    }
  177         -
}
  178         -
impl Farewell {
  179         -
    /// Creates a new builder-style object to manufacture [`Farewell`](crate::model::Farewell).
  180         -
    pub fn builder() -> crate::model::farewell::Builder {
  181         -
        crate::model::farewell::Builder::default()
  182         -
    }
  183         -
}
  184         -
impl crate::constrained::Constrained for crate::model::Farewell {
  185         -
    type Unconstrained = crate::model::farewell::Builder;
  186         -
}
  187         -
  188         -
#[allow(missing_docs)] // documentation missing in model
  189         -
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
  190         -
pub struct TopLevel {
          39  +
    NumberValue(i32),
  191     40   
    #[allow(missing_docs)] // documentation missing in model
  192         -
    pub dialog: crate::model::Dialog,
          41  +
    StringValue(::std::string::String),
  193     42   
    #[allow(missing_docs)] // documentation missing in model
  194         -
    pub dialog_list: ::std::vec::Vec<crate::model::Dialog>,
          43  +
    StructureValue(crate::model::GreetingStruct),
  195     44   
    #[allow(missing_docs)] // documentation missing in model
  196         -
    pub dialog_map: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
          45  +
    TimestampValue(::aws_smithy_types::DateTime),
  197     46   
}
  198         -
impl TopLevel {
  199         -
    #[allow(missing_docs)] // documentation missing in model
  200         -
    pub fn dialog(&self) -> &crate::model::Dialog {
  201         -
        &self.dialog
          47  +
impl MyUnion {
          48  +
    /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_types::Blob).
          49  +
    /// Returns `Err(&Self)` if it can't be converted.
          50  +
    pub fn as_blob_value(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
          51  +
        if let MyUnion::BlobValue(val) = &self {
          52  +
            ::std::result::Result::Ok(val)
          53  +
        } else {
          54  +
            ::std::result::Result::Err(self)
          55  +
        }
  202     56   
    }
  203         -
    #[allow(missing_docs)] // documentation missing in model
  204         -
    pub fn dialog_list(&self) -> &[crate::model::Dialog] {
  205         -
        use std::ops::Deref;
  206         -
        self.dialog_list.deref()
          57  +
    /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
          58  +
    pub fn is_blob_value(&self) -> bool {
          59  +
        self.as_blob_value().is_ok()
  207     60   
    }
  208         -
    #[allow(missing_docs)] // documentation missing in model
  209         -
    pub fn dialog_map(
  210         -
        &self,
  211         -
    ) -> &::std::collections::HashMap<::std::string::String, crate::model::Dialog> {
  212         -
        &self.dialog_map
          61  +
    /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
          62  +
    /// Returns `Err(&Self)` if it can't be converted.
          63  +
    pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
          64  +
        if let MyUnion::BooleanValue(val) = &self {
          65  +
            ::std::result::Result::Ok(val)
          66  +
        } else {
          67  +
            ::std::result::Result::Err(self)
          68  +
        }
  213     69   
    }
  214         -
}
  215         -
impl TopLevel {
  216         -
    /// Creates a new builder-style object to manufacture [`TopLevel`](crate::model::TopLevel).
  217         -
    pub fn builder() -> crate::model::top_level::Builder {
  218         -
        crate::model::top_level::Builder::default()
          70  +
    /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
          71  +
    pub fn is_boolean_value(&self) -> bool {
          72  +
        self.as_boolean_value().is_ok()
  219     73   
    }
  220         -
}
  221         -
impl crate::constrained::Constrained for crate::model::TopLevel {
  222         -
    type Unconstrained = crate::model::top_level::Builder;
  223         -
}
  224         -
  225         -
#[allow(missing_docs)] // documentation missing in model
  226         -
#[derive(
  227         -
    ::std::clone::Clone,
  228         -
    ::std::cmp::Eq,
  229         -
    ::std::cmp::Ord,
  230         -
    ::std::cmp::PartialEq,
  231         -
    ::std::cmp::PartialOrd,
  232         -
    ::std::fmt::Debug,
  233         -
    ::std::hash::Hash,
  234         -
)]
  235         -
pub enum TestEnum {
  236         -
    #[allow(missing_docs)] // documentation missing in model
  237         -
    Bar,
  238         -
    #[allow(missing_docs)] // documentation missing in model
  239         -
    Baz,
  240         -
    #[allow(missing_docs)] // documentation missing in model
  241         -
    Foo,
  242         -
}
  243         -
/// See [`TestEnum`](crate::model::TestEnum).
  244         -
pub mod test_enum {
  245         -
    #[derive(Debug, PartialEq)]
  246         -
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
  247         -
  248         -
    impl ::std::fmt::Display for ConstraintViolation {
  249         -
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  250         -
            write!(
  251         -
                f,
  252         -
                r#"Value provided for 'aws.protocoltests.json10#TestEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
  253         -
            )
          74  +
    /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
          75  +
    /// Returns `Err(&Self)` if it can't be converted.
          76  +
    pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
          77  +
        if let MyUnion::EnumValue(val) = &self {
          78  +
            ::std::result::Result::Ok(val)
          79  +
        } else {
          80  +
            ::std::result::Result::Err(self)
  254     81   
        }
  255     82   
    }
  256         -
  257         -
    impl ::std::error::Error for ConstraintViolation {}
  258         -
    impl ConstraintViolation {
  259         -
        pub(crate) fn as_validation_exception_field(
  260         -
            self,
  261         -
            path: ::std::string::String,
  262         -
        ) -> crate::model::ValidationExceptionField {
  263         -
            crate::model::ValidationExceptionField {
  264         -
                message: format!(
  265         -
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
  266         -
                    &path
  267         -
                ),
  268         -
                path,
  269         -
            }
          83  +
    /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
          84  +
    pub fn is_enum_value(&self) -> bool {
          85  +
        self.as_enum_value().is_ok()
          86  +
    }
          87  +
    /// Tries to convert the enum instance into [`IntEnumValue`](crate::model::MyUnion::IntEnumValue), extracting the inner [`i32`](i32).
          88  +
    /// Returns `Err(&Self)` if it can't be converted.
          89  +
    pub fn as_int_enum_value(&self) -> ::std::result::Result<&i32, &Self> {
          90  +
        if let MyUnion::IntEnumValue(val) = &self {
          91  +
            ::std::result::Result::Ok(val)
          92  +
        } else {
          93  +
            ::std::result::Result::Err(self)
  270     94   
        }
  271     95   
    }
  272         -
}
  273         -
impl ::std::convert::TryFrom<&str> for TestEnum {
  274         -
    type Error = crate::model::test_enum::ConstraintViolation;
  275         -
    fn try_from(
  276         -
        s: &str,
  277         -
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
  278         -
        match s {
  279         -
            "BAR" => Ok(TestEnum::Bar),
  280         -
            "BAZ" => Ok(TestEnum::Baz),
  281         -
            "FOO" => Ok(TestEnum::Foo),
  282         -
            _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
          96  +
    /// Returns true if this is a [`IntEnumValue`](crate::model::MyUnion::IntEnumValue).
          97  +
    pub fn is_int_enum_value(&self) -> bool {
          98  +
        self.as_int_enum_value().is_ok()
          99  +
    }
         100  +
    /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
         101  +
    /// Returns `Err(&Self)` if it can't be converted.
         102  +
    pub fn as_list_value(
         103  +
        &self,
         104  +
    ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
         105  +
        if let MyUnion::ListValue(val) = &self {
         106  +
            ::std::result::Result::Ok(val)
         107  +
        } else {
         108  +
            ::std::result::Result::Err(self)
  283    109   
        }
  284    110   
    }
  285         -
}
  286         -
impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
  287         -
    type Error = crate::model::test_enum::ConstraintViolation;
  288         -
    fn try_from(
  289         -
        s: ::std::string::String,
  290         -
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
  291         -
    {
  292         -
        s.as_str().try_into()
         111  +
    /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
         112  +
    pub fn is_list_value(&self) -> bool {
         113  +
        self.as_list_value().is_ok()
  293    114   
    }
  294         -
}
  295         -
impl std::str::FromStr for TestEnum {
  296         -
    type Err = crate::model::test_enum::ConstraintViolation;
  297         -
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
  298         -
        Self::try_from(s)
         115  +
    /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
         116  +
    /// Returns `Err(&Self)` if it can't be converted.
         117  +
    pub fn as_map_value(
         118  +
        &self,
         119  +
    ) -> ::std::result::Result<
         120  +
        &::std::collections::HashMap<::std::string::String, ::std::string::String>,
         121  +
        &Self,
         122  +
    > {
         123  +
        if let MyUnion::MapValue(val) = &self {
         124  +
            ::std::result::Result::Ok(val)
         125  +
        } else {
         126  +
            ::std::result::Result::Err(self)
         127  +
        }
  299    128   
    }
  300         -
}
  301         -
impl TestEnum {
  302         -
    /// Returns the `&str` value of the enum member.
  303         -
    pub fn as_str(&self) -> &str {
  304         -
        match self {
  305         -
            TestEnum::Bar => "BAR",
  306         -
            TestEnum::Baz => "BAZ",
  307         -
            TestEnum::Foo => "FOO",
         129  +
    /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
         130  +
    pub fn is_map_value(&self) -> bool {
         131  +
        self.as_map_value().is_ok()
         132  +
    }
         133  +
    /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
         134  +
    /// Returns `Err(&Self)` if it can't be converted.
         135  +
    pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
         136  +
        if let MyUnion::NumberValue(val) = &self {
         137  +
            ::std::result::Result::Ok(val)
         138  +
        } else {
         139  +
            ::std::result::Result::Err(self)
  308    140   
        }
  309    141   
    }
  310         -
    /// Returns all the `&str` representations of the enum members.
  311         -
    pub const fn values() -> &'static [&'static str] {
  312         -
        &["BAR", "BAZ", "FOO"]
         142  +
    /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
         143  +
    pub fn is_number_value(&self) -> bool {
         144  +
        self.as_number_value().is_ok()
  313    145   
    }
  314         -
}
  315         -
impl ::std::convert::AsRef<str> for TestEnum {
  316         -
    fn as_ref(&self) -> &str {
  317         -
        self.as_str()
         146  +
    /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
         147  +
    /// Returns `Err(&Self)` if it can't be converted.
         148  +
    pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
         149  +
        if let MyUnion::StringValue(val) = &self {
         150  +
            ::std::result::Result::Ok(val)
         151  +
        } else {
         152  +
            ::std::result::Result::Err(self)
         153  +
        }
  318    154   
    }
  319         -
}
  320         -
impl crate::constrained::Constrained for TestEnum {
  321         -
    type Unconstrained = ::std::string::String;
  322         -
}
  323         -
  324         -
impl ::std::convert::From<::std::string::String>
  325         -
    for crate::constrained::MaybeConstrained<crate::model::TestEnum>
  326         -
{
  327         -
    fn from(value: ::std::string::String) -> Self {
  328         -
        Self::Unconstrained(value)
         155  +
    /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
         156  +
    pub fn is_string_value(&self) -> bool {
         157  +
        self.as_string_value().is_ok()
  329    158   
    }
  330         -
}
  331         -
  332         -
#[allow(missing_docs)] // documentation missing in model
  333         -
#[derive(
  334         -
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  335         -
)]
  336         -
pub struct ClientOptionalDefaults {
  337         -
    #[allow(missing_docs)] // documentation missing in model
  338         -
    pub member: i32,
  339         -
}
  340         -
impl ClientOptionalDefaults {
  341         -
    #[allow(missing_docs)] // documentation missing in model
  342         -
    pub fn member(&self) -> i32 {
  343         -
        self.member
         159  +
    /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
         160  +
    /// Returns `Err(&Self)` if it can't be converted.
         161  +
    pub fn as_structure_value(
         162  +
        &self,
         163  +
    ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
         164  +
        if let MyUnion::StructureValue(val) = &self {
         165  +
            ::std::result::Result::Ok(val)
         166  +
        } else {
         167  +
            ::std::result::Result::Err(self)
         168  +
        }
  344    169   
    }
  345         -
}
  346         -
impl ClientOptionalDefaults {
  347         -
    /// Creates a new builder-style object to manufacture [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
  348         -
    pub fn builder() -> crate::model::client_optional_defaults::Builder {
  349         -
        crate::model::client_optional_defaults::Builder::default()
         170  +
    /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
         171  +
    pub fn is_structure_value(&self) -> bool {
         172  +
        self.as_structure_value().is_ok()
         173  +
    }
         174  +
    /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_types::DateTime).
         175  +
    /// Returns `Err(&Self)` if it can't be converted.
         176  +
    pub fn as_timestamp_value(
         177  +
        &self,
         178  +
    ) -> ::std::result::Result<&::aws_smithy_types::DateTime, &Self> {
         179  +
        if let MyUnion::TimestampValue(val) = &self {
         180  +
            ::std::result::Result::Ok(val)
         181  +
        } else {
         182  +
            ::std::result::Result::Err(self)
         183  +
        }
         184  +
    }
         185  +
    /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
         186  +
    pub fn is_timestamp_value(&self) -> bool {
         187  +
        self.as_timestamp_value().is_ok()
  350    188   
    }
  351         -
}
  352         -
impl crate::constrained::Constrained for crate::model::ClientOptionalDefaults {
  353         -
    type Unconstrained = crate::model::client_optional_defaults::Builder;
  354    189   
}
  355    190   
  356    191   
#[allow(missing_docs)] // documentation missing in model
  357    192   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
  358    193   
pub struct Defaults {
  359    194   
    #[allow(missing_docs)] // documentation missing in model
  360    195   
    pub default_string: ::std::string::String,
  361    196   
    #[allow(missing_docs)] // documentation missing in model
  362    197   
    pub default_boolean: bool,
  363    198   
    #[allow(missing_docs)] // documentation missing in model
@@ -511,346 +764,707 @@
  531    366   
    pub fn zero_double(&self) -> f64 {
  532    367   
        self.zero_double
  533    368   
    }
  534    369   
}
  535    370   
impl Defaults {
  536    371   
    /// Creates a new builder-style object to manufacture [`Defaults`](crate::model::Defaults).
  537    372   
    pub fn builder() -> crate::model::defaults::Builder {
  538    373   
        crate::model::defaults::Builder::default()
  539    374   
    }
  540    375   
}
  541         -
impl crate::constrained::Constrained for crate::model::Defaults {
  542         -
    type Unconstrained = crate::model::defaults::Builder;
         376  +
impl crate::constrained::Constrained for crate::model::Defaults {
         377  +
    type Unconstrained = crate::model::defaults::Builder;
         378  +
}
         379  +
         380  +
#[allow(missing_docs)] // documentation missing in model
         381  +
#[derive(
         382  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         383  +
)]
         384  +
pub struct ClientOptionalDefaults {
         385  +
    #[allow(missing_docs)] // documentation missing in model
         386  +
    pub member: i32,
         387  +
}
         388  +
impl ClientOptionalDefaults {
         389  +
    #[allow(missing_docs)] // documentation missing in model
         390  +
    pub fn member(&self) -> i32 {
         391  +
        self.member
         392  +
    }
         393  +
}
         394  +
impl ClientOptionalDefaults {
         395  +
    /// Creates a new builder-style object to manufacture [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
         396  +
    pub fn builder() -> crate::model::client_optional_defaults::Builder {
         397  +
        crate::model::client_optional_defaults::Builder::default()
         398  +
    }
         399  +
}
         400  +
impl crate::constrained::Constrained for crate::model::ClientOptionalDefaults {
         401  +
    type Unconstrained = crate::model::client_optional_defaults::Builder;
  543    402   
}
  544    403   
  545         -
/// A union with a representative set of types for members.
  546         -
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
  547         -
pub enum MyUnion {
  548         -
    #[allow(missing_docs)] // documentation missing in model
  549         -
    BlobValue(::aws_smithy_types::Blob),
  550         -
    #[allow(missing_docs)] // documentation missing in model
  551         -
    BooleanValue(bool),
  552         -
    #[allow(missing_docs)] // documentation missing in model
  553         -
    EnumValue(crate::model::FooEnum),
  554         -
    #[allow(missing_docs)] // documentation missing in model
  555         -
    IntEnumValue(i32),
  556         -
    #[allow(missing_docs)] // documentation missing in model
  557         -
    ListValue(::std::vec::Vec<::std::string::String>),
  558         -
    #[allow(missing_docs)] // documentation missing in model
  559         -
    MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
  560         -
    #[allow(missing_docs)] // documentation missing in model
  561         -
    NumberValue(i32),
         404  +
#[allow(missing_docs)] // documentation missing in model
         405  +
#[derive(
         406  +
    ::std::clone::Clone,
         407  +
    ::std::cmp::Eq,
         408  +
    ::std::cmp::Ord,
         409  +
    ::std::cmp::PartialEq,
         410  +
    ::std::cmp::PartialOrd,
         411  +
    ::std::fmt::Debug,
         412  +
    ::std::hash::Hash,
         413  +
)]
         414  +
pub enum TestEnum {
  562    415   
    #[allow(missing_docs)] // documentation missing in model
  563         -
    StringValue(::std::string::String),
         416  +
    Bar,
  564    417   
    #[allow(missing_docs)] // documentation missing in model
  565         -
    StructureValue(crate::model::GreetingStruct),
         418  +
    Baz,
  566    419   
    #[allow(missing_docs)] // documentation missing in model
  567         -
    TimestampValue(::aws_smithy_types::DateTime),
         420  +
    Foo,
  568    421   
}
  569         -
impl MyUnion {
  570         -
    /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_types::Blob).
  571         -
    /// Returns `Err(&Self)` if it can't be converted.
  572         -
    pub fn as_blob_value(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
  573         -
        if let MyUnion::BlobValue(val) = &self {
  574         -
            ::std::result::Result::Ok(val)
  575         -
        } else {
  576         -
            ::std::result::Result::Err(self)
  577         -
        }
  578         -
    }
  579         -
    /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
  580         -
    pub fn is_blob_value(&self) -> bool {
  581         -
        self.as_blob_value().is_ok()
  582         -
    }
  583         -
    /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
  584         -
    /// Returns `Err(&Self)` if it can't be converted.
  585         -
    pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
  586         -
        if let MyUnion::BooleanValue(val) = &self {
  587         -
            ::std::result::Result::Ok(val)
  588         -
        } else {
  589         -
            ::std::result::Result::Err(self)
  590         -
        }
  591         -
    }
  592         -
    /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
  593         -
    pub fn is_boolean_value(&self) -> bool {
  594         -
        self.as_boolean_value().is_ok()
  595         -
    }
  596         -
    /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
  597         -
    /// Returns `Err(&Self)` if it can't be converted.
  598         -
    pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
  599         -
        if let MyUnion::EnumValue(val) = &self {
  600         -
            ::std::result::Result::Ok(val)
  601         -
        } else {
  602         -
            ::std::result::Result::Err(self)
         422  +
/// See [`TestEnum`](crate::model::TestEnum).
         423  +
pub mod test_enum {
         424  +
    #[derive(Debug, PartialEq)]
         425  +
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
         426  +
         427  +
    impl ::std::fmt::Display for ConstraintViolation {
         428  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         429  +
            write!(
         430  +
                f,
         431  +
                r#"Value provided for 'aws.protocoltests.json10#TestEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
         432  +
            )
  603    433   
        }
  604    434   
    }
  605         -
    /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
  606         -
    pub fn is_enum_value(&self) -> bool {
  607         -
        self.as_enum_value().is_ok()
  608         -
    }
  609         -
    /// Tries to convert the enum instance into [`IntEnumValue`](crate::model::MyUnion::IntEnumValue), extracting the inner [`i32`](i32).
  610         -
    /// Returns `Err(&Self)` if it can't be converted.
  611         -
    pub fn as_int_enum_value(&self) -> ::std::result::Result<&i32, &Self> {
  612         -
        if let MyUnion::IntEnumValue(val) = &self {
  613         -
            ::std::result::Result::Ok(val)
  614         -
        } else {
  615         -
            ::std::result::Result::Err(self)
         435  +
         436  +
    impl ::std::error::Error for ConstraintViolation {}
         437  +
    impl ConstraintViolation {
         438  +
        pub(crate) fn as_validation_exception_field(
         439  +
            self,
         440  +
            path: ::std::string::String,
         441  +
        ) -> crate::model::ValidationExceptionField {
         442  +
            crate::model::ValidationExceptionField {
         443  +
                message: format!(
         444  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
         445  +
                    &path
         446  +
                ),
         447  +
                path,
         448  +
            }
  616    449   
        }
  617    450   
    }
  618         -
    /// Returns true if this is a [`IntEnumValue`](crate::model::MyUnion::IntEnumValue).
  619         -
    pub fn is_int_enum_value(&self) -> bool {
  620         -
        self.as_int_enum_value().is_ok()
  621         -
    }
  622         -
    /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
  623         -
    /// Returns `Err(&Self)` if it can't be converted.
  624         -
    pub fn as_list_value(
  625         -
        &self,
  626         -
    ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
  627         -
        if let MyUnion::ListValue(val) = &self {
  628         -
            ::std::result::Result::Ok(val)
  629         -
        } else {
  630         -
            ::std::result::Result::Err(self)
         451  +
}
         452  +
impl ::std::convert::TryFrom<&str> for TestEnum {
         453  +
    type Error = crate::model::test_enum::ConstraintViolation;
         454  +
    fn try_from(
         455  +
        s: &str,
         456  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
         457  +
        match s {
         458  +
            "BAR" => Ok(TestEnum::Bar),
         459  +
            "BAZ" => Ok(TestEnum::Baz),
         460  +
            "FOO" => Ok(TestEnum::Foo),
         461  +
            _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
  631    462   
        }
  632    463   
    }
  633         -
    /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
  634         -
    pub fn is_list_value(&self) -> bool {
  635         -
        self.as_list_value().is_ok()
  636         -
    }
  637         -
    /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
  638         -
    /// Returns `Err(&Self)` if it can't be converted.
  639         -
    pub fn as_map_value(
  640         -
        &self,
  641         -
    ) -> ::std::result::Result<
  642         -
        &::std::collections::HashMap<::std::string::String, ::std::string::String>,
  643         -
        &Self,
  644         -
    > {
  645         -
        if let MyUnion::MapValue(val) = &self {
  646         -
            ::std::result::Result::Ok(val)
  647         -
        } else {
  648         -
            ::std::result::Result::Err(self)
  649         -
        }
         464  +
}
         465  +
impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
         466  +
    type Error = crate::model::test_enum::ConstraintViolation;
         467  +
    fn try_from(
         468  +
        s: ::std::string::String,
         469  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
         470  +
    {
         471  +
        s.as_str().try_into()
  650    472   
    }
  651         -
    /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
  652         -
    pub fn is_map_value(&self) -> bool {
  653         -
        self.as_map_value().is_ok()
         473  +
}
         474  +
impl std::str::FromStr for TestEnum {
         475  +
    type Err = crate::model::test_enum::ConstraintViolation;
         476  +
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
         477  +
        Self::try_from(s)
  654    478   
    }
  655         -
    /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
  656         -
    /// Returns `Err(&Self)` if it can't be converted.
  657         -
    pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
  658         -
        if let MyUnion::NumberValue(val) = &self {
  659         -
            ::std::result::Result::Ok(val)
  660         -
        } else {
  661         -
            ::std::result::Result::Err(self)
         479  +
}
         480  +
impl TestEnum {
         481  +
    /// Returns the `&str` value of the enum member.
         482  +
    pub fn as_str(&self) -> &str {
         483  +
        match self {
         484  +
            TestEnum::Bar => "BAR",
         485  +
            TestEnum::Baz => "BAZ",
         486  +
            TestEnum::Foo => "FOO",
  662    487   
        }
  663    488   
    }
  664         -
    /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
  665         -
    pub fn is_number_value(&self) -> bool {
  666         -
        self.as_number_value().is_ok()
         489  +
    /// Returns all the `&str` representations of the enum members.
         490  +
    pub const fn values() -> &'static [&'static str] {
         491  +
        &["BAR", "BAZ", "FOO"]
  667    492   
    }
  668         -
    /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
  669         -
    /// Returns `Err(&Self)` if it can't be converted.
  670         -
    pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
  671         -
        if let MyUnion::StringValue(val) = &self {
  672         -
            ::std::result::Result::Ok(val)
  673         -
        } else {
  674         -
            ::std::result::Result::Err(self)
  675         -
        }
         493  +
}
         494  +
impl ::std::convert::AsRef<str> for TestEnum {
         495  +
    fn as_ref(&self) -> &str {
         496  +
        self.as_str()
  676    497   
    }
  677         -
    /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
  678         -
    pub fn is_string_value(&self) -> bool {
  679         -
        self.as_string_value().is_ok()
         498  +
}
         499  +
impl crate::constrained::Constrained for TestEnum {
         500  +
    type Unconstrained = ::std::string::String;
         501  +
}
         502  +
         503  +
impl ::std::convert::From<::std::string::String>
         504  +
    for crate::constrained::MaybeConstrained<crate::model::TestEnum>
         505  +
{
         506  +
    fn from(value: ::std::string::String) -> Self {
         507  +
        Self::Unconstrained(value)
  680    508   
    }
  681         -
    /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
  682         -
    /// Returns `Err(&Self)` if it can't be converted.
  683         -
    pub fn as_structure_value(
  684         -
        &self,
  685         -
    ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
  686         -
        if let MyUnion::StructureValue(val) = &self {
  687         -
            ::std::result::Result::Ok(val)
  688         -
        } else {
  689         -
            ::std::result::Result::Err(self)
  690         -
        }
         509  +
}
         510  +
         511  +
#[allow(missing_docs)] // documentation missing in model
         512  +
#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
         513  +
pub struct TopLevel {
         514  +
    #[allow(missing_docs)] // documentation missing in model
         515  +
    pub dialog: crate::model::Dialog,
         516  +
    #[allow(missing_docs)] // documentation missing in model
         517  +
    pub dialog_list: ::std::vec::Vec<crate::model::Dialog>,
         518  +
    #[allow(missing_docs)] // documentation missing in model
         519  +
    pub dialog_map: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
         520  +
}
         521  +
impl TopLevel {
         522  +
    #[allow(missing_docs)] // documentation missing in model
         523  +
    pub fn dialog(&self) -> &crate::model::Dialog {
         524  +
        &self.dialog
  691    525   
    }
  692         -
    /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
  693         -
    pub fn is_structure_value(&self) -> bool {
  694         -
        self.as_structure_value().is_ok()
         526  +
    #[allow(missing_docs)] // documentation missing in model
         527  +
    pub fn dialog_list(&self) -> &[crate::model::Dialog] {
         528  +
        use std::ops::Deref;
         529  +
        self.dialog_list.deref()
  695    530   
    }
  696         -
    /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_types::DateTime).
  697         -
    /// Returns `Err(&Self)` if it can't be converted.
  698         -
    pub fn as_timestamp_value(
  699         -
        &self,
  700         -
    ) -> ::std::result::Result<&::aws_smithy_types::DateTime, &Self> {
  701         -
        if let MyUnion::TimestampValue(val) = &self {
  702         -
            ::std::result::Result::Ok(val)
  703         -
        } else {
  704         -
            ::std::result::Result::Err(self)
  705         -
        }
         531  +
    #[allow(missing_docs)] // documentation missing in model
         532  +
    pub fn dialog_map(
         533  +
        &self,
         534  +
    ) -> &::std::collections::HashMap<::std::string::String, crate::model::Dialog> {
         535  +
        &self.dialog_map
  706    536   
    }
  707         -
    /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
  708         -
    pub fn is_timestamp_value(&self) -> bool {
  709         -
        self.as_timestamp_value().is_ok()
         537  +
}
         538  +
impl TopLevel {
         539  +
    /// Creates a new builder-style object to manufacture [`TopLevel`](crate::model::TopLevel).
         540  +
    pub fn builder() -> crate::model::top_level::Builder {
         541  +
        crate::model::top_level::Builder::default()
  710    542   
    }
  711    543   
}
         544  +
impl crate::constrained::Constrained for crate::model::TopLevel {
         545  +
    type Unconstrained = crate::model::top_level::Builder;
         546  +
}
  712    547   
  713    548   
#[allow(missing_docs)] // documentation missing in model
  714    549   
#[derive(
  715    550   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  716    551   
)]
  717         -
pub struct GreetingStruct {
         552  +
pub struct Dialog {
  718    553   
    #[allow(missing_docs)] // documentation missing in model
  719         -
    pub hi: ::std::option::Option<::std::string::String>,
         554  +
    pub language: ::std::option::Option<::std::string::String>,
         555  +
    #[allow(missing_docs)] // documentation missing in model
         556  +
    pub greeting: ::std::string::String,
         557  +
    #[allow(missing_docs)] // documentation missing in model
         558  +
    pub farewell: ::std::option::Option<crate::model::Farewell>,
  720    559   
}
  721         -
impl GreetingStruct {
         560  +
impl Dialog {
  722    561   
    #[allow(missing_docs)] // documentation missing in model
  723         -
    pub fn hi(&self) -> ::std::option::Option<&str> {
  724         -
        self.hi.as_deref()
         562  +
    pub fn language(&self) -> ::std::option::Option<&str> {
         563  +
        self.language.as_deref()
         564  +
    }
         565  +
    #[allow(missing_docs)] // documentation missing in model
         566  +
    pub fn greeting(&self) -> &str {
         567  +
        use std::ops::Deref;
         568  +
        self.greeting.deref()
         569  +
    }
         570  +
    #[allow(missing_docs)] // documentation missing in model
         571  +
    pub fn farewell(&self) -> ::std::option::Option<&crate::model::Farewell> {
         572  +
        self.farewell.as_ref()
  725    573   
    }
  726    574   
}
  727         -
impl GreetingStruct {
  728         -
    /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
  729         -
    pub fn builder() -> crate::model::greeting_struct::Builder {
  730         -
        crate::model::greeting_struct::Builder::default()
         575  +
impl Dialog {
         576  +
    /// Creates a new builder-style object to manufacture [`Dialog`](crate::model::Dialog).
         577  +
    pub fn builder() -> crate::model::dialog::Builder {
         578  +
        crate::model::dialog::Builder::default()
  731    579   
    }
  732    580   
}
  733         -
impl crate::constrained::Constrained for crate::model::GreetingStruct {
  734         -
    type Unconstrained = crate::model::greeting_struct::Builder;
         581  +
impl crate::constrained::Constrained for crate::model::Dialog {
         582  +
    type Unconstrained = crate::model::dialog::Builder;
         583  +
}
         584  +
         585  +
#[allow(missing_docs)] // documentation missing in model
         586  +
#[derive(
         587  +
    ::std::clone::Clone,
         588  +
    ::std::cmp::Eq,
         589  +
    ::std::cmp::Ord,
         590  +
    ::std::cmp::PartialEq,
         591  +
    ::std::cmp::PartialOrd,
         592  +
    ::std::fmt::Debug,
         593  +
    ::std::hash::Hash,
         594  +
)]
         595  +
pub enum RequiredEnum {
         596  +
    #[allow(missing_docs)] // documentation missing in model
         597  +
    Bar,
         598  +
    #[allow(missing_docs)] // documentation missing in model
         599  +
    Baz,
         600  +
    #[allow(missing_docs)] // documentation missing in model
         601  +
    Foo,
         602  +
}
         603  +
/// See [`RequiredEnum`](crate::model::RequiredEnum).
         604  +
pub mod required_enum {
         605  +
    #[derive(Debug, PartialEq)]
         606  +
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
         607  +
         608  +
    impl ::std::fmt::Display for ConstraintViolation {
         609  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         610  +
            write!(
         611  +
                f,
         612  +
                r#"Value provided for 'aws.protocoltests.json10#RequiredEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
         613  +
            )
         614  +
        }
         615  +
    }
         616  +
         617  +
    impl ::std::error::Error for ConstraintViolation {}
         618  +
}
         619  +
impl ::std::convert::TryFrom<&str> for RequiredEnum {
         620  +
    type Error = crate::model::required_enum::ConstraintViolation;
         621  +
    fn try_from(
         622  +
        s: &str,
         623  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
         624  +
        match s {
         625  +
            "BAR" => Ok(RequiredEnum::Bar),
         626  +
            "BAZ" => Ok(RequiredEnum::Baz),
         627  +
            "FOO" => Ok(RequiredEnum::Foo),
         628  +
            _ => Err(crate::model::required_enum::ConstraintViolation(
         629  +
                s.to_owned(),
         630  +
            )),
         631  +
        }
         632  +
    }
         633  +
}
         634  +
impl ::std::convert::TryFrom<::std::string::String> for RequiredEnum {
         635  +
    type Error = crate::model::required_enum::ConstraintViolation;
         636  +
    fn try_from(
         637  +
        s: ::std::string::String,
         638  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
         639  +
    {
         640  +
        s.as_str().try_into()
         641  +
    }
         642  +
}
         643  +
impl std::str::FromStr for RequiredEnum {
         644  +
    type Err = crate::model::required_enum::ConstraintViolation;
         645  +
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
         646  +
        Self::try_from(s)
         647  +
    }
         648  +
}
         649  +
impl RequiredEnum {
         650  +
    /// Returns the `&str` value of the enum member.
         651  +
    pub fn as_str(&self) -> &str {
         652  +
        match self {
         653  +
            RequiredEnum::Bar => "BAR",
         654  +
            RequiredEnum::Baz => "BAZ",
         655  +
            RequiredEnum::Foo => "FOO",
         656  +
        }
         657  +
    }
         658  +
    /// Returns all the `&str` representations of the enum members.
         659  +
    pub const fn values() -> &'static [&'static str] {
         660  +
        &["BAR", "BAZ", "FOO"]
         661  +
    }
         662  +
}
         663  +
impl ::std::convert::AsRef<str> for RequiredEnum {
         664  +
    fn as_ref(&self) -> &str {
         665  +
        self.as_str()
         666  +
    }
         667  +
}
         668  +
impl crate::constrained::Constrained for RequiredEnum {
         669  +
    type Unconstrained = ::std::string::String;
         670  +
}
         671  +
         672  +
impl ::std::convert::From<::std::string::String>
         673  +
    for crate::constrained::MaybeConstrained<crate::model::RequiredEnum>
         674  +
{
         675  +
    fn from(value: ::std::string::String) -> Self {
         676  +
        Self::Unconstrained(value)
         677  +
    }
  735    678   
}
  736    679   
  737    680   
#[allow(missing_docs)] // documentation missing in model
  738    681   
#[derive(
  739    682   
    ::std::clone::Clone,
  740    683   
    ::std::cmp::Eq,
  741    684   
    ::std::cmp::Ord,
  742    685   
    ::std::cmp::PartialEq,
  743    686   
    ::std::cmp::PartialOrd,
  744    687   
    ::std::fmt::Debug,
@@ -826,769 +1223,952 @@
  846    789   
{
  847    790   
    fn from(value: ::std::string::String) -> Self {
  848    791   
        Self::Unconstrained(value)
  849    792   
    }
  850    793   
}
  851    794   
  852    795   
#[allow(missing_docs)] // documentation missing in model
  853    796   
#[derive(
  854    797   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
  855    798   
)]
  856         -
pub struct ComplexNestedErrorData {
         799  +
pub struct GreetingStruct {
  857    800   
    #[allow(missing_docs)] // documentation missing in model
  858         -
    pub foo: ::std::option::Option<::std::string::String>,
         801  +
    pub hi: ::std::option::Option<::std::string::String>,
  859    802   
}
  860         -
impl ComplexNestedErrorData {
         803  +
impl GreetingStruct {
  861    804   
    #[allow(missing_docs)] // documentation missing in model
  862         -
    pub fn foo(&self) -> ::std::option::Option<&str> {
  863         -
        self.foo.as_deref()
         805  +
    pub fn hi(&self) -> ::std::option::Option<&str> {
         806  +
        self.hi.as_deref()
  864    807   
    }
  865    808   
}
  866         -
impl ComplexNestedErrorData {
  867         -
    /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
  868         -
    pub fn builder() -> crate::model::complex_nested_error_data::Builder {
  869         -
        crate::model::complex_nested_error_data::Builder::default()
         809  +
impl GreetingStruct {
         810  +
    /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
         811  +
    pub fn builder() -> crate::model::greeting_struct::Builder {
         812  +
        crate::model::greeting_struct::Builder::default()
  870    813   
    }
  871    814   
}
  872         -
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
  873         -
pub mod validation_exception_field {
  874         -
  875         -
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  876         -
    /// Holds one variant for each of the ways the builder can fail.
  877         -
    #[non_exhaustive]
  878         -
    #[allow(clippy::enum_variant_names)]
  879         -
    pub enum ConstraintViolation {
  880         -
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
  881         -
        MissingPath,
  882         -
        /// `message` was not provided but it is required when building `ValidationExceptionField`.
  883         -
        MissingMessage,
  884         -
    }
  885         -
    impl ::std::fmt::Display for ConstraintViolation {
  886         -
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  887         -
            match self {
  888         -
                ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
  889         -
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
  890         -
            }
  891         -
        }
  892         -
    }
  893         -
    impl ::std::error::Error for ConstraintViolation {}
  894         -
    impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
  895         -
        type Error = ConstraintViolation;
         815  +
impl crate::constrained::Constrained for crate::model::GreetingStruct {
         816  +
    type Unconstrained = crate::model::greeting_struct::Builder;
         817  +
}
  896    818   
  897         -
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
  898         -
            builder.build()
  899         -
        }
  900         -
    }
  901         -
    /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
  902         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
  903         -
    pub struct Builder {
  904         -
        pub(crate) path: ::std::option::Option<::std::string::String>,
  905         -
        pub(crate) message: ::std::option::Option<::std::string::String>,
         819  +
/// Describes one specific validation failure for an input member.
         820  +
#[derive(
         821  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         822  +
)]
         823  +
pub struct ValidationExceptionField {
         824  +
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
         825  +
    pub path: ::std::string::String,
         826  +
    /// A detailed description of the validation failure.
         827  +
    pub message: ::std::string::String,
         828  +
}
         829  +
impl ValidationExceptionField {
         830  +
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
         831  +
    pub fn path(&self) -> &str {
         832  +
        use std::ops::Deref;
         833  +
        self.path.deref()
  906    834   
    }
  907         -
    impl Builder {
  908         -
        /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
  909         -
        pub fn path(mut self, input: ::std::string::String) -> Self {
  910         -
            self.path = Some(input);
  911         -
            self
  912         -
        }
  913         -
        /// A detailed description of the validation failure.
  914         -
        pub fn message(mut self, input: ::std::string::String) -> Self {
  915         -
            self.message = Some(input);
  916         -
            self
  917         -
        }
  918         -
        /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
  919         -
        ///
  920         -
        /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
  921         -
        ///
  922         -
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
  923         -
        pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
  924         -
            self.build_enforcing_all_constraints()
  925         -
        }
  926         -
        fn build_enforcing_all_constraints(
  927         -
            self,
  928         -
        ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
  929         -
            Ok(crate::model::ValidationExceptionField {
  930         -
                path: self.path.ok_or(ConstraintViolation::MissingPath)?,
  931         -
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
  932         -
            })
  933         -
        }
         835  +
    /// A detailed description of the validation failure.
         836  +
    pub fn message(&self) -> &str {
         837  +
        use std::ops::Deref;
         838  +
        self.message.deref()
  934    839   
    }
  935    840   
}
  936         -
/// See [`Dialog`](crate::model::Dialog).
  937         -
pub mod dialog {
  938         -
  939         -
    impl ::std::convert::From<Builder> for crate::model::Dialog {
  940         -
        fn from(builder: Builder) -> Self {
  941         -
            builder.build()
  942         -
        }
         841  +
impl ValidationExceptionField {
         842  +
    /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         843  +
    pub fn builder() -> crate::model::validation_exception_field::Builder {
         844  +
        crate::model::validation_exception_field::Builder::default()
  943    845   
    }
  944         -
    /// A builder for [`Dialog`](crate::model::Dialog).
  945         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
  946         -
    pub struct Builder {
  947         -
        pub(crate) language: ::std::option::Option<::std::string::String>,
  948         -
        pub(crate) greeting: ::std::option::Option<::std::string::String>,
  949         -
        pub(crate) farewell: ::std::option::Option<crate::model::Farewell>,
         846  +
}
         847  +
         848  +
#[allow(missing_docs)] // documentation missing in model
         849  +
#[derive(
         850  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         851  +
)]
         852  +
pub struct Farewell {
         853  +
    #[allow(missing_docs)] // documentation missing in model
         854  +
    pub phrase: ::std::string::String,
         855  +
}
         856  +
impl Farewell {
         857  +
    #[allow(missing_docs)] // documentation missing in model
         858  +
    pub fn phrase(&self) -> &str {
         859  +
        use std::ops::Deref;
         860  +
        self.phrase.deref()
  950    861   
    }
  951         -
    impl Builder {
  952         -
        #[allow(missing_docs)] // documentation missing in model
  953         -
        pub fn language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
  954         -
            self.language = input;
  955         -
            self
  956         -
        }
  957         -
        #[allow(missing_docs)] // documentation missing in model
  958         -
        pub(crate) fn set_language(
  959         -
            mut self,
  960         -
            input: Option<impl ::std::convert::Into<::std::string::String>>,
  961         -
        ) -> Self {
  962         -
            self.language = input.map(|v| v.into());
  963         -
            self
  964         -
        }
  965         -
        #[allow(missing_docs)] // documentation missing in model
  966         -
        pub fn greeting(mut self, input: ::std::string::String) -> Self {
  967         -
            self.greeting = Some(input);
  968         -
            self
  969         -
        }
  970         -
        #[allow(missing_docs)] // documentation missing in model
  971         -
        pub(crate) fn set_greeting(
  972         -
            mut self,
  973         -
            input: impl ::std::convert::Into<::std::string::String>,
  974         -
        ) -> Self {
  975         -
            self.greeting = Some(input.into());
  976         -
            self
  977         -
        }
  978         -
        #[allow(missing_docs)] // documentation missing in model
  979         -
        pub fn farewell(mut self, input: ::std::option::Option<crate::model::Farewell>) -> Self {
  980         -
            self.farewell = input;
  981         -
            self
  982         -
        }
  983         -
        #[allow(missing_docs)] // documentation missing in model
  984         -
        pub(crate) fn set_farewell(
  985         -
            mut self,
  986         -
            input: Option<impl ::std::convert::Into<crate::model::Farewell>>,
  987         -
        ) -> Self {
  988         -
            self.farewell = input.map(|v| v.into());
  989         -
            self
  990         -
        }
  991         -
        /// Consumes the builder and constructs a [`Dialog`](crate::model::Dialog).
  992         -
        pub fn build(self) -> crate::model::Dialog {
  993         -
            self.build_enforcing_all_constraints()
  994         -
        }
  995         -
        fn build_enforcing_all_constraints(self) -> crate::model::Dialog {
  996         -
            crate::model::Dialog {
  997         -
                language: self.language,
  998         -
                greeting: self.greeting.unwrap_or_else(|| String::from("hi")),
  999         -
                farewell: self.farewell,
 1000         -
            }
 1001         -
        }
         862  +
}
         863  +
impl Farewell {
         864  +
    /// Creates a new builder-style object to manufacture [`Farewell`](crate::model::Farewell).
         865  +
    pub fn builder() -> crate::model::farewell::Builder {
         866  +
        crate::model::farewell::Builder::default()
 1002    867   
    }
 1003    868   
}
 1004         -
/// See [`Farewell`](crate::model::Farewell).
 1005         -
pub mod farewell {
         869  +
impl crate::constrained::Constrained for crate::model::Farewell {
         870  +
    type Unconstrained = crate::model::farewell::Builder;
         871  +
}
         872  +
/// See [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
         873  +
pub mod complex_nested_error_data {
 1006    874   
 1007         -
    impl ::std::convert::From<Builder> for crate::model::Farewell {
         875  +
    impl ::std::convert::From<Builder> for crate::model::ComplexNestedErrorData {
 1008    876   
        fn from(builder: Builder) -> Self {
 1009    877   
            builder.build()
 1010    878   
        }
 1011    879   
    }
 1012         -
    /// A builder for [`Farewell`](crate::model::Farewell).
         880  +
    /// A builder for [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
 1013    881   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
 1014    882   
    pub struct Builder {
 1015         -
        pub(crate) phrase: ::std::option::Option<::std::string::String>,
         883  +
        pub(crate) foo: ::std::option::Option<::std::string::String>,
 1016    884   
    }
 1017    885   
    impl Builder {
 1018    886   
        #[allow(missing_docs)] // documentation missing in model
 1019         -
        pub fn phrase(mut self, input: ::std::string::String) -> Self {
 1020         -
            self.phrase = Some(input);
 1021         -
            self
 1022         -
        }
 1023         -
        #[allow(missing_docs)] // documentation missing in model
 1024         -
        pub(crate) fn set_phrase(
 1025         -
            mut self,
 1026         -
            input: impl ::std::convert::Into<::std::string::String>,
 1027         -
        ) -> Self {
 1028         -
            self.phrase = Some(input.into());
         887  +
        pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
         888  +
            self.foo = input;
 1029    889   
            self
 1030    890   
        }
 1031         -
        /// Consumes the builder and constructs a [`Farewell`](crate::model::Farewell).
 1032         -
        pub fn build(self) -> crate::model::Farewell {
         891  +
        /// Consumes the builder and constructs a [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
         892  +
        pub fn build(self) -> crate::model::ComplexNestedErrorData {
 1033    893   
            self.build_enforcing_all_constraints()
 1034    894   
        }
 1035         -
        fn build_enforcing_all_constraints(self) -> crate::model::Farewell {
 1036         -
            crate::model::Farewell {
 1037         -
                phrase: self.phrase.unwrap_or_else(|| String::from("bye")),
 1038         -
            }
         895  +
        fn build_enforcing_all_constraints(self) -> crate::model::ComplexNestedErrorData {
         896  +
            crate::model::ComplexNestedErrorData { foo: self.foo }
 1039    897   
        }
 1040    898   
    }
 1041    899   
}
 1042         -
/// See [`TopLevel`](crate::model::TopLevel).
 1043         -
pub mod top_level {
         900  +
pub mod my_union {
 1044    901   
 1045    902   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 1046         -
    /// Holds one variant for each of the ways the builder can fail.
 1047         -
    #[non_exhaustive]
 1048    903   
    #[allow(clippy::enum_variant_names)]
 1049    904   
    pub enum ConstraintViolation {
 1050         -
        /// `dialog` was not provided but it is required when building `TopLevel`.
 1051         -
        MissingDialog,
         905  +
        EnumValue(crate::model::foo_enum::ConstraintViolation),
 1052    906   
    }
 1053    907   
    impl ::std::fmt::Display for ConstraintViolation {
 1054    908   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 1055    909   
            match self {
 1056         -
                ConstraintViolation::MissingDialog => write!(
 1057         -
                    f,
 1058         -
                    "`dialog` was not provided but it is required when building `TopLevel`"
 1059         -
                ),
         910  +
                Self::EnumValue(inner) => write!(f, "{inner}"),
 1060    911   
            }
 1061    912   
        }
 1062    913   
    }
 1063         -
    impl ::std::error::Error for ConstraintViolation {}
 1064         -
    impl ConstraintViolation {
 1065         -
        pub(crate) fn as_validation_exception_field(
 1066         -
            self,
 1067         -
            path: ::std::string::String,
 1068         -
        ) -> crate::model::ValidationExceptionField {
 1069         -
            match self {
 1070         -
            ConstraintViolation::MissingDialog => crate::model::ValidationExceptionField {
 1071         -
                                                message: format!("Value at '{}/dialog' failed to satisfy constraint: Member must not be null", path),
 1072         -
                                                path: path + "/dialog",
 1073         -
                                            },
 1074         -
        }
 1075         -
        }
 1076         -
    }
 1077         -
    impl ::std::convert::From<Builder>
 1078         -
        for crate::constrained::MaybeConstrained<crate::model::TopLevel>
 1079         -
    {
 1080         -
        fn from(builder: Builder) -> Self {
 1081         -
            Self::Unconstrained(builder)
 1082         -
        }
 1083         -
    }
 1084         -
    impl ::std::convert::TryFrom<Builder> for crate::model::TopLevel {
 1085         -
        type Error = ConstraintViolation;
 1086         -
 1087         -
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
 1088         -
            builder.build()
 1089         -
        }
 1090         -
    }
 1091         -
    /// A builder for [`TopLevel`](crate::model::TopLevel).
 1092         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
 1093         -
    pub struct Builder {
 1094         -
        pub(crate) dialog: ::std::option::Option<crate::model::Dialog>,
 1095         -
        pub(crate) dialog_list: ::std::option::Option<::std::vec::Vec<crate::model::Dialog>>,
 1096         -
        pub(crate) dialog_map: ::std::option::Option<
 1097         -
            ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
 1098         -
        >,
 1099         -
    }
 1100         -
    impl Builder {
 1101         -
        #[allow(missing_docs)] // documentation missing in model
 1102         -
        pub fn dialog(mut self, input: crate::model::Dialog) -> Self {
 1103         -
            self.dialog = Some(input);
 1104         -
            self
 1105         -
        }
 1106         -
        #[allow(missing_docs)] // documentation missing in model
 1107         -
        pub(crate) fn set_dialog(
 1108         -
            mut self,
 1109         -
            input: impl ::std::convert::Into<crate::model::Dialog>,
 1110         -
        ) -> Self {
 1111         -
            self.dialog = Some(input.into());
 1112         -
            self
 1113         -
        }
 1114         -
        #[allow(missing_docs)] // documentation missing in model
 1115         -
        pub fn dialog_list(mut self, input: ::std::vec::Vec<crate::model::Dialog>) -> Self {
 1116         -
            self.dialog_list = Some(input);
 1117         -
            self
 1118         -
        }
 1119         -
        #[allow(missing_docs)] // documentation missing in model
 1120         -
        pub(crate) fn set_dialog_list(
 1121         -
            mut self,
 1122         -
            input: impl ::std::convert::Into<::std::vec::Vec<crate::model::Dialog>>,
 1123         -
        ) -> Self {
 1124         -
            self.dialog_list = Some(input.into());
 1125         -
            self
 1126         -
        }
 1127         -
        #[allow(missing_docs)] // documentation missing in model
 1128         -
        pub fn dialog_map(
 1129         -
            mut self,
 1130         -
            input: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
 1131         -
        ) -> Self {
 1132         -
            self.dialog_map = Some(input);
 1133         -
            self
 1134         -
        }
 1135         -
        #[allow(missing_docs)] // documentation missing in model
 1136         -
        pub(crate) fn set_dialog_map(
 1137         -
            mut self,
 1138         -
            input: impl ::std::convert::Into<
 1139         -
                ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
 1140         -
            >,
 1141         -
        ) -> Self {
 1142         -
            self.dialog_map = Some(input.into());
 1143         -
            self
 1144         -
        }
 1145         -
        /// Consumes the builder and constructs a [`TopLevel`](crate::model::TopLevel).
 1146         -
        ///
 1147         -
        /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if a [`ConstraintViolation`] occurs.
 1148         -
        ///
 1149         -
        pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
 1150         -
            self.build_enforcing_all_constraints()
 1151         -
        }
 1152         -
        fn build_enforcing_all_constraints(
 1153         -
            self,
 1154         -
        ) -> Result<crate::model::TopLevel, ConstraintViolation> {
 1155         -
            Ok(crate::model::TopLevel {
 1156         -
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
 1157         -
                dialog_list: self.dialog_list.unwrap_or_default(),
 1158         -
                dialog_map: self.dialog_map.unwrap_or_default(),
 1159         -
            })
 1160         -
        }
 1161         -
    }
 1162         -
}
 1163         -
/// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
 1164         -
pub mod client_optional_defaults {
 1165    914   
 1166         -
    impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
 1167         -
        fn from(builder: Builder) -> Self {
 1168         -
            builder.build()
 1169         -
        }
 1170         -
    }
 1171         -
    /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
 1172         -
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
 1173         -
    pub struct Builder {
 1174         -
        pub(crate) member: ::std::option::Option<i32>,
 1175         -
    }
 1176         -
    impl Builder {
 1177         -
        #[allow(missing_docs)] // documentation missing in model
 1178         -
        pub fn member(mut self, input: i32) -> Self {
 1179         -
            self.member = Some(input);
 1180         -
            self
 1181         -
        }
 1182         -
        #[allow(missing_docs)] // documentation missing in model
 1183         -
        pub(crate) fn set_member(mut self, input: impl ::std::convert::Into<i32>) -> Self {
 1184         -
            self.member = Some(input.into());
 1185         -
            self
 1186         -
        }
 1187         -
        /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
 1188         -
        pub fn build(self) -> crate::model::ClientOptionalDefaults {
 1189         -
            self.build_enforcing_all_constraints()
 1190         -
        }
 1191         -
        fn build_enforcing_all_constraints(self) -> crate::model::ClientOptionalDefaults {
 1192         -
            crate::model::ClientOptionalDefaults {
 1193         -
                member: self.member.unwrap_or(0i32),
         915  +
    impl ::std::error::Error for ConstraintViolation {}
         916  +
    impl ConstraintViolation {
         917  +
        pub(crate) fn as_validation_exception_field(
         918  +
            self,
         919  +
            path: ::std::string::String,
         920  +
        ) -> crate::model::ValidationExceptionField {
         921  +
            match self {
         922  +
                Self::EnumValue(inner) => inner.as_validation_exception_field(path + "/enumValue"),
 1194    923   
            }
 1195    924   
        }
 1196    925   
    }
 1197    926   
}
 1198    927   
/// See [`Defaults`](crate::model::Defaults).
 1199    928   
pub mod defaults {
 1200    929   
 1201    930   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 1202    931   
    /// Holds one variant for each of the ways the builder can fail.
 1203    932   
    #[non_exhaustive]
@@ -1550,1279 +1774,1774 @@
 1570   1299   
        #[allow(missing_docs)] // documentation missing in model
 1571   1300   
        pub(crate) fn set_zero_short(mut self, input: impl ::std::convert::Into<i16>) -> Self {
 1572   1301   
            self.zero_short = Some(input.into());
 1573   1302   
            self
 1574   1303   
        }
 1575   1304   
        #[allow(missing_docs)] // documentation missing in model
 1576   1305   
        pub fn zero_integer(mut self, input: i32) -> Self {
 1577   1306   
            self.zero_integer = Some(input);
 1578   1307   
            self
 1579   1308   
        }
 1580         -
        #[allow(missing_docs)] // documentation missing in model
 1581         -
        pub(crate) fn set_zero_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
 1582         -
            self.zero_integer = Some(input.into());
 1583         -
            self
        1309  +
        #[allow(missing_docs)] // documentation missing in model
        1310  +
        pub(crate) fn set_zero_integer(mut self, input: impl ::std::convert::Into<i32>) -> Self {
        1311  +
            self.zero_integer = Some(input.into());
        1312  +
            self
        1313  +
        }
        1314  +
        #[allow(missing_docs)] // documentation missing in model
        1315  +
        pub fn zero_long(mut self, input: i64) -> Self {
        1316  +
            self.zero_long = Some(input);
        1317  +
            self
        1318  +
        }
        1319  +
        #[allow(missing_docs)] // documentation missing in model
        1320  +
        pub(crate) fn set_zero_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
        1321  +
            self.zero_long = Some(input.into());
        1322  +
            self
        1323  +
        }
        1324  +
        #[allow(missing_docs)] // documentation missing in model
        1325  +
        pub fn zero_float(mut self, input: f32) -> Self {
        1326  +
            self.zero_float = Some(input);
        1327  +
            self
        1328  +
        }
        1329  +
        #[allow(missing_docs)] // documentation missing in model
        1330  +
        pub(crate) fn set_zero_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
        1331  +
            self.zero_float = Some(input.into());
        1332  +
            self
        1333  +
        }
        1334  +
        #[allow(missing_docs)] // documentation missing in model
        1335  +
        pub fn zero_double(mut self, input: f64) -> Self {
        1336  +
            self.zero_double = Some(input);
        1337  +
            self
        1338  +
        }
        1339  +
        #[allow(missing_docs)] // documentation missing in model
        1340  +
        pub(crate) fn set_zero_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
        1341  +
            self.zero_double = Some(input.into());
        1342  +
            self
        1343  +
        }
        1344  +
        /// Consumes the builder and constructs a [`Defaults`](crate::model::Defaults).
        1345  +
        ///
        1346  +
        /// The builder fails to construct a [`Defaults`](crate::model::Defaults) if a [`ConstraintViolation`] occurs.
        1347  +
        ///
        1348  +
        pub fn build(self) -> Result<crate::model::Defaults, ConstraintViolation> {
        1349  +
            self.build_enforcing_all_constraints()
        1350  +
        }
        1351  +
        fn build_enforcing_all_constraints(
        1352  +
            self,
        1353  +
        ) -> Result<crate::model::Defaults, ConstraintViolation> {
        1354  +
            Ok(crate::model::Defaults {
        1355  +
                default_string: self.default_string.unwrap_or_else(|| String::from("hi")),
        1356  +
                default_boolean: self.default_boolean.unwrap_or(true),
        1357  +
                default_list: self.default_list.unwrap_or_default(),
        1358  +
                default_document_map: self.default_document_map.unwrap_or_else(|| {
        1359  +
                    ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
        1360  +
                }),
        1361  +
                default_document_string: self.default_document_string.unwrap_or_else(|| {
        1362  +
                    ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
        1363  +
                }),
        1364  +
                default_document_boolean: self
        1365  +
                    .default_document_boolean
        1366  +
                    .unwrap_or(::aws_smithy_types::Document::Bool(true)),
        1367  +
                default_document_list: self
        1368  +
                    .default_document_list
        1369  +
                    .unwrap_or_else(|| ::aws_smithy_types::Document::Array(::std::vec::Vec::new())),
        1370  +
                default_null_document: self.default_null_document,
        1371  +
                default_timestamp: self.default_timestamp.unwrap_or_else(|| {
        1372  +
                    ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)
        1373  +
                }),
        1374  +
                default_blob: self
        1375  +
                    .default_blob
        1376  +
                    .unwrap_or_else(|| ::aws_smithy_types::Blob::new("YWJj")),
        1377  +
                default_byte: self.default_byte.unwrap_or(1i8),
        1378  +
                default_short: self.default_short.unwrap_or(1i16),
        1379  +
                default_integer: self.default_integer.unwrap_or(10i32),
        1380  +
                default_long: self.default_long.unwrap_or(100i64),
        1381  +
                default_float: self.default_float.unwrap_or(1.0f32),
        1382  +
                default_double: self.default_double.unwrap_or(1.0f64),
        1383  +
                default_map: self.default_map.unwrap_or_default(),
        1384  +
                default_enum: self
        1385  +
                    .default_enum
        1386  +
                    .map(|v| match v {
        1387  +
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
        1388  +
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
        1389  +
                    })
        1390  +
                    .map(|res| res.map_err(ConstraintViolation::DefaultEnum))
        1391  +
                    .transpose()?
        1392  +
                    .unwrap_or(
        1393  +
                        "FOO"
        1394  +
                            .parse::<crate::model::TestEnum>()
        1395  +
                            .expect("static value validated to member"),
        1396  +
                    ),
        1397  +
                default_int_enum: self.default_int_enum.unwrap_or(1i32),
        1398  +
                empty_string: self.empty_string.unwrap_or_else(|| String::from("")),
        1399  +
                false_boolean: self.false_boolean.unwrap_or(false),
        1400  +
                empty_blob: self
        1401  +
                    .empty_blob
        1402  +
                    .unwrap_or_else(|| ::aws_smithy_types::Blob::new("")),
        1403  +
                zero_byte: self.zero_byte.unwrap_or(0i8),
        1404  +
                zero_short: self.zero_short.unwrap_or(0i16),
        1405  +
                zero_integer: self.zero_integer.unwrap_or(0i32),
        1406  +
                zero_long: self.zero_long.unwrap_or(0i64),
        1407  +
                zero_float: self.zero_float.unwrap_or(0.0f32),
        1408  +
                zero_double: self.zero_double.unwrap_or(0.0f64),
        1409  +
            })
        1410  +
        }
        1411  +
    }
        1412  +
}
        1413  +
/// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
        1414  +
pub mod client_optional_defaults {
        1415  +
        1416  +
    impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
        1417  +
        fn from(builder: Builder) -> Self {
        1418  +
            builder.build()
        1419  +
        }
        1420  +
    }
        1421  +
    /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
        1422  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1423  +
    pub struct Builder {
        1424  +
        pub(crate) member: ::std::option::Option<i32>,
        1425  +
    }
        1426  +
    impl Builder {
        1427  +
        #[allow(missing_docs)] // documentation missing in model
        1428  +
        pub fn member(mut self, input: i32) -> Self {
        1429  +
            self.member = Some(input);
        1430  +
            self
        1431  +
        }
        1432  +
        #[allow(missing_docs)] // documentation missing in model
        1433  +
        pub(crate) fn set_member(mut self, input: impl ::std::convert::Into<i32>) -> Self {
        1434  +
            self.member = Some(input.into());
        1435  +
            self
        1436  +
        }
        1437  +
        /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
        1438  +
        pub fn build(self) -> crate::model::ClientOptionalDefaults {
        1439  +
            self.build_enforcing_all_constraints()
        1440  +
        }
        1441  +
        fn build_enforcing_all_constraints(self) -> crate::model::ClientOptionalDefaults {
        1442  +
            crate::model::ClientOptionalDefaults {
        1443  +
                member: self.member.unwrap_or(0i32),
        1444  +
            }
        1445  +
        }
        1446  +
    }
        1447  +
}
        1448  +
/// See [`TopLevel`](crate::model::TopLevel).
        1449  +
pub mod top_level {
        1450  +
        1451  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        1452  +
    /// Holds one variant for each of the ways the builder can fail.
        1453  +
    #[non_exhaustive]
        1454  +
    #[allow(clippy::enum_variant_names)]
        1455  +
    pub enum ConstraintViolation {
        1456  +
        /// `dialog` was not provided but it is required when building `TopLevel`.
        1457  +
        MissingDialog,
        1458  +
    }
        1459  +
    impl ::std::fmt::Display for ConstraintViolation {
        1460  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1461  +
            match self {
        1462  +
                ConstraintViolation::MissingDialog => write!(
        1463  +
                    f,
        1464  +
                    "`dialog` was not provided but it is required when building `TopLevel`"
        1465  +
                ),
        1466  +
            }
        1467  +
        }
        1468  +
    }
        1469  +
    impl ::std::error::Error for ConstraintViolation {}
        1470  +
    impl ConstraintViolation {
        1471  +
        pub(crate) fn as_validation_exception_field(
        1472  +
            self,
        1473  +
            path: ::std::string::String,
        1474  +
        ) -> crate::model::ValidationExceptionField {
        1475  +
            match self {
        1476  +
            ConstraintViolation::MissingDialog => crate::model::ValidationExceptionField {
        1477  +
                                                message: format!("Value at '{}/dialog' failed to satisfy constraint: Member must not be null", path),
        1478  +
                                                path: path + "/dialog",
        1479  +
                                            },
        1480  +
        }
        1481  +
        }
        1482  +
    }
        1483  +
    impl ::std::convert::From<Builder>
        1484  +
        for crate::constrained::MaybeConstrained<crate::model::TopLevel>
        1485  +
    {
        1486  +
        fn from(builder: Builder) -> Self {
        1487  +
            Self::Unconstrained(builder)
        1488  +
        }
        1489  +
    }
        1490  +
    impl ::std::convert::TryFrom<Builder> for crate::model::TopLevel {
        1491  +
        type Error = ConstraintViolation;
        1492  +
        1493  +
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
        1494  +
            builder.build()
        1495  +
        }
        1496  +
    }
        1497  +
    /// A builder for [`TopLevel`](crate::model::TopLevel).
        1498  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1499  +
    pub struct Builder {
        1500  +
        pub(crate) dialog: ::std::option::Option<crate::model::Dialog>,
        1501  +
        pub(crate) dialog_list: ::std::option::Option<::std::vec::Vec<crate::model::Dialog>>,
        1502  +
        pub(crate) dialog_map: ::std::option::Option<
        1503  +
            ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
        1504  +
        >,
        1505  +
    }
        1506  +
    impl Builder {
        1507  +
        #[allow(missing_docs)] // documentation missing in model
        1508  +
        pub fn dialog(mut self, input: crate::model::Dialog) -> Self {
        1509  +
            self.dialog = Some(input);
        1510  +
            self
        1511  +
        }
        1512  +
        #[allow(missing_docs)] // documentation missing in model
        1513  +
        pub(crate) fn set_dialog(
        1514  +
            mut self,
        1515  +
            input: impl ::std::convert::Into<crate::model::Dialog>,
        1516  +
        ) -> Self {
        1517  +
            self.dialog = Some(input.into());
        1518  +
            self
        1519  +
        }
        1520  +
        #[allow(missing_docs)] // documentation missing in model
        1521  +
        pub fn dialog_list(mut self, input: ::std::vec::Vec<crate::model::Dialog>) -> Self {
        1522  +
            self.dialog_list = Some(input);
        1523  +
            self
        1524  +
        }
        1525  +
        #[allow(missing_docs)] // documentation missing in model
        1526  +
        pub(crate) fn set_dialog_list(
        1527  +
            mut self,
        1528  +
            input: impl ::std::convert::Into<::std::vec::Vec<crate::model::Dialog>>,
        1529  +
        ) -> Self {
        1530  +
            self.dialog_list = Some(input.into());
        1531  +
            self
        1532  +
        }
        1533  +
        #[allow(missing_docs)] // documentation missing in model
        1534  +
        pub fn dialog_map(
        1535  +
            mut self,
        1536  +
            input: ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
        1537  +
        ) -> Self {
        1538  +
            self.dialog_map = Some(input);
        1539  +
            self
        1540  +
        }
        1541  +
        #[allow(missing_docs)] // documentation missing in model
        1542  +
        pub(crate) fn set_dialog_map(
        1543  +
            mut self,
        1544  +
            input: impl ::std::convert::Into<
        1545  +
                ::std::collections::HashMap<::std::string::String, crate::model::Dialog>,
        1546  +
            >,
        1547  +
        ) -> Self {
        1548  +
            self.dialog_map = Some(input.into());
        1549  +
            self
        1550  +
        }
        1551  +
        /// Consumes the builder and constructs a [`TopLevel`](crate::model::TopLevel).
        1552  +
        ///
        1553  +
        /// The builder fails to construct a [`TopLevel`](crate::model::TopLevel) if a [`ConstraintViolation`] occurs.
        1554  +
        ///
        1555  +
        pub fn build(self) -> Result<crate::model::TopLevel, ConstraintViolation> {
        1556  +
            self.build_enforcing_all_constraints()
        1557  +
        }
        1558  +
        fn build_enforcing_all_constraints(
        1559  +
            self,
        1560  +
        ) -> Result<crate::model::TopLevel, ConstraintViolation> {
        1561  +
            Ok(crate::model::TopLevel {
        1562  +
                dialog: self.dialog.ok_or(ConstraintViolation::MissingDialog)?,
        1563  +
                dialog_list: self.dialog_list.unwrap_or_default(),
        1564  +
                dialog_map: self.dialog_map.unwrap_or_default(),
        1565  +
            })
        1566  +
        }
        1567  +
    }
        1568  +
}
        1569  +
/// See [`Dialog`](crate::model::Dialog).
        1570  +
pub mod dialog {
        1571  +
        1572  +
    impl ::std::convert::From<Builder> for crate::model::Dialog {
        1573  +
        fn from(builder: Builder) -> Self {
        1574  +
            builder.build()
 1584   1575   
        }
        1576  +
    }
        1577  +
    /// A builder for [`Dialog`](crate::model::Dialog).
        1578  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1579  +
    pub struct Builder {
        1580  +
        pub(crate) language: ::std::option::Option<::std::string::String>,
        1581  +
        pub(crate) greeting: ::std::option::Option<::std::string::String>,
        1582  +
        pub(crate) farewell: ::std::option::Option<crate::model::Farewell>,
        1583  +
    }
        1584  +
    impl Builder {
 1585   1585   
        #[allow(missing_docs)] // documentation missing in model
 1586         -
        pub fn zero_long(mut self, input: i64) -> Self {
 1587         -
            self.zero_long = Some(input);
        1586  +
        pub fn language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        1587  +
            self.language = input;
 1588   1588   
            self
 1589   1589   
        }
 1590   1590   
        #[allow(missing_docs)] // documentation missing in model
 1591         -
        pub(crate) fn set_zero_long(mut self, input: impl ::std::convert::Into<i64>) -> Self {
 1592         -
            self.zero_long = Some(input.into());
        1591  +
        pub(crate) fn set_language(
        1592  +
            mut self,
        1593  +
            input: Option<impl ::std::convert::Into<::std::string::String>>,
        1594  +
        ) -> Self {
        1595  +
            self.language = input.map(|v| v.into());
 1593   1596   
            self
 1594   1597   
        }
 1595   1598   
        #[allow(missing_docs)] // documentation missing in model
 1596         -
        pub fn zero_float(mut self, input: f32) -> Self {
 1597         -
            self.zero_float = Some(input);
        1599  +
        pub fn greeting(mut self, input: ::std::string::String) -> Self {
        1600  +
            self.greeting = Some(input);
 1598   1601   
            self
 1599   1602   
        }
 1600   1603   
        #[allow(missing_docs)] // documentation missing in model
 1601         -
        pub(crate) fn set_zero_float(mut self, input: impl ::std::convert::Into<f32>) -> Self {
 1602         -
            self.zero_float = Some(input.into());
        1604  +
        pub(crate) fn set_greeting(
        1605  +
            mut self,
        1606  +
            input: impl ::std::convert::Into<::std::string::String>,
        1607  +
        ) -> Self {
        1608  +
            self.greeting = Some(input.into());
 1603   1609   
            self
 1604   1610   
        }
 1605   1611   
        #[allow(missing_docs)] // documentation missing in model
 1606         -
        pub fn zero_double(mut self, input: f64) -> Self {
 1607         -
            self.zero_double = Some(input);
        1612  +
        pub fn farewell(mut self, input: ::std::option::Option<crate::model::Farewell>) -> Self {
        1613  +
            self.farewell = input;
 1608   1614   
            self
 1609   1615   
        }
 1610   1616   
        #[allow(missing_docs)] // documentation missing in model
 1611         -
        pub(crate) fn set_zero_double(mut self, input: impl ::std::convert::Into<f64>) -> Self {
 1612         -
            self.zero_double = Some(input.into());
        1617  +
        pub(crate) fn set_farewell(
        1618  +
            mut self,
        1619  +
            input: Option<impl ::std::convert::Into<crate::model::Farewell>>,
        1620  +
        ) -> Self {
        1621  +
            self.farewell = input.map(|v| v.into());
 1613   1622   
            self
 1614   1623   
        }
 1615         -
        /// Consumes the builder and constructs a [`Defaults`](crate::model::Defaults).
 1616         -
        ///
 1617         -
        /// The builder fails to construct a [`Defaults`](crate::model::Defaults) if a [`ConstraintViolation`] occurs.
 1618         -
        ///
 1619         -
        pub fn build(self) -> Result<crate::model::Defaults, ConstraintViolation> {
        1624  +
        /// Consumes the builder and constructs a [`Dialog`](crate::model::Dialog).
        1625  +
        pub fn build(self) -> crate::model::Dialog {
 1620   1626   
            self.build_enforcing_all_constraints()
 1621   1627   
        }
 1622         -
        fn build_enforcing_all_constraints(
 1623         -
            self,
 1624         -
        ) -> Result<crate::model::Defaults, ConstraintViolation> {
 1625         -
            Ok(crate::model::Defaults {
 1626         -
                default_string: self.default_string.unwrap_or_else(|| String::from("hi")),
 1627         -
                default_boolean: self.default_boolean.unwrap_or(true),
 1628         -
                default_list: self.default_list.unwrap_or_default(),
 1629         -
                default_document_map: self.default_document_map.unwrap_or_else(|| {
 1630         -
                    ::aws_smithy_types::Document::Object(::std::collections::HashMap::new())
 1631         -
                }),
 1632         -
                default_document_string: self.default_document_string.unwrap_or_else(|| {
 1633         -
                    ::aws_smithy_types::Document::String(::std::string::String::from("hi"))
 1634         -
                }),
 1635         -
                default_document_boolean: self
 1636         -
                    .default_document_boolean
 1637         -
                    .unwrap_or(::aws_smithy_types::Document::Bool(true)),
 1638         -
                default_document_list: self
 1639         -
                    .default_document_list
 1640         -
                    .unwrap_or_else(|| ::aws_smithy_types::Document::Array(::std::vec::Vec::new())),
 1641         -
                default_null_document: self.default_null_document,
 1642         -
                default_timestamp: self.default_timestamp.unwrap_or_else(|| {
 1643         -
                    ::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)
 1644         -
                }),
 1645         -
                default_blob: self
 1646         -
                    .default_blob
 1647         -
                    .unwrap_or_else(|| ::aws_smithy_types::Blob::new("YWJj")),
 1648         -
                default_byte: self.default_byte.unwrap_or(1i8),
 1649         -
                default_short: self.default_short.unwrap_or(1i16),
 1650         -
                default_integer: self.default_integer.unwrap_or(10i32),
 1651         -
                default_long: self.default_long.unwrap_or(100i64),
 1652         -
                default_float: self.default_float.unwrap_or(1.0f32),
 1653         -
                default_double: self.default_double.unwrap_or(1.0f64),
 1654         -
                default_map: self.default_map.unwrap_or_default(),
 1655         -
                default_enum: self
 1656         -
                    .default_enum
 1657         -
                    .map(|v| match v {
 1658         -
                        crate::constrained::MaybeConstrained::Constrained(x) => Ok(x),
 1659         -
                        crate::constrained::MaybeConstrained::Unconstrained(x) => x.try_into(),
 1660         -
                    })
 1661         -
                    .map(|res| res.map_err(ConstraintViolation::DefaultEnum))
 1662         -
                    .transpose()?
 1663         -
                    .unwrap_or(
 1664         -
                        "FOO"
 1665         -
                            .parse::<crate::model::TestEnum>()
 1666         -
                            .expect("static value validated to member"),
 1667         -
                    ),
 1668         -
                default_int_enum: self.default_int_enum.unwrap_or(1i32),
 1669         -
                empty_string: self.empty_string.unwrap_or_else(|| String::from("")),
 1670         -
                false_boolean: self.false_boolean.unwrap_or(false),
 1671         -
                empty_blob: self
 1672         -
                    .empty_blob
 1673         -
                    .unwrap_or_else(|| ::aws_smithy_types::Blob::new("")),
 1674         -
                zero_byte: self.zero_byte.unwrap_or(0i8),
 1675         -
                zero_short: self.zero_short.unwrap_or(0i16),
 1676         -
                zero_integer: self.zero_integer.unwrap_or(0i32),
 1677         -
                zero_long: self.zero_long.unwrap_or(0i64),
 1678         -
                zero_float: self.zero_float.unwrap_or(0.0f32),
 1679         -
                zero_double: self.zero_double.unwrap_or(0.0f64),
 1680         -
            })
 1681         -
        }
 1682         -
    }
 1683         -
}
 1684         -
pub mod my_union {
 1685         -
 1686         -
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
 1687         -
    #[allow(clippy::enum_variant_names)]
 1688         -
    pub enum ConstraintViolation {
 1689         -
        EnumValue(crate::model::foo_enum::ConstraintViolation),
 1690         -
    }
 1691         -
    impl ::std::fmt::Display for ConstraintViolation {
 1692         -
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 1693         -
            match self {
 1694         -
                Self::EnumValue(inner) => write!(f, "{inner}"),
 1695         -
            }
 1696         -
        }
 1697         -
    }
 1698         -
 1699         -
    impl ::std::error::Error for ConstraintViolation {}
 1700         -
    impl ConstraintViolation {
 1701         -
        pub(crate) fn as_validation_exception_field(
 1702         -
            self,
 1703         -
            path: ::std::string::String,
 1704         -
        ) -> crate::model::ValidationExceptionField {
 1705         -
            match self {
 1706         -
                Self::EnumValue(inner) => inner.as_validation_exception_field(path + "/enumValue"),
        1628  +
        fn build_enforcing_all_constraints(self) -> crate::model::Dialog {
        1629  +
            crate::model::Dialog {
        1630  +
                language: self.language,
        1631  +
                greeting: self.greeting.unwrap_or_else(|| String::from("hi")),
        1632  +
                farewell: self.farewell,
 1707   1633   
            }
 1708   1634   
        }
 1709   1635   
    }
 1710   1636   
}
 1711   1637   
/// See [`GreetingStruct`](crate::model::GreetingStruct).
 1712   1638   
pub mod greeting_struct {
 1713   1639   
 1714   1640   
    impl ::std::convert::From<Builder> for crate::model::GreetingStruct {
 1715   1641   
        fn from(builder: Builder) -> Self {
 1716   1642   
            builder.build()
 1717   1643   
        }
 1718   1644   
    }
 1719   1645   
    /// A builder for [`GreetingStruct`](crate::model::GreetingStruct).
 1720   1646   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
 1721   1647   
    pub struct Builder {
 1722   1648   
        pub(crate) hi: ::std::option::Option<::std::string::String>,
 1723   1649   
    }
 1724   1650   
    impl Builder {
 1725   1651   
        #[allow(missing_docs)] // documentation missing in model
 1726   1652   
        pub fn hi(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
 1727   1653   
            self.hi = input;
 1728   1654   
            self
 1729   1655   
        }
 1730   1656   
        #[allow(missing_docs)] // documentation missing in model
 1731   1657   
        pub(crate) fn set_hi(
 1732   1658   
            mut self,
 1733   1659   
            input: Option<impl ::std::convert::Into<::std::string::String>>,
 1734   1660   
        ) -> Self {
 1735   1661   
            self.hi = input.map(|v| v.into());
 1736   1662   
            self
 1737   1663   
        }
 1738   1664   
        /// Consumes the builder and constructs a [`GreetingStruct`](crate::model::GreetingStruct).
 1739   1665   
        pub fn build(self) -> crate::model::GreetingStruct {
 1740   1666   
            self.build_enforcing_all_constraints()
 1741   1667   
        }
 1742   1668   
        fn build_enforcing_all_constraints(self) -> crate::model::GreetingStruct {
 1743   1669   
            crate::model::GreetingStruct { hi: self.hi }
 1744   1670   
        }
 1745   1671   
    }
 1746   1672   
}
 1747         -
/// See [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
 1748         -
pub mod complex_nested_error_data {
        1673  +
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
        1674  +
pub mod validation_exception_field {
 1749   1675   
 1750         -
    impl ::std::convert::From<Builder> for crate::model::ComplexNestedErrorData {
        1676  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
        1677  +
    /// Holds one variant for each of the ways the builder can fail.
        1678  +
    #[non_exhaustive]
        1679  +
    #[allow(clippy::enum_variant_names)]
        1680  +
    pub enum ConstraintViolation {
        1681  +
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
        1682  +
        MissingPath,
        1683  +
        /// `message` was not provided but it is required when building `ValidationExceptionField`.
        1684  +
        MissingMessage,
        1685  +
    }
        1686  +
    impl ::std::fmt::Display for ConstraintViolation {
        1687  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        1688  +
            match self {
        1689  +
                ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
        1690  +
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
        1691  +
            }
        1692  +
        }
        1693  +
    }
        1694  +
    impl ::std::error::Error for ConstraintViolation {}
        1695  +
    impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
        1696  +
        type Error = ConstraintViolation;
        1697  +
        1698  +
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
        1699  +
            builder.build()
        1700  +
        }
        1701  +
    }
        1702  +
    /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
        1703  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
        1704  +
    pub struct Builder {
        1705  +
        pub(crate) path: ::std::option::Option<::std::string::String>,
        1706  +
        pub(crate) message: ::std::option::Option<::std::string::String>,
        1707  +
    }
        1708  +
    impl Builder {
        1709  +
        /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
        1710  +
        pub fn path(mut self, input: ::std::string::String) -> Self {
        1711  +
            self.path = Some(input);
        1712  +
            self
        1713  +
        }
        1714  +
        /// A detailed description of the validation failure.
        1715  +
        pub fn message(mut self, input: ::std::string::String) -> Self {
        1716  +
            self.message = Some(input);
        1717  +
            self
        1718  +
        }
        1719  +
        /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
        1720  +
        ///
        1721  +
        /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
        1722  +
        ///
        1723  +
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
        1724  +
        pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
        1725  +
            self.build_enforcing_all_constraints()
        1726  +
        }
        1727  +
        fn build_enforcing_all_constraints(
        1728  +
            self,
        1729  +
        ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
        1730  +
            Ok(crate::model::ValidationExceptionField {
        1731  +
                path: self.path.ok_or(ConstraintViolation::MissingPath)?,
        1732  +
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
        1733  +
            })
        1734  +
        }
        1735  +
    }
        1736  +
}
        1737  +
/// See [`Farewell`](crate::model::Farewell).
        1738  +
pub mod farewell {
        1739  +
        1740  +
    impl ::std::convert::From<Builder> for crate::model::Farewell {
 1751   1741   
        fn from(builder: Builder) -> Self {
 1752   1742   
            builder.build()
 1753   1743   
        }
 1754   1744   
    }
 1755         -
    /// A builder for [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
        1745  +
    /// A builder for [`Farewell`](crate::model::Farewell).
 1756   1746   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
 1757   1747   
    pub struct Builder {
 1758         -
        pub(crate) foo: ::std::option::Option<::std::string::String>,
        1748  +
        pub(crate) phrase: ::std::option::Option<::std::string::String>,
 1759   1749   
    }
 1760   1750   
    impl Builder {
 1761   1751   
        #[allow(missing_docs)] // documentation missing in model
 1762         -
        pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
 1763         -
            self.foo = input;
        1752  +
        pub fn phrase(mut self, input: ::std::string::String) -> Self {
        1753  +
            self.phrase = Some(input);
 1764   1754   
            self
 1765   1755   
        }
 1766         -
        /// Consumes the builder and constructs a [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
 1767         -
        pub fn build(self) -> crate::model::ComplexNestedErrorData {
        1756  +
        #[allow(missing_docs)] // documentation missing in model
        1757  +
        pub(crate) fn set_phrase(
        1758  +
            mut self,
        1759  +
            input: impl ::std::convert::Into<::std::string::String>,
        1760  +
        ) -> Self {
        1761  +
            self.phrase = Some(input.into());
        1762  +
            self
        1763  +
        }
        1764  +
        /// Consumes the builder and constructs a [`Farewell`](crate::model::Farewell).
        1765  +
        pub fn build(self) -> crate::model::Farewell {
 1768   1766   
            self.build_enforcing_all_constraints()
 1769   1767   
        }
 1770         -
        fn build_enforcing_all_constraints(self) -> crate::model::ComplexNestedErrorData {
 1771         -
            crate::model::ComplexNestedErrorData { foo: self.foo }
        1768  +
        fn build_enforcing_all_constraints(self) -> crate::model::Farewell {
        1769  +
            crate::model::Farewell {
        1770  +
                phrase: self.phrase.unwrap_or_else(|| String::from("bye")),
        1771  +
            }
 1772   1772   
        }
 1773   1773   
    }
 1774   1774   
}