From 2c11cc15d146e43e028c98efec1272211cae02e4 Mon Sep 17 00:00:00 2001 From: linsui Date: Sat, 27 May 2023 16:41:45 +0800 Subject: [PATCH] schema: add localized anti-features --- schemas/metadata.json | 60 +++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/schemas/metadata.json b/schemas/metadata.json index 4b210256e8..910fd3687b 100644 --- a/schemas/metadata.json +++ b/schemas/metadata.json @@ -736,25 +736,38 @@ "definitions": { "anti_features": { "$id": "#antifeatures", - "type": "array", - "items": { - "type": "string", - "enum": [ - "Ads", - "Tracking", - "NonFreeNet", - "NonFreeAdd", - "NonFreeDep", - "UpstreamNonFree", - "NonFreeAssets", - "NSFW", - "KnownVuln", - "ApplicationDebuggable", - "NoSourceSince" - ] - }, - "uniqueItems": true, - "minItems": 1 + "oneOf": [ + { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Ads", + "ApplicationDebuggable", + "KnownVuln", + "NonFreeAdd", + "NonFreeAssets", + "NonFreeDep", + "NonFreeNet", + "NoSourceSince", + "NSFW", + "UpstreamNonFree", + "Tracking" + ] + }, + "uniqueItems": true, + "minItems": 1 + }, + { + "type": "object", + "patternProperties": { + "^(Ads|Tracking|ApplicationDebuggable|KnownVuln|NonFreeAdd|NonFreeAssets|NonFreeDep|NonFreeNet|NoSourceSince|NSFW|UpstreamNonFree|Tracking)$": { + "$ref": "#/definitions/localized_string" + } + }, + "additionalProperties": false + } + ] }, "string_list": { "anyOf": [ @@ -769,6 +782,15 @@ } ] }, + "localized_string": { + "type": "object", + "patternProperties": { + "^[a-z]{2,3}(-([A-Z][a-zA-Z]+|\\d+|[a-z]+))*$": { + "type": "string" + } + }, + "additionalProperties": false + }, "url": { "type": "string", "pattern": "^https?://.*$"