pub trait ValidatorExt:
IsA<Validator>
+ Sealed
+ 'static {
Show 19 methods
// Provided methods
fn add_override(
&self,
tag: &str,
severity_override: IssueSeverity,
) -> Result<(), Error> { ... }
fn add_release_bytes(
&self,
release_fname: &str,
release_metadata: &Bytes,
) -> Result<(), Error> { ... }
fn add_release_file(
&self,
release_file: &impl IsA<File>,
) -> Result<(), Error> { ... }
fn check_success(&self) -> bool { ... }
fn clear_release_data(&self) { ... }
fn allows_net(&self) -> bool { ... }
fn issue_files_count(&self) -> u32 { ... }
fn issues(&self) -> Vec<ValidatorIssue> { ... }
fn report_yaml(&self) -> Result<GString, Error> { ... }
fn is_strict(&self) -> bool { ... }
fn tag_explanation(&self, tag: &str) -> Option<GString> { ... }
fn tag_severity(&self, tag: &str) -> IssueSeverity { ... }
fn tags(&self) -> Vec<GString> { ... }
fn set_allow_net(&self, value: bool) { ... }
fn set_strict(&self, is_strict: bool) { ... }
fn validate_bytes(&self, metadata: &Bytes) -> bool { ... }
fn validate_data(&self, metadata: &str) -> bool { ... }
fn validate_file(&self, metadata_file: &impl IsA<File>) -> bool { ... }
fn validate_tree(&self, root_dir: &str) -> bool { ... }
}
Provided Methods§
sourcefn add_override(
&self,
tag: &str,
severity_override: IssueSeverity,
) -> Result<(), Error>
fn add_override( &self, tag: &str, severity_override: IssueSeverity, ) -> Result<(), Error>
Override the severity of a selected tag. For most tags, the severity can not be lowered to a value that makes a validation that would otherwise fail pass (so e.g. an ERROR can not become an INFO). Some tags are explicitly allowed to have their severity lowered to enable validation of e.g. incomplete metadata during development. Increasing the severity of any tag is always allowed.
§tag
the issue tag to override, e.g. “release-time-missing”
§severity_override
the new severity for the tag.
sourcefn add_release_bytes(
&self,
release_fname: &str,
release_metadata: &Bytes,
) -> Result<(), Error>
fn add_release_bytes( &self, release_fname: &str, release_metadata: &Bytes, ) -> Result<(), Error>
sourcefn check_success(&self) -> bool
fn check_success(&self) -> bool
Check the current registered values again and return true
if no issues were found that would make the previously validated
files fail validation.
Usually you do not need to call this function explicitly, as the as_validator_validate_* functions will already return whether data was valid as return value.
§Returns
true
if previously validated files were valid.
sourcefn clear_release_data(&self)
fn clear_release_data(&self)
Clear all release information that was explicitly added to the validation process.
sourcefn allows_net(&self) -> bool
fn allows_net(&self) -> bool
sourcefn issue_files_count(&self) -> u32
fn issue_files_count(&self) -> u32
Get the number of files for which issues have been found.
§Returns
The number of files that have issues.
sourcefn issues(&self) -> Vec<ValidatorIssue>
fn issues(&self) -> Vec<ValidatorIssue>
Get a list of found metadata format issues.
§Returns
a list of ValidatorIssue
instances, free with g_list_free()
fn report_yaml(&self) -> Result<GString, Error>
sourcefn tag_explanation(&self, tag: &str) -> Option<GString>
fn tag_explanation(&self, tag: &str) -> Option<GString>
sourcefn tag_severity(&self, tag: &str) -> IssueSeverity
fn tag_severity(&self, tag: &str) -> IssueSeverity
sourcefn set_allow_net(&self, value: bool)
fn set_allow_net(&self, value: bool)
sourcefn set_strict(&self, is_strict: bool)
fn set_strict(&self, is_strict: bool)
sourcefn validate_bytes(&self, metadata: &Bytes) -> bool
fn validate_bytes(&self, metadata: &Bytes) -> bool
Validate AppStream XML data from a byte array.
Remember to run as_validator_clear_issues
if you do not want previous
validation runs to affect the outcome of this validation.
§metadata
XML metadata as glib::Bytes
.
§Returns
true
if bytes validated successfully.