use crate::{
base::CommonProperties,
error::{return_multiple_errors, StixError as Error},
};
pub fn check_sro_properties(properties: &CommonProperties) -> Result<(), Error> {
let mut errors = Vec::new();
if properties.spec_version.is_none() {
errors.push(Error::ValidationError(
"SDOs must have a `spec_version` property.".to_string(),
));
}
if properties.created.is_none() {
errors.push(Error::ValidationError(
"SDOs must have a `created` property.".to_string(),
));
}
if properties.modified.is_none() {
errors.push(Error::ValidationError(
"SDOs must have a `modified` property.".to_string(),
));
}
if properties.defanged.is_some() {
errors.push(Error::ValidationError(
"SDOs cannot have a `defanged` property.".to_string(),
));
}
return_multiple_errors(errors)
}