semanticdb-core 1.1.21 → 1.1.22
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.
|
@@ -35,10 +35,6 @@ function isSchemaValid(schema, schemasDict) {
|
|
|
35
35
|
if (!schema.properties.every((property) => property.name && property.name.trim() !== '' && property.type)) {
|
|
36
36
|
return { valid: false, message: '每一个属性都必须有名称和类型' };
|
|
37
37
|
}
|
|
38
|
-
// 检查_id
|
|
39
|
-
if (!schema._id) {
|
|
40
|
-
return { valid: false, message: '错误的schema配置,缺少_id' };
|
|
41
|
-
}
|
|
42
38
|
// 检查db
|
|
43
39
|
if (!schema.db) {
|
|
44
40
|
return { valid: false, message: '缺少数据库配置' };
|
|
@@ -100,11 +96,11 @@ function isSchemaValid(schema, schemasDict) {
|
|
|
100
96
|
seenNames.add(name);
|
|
101
97
|
}
|
|
102
98
|
// ==================== 检查属性_id重复 ====================
|
|
103
|
-
const propertyIds = schema.properties.map((p) => p.
|
|
99
|
+
const propertyIds = schema.properties.map((p) => p.id).filter((id) => !!id);
|
|
104
100
|
const seenIds = new Set();
|
|
105
101
|
for (const id of propertyIds) {
|
|
106
102
|
if (seenIds.has(id)) {
|
|
107
|
-
return { valid: false, message: `${schema.name} 中有两个相同
|
|
103
|
+
return { valid: false, message: `${schema.name} 中有两个相同id的属性:${id}` };
|
|
108
104
|
}
|
|
109
105
|
seenIds.add(id);
|
|
110
106
|
}
|