schema: add third-party support

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-08-19 12:26:45 +02:00
parent 9604b536fa
commit e15304b445
3 changed files with 24 additions and 0 deletions

View File

@@ -33,3 +33,6 @@ properties:
$ref: "https://ucentral.io/schema/v1/metrics/"
config-raw:
$ref: "https://ucentral.io/schema/v1/config-raw/"
third-party:
type: object
additionalProperties: true

View File

@@ -5119,6 +5119,23 @@ function newUCentralState(location, value, errors) {
obj.config_raw = instantiateConfigRaw(location + "/config-raw", value["config-raw"], errors);
}
function parseThirdParty(location, value, errors) {
if (type(value) == "object") {
let obj = { ...value };
return obj;
}
if (type(value) != "object")
push(errors, [ location, "must be of type object" ]);
return value;
}
if (exists(value, "third-party")) {
obj.third_party = parseThirdParty(location + "/third-party", value["third-party"], errors);
}
return obj;
}

View File

@@ -44,6 +44,10 @@
},
"config-raw": {
"$ref": "#/$defs/config-raw"
},
"third-party": {
"type": "object",
"additionalProperties": true
}
},
"$defs": {