aws_sdk_appconfigcloudextension/schema_serde/
shape_validation_error.rs1static VALIDATIONERROR_MEMBER_FIELDCONSTRAINT: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3 ::aws_smithy_schema::ShapeId::from_parts(
4 "com.amazonaws.appconfigcloudextension#ValidationError$fieldConstraint",
5 "com.amazonaws.appconfigcloudextension",
6 "ValidationError",
7 ),
8 ::aws_smithy_schema::ShapeType::Structure,
9 "fieldConstraint",
10 0,
11);
12static VALIDATIONERROR_MEMBER_SEMANTICERROR: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13 ::aws_smithy_schema::ShapeId::from_parts(
14 "com.amazonaws.appconfigcloudextension#ValidationError$semanticError",
15 "com.amazonaws.appconfigcloudextension",
16 "ValidationError",
17 ),
18 ::aws_smithy_schema::ShapeType::Structure,
19 "semanticError",
20 1,
21);
22static VALIDATIONERROR_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
23 ::aws_smithy_schema::ShapeId::from_parts(
24 "com.amazonaws.appconfigcloudextension#ValidationError",
25 "com.amazonaws.appconfigcloudextension",
26 "ValidationError",
27 ),
28 ::aws_smithy_schema::ShapeType::Union,
29 &[&VALIDATIONERROR_MEMBER_FIELDCONSTRAINT, &VALIDATIONERROR_MEMBER_SEMANTICERROR],
30);
31impl crate::types::ValidationError {
32 pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &VALIDATIONERROR_SCHEMA;
34}
35impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::ValidationError {
36 fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
37 Self::SCHEMA
38 }
39
40 #[allow(unused_variables, clippy::diverging_sub_expression)]
41 fn serialize_members(
42 &self,
43 ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
44 ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
45 match self {
46 Self::FieldConstraint(val) => {
47 ser.write_struct(&VALIDATIONERROR_MEMBER_FIELDCONSTRAINT, val)?;
48 }
49 Self::SemanticError(val) => {
50 ser.write_struct(&VALIDATIONERROR_MEMBER_SEMANTICERROR, val)?;
51 }
52 Self::Unknown => return Err(::aws_smithy_schema::serde::SerdeError::custom("cannot serialize unknown union variant")),
53 }
54 Ok(())
55 }
56}
57impl crate::types::ValidationError {
58 pub fn deserialize(
60 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
61 ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
62 let mut result: ::std::option::Option<Self> = ::std::option::Option::None;
63 #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding)]
64 deserializer.read_struct(&VALIDATIONERROR_SCHEMA, &mut |member, deser| {
65 if result.is_some() {
68 return Err(::aws_smithy_schema::serde::SerdeError::invalid_input(
69 "encountered mixed variants in union",
70 ));
71 }
72 result = ::std::option::Option::Some(match member.member_index() {
73 Some(0) => Self::FieldConstraint(crate::types::FieldConstraint::deserialize(deser)?),
74 Some(1) => Self::SemanticError(crate::types::SemanticError::deserialize(deser)?),
75 _ => Self::Unknown,
76 });
77 Ok(())
78 })?;
79 result.ok_or_else(|| ::aws_smithy_schema::serde::SerdeError::custom("expected a union variant"))
80 }
81}