Skip to content

Commit

Permalink
fix(lib): allOf merge 相同类型直接使用左边
Browse files Browse the repository at this point in the history
re #116
  • Loading branch information
lljj-x committed Oct 10, 2021
1 parent 8e1f892 commit c0bd0cd
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 53 deletions.
9 changes: 4 additions & 5 deletions packages/lib/utils/schema/retriev.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,9 @@ function mergeSchemaAllOf(...args) {
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -329,7 +328,7 @@ export function resolveAllOf(schema, rootSchema, formData) {
const { allOf, ...originProperties } = resolvedAllOfRefSchema;
return mergeSchemaAllOf(originProperties, ...allOf);
} catch (e) {
console.warn(`无法合并allOf,丢弃allOf配置继续渲染: \n${e}`);
console.error(`无法合并allOf,丢弃allOf配置继续渲染: \n${e}`);
// eslint-disable-next-line no-unused-vars
const { allOf: errAllOf, ...resolvedSchemaWithoutAllOf } = resolvedAllOfRefSchema;
return resolvedSchemaWithoutAllOf;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8183,10 +8183,9 @@ function mergeSchemaAllOf() {
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -8222,7 +8221,7 @@ function resolveAllOf(schema, rootSchema, formData) {

return mergeSchemaAllOf.apply(void 0, [originProperties].concat(_toConsumableArray(allOf)));
} catch (e) {
console.warn("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars
console.error("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars

resolvedAllOfRefSchema.allOf;
var resolvedSchemaWithoutAllOf = _objectWithoutProperties(resolvedAllOfRefSchema, ["allOf"]);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8191,10 +8191,9 @@
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -8230,7 +8229,7 @@

return mergeSchemaAllOf.apply(void 0, [originProperties].concat(_toConsumableArray(allOf)));
} catch (e) {
console.warn("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars
console.error("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars

resolvedAllOfRefSchema.allOf;
var resolvedSchemaWithoutAllOf = _objectWithoutProperties(resolvedAllOfRefSchema, ["allOf"]);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8183,10 +8183,9 @@ function mergeSchemaAllOf() {
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -8222,7 +8221,7 @@ function resolveAllOf(schema, rootSchema, formData) {

return mergeSchemaAllOf.apply(void 0, [originProperties].concat(_toConsumableArray(allOf)));
} catch (e) {
console.warn("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars
console.error("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars

resolvedAllOfRefSchema.allOf;
var resolvedSchemaWithoutAllOf = _objectWithoutProperties(resolvedAllOfRefSchema, ["allOf"]);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8191,10 +8191,9 @@
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -8230,7 +8229,7 @@

return mergeSchemaAllOf.apply(void 0, [originProperties].concat(_toConsumableArray(allOf)));
} catch (e) {
console.warn("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars
console.error("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars

resolvedAllOfRefSchema.allOf;
var resolvedSchemaWithoutAllOf = _objectWithoutProperties(resolvedAllOfRefSchema, ["allOf"]);
Expand Down

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions packages/lib/vue3/vue3-form-ant/dist/vue3-form-ant.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -8248,10 +8248,9 @@ function mergeSchemaAllOf() {
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -8287,7 +8286,7 @@ function resolveAllOf(schema, rootSchema, formData) {

return mergeSchemaAllOf.apply(void 0, [originProperties].concat(_toConsumableArray(allOf)));
} catch (e) {
console.warn("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars
console.error("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars

resolvedAllOfRefSchema.allOf;
var resolvedSchemaWithoutAllOf = _objectWithoutProperties(resolvedAllOfRefSchema, ["allOf"]);
Expand Down

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions packages/lib/vue3/vue3-form-ant/dist/vue3-form-ant.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -8252,10 +8252,9 @@
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -8291,7 +8290,7 @@

return mergeSchemaAllOf.apply(void 0, [originProperties].concat(_toConsumableArray(allOf)));
} catch (e) {
console.warn("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars
console.error("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars

resolvedAllOfRefSchema.allOf;
var resolvedSchemaWithoutAllOf = _objectWithoutProperties(resolvedAllOfRefSchema, ["allOf"]);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8294,10 +8294,9 @@ function mergeSchemaAllOf() {
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -8333,7 +8332,7 @@ function resolveAllOf(schema, rootSchema, formData) {

return mergeSchemaAllOf.apply(void 0, [originProperties].concat(_toConsumableArray(allOf)));
} catch (e) {
console.warn("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars
console.error("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars

resolvedAllOfRefSchema.allOf;
var resolvedSchemaWithoutAllOf = _objectWithoutProperties(resolvedAllOfRefSchema, ["allOf"]);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8298,10 +8298,9 @@
// 获取最小公倍数
acc[key] = scm(left, right);
} else {
if (left !== right) {
throw new Error('无法合并如下数据');
}

// if (left !== right) {
// throw new Error('无法合并如下数据');
// }
acc[key] = left;
}
} else {
Expand Down Expand Up @@ -8337,7 +8336,7 @@

return mergeSchemaAllOf.apply(void 0, [originProperties].concat(_toConsumableArray(allOf)));
} catch (e) {
console.warn("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars
console.error("\u65E0\u6CD5\u5408\u5E76allOf\uFF0C\u4E22\u5F03allOf\u914D\u7F6E\u7EE7\u7EED\u6E32\u67D3: \n".concat(e)); // eslint-disable-next-line no-unused-vars

resolvedAllOfRefSchema.allOf;
var resolvedSchemaWithoutAllOf = _objectWithoutProperties(resolvedAllOfRefSchema, ["allOf"]);
Expand Down

Large diffs are not rendered by default.

0 comments on commit c0bd0cd

Please sign in to comment.