1681 1681 | pub mod malformed_required_input {
|
1682 1682 |
|
1683 1683 | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1684 1684 | /// Holds one variant for each of the ways the builder can fail.
|
1685 1685 | #[non_exhaustive]
|
1686 1686 | #[allow(clippy::enum_variant_names)]
|
1687 1687 | pub enum ConstraintViolation {
|
1688 1688 | /// `string` was not provided but it is required when building `MalformedRequiredInput`.
|
1689 1689 | MissingString,
|
1690 1690 | /// `string_in_query` was not provided but it is required when building `MalformedRequiredInput`.
|
1691 1691 | MissingStringInQuery,
|
1692 1692 | /// `string_in_header` was not provided but it is required when building `MalformedRequiredInput`.
|
1693 1693 | MissingStringInHeader,
|
1694 1694 | }
|
1695 1695 | impl ::std::fmt::Display for ConstraintViolation {
|
1696 1696 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1697 1697 | match self {
|
1698 1698 | ConstraintViolation::MissingString => write!(f, "`string` was not provided but it is required when building `MalformedRequiredInput`"),
|
1699 1699 | ConstraintViolation::MissingStringInQuery => write!(f, "`string_in_query` was not provided but it is required when building `MalformedRequiredInput`"),
|
1700 1700 | ConstraintViolation::MissingStringInHeader => write!(f, "`string_in_header` was not provided but it is required when building `MalformedRequiredInput`"),
|
1701 1701 | }
|
1702 1702 | }
|
1703 1703 | }
|
1704 1704 | impl ::std::error::Error for ConstraintViolation {}
|
1705 1705 | impl ConstraintViolation {
|
1706 1706 | pub(crate) fn as_validation_exception_field(
|
1707 1707 | self,
|
1708 1708 | path: ::std::string::String,
|
1709 1709 | ) -> crate::model::ValidationExceptionField {
|
1710 1710 | match self {
|
1711 - | ConstraintViolation::MissingString => crate::model::ValidationExceptionField {
|
1712 - | message: format!("Value at '{}/string' failed to satisfy constraint: Member must not be null", path),
|
1713 - | path: path + "/string",
|
1714 - | },
|
1715 - | ConstraintViolation::MissingStringInQuery => crate::model::ValidationExceptionField {
|
1716 - | message: format!("Value at '{}/stringInQuery' failed to satisfy constraint: Member must not be null", path),
|
1717 - | path: path + "/stringInQuery",
|
1718 - | },
|
1719 - | ConstraintViolation::MissingStringInHeader => crate::model::ValidationExceptionField {
|
1720 - | message: format!("Value at '{}/stringInHeader' failed to satisfy constraint: Member must not be null", path),
|
1721 - | path: path + "/stringInHeader",
|
1722 - | },
|
1723 - | }
|
1711 + | ConstraintViolation::MissingString => crate::model::ValidationExceptionField {
|
1712 + | message: format!("Value at '{}/string' failed to satisfy constraint: Member must not be null", path),
|
1713 + | path: path + "/string",
|
1714 + | },
|
1715 + | ConstraintViolation::MissingStringInQuery => crate::model::ValidationExceptionField {
|
1716 + | message: format!("Value at '{}/stringInQuery' failed to satisfy constraint: Member must not be null", path),
|
1717 + | path: path + "/stringInQuery",
|
1718 + | },
|
1719 + | ConstraintViolation::MissingStringInHeader => crate::model::ValidationExceptionField {
|
1720 + | message: format!("Value at '{}/stringInHeader' failed to satisfy constraint: Member must not be null", path),
|
1721 + | path: path + "/stringInHeader",
|
1722 + | },
|
1723 + | }
|
1724 1724 | }
|
1725 1725 | }
|
1726 1726 | impl ::std::convert::From<ConstraintViolation>
|
1727 1727 | for ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection
|
1728 1728 | {
|
1729 1729 | fn from(constraint_violation: ConstraintViolation) -> Self {
|
1730 1730 | let first_validation_exception_field =
|
1731 1731 | constraint_violation.as_validation_exception_field("".to_owned());
|
1732 1732 | let validation_exception = crate::error::ValidationException {
|
1733 1733 | message: format!(
|
1734 1734 | "1 validation error detected. {}",
|
1735 1735 | &first_validation_exception_field.message
|
1736 1736 | ),
|
1737 1737 | field_list: Some(vec![first_validation_exception_field]),
|
1738 1738 | };
|
1739 1739 | Self::ConstraintViolation(
|
1740 1740 | crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(&validation_exception)
|
1741 1741 | .expect("validation exceptions should never fail to serialize; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues")
|
1742 1742 | )
|
1743 1743 | }
|
1744 1744 | }
|
1745 1745 | impl ::std::convert::From<Builder>
|
1746 1746 | for crate::constrained::MaybeConstrained<crate::input::MalformedRequiredInput>
|
1747 1747 | {
|
1748 1748 | fn from(builder: Builder) -> Self {
|
1749 1749 | Self::Unconstrained(builder)
|
1750 1750 | }
|
1751 1751 | }
|
1752 1752 | impl ::std::convert::TryFrom<Builder> for crate::input::MalformedRequiredInput {
|
1753 1753 | type Error = ConstraintViolation;
|