Add JSON schema for bloatware list and suggestions

This commit is contained in:
Muntashir Al-Islam 2023-07-15 01:12:59 +06:00
parent 17a484ed71
commit 3e7fa95cbb
4 changed files with 106 additions and 2 deletions

View File

@ -0,0 +1,70 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://muntashirakon.github.io/android-debloat-list/bloatware_list.json",
"title": "Bloatware List",
"description": "Listing of Android bloatware",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Bloatware package name",
"type": "string"
},
"label": {
"description": "Bloatware package label",
"type": "string"
},
"dependencies": {
"description": "Packages that this bloatware depends on",
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},
"required_by": {
"description": "Packages that depend on this bloatware",
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},
"tags": {
"description": "Predefined tags",
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},
"description": {
"description": "Bloatware description",
"type": "string"
},
"web": {
"description": "Online references",
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},
"removal": {
"description": "Bloatware removal type (delete, replace, caution, unsafe)",
"type": "string"
},
"suggestions": {
"description": "Suggestion ID for listing alternatives to this bloatware",
"type": "string"
}
},
"required": [ "id", "label", "description", "removal" ]
},
"uniqueItems": true
}

View File

@ -0,0 +1,34 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://muntashirakon.github.io/android-debloat-list/suggestion_list.json",
"title": "Suggestion List",
"description": "Listing of suggestions for Android bloatware",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "Suggested package name",
"type": "string"
},
"label": {
"description": "Suggested package label",
"type": "string"
},
"reason": {
"description": "Reason for choosing this package if it violates some criteria",
"type": "string"
},
"source": {
"description": "Predefined list of app stores where this package might be located",
"type": "string"
},
"repo": {
"description": "Source code repository for this package",
"type": "string"
}
},
"required": [ "id", "label", "repo" ]
},
"uniqueItems": true
}

View File

@ -154,7 +154,7 @@ function validate_bloatware_item(array $item): int {
fprintf($lint_writer, "{$item['id']}: Expected `warning` field to be a string, found: " . gettype($item['warning']) . "\n"); fprintf($lint_writer, "{$item['id']}: Expected `warning` field to be a string, found: " . gettype($item['warning']) . "\n");
++$error_count; ++$error_count;
} }
// `warning` is an optional string // `suggestions` is an optional string
if (isset($item['suggestions'])) { if (isset($item['suggestions'])) {
if (gettype($item['suggestions']) != 'string') { if (gettype($item['suggestions']) != 'string') {
fprintf($lint_writer, "{$item['id']}: Expected `suggestions` field to be a string, found: " . gettype($item['suggestions']) . "\n"); fprintf($lint_writer, "{$item['id']}: Expected `suggestions` field to be a string, found: " . gettype($item['suggestions']) . "\n");