@iobroker/repochecker 5.18.1 → 5.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/config_StateRoles.js +2 -0
- package/lib/objectStructure.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/config_StateRoles.js
CHANGED
|
@@ -9,6 +9,8 @@ const ROOT_OBJECT_SCHEMA = {
|
|
|
9
9
|
ts: { type: 'number', optional: true },
|
|
10
10
|
acl: { type: 'object', optional: true },
|
|
11
11
|
user: { type: 'string', optional: true },
|
|
12
|
+
ack: { type: 'boolean', optional: true },
|
|
13
|
+
val: { optional: true, matchesCommonType: true },
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
const ALLOWED_OBJECT_TYPES = new Set([
|
package/lib/objectStructure.js
CHANGED
|
@@ -338,12 +338,21 @@ function validateObjectDump(objects, adapter, collector) {
|
|
|
338
338
|
continue;
|
|
339
339
|
}
|
|
340
340
|
const actualType = getValueType(objectData[schemaKey]);
|
|
341
|
-
if (actualType !== descriptor.type) {
|
|
341
|
+
if (descriptor.type && actualType !== descriptor.type) {
|
|
342
342
|
collector.error(
|
|
343
343
|
'E3005',
|
|
344
344
|
`Object "${objectId}": key "${schemaKey}" must be type ${descriptor.type}, got ${actualType}.`,
|
|
345
345
|
);
|
|
346
346
|
}
|
|
347
|
+
if (descriptor.matchesCommonType) {
|
|
348
|
+
const commonType = objectData.common && objectData.common.type;
|
|
349
|
+
if (commonType && !matchesCommonType(objectData[schemaKey], commonType)) {
|
|
350
|
+
collector.error(
|
|
351
|
+
'E3005',
|
|
352
|
+
`Object "${objectId}": key "${schemaKey}" must match common.type "${commonType}".`,
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
347
356
|
}
|
|
348
357
|
|
|
349
358
|
// --- No extra root keys ---
|
package/package.json
CHANGED