6 6 | pub struct ValidationException {
|
7 7 | /// A summary of the validation failure.
|
8 8 | pub message: ::std::string::String,
|
9 9 | /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
|
10 10 | pub field_list: ::std::option::Option<::std::vec::Vec<crate::types::ValidationExceptionField>>,
|
11 11 | pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
|
12 12 | }
|
13 13 | impl ValidationException {
|
14 14 | /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
|
15 15 | ///
|
16 16 | /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.field_list.is_none()`.
|
17 17 | pub fn field_list(&self) -> &[crate::types::ValidationExceptionField] {
|
18 18 | self.field_list.as_deref().unwrap_or_default()
|
19 19 | }
|
20 20 | }
|
21 21 | static VALIDATIONEXCEPTION_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
|
22 22 | ::aws_smithy_schema::ShapeId::from_static("smithy.framework#ValidationException", "smithy.framework", "ValidationException");
|
23 23 | static VALIDATIONEXCEPTION_MEMBER_MESSAGE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
24 24 | ::aws_smithy_schema::ShapeId::from_static("smithy.framework#ValidationException$message", "smithy.framework", "ValidationException"),
|
25 25 | ::aws_smithy_schema::ShapeType::String,
|
26 26 | "message",
|
27 27 | 0,
|
28 28 | );
|
29 29 | static VALIDATIONEXCEPTION_MEMBER_FIELD_LIST: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
30 30 | ::aws_smithy_schema::ShapeId::from_static(
|
31 31 | "smithy.framework#ValidationException$fieldList",
|
32 32 | "smithy.framework",
|
33 33 | "ValidationException",
|
34 34 | ),
|
35 35 | ::aws_smithy_schema::ShapeType::List,
|
36 - | "field_list",
|
36 + | "fieldList",
|
37 37 | 1,
|
38 38 | );
|
39 39 | static VALIDATIONEXCEPTION_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
40 40 | VALIDATIONEXCEPTION_SCHEMA_ID,
|
41 41 | ::aws_smithy_schema::ShapeType::Structure,
|
42 42 | &[&VALIDATIONEXCEPTION_MEMBER_MESSAGE, &VALIDATIONEXCEPTION_MEMBER_FIELD_LIST],
|
43 43 | );
|
44 44 | impl ValidationException {
|
45 45 | /// The schema for this shape.
|
46 46 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &VALIDATIONEXCEPTION_SCHEMA;
|
47 47 | }
|
48 48 | impl ::aws_smithy_schema::serde::SerializableStruct for ValidationException {
|
49 49 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
50 50 | fn serialize_members(
|
51 51 | &self,
|
52 52 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
53 53 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
54 54 | {
|
55 55 | let val = &self.message;
|
56 56 | ser.write_string(&VALIDATIONEXCEPTION_MEMBER_MESSAGE, val)?;
|
57 57 | }
|
58 58 | if let Some(ref val) = self.field_list {
|
59 59 | ser.write_list(
|
60 60 | &VALIDATIONEXCEPTION_MEMBER_FIELD_LIST,
|
61 61 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
62 62 | for item in val {
|
63 63 | ser.write_struct(crate::types::ValidationExceptionField::SCHEMA, item)?;
|
64 64 | }
|
65 65 | Ok(())
|
66 66 | },
|
67 67 | )?;
|
68 68 | }
|
69 69 | Ok(())
|
70 70 | }
|
71 71 | }
|
72 72 | impl ValidationException {
|
73 73 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
74 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
75 - | deserializer: &mut D,
|
74 + | pub fn deserialize(
|
75 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
76 76 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
77 77 | #[allow(unused_variables, unused_mut)]
|
78 78 | let mut builder = Self::builder();
|
79 79 | #[allow(
|
80 80 | unused_variables,
|
81 81 | unreachable_code,
|
82 82 | clippy::single_match,
|
83 83 | clippy::match_single_binding,
|
84 84 | clippy::diverging_sub_expression
|
85 85 | )]
|
86 - | deserializer.read_struct(&VALIDATIONEXCEPTION_SCHEMA, (), |_, member, deser| {
|
86 + | deserializer.read_struct(&VALIDATIONEXCEPTION_SCHEMA, &mut |member, deser| {
|
87 87 | match member.member_index() {
|
88 88 | Some(0) => {
|
89 89 | builder.message = Some(deser.read_string(member)?);
|
90 90 | }
|
91 91 | Some(1) => {
|
92 92 | builder.field_list = Some({
|
93 - | let container = if let Some(cap) = deser.container_size() {
|
94 - | Vec::with_capacity(cap)
|
95 - | } else {
|
96 - | Vec::new()
|
97 - | };
|
98 - | deser.read_list(member, container, |mut list, deser| {
|
99 - | list.push(crate::types::ValidationExceptionField::deserialize(deser)?);
|
100 - | Ok(list)
|
101 - | })?
|
93 + | let mut container = Vec::new();
|
94 + | deser.read_list(member, &mut |deser| {
|
95 + | container.push(crate::types::ValidationExceptionField::deserialize(deser)?);
|
96 + | Ok(())
|
97 + | })?;
|
98 + | container
|
102 99 | });
|
103 100 | }
|
104 101 | _ => {}
|
105 102 | }
|
106 103 | Ok(())
|
107 104 | })?;
|
105 + | builder.message = builder.message.or(Some(String::new()));
|
108 106 | builder
|
109 107 | .build()
|
110 108 | .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
|
111 109 | }
|
112 110 | }
|
111 + | impl ValidationException {
|
112 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
113 + | pub fn deserialize_with_response(
|
114 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
115 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
116 + | _status: u16,
|
117 + | _body: &[u8],
|
118 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
119 + | Self::deserialize(deserializer)
|
120 + | }
|
121 + | }
|
113 122 | impl ValidationException {
|
114 123 | /// Returns the error message.
|
115 124 | pub fn message(&self) -> &str {
|
116 125 | &self.message
|
117 126 | }
|
118 127 | }
|
119 128 | impl ::std::fmt::Display for ValidationException {
|
120 129 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
121 130 | ::std::write!(f, "ValidationException")?;
|
122 131 | {
|