Skip to content

Commit 1f34d32

Browse files
committed
fix(objectfield): 修复调用isValid 校验schema 返回结果可能不正确的问题
由于ajv会缓存schema的解析结果,存在id会通过id做为key来缓存,内部拆解schema校验可能导致id重复
1 parent 471b926 commit 1f34d32

File tree

1 file changed

+4
-1
lines changed
  • packages/lib/src/JsonSchemaForm/fields/ObjectField

1 file changed

+4
-1
lines changed

packages/lib/src/JsonSchemaForm/fields/ObjectField/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ export default {
8989
},
9090
props: {
9191
schema: Object.entries(self.$props.schema).reduce((preVal, [key, value]) => {
92-
if (self.$props.schema.additionalProperties === false || key !== 'properties') preVal[key] = value;
92+
if (
93+
self.$props.schema.additionalProperties === false
94+
|| !['properties', 'id', '$id'].includes(key)
95+
) preVal[key] = value;
9396
return preVal;
9497
}, {}),
9598
errorSchema: this.errorSchema,

0 commit comments

Comments
 (0)