static VALIDATIONERROR_MEMBER_FIELDCONSTRAINT: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.appconfigcloudextension#ValidationError$fieldConstraint",
"com.amazonaws.appconfigcloudextension",
"ValidationError",
),
::aws_smithy_schema::ShapeType::Structure,
"fieldConstraint",
0,
);
static VALIDATIONERROR_MEMBER_SEMANTICERROR: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.appconfigcloudextension#ValidationError$semanticError",
"com.amazonaws.appconfigcloudextension",
"ValidationError",
),
::aws_smithy_schema::ShapeType::Structure,
"semanticError",
1,
);
static VALIDATIONERROR_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.appconfigcloudextension#ValidationError",
"com.amazonaws.appconfigcloudextension",
"ValidationError",
),
::aws_smithy_schema::ShapeType::Union,
&[&VALIDATIONERROR_MEMBER_FIELDCONSTRAINT, &VALIDATIONERROR_MEMBER_SEMANTICERROR],
);
impl crate::types::ValidationError {
pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &VALIDATIONERROR_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::ValidationError {
fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
Self::SCHEMA
}
#[allow(unused_variables, clippy::diverging_sub_expression)]
fn serialize_members(
&self,
ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
match self {
Self::FieldConstraint(val) => {
ser.write_struct(&VALIDATIONERROR_MEMBER_FIELDCONSTRAINT, val)?;
}
Self::SemanticError(val) => {
ser.write_struct(&VALIDATIONERROR_MEMBER_SEMANTICERROR, val)?;
}
Self::Unknown => return Err(::aws_smithy_schema::serde::SerdeError::custom("cannot serialize unknown union variant")),
}
Ok(())
}
}
impl crate::types::ValidationError {
pub fn deserialize(
deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
let mut result: ::std::option::Option<Self> = ::std::option::Option::None;
#[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding)]
deserializer.read_struct(&VALIDATIONERROR_SCHEMA, &mut |member, deser| {
if result.is_some() {
return Err(::aws_smithy_schema::serde::SerdeError::invalid_input(
"encountered mixed variants in union",
));
}
result = ::std::option::Option::Some(match member.member_index() {
Some(0) => Self::FieldConstraint(crate::types::FieldConstraint::deserialize(deser)?),
Some(1) => Self::SemanticError(crate::types::SemanticError::deserialize(deser)?),
_ => Self::Unknown,
});
Ok(())
})?;
result.ok_or_else(|| ::aws_smithy_schema::serde::SerdeError::custom("expected a union variant"))
}
}