semanticdb-core 1.1.24 → 1.1.26

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.
@@ -44,11 +44,14 @@ function isSchemaValid(schema, schemasDict) {
44
44
  return { valid: false, message: 'schema的标签不能是对象类型' };
45
45
  }
46
46
  // ==================== 构建名称列表(用于冲突检查) ====================
47
- const schemaNames = [schema.name, ...(schema.syno || [])];
47
+ if (typeof schema.syno === 'string') {
48
+ schema.syno = schema.syno.split(',');
49
+ }
50
+ const schemaNames = [schema.name, ...(schema.syno || [])].filter(n => n.trim().length > 0);
48
51
  let hierarchyNames = [];
49
52
  if (schema.hierarchy) {
50
53
  for (const h of schema.hierarchy) {
51
- hierarchyNames = [...hierarchyNames, h.name, ...(h.syno || [])];
54
+ hierarchyNames = [...hierarchyNames, h.name, ...(h.syno || [])].filter(n => n.trim().length > 0);
52
55
  }
53
56
  }
54
57
  // ==================== RULE: schema和hierarchy不能有名词重复 ====================
@@ -186,7 +189,7 @@ function isPropertyValid(property, schemaNames = [], hierarchyNames = []) {
186
189
  propertySyno = syno.split(',');
187
190
  }
188
191
  // RULE: 属性名或者属性syno不能和schema名和schema syno一样
189
- const propertyNames = [property.name || '', ...propertySyno];
192
+ const propertyNames = [property.name || '', ...propertySyno].filter(n => n.trim().length > 0);
190
193
  const conflicts = _intersection(schemaNames, propertyNames);
191
194
  if (conflicts.length > 0) {
192
195
  return { valid: false, message: `属性${property.name}和Schema包含相同的关键词: ${conflicts.join(',')}` };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semanticdb-core",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [