diff --git a/src/as-validator-issue-tag.h b/src/as-validator-issue-tag.h index 70ba6625..00daab1a 100644 --- a/src/as-validator-issue-tag.h +++ b/src/as-validator-issue-tag.h @@ -685,6 +685,17 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = { N_("The value set as release type is invalid."), }, + { "release-version-missing", + AS_ISSUE_SEVERITY_ERROR, + /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ + N_("The release is missing the `version` property."), + }, + + { "release-time-missing", + AS_ISSUE_SEVERITY_ERROR, + /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ + N_("The release is missing either the `date` (preferred) or the `timestamp` property."), + }, { "artifact-type-invalid", AS_ISSUE_SEVERITY_ERROR, /* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */ diff --git a/src/as-validator.c b/src/as-validator.c index 5e1bdce0..5d6d9223 100644 --- a/src/as-validator.c +++ b/src/as-validator.c @@ -1519,11 +1519,22 @@ as_validator_check_release (AsValidator *validator, xmlNode *node, AsFormatStyle { gchar *prop; + /* validate presence of version property */ + prop = as_xml_get_prop_value (node, "version"); + if (prop == NULL) + as_validator_add_issue (validator, node, "release-version-missing", "version"); + g_free (prop); + /* validate date strings */ prop = as_xml_get_prop_value (node, "date"); if (prop != NULL) { as_validator_validate_iso8601_complete_date (validator, node, prop); g_free (prop); + } else { + g_autofree gchar *timestamp = as_xml_get_prop_value (node, "timestamp"); + /* Neither timestamp, nor date property exists */ + if (timestamp == NULL) + as_validator_add_issue (validator, node, "release-time-missing", "date"); } prop = as_xml_get_prop_value (node, "date_eol"); if (prop != NULL) {