1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - |
|
3 - | /// Describes one specific validation failure for an input member.
|
2 + | #[allow(missing_docs)] // documentation missing in model
|
3 + | ///
|
4 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
5 + | /// [constraint traits]. Use [`StringSet::try_from`] to construct values of this type.
|
6 + | ///
|
7 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
8 + | ///
|
4 9 | #[derive(
|
5 10 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
6 11 | )]
|
7 - | pub struct ValidationExceptionField {
|
8 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
9 - | pub path: ::std::string::String,
|
10 - | /// A detailed description of the validation failure.
|
11 - | pub message: ::std::string::String,
|
12 - | }
|
13 - | impl ValidationExceptionField {
|
14 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
15 - | pub fn path(&self) -> &str {
|
16 - | use std::ops::Deref;
|
17 - | self.path.deref()
|
18 - | }
|
19 - | /// A detailed description of the validation failure.
|
20 - | pub fn message(&self) -> &str {
|
21 - | use std::ops::Deref;
|
22 - | self.message.deref()
|
12 + | pub struct StringSet(pub(crate) ::std::vec::Vec<::std::string::String>);
|
13 + | impl StringSet {
|
14 + | /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::string::String>`].
|
15 + | pub fn inner(&self) -> &::std::vec::Vec<::std::string::String> {
|
16 + | &self.0
|
23 17 | }
|
24 - | }
|
25 - | impl ValidationExceptionField {
|
26 - | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
27 - | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
28 - | crate::model::validation_exception_field::Builder::default()
|
18 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::string::String>`].
|
19 + | pub fn into_inner(self) -> ::std::vec::Vec<::std::string::String> {
|
20 + | self.0
|
29 21 | }
|
30 - | }
|
31 - |
|
32 - | #[allow(missing_docs)] // documentation missing in model
|
33 - | #[derive(
|
34 - | ::std::clone::Clone,
|
35 - | ::std::cmp::Eq,
|
36 - | ::std::cmp::Ord,
|
37 - | ::std::cmp::PartialEq,
|
38 - | ::std::cmp::PartialOrd,
|
39 - | ::std::fmt::Debug,
|
40 - | ::std::hash::Hash,
|
41 - | )]
|
42 - | pub enum TestEnum {
|
43 - | #[allow(missing_docs)] // documentation missing in model
|
44 - | Bar,
|
45 - | #[allow(missing_docs)] // documentation missing in model
|
46 - | Baz,
|
47 - | #[allow(missing_docs)] // documentation missing in model
|
48 - | Foo,
|
49 - | }
|
50 - | /// See [`TestEnum`](crate::model::TestEnum).
|
51 - | pub mod test_enum {
|
52 - | #[derive(Debug, PartialEq)]
|
53 - | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
54 22 |
|
55 - | impl ::std::fmt::Display for ConstraintViolation {
|
56 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
57 - | write!(
|
58 - | f,
|
59 - | r#"Value provided for 'smithy.protocoltests.rpcv2Cbor#TestEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
|
60 - | )
|
23 + | fn check_unique_items(
|
24 + | items: ::std::vec::Vec<::std::string::String>,
|
25 + | ) -> ::std::result::Result<
|
26 + | ::std::vec::Vec<::std::string::String>,
|
27 + | crate::model::string_set::ConstraintViolation,
|
28 + | > {
|
29 + | let mut seen = ::std::collections::HashMap::new();
|
30 + | let mut duplicate_indices = ::std::vec::Vec::new();
|
31 + | for (idx, item) in items.iter().enumerate() {
|
32 + | if let Some(prev_idx) = seen.insert(item, idx) {
|
33 + | duplicate_indices.push(prev_idx);
|
34 + | }
|
61 35 | }
|
62 - | }
|
63 36 |
|
64 - | impl ::std::error::Error for ConstraintViolation {}
|
65 - | impl ConstraintViolation {
|
66 - | pub(crate) fn as_validation_exception_field(
|
67 - | self,
|
68 - | path: ::std::string::String,
|
69 - | ) -> crate::model::ValidationExceptionField {
|
70 - | crate::model::ValidationExceptionField {
|
71 - | message: format!(
|
72 - | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
|
73 - | &path
|
74 - | ),
|
75 - | path,
|
37 + | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
38 + | for idx in &duplicate_indices {
|
39 + | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
40 + | last_duplicate_indices.push(prev_idx);
|
76 41 | }
|
77 42 | }
|
78 - | }
|
79 - | }
|
80 - | impl ::std::convert::TryFrom<&str> for TestEnum {
|
81 - | type Error = crate::model::test_enum::ConstraintViolation;
|
82 - | fn try_from(
|
83 - | s: &str,
|
84 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
85 - | match s {
|
86 - | "BAR" => Ok(TestEnum::Bar),
|
87 - | "BAZ" => Ok(TestEnum::Baz),
|
88 - | "FOO" => Ok(TestEnum::Foo),
|
89 - | _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
|
43 + | duplicate_indices.extend(last_duplicate_indices);
|
44 + |
|
45 + | if !duplicate_indices.is_empty() {
|
46 + | debug_assert!(duplicate_indices.len() >= 2);
|
47 + | Err(crate::model::string_set::ConstraintViolation::UniqueItems {
|
48 + | duplicate_indices,
|
49 + | original: items,
|
50 + | })
|
51 + | } else {
|
52 + | Ok(items)
|
90 53 | }
|
91 54 | }
|
92 55 | }
|
93 - | impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
|
94 - | type Error = crate::model::test_enum::ConstraintViolation;
|
56 + | impl ::std::convert::TryFrom<::std::vec::Vec<::std::string::String>> for StringSet {
|
57 + | type Error = crate::model::string_set::ConstraintViolation;
|
58 + |
|
59 + | /// Constructs a `StringSet` from an [`::std::vec::Vec<::std::string::String>`], failing when the provided value does not satisfy the modeled constraints.
|
95 60 | fn try_from(
|
96 - | s: ::std::string::String,
|
97 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
98 - | {
|
99 - | s.as_str().try_into()
|
61 + | value: ::std::vec::Vec<::std::string::String>,
|
62 + | ) -> ::std::result::Result<Self, Self::Error> {
|
63 + | let value = Self::check_unique_items(value)?;
|
64 + |
|
65 + | Ok(Self(value))
|
100 66 | }
|
101 67 | }
|
102 - | impl std::str::FromStr for TestEnum {
|
103 - | type Err = crate::model::test_enum::ConstraintViolation;
|
104 - | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
105 - | Self::try_from(s)
|
68 + |
|
69 + | impl ::std::convert::From<StringSet> for ::std::vec::Vec<::std::string::String> {
|
70 + | fn from(value: StringSet) -> Self {
|
71 + | value.into_inner()
|
106 72 | }
|
107 73 | }
|
108 - | impl TestEnum {
|
109 - | /// Returns the `&str` value of the enum member.
|
110 - | pub fn as_str(&self) -> &str {
|
111 - | match self {
|
112 - | TestEnum::Bar => "BAR",
|
113 - | TestEnum::Baz => "BAZ",
|
114 - | TestEnum::Foo => "FOO",
|
115 - | }
|
74 + | impl crate::constrained::Constrained for StringSet {
|
75 + | type Unconstrained = crate::unconstrained::string_set_unconstrained::StringSetUnconstrained;
|
76 + | }
|
77 + |
|
78 + | #[allow(missing_docs)] // documentation missing in model
|
79 + | #[derive(
|
80 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
81 + | )]
|
82 + | pub struct RecursiveShapesInputOutputNested1 {
|
83 + | #[allow(missing_docs)] // documentation missing in model
|
84 + | pub foo: ::std::option::Option<::std::string::String>,
|
85 + | #[allow(missing_docs)] // documentation missing in model
|
86 + | pub nested:
|
87 + | ::std::option::Option<::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>>,
|
88 + | }
|
89 + | impl RecursiveShapesInputOutputNested1 {
|
90 + | #[allow(missing_docs)] // documentation missing in model
|
91 + | pub fn foo(&self) -> ::std::option::Option<&str> {
|
92 + | self.foo.as_deref()
|
116 93 | }
|
117 - | /// Returns all the `&str` representations of the enum members.
|
118 - | pub const fn values() -> &'static [&'static str] {
|
119 - | &["BAR", "BAZ", "FOO"]
|
94 + | #[allow(missing_docs)] // documentation missing in model
|
95 + | pub fn nested(
|
96 + | &self,
|
97 + | ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested2> {
|
98 + | self.nested.as_deref()
|
120 99 | }
|
121 100 | }
|
122 - | impl ::std::convert::AsRef<str> for TestEnum {
|
123 - | fn as_ref(&self) -> &str {
|
124 - | self.as_str()
|
101 + | impl RecursiveShapesInputOutputNested1 {
|
102 + | /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
103 + | pub fn builder() -> crate::model::recursive_shapes_input_output_nested1::Builder {
|
104 + | crate::model::recursive_shapes_input_output_nested1::Builder::default()
|
125 105 | }
|
126 106 | }
|
127 - | impl crate::constrained::Constrained for TestEnum {
|
128 - | type Unconstrained = ::std::string::String;
|
129 - | }
|
130 - |
|
131 - | impl ::std::convert::From<::std::string::String>
|
132 - | for crate::constrained::MaybeConstrained<crate::model::TestEnum>
|
133 - | {
|
134 - | fn from(value: ::std::string::String) -> Self {
|
135 - | Self::Unconstrained(value)
|
136 - | }
|
107 + | impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested1 {
|
108 + | type Unconstrained = crate::model::recursive_shapes_input_output_nested1::Builder;
|
137 109 | }
|
138 110 |
|
139 111 | #[allow(missing_docs)] // documentation missing in model
|
140 112 | #[derive(
|
141 113 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
142 114 | )]
|
143 - | pub struct ClientOptionalDefaults {
|
115 + | pub struct ComplexNestedErrorData {
|
144 116 | #[allow(missing_docs)] // documentation missing in model
|
145 - | pub member: i32,
|
117 + | pub foo: ::std::option::Option<::std::string::String>,
|
146 118 | }
|
147 - | impl ClientOptionalDefaults {
|
119 + | impl ComplexNestedErrorData {
|
148 120 | #[allow(missing_docs)] // documentation missing in model
|
149 - | pub fn member(&self) -> i32 {
|
150 - | self.member
|
121 + | pub fn foo(&self) -> ::std::option::Option<&str> {
|
122 + | self.foo.as_deref()
|
151 123 | }
|
152 124 | }
|
153 - | impl ClientOptionalDefaults {
|
154 - | /// Creates a new builder-style object to manufacture [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
155 - | pub fn builder() -> crate::model::client_optional_defaults::Builder {
|
156 - | crate::model::client_optional_defaults::Builder::default()
|
125 + | impl ComplexNestedErrorData {
|
126 + | /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
127 + | pub fn builder() -> crate::model::complex_nested_error_data::Builder {
|
128 + | crate::model::complex_nested_error_data::Builder::default()
|
157 129 | }
|
158 130 | }
|
159 - | impl crate::constrained::Constrained for crate::model::ClientOptionalDefaults {
|
160 - | type Unconstrained = crate::model::client_optional_defaults::Builder;
|
161 - | }
|
162 131 |
|
163 132 | #[allow(missing_docs)] // documentation missing in model
|
164 133 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
165 134 | pub struct Defaults {
|
166 135 | #[allow(missing_docs)] // documentation missing in model
|
167 136 | pub default_string: ::std::string::String,
|
168 137 | #[allow(missing_docs)] // documentation missing in model
|
169 138 | pub default_boolean: bool,
|
170 139 | #[allow(missing_docs)] // documentation missing in model
|
171 140 | pub default_list: ::std::vec::Vec<::std::string::String>,
|
316 285 | }
|
317 286 | }
|
318 287 | impl crate::constrained::Constrained for crate::model::Defaults {
|
319 288 | type Unconstrained = crate::model::defaults::Builder;
|
320 289 | }
|
321 290 |
|
322 291 | #[allow(missing_docs)] // documentation missing in model
|
323 292 | #[derive(
|
324 293 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
325 294 | )]
|
326 - | pub struct ComplexNestedErrorData {
|
295 + | pub struct ClientOptionalDefaults {
|
327 296 | #[allow(missing_docs)] // documentation missing in model
|
328 - | pub foo: ::std::option::Option<::std::string::String>,
|
297 + | pub member: i32,
|
329 298 | }
|
330 - | impl ComplexNestedErrorData {
|
299 + | impl ClientOptionalDefaults {
|
331 300 | #[allow(missing_docs)] // documentation missing in model
|
332 - | pub fn foo(&self) -> ::std::option::Option<&str> {
|
333 - | self.foo.as_deref()
|
301 + | pub fn member(&self) -> i32 {
|
302 + | self.member
|
334 303 | }
|
335 304 | }
|
336 - | impl ComplexNestedErrorData {
|
337 - | /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
338 - | pub fn builder() -> crate::model::complex_nested_error_data::Builder {
|
339 - | crate::model::complex_nested_error_data::Builder::default()
|
305 + | impl ClientOptionalDefaults {
|
306 + | /// Creates a new builder-style object to manufacture [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
307 + | pub fn builder() -> crate::model::client_optional_defaults::Builder {
|
308 + | crate::model::client_optional_defaults::Builder::default()
|
340 309 | }
|
341 310 | }
|
311 + | impl crate::constrained::Constrained for crate::model::ClientOptionalDefaults {
|
312 + | type Unconstrained = crate::model::client_optional_defaults::Builder;
|
313 + | }
|
342 314 |
|
343 315 | #[allow(missing_docs)] // documentation missing in model
|
344 316 | #[derive(
|
345 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
317 + | ::std::clone::Clone,
|
318 + | ::std::cmp::Eq,
|
319 + | ::std::cmp::Ord,
|
320 + | ::std::cmp::PartialEq,
|
321 + | ::std::cmp::PartialOrd,
|
322 + | ::std::fmt::Debug,
|
323 + | ::std::hash::Hash,
|
346 324 | )]
|
347 - | pub struct RecursiveShapesInputOutputNested1 {
|
325 + | pub enum TestEnum {
|
348 326 | #[allow(missing_docs)] // documentation missing in model
|
349 - | pub foo: ::std::option::Option<::std::string::String>,
|
327 + | Bar,
|
350 328 | #[allow(missing_docs)] // documentation missing in model
|
351 - | pub nested:
|
352 - | ::std::option::Option<::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>>,
|
353 - | }
|
354 - | impl RecursiveShapesInputOutputNested1 {
|
329 + | Baz,
|
355 330 | #[allow(missing_docs)] // documentation missing in model
|
356 - | pub fn foo(&self) -> ::std::option::Option<&str> {
|
357 - | self.foo.as_deref()
|
358 - | }
|
359 - | #[allow(missing_docs)] // documentation missing in model
|
360 - | pub fn nested(
|
361 - | &self,
|
362 - | ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested2> {
|
363 - | self.nested.as_deref()
|
364 - | }
|
365 - | }
|
366 - | impl RecursiveShapesInputOutputNested1 {
|
367 - | /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
368 - | pub fn builder() -> crate::model::recursive_shapes_input_output_nested1::Builder {
|
369 - | crate::model::recursive_shapes_input_output_nested1::Builder::default()
|
370 - | }
|
371 - | }
|
372 - | impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested1 {
|
373 - | type Unconstrained = crate::model::recursive_shapes_input_output_nested1::Builder;
|
374 - | }
|
375 - |
|
376 - | #[allow(missing_docs)] // documentation missing in model
|
377 - | #[derive(
|
378 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
379 - | )]
|
380 - | pub struct RecursiveShapesInputOutputNested2 {
|
381 - | #[allow(missing_docs)] // documentation missing in model
|
382 - | pub bar: ::std::option::Option<::std::string::String>,
|
383 - | #[allow(missing_docs)] // documentation missing in model
|
384 - | pub recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
385 - | }
|
386 - | impl RecursiveShapesInputOutputNested2 {
|
387 - | #[allow(missing_docs)] // documentation missing in model
|
388 - | pub fn bar(&self) -> ::std::option::Option<&str> {
|
389 - | self.bar.as_deref()
|
390 - | }
|
391 - | #[allow(missing_docs)] // documentation missing in model
|
392 - | pub fn recursive_member(
|
393 - | &self,
|
394 - | ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested1> {
|
395 - | self.recursive_member.as_ref()
|
396 - | }
|
397 - | }
|
398 - | impl RecursiveShapesInputOutputNested2 {
|
399 - | /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
400 - | pub fn builder() -> crate::model::recursive_shapes_input_output_nested2::Builder {
|
401 - | crate::model::recursive_shapes_input_output_nested2::Builder::default()
|
402 - | }
|
403 - | }
|
404 - | impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested2 {
|
405 - | type Unconstrained = crate::model::recursive_shapes_input_output_nested2::Builder;
|
331 + | Foo,
|
406 332 | }
|
333 + | /// See [`TestEnum`](crate::model::TestEnum).
|
334 + | pub mod test_enum {
|
335 + | #[derive(Debug, PartialEq)]
|
336 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
407 337 |
|
408 - | #[allow(missing_docs)] // documentation missing in model
|
409 - | ///
|
410 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
411 - | /// [constraint traits]. Use [`StringSet::try_from`] to construct values of this type.
|
412 - | ///
|
413 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
414 - | ///
|
415 - | #[derive(
|
416 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
417 - | )]
|
418 - | pub struct StringSet(pub(crate) ::std::vec::Vec<::std::string::String>);
|
419 - | impl StringSet {
|
420 - | /// Returns an immutable reference to the underlying [`::std::vec::Vec<::std::string::String>`].
|
421 - | pub fn inner(&self) -> &::std::vec::Vec<::std::string::String> {
|
422 - | &self.0
|
423 - | }
|
424 - | /// Consumes the value, returning the underlying [`::std::vec::Vec<::std::string::String>`].
|
425 - | pub fn into_inner(self) -> ::std::vec::Vec<::std::string::String> {
|
426 - | self.0
|
427 - | }
|
428 - |
|
429 - | fn check_unique_items(
|
430 - | items: ::std::vec::Vec<::std::string::String>,
|
431 - | ) -> ::std::result::Result<
|
432 - | ::std::vec::Vec<::std::string::String>,
|
433 - | crate::model::string_set::ConstraintViolation,
|
434 - | > {
|
435 - | let mut seen = ::std::collections::HashMap::new();
|
436 - | let mut duplicate_indices = ::std::vec::Vec::new();
|
437 - | for (idx, item) in items.iter().enumerate() {
|
438 - | if let Some(prev_idx) = seen.insert(item, idx) {
|
439 - | duplicate_indices.push(prev_idx);
|
440 - | }
|
338 + | impl ::std::fmt::Display for ConstraintViolation {
|
339 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
340 + | write!(
|
341 + | f,
|
342 + | r#"Value provided for 'smithy.protocoltests.rpcv2Cbor#TestEnum' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#
|
343 + | )
|
441 344 | }
|
345 + | }
|
442 346 |
|
443 - | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
444 - | for idx in &duplicate_indices {
|
445 - | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
446 - | last_duplicate_indices.push(prev_idx);
|
347 + | impl ::std::error::Error for ConstraintViolation {}
|
348 + | impl ConstraintViolation {
|
349 + | pub(crate) fn as_validation_exception_field(
|
350 + | self,
|
351 + | path: ::std::string::String,
|
352 + | ) -> crate::model::ValidationExceptionField {
|
353 + | crate::model::ValidationExceptionField {
|
354 + | message: format!(
|
355 + | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [FOO, BAR, BAZ]"#,
|
356 + | &path
|
357 + | ),
|
358 + | path,
|
447 359 | }
|
448 360 | }
|
449 - | duplicate_indices.extend(last_duplicate_indices);
|
450 - |
|
451 - | if !duplicate_indices.is_empty() {
|
452 - | debug_assert!(duplicate_indices.len() >= 2);
|
453 - | Err(crate::model::string_set::ConstraintViolation::UniqueItems {
|
454 - | duplicate_indices,
|
455 - | original: items,
|
456 - | })
|
457 - | } else {
|
458 - | Ok(items)
|
459 - | }
|
460 361 | }
|
461 362 | }
|
462 - | impl ::std::convert::TryFrom<::std::vec::Vec<::std::string::String>> for StringSet {
|
463 - | type Error = crate::model::string_set::ConstraintViolation;
|
464 - |
|
465 - | /// Constructs a `StringSet` from an [`::std::vec::Vec<::std::string::String>`], failing when the provided value does not satisfy the modeled constraints.
|
363 + | impl ::std::convert::TryFrom<&str> for TestEnum {
|
364 + | type Error = crate::model::test_enum::ConstraintViolation;
|
466 365 | fn try_from(
|
467 - | value: ::std::vec::Vec<::std::string::String>,
|
468 - | ) -> ::std::result::Result<Self, Self::Error> {
|
469 - | let value = Self::check_unique_items(value)?;
|
470 - |
|
471 - | Ok(Self(value))
|
366 + | s: &str,
|
367 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
368 + | match s {
|
369 + | "BAR" => Ok(TestEnum::Bar),
|
370 + | "BAZ" => Ok(TestEnum::Baz),
|
371 + | "FOO" => Ok(TestEnum::Foo),
|
372 + | _ => Err(crate::model::test_enum::ConstraintViolation(s.to_owned())),
|
373 + | }
|
472 374 | }
|
473 375 | }
|
474 - |
|
475 - | impl ::std::convert::From<StringSet> for ::std::vec::Vec<::std::string::String> {
|
476 - | fn from(value: StringSet) -> Self {
|
477 - | value.into_inner()
|
376 + | impl ::std::convert::TryFrom<::std::string::String> for TestEnum {
|
377 + | type Error = crate::model::test_enum::ConstraintViolation;
|
378 + | fn try_from(
|
379 + | s: ::std::string::String,
|
380 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
381 + | {
|
382 + | s.as_str().try_into()
|
478 383 | }
|
479 384 | }
|
480 - | impl crate::constrained::Constrained for StringSet {
|
481 - | type Unconstrained = crate::unconstrained::string_set_unconstrained::StringSetUnconstrained;
|
482 - | }
|
483 - |
|
484 - | #[allow(missing_docs)] // documentation missing in model
|
485 - | #[derive(
|
486 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
487 - | )]
|
488 - | pub struct GreetingStruct {
|
489 - | #[allow(missing_docs)] // documentation missing in model
|
490 - | pub hi: ::std::option::Option<::std::string::String>,
|
385 + | impl std::str::FromStr for TestEnum {
|
386 + | type Err = crate::model::test_enum::ConstraintViolation;
|
387 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
388 + | Self::try_from(s)
|
389 + | }
|
491 390 | }
|
492 - | impl GreetingStruct {
|
493 - | #[allow(missing_docs)] // documentation missing in model
|
494 - | pub fn hi(&self) -> ::std::option::Option<&str> {
|
495 - | self.hi.as_deref()
|
391 + | impl TestEnum {
|
392 + | /// Returns the `&str` value of the enum member.
|
393 + | pub fn as_str(&self) -> &str {
|
394 + | match self {
|
395 + | TestEnum::Bar => "BAR",
|
396 + | TestEnum::Baz => "BAZ",
|
397 + | TestEnum::Foo => "FOO",
|
398 + | }
|
399 + | }
|
400 + | /// Returns all the `&str` representations of the enum members.
|
401 + | pub const fn values() -> &'static [&'static str] {
|
402 + | &["BAR", "BAZ", "FOO"]
|
496 403 | }
|
497 404 | }
|
498 - | impl GreetingStruct {
|
499 - | /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
|
500 - | pub fn builder() -> crate::model::greeting_struct::Builder {
|
501 - | crate::model::greeting_struct::Builder::default()
|
405 + | impl ::std::convert::AsRef<str> for TestEnum {
|
406 + | fn as_ref(&self) -> &str {
|
407 + | self.as_str()
|
502 408 | }
|
503 409 | }
|
504 - | impl crate::constrained::Constrained for crate::model::GreetingStruct {
|
505 - | type Unconstrained = crate::model::greeting_struct::Builder;
|
410 + | impl crate::constrained::Constrained for TestEnum {
|
411 + | type Unconstrained = ::std::string::String;
|
506 412 | }
|
507 413 |
|
508 - | #[allow(missing_docs)] // documentation missing in model
|
509 - | #[derive(
|
510 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
511 - | )]
|
512 - | pub struct StructureListMember {
|
513 - | #[allow(missing_docs)] // documentation missing in model
|
514 - | pub a: ::std::option::Option<::std::string::String>,
|
515 - | #[allow(missing_docs)] // documentation missing in model
|
516 - | pub b: ::std::option::Option<::std::string::String>,
|
517 - | }
|
518 - | impl StructureListMember {
|
519 - | #[allow(missing_docs)] // documentation missing in model
|
520 - | pub fn a(&self) -> ::std::option::Option<&str> {
|
521 - | self.a.as_deref()
|
522 - | }
|
523 - | #[allow(missing_docs)] // documentation missing in model
|
524 - | pub fn b(&self) -> ::std::option::Option<&str> {
|
525 - | self.b.as_deref()
|
526 - | }
|
527 - | }
|
528 - | impl StructureListMember {
|
529 - | /// Creates a new builder-style object to manufacture [`StructureListMember`](crate::model::StructureListMember).
|
530 - | pub fn builder() -> crate::model::structure_list_member::Builder {
|
531 - | crate::model::structure_list_member::Builder::default()
|
414 + | impl ::std::convert::From<::std::string::String>
|
415 + | for crate::constrained::MaybeConstrained<crate::model::TestEnum>
|
416 + | {
|
417 + | fn from(value: ::std::string::String) -> Self {
|
418 + | Self::Unconstrained(value)
|
532 419 | }
|
533 420 | }
|
534 - | impl crate::constrained::Constrained for crate::model::StructureListMember {
|
535 - | type Unconstrained = crate::model::structure_list_member::Builder;
|
536 - | }
|
537 421 |
|
538 422 | #[allow(missing_docs)] // documentation missing in model
|
539 423 | #[derive(
|
540 424 | ::std::clone::Clone,
|
541 425 | ::std::cmp::Eq,
|
542 426 | ::std::cmp::Ord,
|
543 427 | ::std::cmp::PartialEq,
|
544 428 | ::std::cmp::PartialOrd,
|
545 429 | ::std::fmt::Debug,
|
546 430 | ::std::hash::Hash,
|
642 526 | type Unconstrained = ::std::string::String;
|
643 527 | }
|
644 528 |
|
645 529 | impl ::std::convert::From<::std::string::String>
|
646 530 | for crate::constrained::MaybeConstrained<crate::model::FooEnum>
|
647 531 | {
|
648 532 | fn from(value: ::std::string::String) -> Self {
|
649 533 | Self::Unconstrained(value)
|
650 534 | }
|
651 535 | }
|
652 - | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
653 - | pub mod validation_exception_field {
|
654 536 |
|
655 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
656 - | /// Holds one variant for each of the ways the builder can fail.
|
657 - | #[non_exhaustive]
|
658 - | #[allow(clippy::enum_variant_names)]
|
659 - | pub enum ConstraintViolation {
|
660 - | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
661 - | MissingPath,
|
662 - | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
663 - | MissingMessage,
|
537 + | #[allow(missing_docs)] // documentation missing in model
|
538 + | #[derive(
|
539 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
540 + | )]
|
541 + | pub struct StructureListMember {
|
542 + | #[allow(missing_docs)] // documentation missing in model
|
543 + | pub a: ::std::option::Option<::std::string::String>,
|
544 + | #[allow(missing_docs)] // documentation missing in model
|
545 + | pub b: ::std::option::Option<::std::string::String>,
|
546 + | }
|
547 + | impl StructureListMember {
|
548 + | #[allow(missing_docs)] // documentation missing in model
|
549 + | pub fn a(&self) -> ::std::option::Option<&str> {
|
550 + | self.a.as_deref()
|
664 551 | }
|
665 - | impl ::std::fmt::Display for ConstraintViolation {
|
666 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
667 - | match self {
|
668 - | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
669 - | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
552 + | #[allow(missing_docs)] // documentation missing in model
|
553 + | pub fn b(&self) -> ::std::option::Option<&str> {
|
554 + | self.b.as_deref()
|
555 + | }
|
556 + | }
|
557 + | impl StructureListMember {
|
558 + | /// Creates a new builder-style object to manufacture [`StructureListMember`](crate::model::StructureListMember).
|
559 + | pub fn builder() -> crate::model::structure_list_member::Builder {
|
560 + | crate::model::structure_list_member::Builder::default()
|
561 + | }
|
562 + | }
|
563 + | impl crate::constrained::Constrained for crate::model::StructureListMember {
|
564 + | type Unconstrained = crate::model::structure_list_member::Builder;
|
565 + | }
|
566 + |
|
567 + | /// Describes one specific validation failure for an input member.
|
568 + | #[derive(
|
569 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
570 + | )]
|
571 + | pub struct ValidationExceptionField {
|
572 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
573 + | pub path: ::std::string::String,
|
574 + | /// A detailed description of the validation failure.
|
575 + | pub message: ::std::string::String,
|
576 + | }
|
577 + | impl ValidationExceptionField {
|
578 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
579 + | pub fn path(&self) -> &str {
|
580 + | use std::ops::Deref;
|
581 + | self.path.deref()
|
582 + | }
|
583 + | /// A detailed description of the validation failure.
|
584 + | pub fn message(&self) -> &str {
|
585 + | use std::ops::Deref;
|
586 + | self.message.deref()
|
587 + | }
|
588 + | }
|
589 + | impl ValidationExceptionField {
|
590 + | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
591 + | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
592 + | crate::model::validation_exception_field::Builder::default()
|
593 + | }
|
594 + | }
|
595 + |
|
596 + | #[allow(missing_docs)] // documentation missing in model
|
597 + | #[derive(
|
598 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
599 + | )]
|
600 + | pub struct GreetingStruct {
|
601 + | #[allow(missing_docs)] // documentation missing in model
|
602 + | pub hi: ::std::option::Option<::std::string::String>,
|
603 + | }
|
604 + | impl GreetingStruct {
|
605 + | #[allow(missing_docs)] // documentation missing in model
|
606 + | pub fn hi(&self) -> ::std::option::Option<&str> {
|
607 + | self.hi.as_deref()
|
608 + | }
|
609 + | }
|
610 + | impl GreetingStruct {
|
611 + | /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
|
612 + | pub fn builder() -> crate::model::greeting_struct::Builder {
|
613 + | crate::model::greeting_struct::Builder::default()
|
614 + | }
|
615 + | }
|
616 + | impl crate::constrained::Constrained for crate::model::GreetingStruct {
|
617 + | type Unconstrained = crate::model::greeting_struct::Builder;
|
618 + | }
|
619 + |
|
620 + | #[allow(missing_docs)] // documentation missing in model
|
621 + | #[derive(
|
622 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
623 + | )]
|
624 + | pub struct RecursiveShapesInputOutputNested2 {
|
625 + | #[allow(missing_docs)] // documentation missing in model
|
626 + | pub bar: ::std::option::Option<::std::string::String>,
|
627 + | #[allow(missing_docs)] // documentation missing in model
|
628 + | pub recursive_member: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
629 + | }
|
630 + | impl RecursiveShapesInputOutputNested2 {
|
631 + | #[allow(missing_docs)] // documentation missing in model
|
632 + | pub fn bar(&self) -> ::std::option::Option<&str> {
|
633 + | self.bar.as_deref()
|
634 + | }
|
635 + | #[allow(missing_docs)] // documentation missing in model
|
636 + | pub fn recursive_member(
|
637 + | &self,
|
638 + | ) -> ::std::option::Option<&crate::model::RecursiveShapesInputOutputNested1> {
|
639 + | self.recursive_member.as_ref()
|
640 + | }
|
641 + | }
|
642 + | impl RecursiveShapesInputOutputNested2 {
|
643 + | /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
644 + | pub fn builder() -> crate::model::recursive_shapes_input_output_nested2::Builder {
|
645 + | crate::model::recursive_shapes_input_output_nested2::Builder::default()
|
646 + | }
|
647 + | }
|
648 + | impl crate::constrained::Constrained for crate::model::RecursiveShapesInputOutputNested2 {
|
649 + | type Unconstrained = crate::model::recursive_shapes_input_output_nested2::Builder;
|
650 + | }
|
651 + | /// See [`StringSet`](crate::model::StringSet).
|
652 + | pub mod string_set {
|
653 + |
|
654 + | #[allow(clippy::enum_variant_names)]
|
655 + | #[derive(Debug, PartialEq)]
|
656 + | pub enum ConstraintViolation {
|
657 + | /// Constraint violation error when the list does not contain unique items
|
658 + | UniqueItems {
|
659 + | /// A vector of indices into `original` pointing to all duplicate items. This vector has
|
660 + | /// at least two elements.
|
661 + | /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
|
662 + | /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
|
663 + | /// Nothing is guaranteed about the order of the indices.
|
664 + | duplicate_indices: ::std::vec::Vec<usize>,
|
665 + | /// The original vector, that contains duplicate items.
|
666 + | original: ::std::vec::Vec<::std::string::String>,
|
667 + | },
|
668 + | }
|
669 + |
|
670 + | impl ::std::fmt::Display for ConstraintViolation {
|
671 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
672 + | let message = match self {
|
673 + | Self::UniqueItems { duplicate_indices, .. } =>
|
674 + | format!("Value with repeated values at indices {:?} provided for 'smithy.protocoltests.shared#StringSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
|
675 + | };
|
676 + | write!(f, "{message}")
|
677 + | }
|
678 + | }
|
679 + |
|
680 + | impl ::std::error::Error for ConstraintViolation {}
|
681 + | impl ConstraintViolation {
|
682 + | pub(crate) fn as_validation_exception_field(
|
683 + | self,
|
684 + | path: ::std::string::String,
|
685 + | ) -> crate::model::ValidationExceptionField {
|
686 + | match self {
|
687 + | Self::UniqueItems { duplicate_indices, .. } =>
|
688 + | crate::model::ValidationExceptionField {
|
689 + | message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
|
690 + | path,
|
691 + | },
|
692 + | }
|
693 + | }
|
694 + | }
|
695 + | }
|
696 + | pub mod foo_enum_list {
|
697 + |
|
698 + | #[allow(clippy::enum_variant_names)]
|
699 + | #[derive(Debug, PartialEq)]
|
700 + | pub enum ConstraintViolation {
|
701 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
702 + | /// The first component of the tuple is the index in the collection where the
|
703 + | /// first constraint violation was found.
|
704 + | #[doc(hidden)]
|
705 + | Member(usize, crate::model::foo_enum::ConstraintViolation),
|
706 + | }
|
707 + |
|
708 + | impl ::std::fmt::Display for ConstraintViolation {
|
709 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
710 + | let message = match self {
|
711 + | Self::Member(index, failing_member) => format!(
|
712 + | "Value at index {index} failed to satisfy constraint. {}",
|
713 + | failing_member
|
714 + | ),
|
715 + | };
|
716 + | write!(f, "{message}")
|
717 + | }
|
718 + | }
|
719 + |
|
720 + | impl ::std::error::Error for ConstraintViolation {}
|
721 + | impl ConstraintViolation {
|
722 + | pub(crate) fn as_validation_exception_field(
|
723 + | self,
|
724 + | path: ::std::string::String,
|
725 + | ) -> crate::model::ValidationExceptionField {
|
726 + | match self {
|
727 + | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
728 + | .as_validation_exception_field(path + "/" + &index.to_string()),
|
729 + | }
|
730 + | }
|
731 + | }
|
732 + | }
|
733 + | pub mod dense_set_map {
|
734 + |
|
735 + | #[allow(clippy::enum_variant_names)]
|
736 + | #[derive(Debug, PartialEq)]
|
737 + | pub enum ConstraintViolation {
|
738 + | #[doc(hidden)]
|
739 + | Value(
|
740 + | ::std::string::String,
|
741 + | crate::model::string_set::ConstraintViolation,
|
742 + | ),
|
743 + | }
|
744 + |
|
745 + | impl ::std::fmt::Display for ConstraintViolation {
|
746 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
747 + | match self {
|
748 + | Self::Value(_, value_constraint_violation) => {
|
749 + | write!(f, "{}", value_constraint_violation)
|
750 + | }
|
670 751 | }
|
671 752 | }
|
672 753 | }
|
754 + |
|
673 755 | impl ::std::error::Error for ConstraintViolation {}
|
674 - | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
675 - | type Error = ConstraintViolation;
|
756 + | impl ConstraintViolation {
|
757 + | pub(crate) fn as_validation_exception_field(
|
758 + | self,
|
759 + | path: ::std::string::String,
|
760 + | ) -> crate::model::ValidationExceptionField {
|
761 + | match self {
|
762 + | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
763 + | .as_validation_exception_field(path + "/" + key.as_str()),
|
764 + | }
|
765 + | }
|
766 + | }
|
767 + | }
|
768 + | pub mod sparse_set_map {
|
676 769 |
|
677 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
770 + | #[allow(clippy::enum_variant_names)]
|
771 + | #[derive(Debug, PartialEq)]
|
772 + | pub enum ConstraintViolation {
|
773 + | #[doc(hidden)]
|
774 + | Value(
|
775 + | ::std::string::String,
|
776 + | crate::model::string_set::ConstraintViolation,
|
777 + | ),
|
778 + | }
|
779 + |
|
780 + | impl ::std::fmt::Display for ConstraintViolation {
|
781 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
782 + | match self {
|
783 + | Self::Value(_, value_constraint_violation) => {
|
784 + | write!(f, "{}", value_constraint_violation)
|
785 + | }
|
786 + | }
|
787 + | }
|
788 + | }
|
789 + |
|
790 + | impl ::std::error::Error for ConstraintViolation {}
|
791 + | impl ConstraintViolation {
|
792 + | pub(crate) fn as_validation_exception_field(
|
793 + | self,
|
794 + | path: ::std::string::String,
|
795 + | ) -> crate::model::ValidationExceptionField {
|
796 + | match self {
|
797 + | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
798 + | .as_validation_exception_field(path + "/" + key.as_str()),
|
799 + | }
|
800 + | }
|
801 + | }
|
802 + | }
|
803 + | /// See [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
804 + | pub mod recursive_shapes_input_output_nested1 {
|
805 + |
|
806 + | impl ::std::convert::From<Builder> for crate::model::RecursiveShapesInputOutputNested1 {
|
807 + | fn from(builder: Builder) -> Self {
|
678 808 | builder.build()
|
679 809 | }
|
680 810 | }
|
681 - | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
811 + | /// A builder for [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
682 812 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
683 813 | pub struct Builder {
|
684 - | pub(crate) path: ::std::option::Option<::std::string::String>,
|
685 - | pub(crate) message: ::std::option::Option<::std::string::String>,
|
814 + | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
815 + | pub(crate) nested: ::std::option::Option<
|
816 + | ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
817 + | >,
|
686 818 | }
|
687 819 | impl Builder {
|
688 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
689 - | pub fn path(mut self, input: ::std::string::String) -> Self {
|
690 - | self.path = Some(input);
|
820 + | #[allow(missing_docs)] // documentation missing in model
|
821 + | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
822 + | self.foo = input;
|
691 823 | self
|
692 824 | }
|
693 - | /// A detailed description of the validation failure.
|
694 - | pub fn message(mut self, input: ::std::string::String) -> Self {
|
695 - | self.message = Some(input);
|
825 + | #[allow(missing_docs)] // documentation missing in model
|
826 + | pub(crate) fn set_foo(
|
827 + | mut self,
|
828 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
829 + | ) -> Self {
|
830 + | self.foo = input.map(|v| v.into());
|
696 831 | self
|
697 832 | }
|
698 - | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
699 - | ///
|
700 - | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
|
701 - | ///
|
702 - | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
703 - | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
833 + | #[allow(missing_docs)] // documentation missing in model
|
834 + | pub fn nested(
|
835 + | mut self,
|
836 + | input: ::std::option::Option<
|
837 + | ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
838 + | >,
|
839 + | ) -> Self {
|
840 + | self.nested = input;
|
841 + | self
|
842 + | }
|
843 + | #[allow(missing_docs)] // documentation missing in model
|
844 + | pub(crate) fn set_nested(
|
845 + | mut self,
|
846 + | input: Option<
|
847 + | impl ::std::convert::Into<
|
848 + | ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
849 + | >,
|
850 + | >,
|
851 + | ) -> Self {
|
852 + | self.nested = input.map(|v| v.into());
|
853 + | self
|
854 + | }
|
855 + | /// Consumes the builder and constructs a [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
856 + | pub fn build(self) -> crate::model::RecursiveShapesInputOutputNested1 {
|
704 857 | self.build_enforcing_all_constraints()
|
705 858 | }
|
706 859 | fn build_enforcing_all_constraints(
|
707 860 | self,
|
708 - | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
709 - | Ok(crate::model::ValidationExceptionField {
|
710 - | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
711 - | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
712 - | })
|
861 + | ) -> crate::model::RecursiveShapesInputOutputNested1 {
|
862 + | crate::model::RecursiveShapesInputOutputNested1 {
|
863 + | foo: self.foo,
|
864 + | nested: self.nested,
|
865 + | }
|
713 866 | }
|
714 867 | }
|
715 868 | }
|
716 - | /// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
717 - | pub mod client_optional_defaults {
|
869 + | /// See [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
870 + | pub mod complex_nested_error_data {
|
718 871 |
|
719 - | impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
|
872 + | impl ::std::convert::From<Builder> for crate::model::ComplexNestedErrorData {
|
720 873 | fn from(builder: Builder) -> Self {
|
721 874 | builder.build()
|
722 875 | }
|
723 876 | }
|
724 - | /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
877 + | /// A builder for [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
725 878 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
726 879 | pub struct Builder {
|
727 - | pub(crate) member: ::std::option::Option<i32>,
|
880 + | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
728 881 | }
|
729 882 | impl Builder {
|
730 883 | #[allow(missing_docs)] // documentation missing in model
|
731 - | pub fn member(mut self, input: i32) -> Self {
|
732 - | self.member = Some(input);
|
733 - | self
|
734 - | }
|
735 - | #[allow(missing_docs)] // documentation missing in model
|
736 - | pub(crate) fn set_member(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
737 - | self.member = Some(input.into());
|
884 + | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
885 + | self.foo = input;
|
738 886 | self
|
739 887 | }
|
740 - | /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
741 - | pub fn build(self) -> crate::model::ClientOptionalDefaults {
|
888 + | /// Consumes the builder and constructs a [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
889 + | pub fn build(self) -> crate::model::ComplexNestedErrorData {
|
742 890 | self.build_enforcing_all_constraints()
|
743 891 | }
|
744 - | fn build_enforcing_all_constraints(self) -> crate::model::ClientOptionalDefaults {
|
745 - | crate::model::ClientOptionalDefaults {
|
746 - | member: self.member.unwrap_or(0i32),
|
747 - | }
|
892 + | fn build_enforcing_all_constraints(self) -> crate::model::ComplexNestedErrorData {
|
893 + | crate::model::ComplexNestedErrorData { foo: self.foo }
|
748 894 | }
|
749 895 | }
|
750 896 | }
|
751 897 | /// See [`Defaults`](crate::model::Defaults).
|
752 898 | pub mod defaults {
|
753 899 |
|
754 900 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
755 901 | /// Holds one variant for each of the ways the builder can fail.
|
756 902 | #[non_exhaustive]
|
757 903 | #[allow(clippy::enum_variant_names)]
|
1141 1287 | zero_byte: self.zero_byte.unwrap_or(0i8),
|
1142 1288 | zero_short: self.zero_short.unwrap_or(0i16),
|
1143 1289 | zero_integer: self.zero_integer.unwrap_or(0i32),
|
1144 1290 | zero_long: self.zero_long.unwrap_or(0i64),
|
1145 1291 | zero_float: self.zero_float.unwrap_or(0.0f32),
|
1146 1292 | zero_double: self.zero_double.unwrap_or(0.0f64),
|
1147 1293 | })
|
1148 1294 | }
|
1149 1295 | }
|
1150 1296 | }
|
1151 - | /// See [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1152 - | pub mod complex_nested_error_data {
|
1153 - |
|
1154 - | impl ::std::convert::From<Builder> for crate::model::ComplexNestedErrorData {
|
1155 - | fn from(builder: Builder) -> Self {
|
1156 - | builder.build()
|
1157 - | }
|
1158 - | }
|
1159 - | /// A builder for [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1160 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1161 - | pub struct Builder {
|
1162 - | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
1163 - | }
|
1164 - | impl Builder {
|
1165 - | #[allow(missing_docs)] // documentation missing in model
|
1166 - | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1167 - | self.foo = input;
|
1168 - | self
|
1169 - | }
|
1170 - | /// Consumes the builder and constructs a [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1171 - | pub fn build(self) -> crate::model::ComplexNestedErrorData {
|
1172 - | self.build_enforcing_all_constraints()
|
1173 - | }
|
1174 - | fn build_enforcing_all_constraints(self) -> crate::model::ComplexNestedErrorData {
|
1175 - | crate::model::ComplexNestedErrorData { foo: self.foo }
|
1176 - | }
|
1177 - | }
|
1178 - | }
|
1179 - | /// See [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
1180 - | pub mod recursive_shapes_input_output_nested1 {
|
1297 + | /// See [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
1298 + | pub mod client_optional_defaults {
|
1181 1299 |
|
1182 - | impl ::std::convert::From<Builder> for crate::model::RecursiveShapesInputOutputNested1 {
|
1300 + | impl ::std::convert::From<Builder> for crate::model::ClientOptionalDefaults {
|
1183 1301 | fn from(builder: Builder) -> Self {
|
1184 1302 | builder.build()
|
1185 1303 | }
|
1186 1304 | }
|
1187 - | /// A builder for [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
1305 + | /// A builder for [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
1188 1306 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1189 1307 | pub struct Builder {
|
1190 - | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
1191 - | pub(crate) nested: ::std::option::Option<
|
1192 - | ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
1193 - | >,
|
1308 + | pub(crate) member: ::std::option::Option<i32>,
|
1194 1309 | }
|
1195 1310 | impl Builder {
|
1196 1311 | #[allow(missing_docs)] // documentation missing in model
|
1197 - | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1198 - | self.foo = input;
|
1199 - | self
|
1200 - | }
|
1201 - | #[allow(missing_docs)] // documentation missing in model
|
1202 - | pub(crate) fn set_foo(
|
1203 - | mut self,
|
1204 - | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1205 - | ) -> Self {
|
1206 - | self.foo = input.map(|v| v.into());
|
1207 - | self
|
1208 - | }
|
1209 - | #[allow(missing_docs)] // documentation missing in model
|
1210 - | pub fn nested(
|
1211 - | mut self,
|
1212 - | input: ::std::option::Option<
|
1213 - | ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
1214 - | >,
|
1215 - | ) -> Self {
|
1216 - | self.nested = input;
|
1312 + | pub fn member(mut self, input: i32) -> Self {
|
1313 + | self.member = Some(input);
|
1217 1314 | self
|
1218 1315 | }
|
1219 1316 | #[allow(missing_docs)] // documentation missing in model
|
1220 - | pub(crate) fn set_nested(
|
1221 - | mut self,
|
1222 - | input: Option<
|
1223 - | impl ::std::convert::Into<
|
1224 - | ::std::boxed::Box<crate::model::RecursiveShapesInputOutputNested2>,
|
1225 - | >,
|
1226 - | >,
|
1227 - | ) -> Self {
|
1228 - | self.nested = input.map(|v| v.into());
|
1317 + | pub(crate) fn set_member(mut self, input: impl ::std::convert::Into<i32>) -> Self {
|
1318 + | self.member = Some(input.into());
|
1229 1319 | self
|
1230 1320 | }
|
1231 - | /// Consumes the builder and constructs a [`RecursiveShapesInputOutputNested1`](crate::model::RecursiveShapesInputOutputNested1).
|
1232 - | pub fn build(self) -> crate::model::RecursiveShapesInputOutputNested1 {
|
1321 + | /// Consumes the builder and constructs a [`ClientOptionalDefaults`](crate::model::ClientOptionalDefaults).
|
1322 + | pub fn build(self) -> crate::model::ClientOptionalDefaults {
|
1233 1323 | self.build_enforcing_all_constraints()
|
1234 1324 | }
|
1235 - | fn build_enforcing_all_constraints(
|
1236 - | self,
|
1237 - | ) -> crate::model::RecursiveShapesInputOutputNested1 {
|
1238 - | crate::model::RecursiveShapesInputOutputNested1 {
|
1239 - | foo: self.foo,
|
1240 - | nested: self.nested,
|
1325 + | fn build_enforcing_all_constraints(self) -> crate::model::ClientOptionalDefaults {
|
1326 + | crate::model::ClientOptionalDefaults {
|
1327 + | member: self.member.unwrap_or(0i32),
|
1241 1328 | }
|
1242 1329 | }
|
1243 1330 | }
|
1244 1331 | }
|
1245 - | /// See [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
1246 - | pub mod recursive_shapes_input_output_nested2 {
|
1332 + | /// See [`StructureListMember`](crate::model::StructureListMember).
|
1333 + | pub mod structure_list_member {
|
1247 1334 |
|
1248 - | impl ::std::convert::From<Builder> for crate::model::RecursiveShapesInputOutputNested2 {
|
1335 + | impl ::std::convert::From<Builder> for crate::model::StructureListMember {
|
1249 1336 | fn from(builder: Builder) -> Self {
|
1250 1337 | builder.build()
|
1251 1338 | }
|
1252 1339 | }
|
1253 - | /// A builder for [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
1340 + | /// A builder for [`StructureListMember`](crate::model::StructureListMember).
|
1254 1341 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1255 1342 | pub struct Builder {
|
1256 - | pub(crate) bar: ::std::option::Option<::std::string::String>,
|
1257 - | pub(crate) recursive_member:
|
1258 - | ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
1343 + | pub(crate) a: ::std::option::Option<::std::string::String>,
|
1344 + | pub(crate) b: ::std::option::Option<::std::string::String>,
|
1259 1345 | }
|
1260 1346 | impl Builder {
|
1261 1347 | #[allow(missing_docs)] // documentation missing in model
|
1262 - | pub fn bar(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1263 - | self.bar = input;
|
1348 + | pub fn a(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1349 + | self.a = input;
|
1264 1350 | self
|
1265 1351 | }
|
1266 1352 | #[allow(missing_docs)] // documentation missing in model
|
1267 - | pub(crate) fn set_bar(
|
1353 + | pub(crate) fn set_a(
|
1268 1354 | mut self,
|
1269 1355 | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1270 1356 | ) -> Self {
|
1271 - | self.bar = input.map(|v| v.into());
|
1357 + | self.a = input.map(|v| v.into());
|
1272 1358 | self
|
1273 1359 | }
|
1274 1360 | #[allow(missing_docs)] // documentation missing in model
|
1275 - | pub fn recursive_member(
|
1276 - | mut self,
|
1277 - | input: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
1278 - | ) -> Self {
|
1279 - | self.recursive_member = input;
|
1361 + | pub fn b(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1362 + | self.b = input;
|
1280 1363 | self
|
1281 1364 | }
|
1282 1365 | #[allow(missing_docs)] // documentation missing in model
|
1283 - | pub(crate) fn set_recursive_member(
|
1366 + | pub(crate) fn set_b(
|
1284 1367 | mut self,
|
1285 - | input: Option<
|
1286 - | impl ::std::convert::Into<crate::model::RecursiveShapesInputOutputNested1>,
|
1287 - | >,
|
1368 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1288 1369 | ) -> Self {
|
1289 - | self.recursive_member = input.map(|v| v.into());
|
1370 + | self.b = input.map(|v| v.into());
|
1290 1371 | self
|
1291 1372 | }
|
1292 - | /// Consumes the builder and constructs a [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
1293 - | pub fn build(self) -> crate::model::RecursiveShapesInputOutputNested2 {
|
1373 + | /// Consumes the builder and constructs a [`StructureListMember`](crate::model::StructureListMember).
|
1374 + | pub fn build(self) -> crate::model::StructureListMember {
|
1294 1375 | self.build_enforcing_all_constraints()
|
1295 1376 | }
|
1296 - | fn build_enforcing_all_constraints(
|
1297 - | self,
|
1298 - | ) -> crate::model::RecursiveShapesInputOutputNested2 {
|
1299 - | crate::model::RecursiveShapesInputOutputNested2 {
|
1300 - | bar: self.bar,
|
1301 - | recursive_member: self.recursive_member,
|
1377 + | fn build_enforcing_all_constraints(self) -> crate::model::StructureListMember {
|
1378 + | crate::model::StructureListMember {
|
1379 + | a: self.a,
|
1380 + | b: self.b,
|
1302 1381 | }
|
1303 1382 | }
|
1304 1383 | }
|
1305 1384 | }
|
1306 - | pub mod sparse_set_map {
|
1385 + | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1386 + | pub mod validation_exception_field {
|
1307 1387 |
|
1388 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1389 + | /// Holds one variant for each of the ways the builder can fail.
|
1390 + | #[non_exhaustive]
|
1308 1391 | #[allow(clippy::enum_variant_names)]
|
1309 - | #[derive(Debug, PartialEq)]
|
1310 1392 | pub enum ConstraintViolation {
|
1311 - | #[doc(hidden)]
|
1312 - | Value(
|
1313 - | ::std::string::String,
|
1314 - | crate::model::string_set::ConstraintViolation,
|
1315 - | ),
|
1393 + | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
1394 + | MissingPath,
|
1395 + | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
1396 + | MissingMessage,
|
1316 1397 | }
|
1317 - |
|
1318 1398 | impl ::std::fmt::Display for ConstraintViolation {
|
1319 1399 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1320 1400 | match self {
|
1321 - | Self::Value(_, value_constraint_violation) => {
|
1322 - | write!(f, "{}", value_constraint_violation)
|
1323 - | }
|
1401 + | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
1402 + | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
1324 1403 | }
|
1325 1404 | }
|
1326 1405 | }
|
1327 - |
|
1328 1406 | impl ::std::error::Error for ConstraintViolation {}
|
1329 - | impl ConstraintViolation {
|
1330 - | pub(crate) fn as_validation_exception_field(
|
1331 - | self,
|
1332 - | path: ::std::string::String,
|
1333 - | ) -> crate::model::ValidationExceptionField {
|
1334 - | match self {
|
1335 - | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
1336 - | .as_validation_exception_field(path + "/" + key.as_str()),
|
1337 - | }
|
1407 + | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
1408 + | type Error = ConstraintViolation;
|
1409 + |
|
1410 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1411 + | builder.build()
|
1338 1412 | }
|
1339 1413 | }
|
1340 - | }
|
1341 - | /// See [`StringSet`](crate::model::StringSet).
|
1342 - | pub mod string_set {
|
1343 - |
|
1344 - | #[allow(clippy::enum_variant_names)]
|
1345 - | #[derive(Debug, PartialEq)]
|
1346 - | pub enum ConstraintViolation {
|
1347 - | /// Constraint violation error when the list does not contain unique items
|
1348 - | UniqueItems {
|
1349 - | /// A vector of indices into `original` pointing to all duplicate items. This vector has
|
1350 - | /// at least two elements.
|
1351 - | /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
|
1352 - | /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
|
1353 - | /// Nothing is guaranteed about the order of the indices.
|
1354 - | duplicate_indices: ::std::vec::Vec<usize>,
|
1355 - | /// The original vector, that contains duplicate items.
|
1356 - | original: ::std::vec::Vec<::std::string::String>,
|
1357 - | },
|
1414 + | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1415 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1416 + | pub struct Builder {
|
1417 + | pub(crate) path: ::std::option::Option<::std::string::String>,
|
1418 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
1358 1419 | }
|
1359 - |
|
1360 - | impl ::std::fmt::Display for ConstraintViolation {
|
1361 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1362 - | let message = match self {
|
1363 - | Self::UniqueItems { duplicate_indices, .. } =>
|
1364 - | format!("Value with repeated values at indices {:?} provided for 'smithy.protocoltests.shared#StringSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
|
1365 - | };
|
1366 - | write!(f, "{message}")
|
1420 + | impl Builder {
|
1421 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
1422 + | pub fn path(mut self, input: ::std::string::String) -> Self {
|
1423 + | self.path = Some(input);
|
1424 + | self
|
1367 1425 | }
|
1368 - | }
|
1369 - |
|
1370 - | impl ::std::error::Error for ConstraintViolation {}
|
1371 - | impl ConstraintViolation {
|
1372 - | pub(crate) fn as_validation_exception_field(
|
1426 + | /// A detailed description of the validation failure.
|
1427 + | pub fn message(mut self, input: ::std::string::String) -> Self {
|
1428 + | self.message = Some(input);
|
1429 + | self
|
1430 + | }
|
1431 + | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1432 + | ///
|
1433 + | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
|
1434 + | ///
|
1435 + | /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
|
1436 + | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
1437 + | self.build_enforcing_all_constraints()
|
1438 + | }
|
1439 + | fn build_enforcing_all_constraints(
|
1373 1440 | self,
|
1374 - | path: ::std::string::String,
|
1375 - | ) -> crate::model::ValidationExceptionField {
|
1376 - | match self {
|
1377 - | Self::UniqueItems { duplicate_indices, .. } =>
|
1378 - | crate::model::ValidationExceptionField {
|
1379 - | message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
|
1380 - | path,
|
1381 - | },
|
1382 - | }
|
1441 + | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
1442 + | Ok(crate::model::ValidationExceptionField {
|
1443 + | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
1444 + | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
1445 + | })
|
1383 1446 | }
|
1384 1447 | }
|
1385 1448 | }
|
1386 1449 | /// See [`GreetingStruct`](crate::model::GreetingStruct).
|
1387 1450 | pub mod greeting_struct {
|
1388 1451 |
|
1389 1452 | impl ::std::convert::From<Builder> for crate::model::GreetingStruct {
|
1390 1453 | fn from(builder: Builder) -> Self {
|
1391 1454 | builder.build()
|
1392 1455 | }
|
1393 1456 | }
|
1394 1457 | /// A builder for [`GreetingStruct`](crate::model::GreetingStruct).
|
1395 1458 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1396 1459 | pub struct Builder {
|
1397 1460 | pub(crate) hi: ::std::option::Option<::std::string::String>,
|
1398 1461 | }
|
1399 1462 | impl Builder {
|
1400 1463 | #[allow(missing_docs)] // documentation missing in model
|
1401 1464 | pub fn hi(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1402 1465 | self.hi = input;
|
1403 1466 | self
|
1404 1467 | }
|
1405 1468 | #[allow(missing_docs)] // documentation missing in model
|
1406 1469 | pub(crate) fn set_hi(
|
1407 1470 | mut self,
|
1408 1471 | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1409 1472 | ) -> Self {
|
1410 1473 | self.hi = input.map(|v| v.into());
|
1411 1474 | self
|
1412 1475 | }
|
1413 1476 | /// Consumes the builder and constructs a [`GreetingStruct`](crate::model::GreetingStruct).
|
1414 1477 | pub fn build(self) -> crate::model::GreetingStruct {
|
1415 1478 | self.build_enforcing_all_constraints()
|
1416 1479 | }
|
1417 1480 | fn build_enforcing_all_constraints(self) -> crate::model::GreetingStruct {
|
1418 1481 | crate::model::GreetingStruct { hi: self.hi }
|
1419 1482 | }
|
1420 1483 | }
|
1421 1484 | }
|
1422 - | pub mod dense_set_map {
|
1423 - |
|
1424 - | #[allow(clippy::enum_variant_names)]
|
1425 - | #[derive(Debug, PartialEq)]
|
1426 - | pub enum ConstraintViolation {
|
1427 - | #[doc(hidden)]
|
1428 - | Value(
|
1429 - | ::std::string::String,
|
1430 - | crate::model::string_set::ConstraintViolation,
|
1431 - | ),
|
1432 - | }
|
1433 - |
|
1434 - | impl ::std::fmt::Display for ConstraintViolation {
|
1435 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1436 - | match self {
|
1437 - | Self::Value(_, value_constraint_violation) => {
|
1438 - | write!(f, "{}", value_constraint_violation)
|
1439 - | }
|
1440 - | }
|
1441 - | }
|
1442 - | }
|
1443 - |
|
1444 - | impl ::std::error::Error for ConstraintViolation {}
|
1445 - | impl ConstraintViolation {
|
1446 - | pub(crate) fn as_validation_exception_field(
|
1447 - | self,
|
1448 - | path: ::std::string::String,
|
1449 - | ) -> crate::model::ValidationExceptionField {
|
1450 - | match self {
|
1451 - | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
1452 - | .as_validation_exception_field(path + "/" + key.as_str()),
|
1453 - | }
|
1454 - | }
|
1455 - | }
|
1456 - | }
|
1457 - | /// See [`StructureListMember`](crate::model::StructureListMember).
|
1458 - | pub mod structure_list_member {
|
1485 + | /// See [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
1486 + | pub mod recursive_shapes_input_output_nested2 {
|
1459 1487 |
|
1460 - | impl ::std::convert::From<Builder> for crate::model::StructureListMember {
|
1488 + | impl ::std::convert::From<Builder> for crate::model::RecursiveShapesInputOutputNested2 {
|
1461 1489 | fn from(builder: Builder) -> Self {
|
1462 1490 | builder.build()
|
1463 1491 | }
|
1464 1492 | }
|
1465 - | /// A builder for [`StructureListMember`](crate::model::StructureListMember).
|
1493 + | /// A builder for [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
1466 1494 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1467 1495 | pub struct Builder {
|
1468 - | pub(crate) a: ::std::option::Option<::std::string::String>,
|
1469 - | pub(crate) b: ::std::option::Option<::std::string::String>,
|
1496 + | pub(crate) bar: ::std::option::Option<::std::string::String>,
|
1497 + | pub(crate) recursive_member:
|
1498 + | ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
1470 1499 | }
|
1471 1500 | impl Builder {
|
1472 1501 | #[allow(missing_docs)] // documentation missing in model
|
1473 - | pub fn a(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1474 - | self.a = input;
|
1502 + | pub fn bar(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1503 + | self.bar = input;
|
1475 1504 | self
|
1476 1505 | }
|
1477 1506 | #[allow(missing_docs)] // documentation missing in model
|
1478 - | pub(crate) fn set_a(
|
1507 + | pub(crate) fn set_bar(
|
1479 1508 | mut self,
|
1480 1509 | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1481 1510 | ) -> Self {
|
1482 - | self.a = input.map(|v| v.into());
|
1511 + | self.bar = input.map(|v| v.into());
|
1483 1512 | self
|
1484 1513 | }
|
1485 1514 | #[allow(missing_docs)] // documentation missing in model
|
1486 - | pub fn b(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1487 - | self.b = input;
|
1515 + | pub fn recursive_member(
|
1516 + | mut self,
|
1517 + | input: ::std::option::Option<crate::model::RecursiveShapesInputOutputNested1>,
|
1518 + | ) -> Self {
|
1519 + | self.recursive_member = input;
|
1488 1520 | self
|
1489 1521 | }
|
1490 1522 | #[allow(missing_docs)] // documentation missing in model
|
1491 - | pub(crate) fn set_b(
|
1523 + | pub(crate) fn set_recursive_member(
|
1492 1524 | mut self,
|
1493 - | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1525 + | input: Option<
|
1526 + | impl ::std::convert::Into<crate::model::RecursiveShapesInputOutputNested1>,
|
1527 + | >,
|
1494 1528 | ) -> Self {
|
1495 - | self.b = input.map(|v| v.into());
|
1529 + | self.recursive_member = input.map(|v| v.into());
|
1496 1530 | self
|
1497 1531 | }
|
1498 - | /// Consumes the builder and constructs a [`StructureListMember`](crate::model::StructureListMember).
|
1499 - | pub fn build(self) -> crate::model::StructureListMember {
|
1532 + | /// Consumes the builder and constructs a [`RecursiveShapesInputOutputNested2`](crate::model::RecursiveShapesInputOutputNested2).
|
1533 + | pub fn build(self) -> crate::model::RecursiveShapesInputOutputNested2 {
|
1500 1534 | self.build_enforcing_all_constraints()
|
1501 1535 | }
|
1502 - | fn build_enforcing_all_constraints(self) -> crate::model::StructureListMember {
|
1503 - | crate::model::StructureListMember {
|
1504 - | a: self.a,
|
1505 - | b: self.b,
|
1506 - | }
|
1507 - | }
|
1508 - | }
|
1509 - | }
|
1510 - | pub mod foo_enum_list {
|
1511 - |
|
1512 - | #[allow(clippy::enum_variant_names)]
|
1513 - | #[derive(Debug, PartialEq)]
|
1514 - | pub enum ConstraintViolation {
|
1515 - | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
1516 - | /// The first component of the tuple is the index in the collection where the
|
1517 - | /// first constraint violation was found.
|
1518 - | #[doc(hidden)]
|
1519 - | Member(usize, crate::model::foo_enum::ConstraintViolation),
|
1520 - | }
|
1521 - |
|
1522 - | impl ::std::fmt::Display for ConstraintViolation {
|
1523 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1524 - | let message = match self {
|
1525 - | Self::Member(index, failing_member) => format!(
|
1526 - | "Value at index {index} failed to satisfy constraint. {}",
|
1527 - | failing_member
|
1528 - | ),
|
1529 - | };
|
1530 - | write!(f, "{message}")
|
1531 - | }
|
1532 - | }
|
1533 - |
|
1534 - | impl ::std::error::Error for ConstraintViolation {}
|
1535 - | impl ConstraintViolation {
|
1536 - | pub(crate) fn as_validation_exception_field(
|
1536 + | fn build_enforcing_all_constraints(
|
1537 1537 | self,
|
1538 - | path: ::std::string::String,
|
1539 - | ) -> crate::model::ValidationExceptionField {
|
1540 - | match self {
|
1541 - | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
1542 - | .as_validation_exception_field(path + "/" + &index.to_string()),
|
1538 + | ) -> crate::model::RecursiveShapesInputOutputNested2 {
|
1539 + | crate::model::RecursiveShapesInputOutputNested2 {
|
1540 + | bar: self.bar,
|
1541 + | recursive_member: self.recursive_member,
|
1543 1542 | }
|
1544 1543 | }
|
1545 1544 | }
|
1546 1545 | }
|