AsValidator: AppStream Library Reference Manual

## AsValidator AsValidator — Validator and report-generator about AppStream XML metadata |

## Functions

AsValidator * | as_validator_new ()
void | as_validator_clear_issues ()
gboolean | as_validator_validate_file ()
gboolean | as_validator_validate_data ()
gboolean | as_validator_validate_tree ()
GList * | as_validator_get_issues ()
GHashTable * | as_validator_get_issues_per_file ()
gboolean | as_validator_get_report_yaml ()
gboolean | as_validator_get_check_urls ()
void | as_validator_set_check_urls ()
const gchar * | as_validator_get_tag_explanation ()
AsIssueSeverity | as_validator_get_tag_severity ()

## Types and Values

#define | AS_TYPE_VALIDATOR
struct | AsValidatorClass
| AsValidator

## Includes

    #include <appstream.h>

## Description

This object is able to validate AppStream XML metadata (collection and metainfo) and to generate a report about issues found with it.

See also: AsMetadata

## Functions

### as_validator_new ()

    AsValidator *
    as_validator_new (void);

Creates a new AsValidator.

#### Returns

an AsValidator.

[transfer full]

### as_validator_clear_issues ()

    void
    as_validator_clear_issues (AsValidator *validator);

Clears the list of issues

#### Parameters

validator | An instance of AsValidator. |

### as_validator_validate_file ()

    gboolean
    as_validator_validate_file (AsValidator *validator,
                                GFile *metadata_file);

Validate an AppStream XML file

#### Parameters

validator | An instance of AsValidator. |
metadata_file | An AppStream XML file. |

### as_validator_validate_data ()

    gboolean
    as_validator_validate_data (AsValidator *validator,
                                const gchar *metadata);

Validate AppStream XML data

#### Parameters

validator | An instance of AsValidator. |
metadata | XML metadata. |

### as_validator_validate_tree ()

    gboolean
    as_validator_validate_tree (AsValidator *validator,
                                const gchar *root_dir);

Validate a full directory tree for issues in AppStream metadata.

#### Parameters

validator | An instance of AsValidator. |
root_dir | The root directory of the filesystem tree that should be validated. |

### as_validator_get_issues ()

    GList *
    as_validator_get_issues (AsValidator *validator);

Get a list of found metadata format issues.

#### Parameters

validator | An instance of AsValidator. |

#### Returns

a list of AsValidatorIssue instances, free with `g_list_free()`.

[element-type AsValidatorIssue][transfer container]

### as_validator_get_issues_per_file ()

    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.

#### Parameters

validator | An instance of AsValidator. |

#### Returns

a file to issue list mapping.

[element-type utf8 GPtrArray(AsValidatorIssue)][transfer none]

Since: 0.12.8

### as_validator_get_report_yaml ()

    gboolean
    as_validator_get_report_yaml (AsValidator *validator,
                                  gchar **yaml_report);

### as_validator_get_check_urls ()

    gboolean
    as_validator_get_check_urls (AsValidator *validator);

#### Parameters

validator | a AsValidator instance. |

#### Returns

`TRUE` in case we check if remote URLs exist.

### as_validator_set_check_urls ()

    void
    as_validator_set_check_urls (AsValidator *validator,
                                 gboolean value);

Set this value to make the AsValidator check whether remote URLs actually exist.

#### Parameters

validator | a AsValidator instance. |

### as_validator_get_tag_explanation ()

    const gchar *
    as_validator_get_tag_explanation (AsValidator *validator,
                                      const gchar *tag);

Get the explanatory text for a given issue tag.

#### Parameters

validator | An instance of AsValidator. |

#### Returns

Explanation text.

### as_validator_get_tag_severity ()

    AsIssueSeverity
    as_validator_get_tag_severity (AsValidator *validator,
                                   const gchar *tag);

Get the severity for a given issue tag.

#### Parameters

validator | An instance of AsValidator. |

#### Returns

The AsIssueSeverity

## Types and Values

### AS_TYPE_VALIDATOR

    #define AS_TYPE_VALIDATOR (as_validator_get_type ())

### struct AsValidatorClass

    struct AsValidatorClass {
    	GObjectClass		parent_class;
    };

### AsValidator

    typedef struct _AsValidator AsValidator;