nominal-api 0.1241.0

API bindings for the Nominal platform
Documentation
/// Result of template validation
#[derive(
    Debug,
    Clone,
    conjure_object::serde::Serialize,
    conjure_object::serde::Deserialize,
    PartialEq,
    Eq,
    PartialOrd,
    Ord,
    Hash
)]
#[serde(crate = "conjure_object::serde")]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct ValidationResult {
    #[serde(rename = "valid")]
    valid: bool,
    #[builder(default, into)]
    #[serde(
        rename = "evaluatedPayload",
        skip_serializing_if = "Option::is_none",
        default
    )]
    evaluated_payload: Option<String>,
    #[builder(default, list(item(type = super::ValidationError)))]
    #[serde(rename = "errors", skip_serializing_if = "Vec::is_empty", default)]
    errors: Vec<super::ValidationError>,
    #[builder(default, list(item(type = super::ValidationWarning)))]
    #[serde(rename = "warnings", skip_serializing_if = "Vec::is_empty", default)]
    warnings: Vec<super::ValidationWarning>,
}
impl ValidationResult {
    /// Constructs a new instance of the type.
    #[inline]
    pub fn new(valid: bool) -> Self {
        Self::builder().valid(valid).build()
    }
    /// Whether the template is syntactically valid and produces valid JSON
    #[inline]
    pub fn valid(&self) -> bool {
        self.valid
    }
    /// Evaluated JSON payload if template is valid
    #[inline]
    pub fn evaluated_payload(&self) -> Option<&str> {
        self.evaluated_payload.as_ref().map(|o| &**o)
    }
    /// List of validation errors
    #[inline]
    pub fn errors(&self) -> &[super::ValidationError] {
        &*self.errors
    }
    /// List of validation warnings
    #[inline]
    pub fn warnings(&self) -> &[super::ValidationWarning] {
        &*self.warnings
    }
}