![]() |
![]() |
![]() |
![]() |
#define | AS_TYPE_VALIDATOR |
struct | AsValidatorClass |
enum | AsValidatorError |
#define | AS_VALIDATOR_ERROR |
AsValidator |
This object is able to validate AppStream XML metadata (catalog and metainfo) and to generate a report about issues found with it.
See also: AsMetadata
gboolean as_validator_validate_file (AsValidator *validator
,GFile *metadata_file
);
Validate an AppStream XML file.
gboolean as_validator_validate_bytes (AsValidator *validator
,GBytes *metadata
);
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.
Since: 0.14.0
gboolean as_validator_validate_data (AsValidator *validator
,const gchar *metadata
);
Validate AppStream XML data.
gboolean as_validator_validate_tree (AsValidator *validator
,const gchar *root_dir
);
Validate a full directory tree for issues in AppStream metadata.
validator |
An instance of AsValidator. |
|
root_dir |
The root directory of the filesystem tree that should be validated. |
void
as_validator_clear_release_data (AsValidator *validator
);
Clear all release information that was explicitly added to the validation process.
Since: 0.16.0
gboolean as_validator_add_release_bytes (AsValidator *validator
,const gchar *release_fname
,GBytes *release_metadata
,GError **error
);
Add release metadata explicitly from bytes.
validator |
a AsValidator instance. |
|
release_fname |
File basename of the release metadata file to add. |
|
release_metadata |
Data of the release metadata file. |
|
error |
Since: 0.16.0
gboolean as_validator_add_release_file (AsValidator *validator
,GFile *release_file
,GError **error
);
Add a release metadata file to the validation process.
Since: 0.16.0
guint
as_validator_get_issue_files_count (AsValidator *validator
);
Get the number of files for which issues have been found.
Since: 0.16.0
GList *
as_validator_get_issues (AsValidator *validator
);
Get a list of found metadata format issues.
a list of AsValidatorIssue instances, free with g_list_free()
.
[element-type AsValidatorIssue][transfer container]
GHashTable *
as_validator_get_issues_per_file (AsValidator *validator
);
Get a hash table of filenames mapped to lists of issues. This is useful if validation was requested for multiple files and a list of issues per-file is desired without prior explicit sorting.
a file to issue list mapping.
[element-type utf8 GPtrArray(AsValidatorIssue)][transfer none]
Since: 0.12.8
gchar * as_validator_get_report_yaml (AsValidator *validator
,GError **error
);
gboolean
as_validator_check_success (AsValidator *validator
);
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.
void as_validator_set_check_urls (AsValidator *validator
,gboolean value
);
Set this value to make the AsValidator check whether remote URLs actually exist.
validator |
a AsValidator instance. |
|
value |
|
void as_validator_set_strict (AsValidator *validator
,gboolean is_strict
);
Enable or disable strict mode. In strict mode, any found issue will result in a failed validation (except for issues of "pedantic" severity). Otherwise, only a "warning" or "error" will cause the validation to fail.
Since: 0.15.4
gboolean as_validator_add_override (AsValidator *validator
,const gchar *tag
,AsIssueSeverity severity_override
,GError **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.
validator |
a AsValidator instance. |
|
tag |
the issue tag to override, e.g. "release-time-missing" |
|
severity_override |
the new severity for the tag. |
|
error |
Since: 0.15.4
const gchar * as_validator_get_tag_explanation (AsValidator *validator
,const gchar *tag
);
Get the explanatory text for a given issue tag.
AsIssueSeverity as_validator_get_tag_severity (AsValidator *validator
,const gchar *tag
);
Get the severity for a given issue tag.
gchar **
as_validator_get_tags (AsValidator *validator
);
Get an array of all tags known to the validator.