diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 4f97ca1e..e2ac4ffd 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.8.1", + "version": "1.8.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 64353225..d9c0229d 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.8.1", + "version": "1.8.2", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/components/labels-editor/common.ts b/cvat-ui/src/components/labels-editor/common.ts index ed3a6413..a50765da 100644 --- a/cvat-ui/src/components/labels-editor/common.ts +++ b/cvat-ui/src/components/labels-editor/common.ts @@ -44,6 +44,11 @@ function validateParsedAttribute(attr: Attribute): void { + `Attribute values must be an array. Got type ${typeof (attr.values)}`); } + if (!attr.values.length) { + throw new Error(`Attribute: "${attr.name}". Attribute values array mustn't be empty`); + } + + for (const value of attr.values) { if (typeof (value) !== 'string') { throw new Error(`Attribute: "${attr.name}". ` @@ -62,6 +67,11 @@ export function validateParsedLabel(label: Label): void { + `Type of label id must be only a number or undefined. Got value ${label.id}`); } + if (typeof (label.color) !== 'string') { + throw new Error(`Label "${label.name}". ` + + `Label color must be a string. Got ${typeof (label.color)}`); + } + if (!label.color.match(/^#[0-9a-f]{6}$|^$/)) { throw new Error(`Label "${label.name}". ` + `Type of label color must be only a valid color string. Got value ${label.color}`);