From 072e5b3a16f4aff3e3c57224e10d6c704fb9b747 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 19 Jul 2022 16:08:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Djson=E8=BD=ACjson-schema=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=B8=8D=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1014946 --user=赵勇 [接口测试]github#15843接口定义,在已有接口上用JSON格式新增字段,保存后切换到JSON-SCHEMA格式,新增的字段未增加 https://www.tapd.cn/55049933/s/1204201 --- .../api/definition/components/body/ApiBody.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/body/ApiBody.vue b/frontend/src/business/components/api/definition/components/body/ApiBody.vue index c475f6f8d5..b90c948acf 100644 --- a/frontend/src/business/components/api/definition/components/body/ApiBody.vue +++ b/frontend/src/business/components/api/definition/components/body/ApiBody.vue @@ -178,7 +178,6 @@ export default { to[key] = this.assign(Object(to[key]), from[key]); } }, - assign(to, from) { if (to === from) { return to; @@ -189,17 +188,20 @@ export default { this.assignKey(to, from, key); } } - + // 清除多出部分属性 + for (let key in to) { + if (!this.hasOwnProperty.call(from, key) && key !== 'description') { + this.$delete(to, key) + } + } if (Object.getOwnPropertySymbols) { let symbols = Object.getOwnPropertySymbols(from); - for (let i = 0; i < symbols.length; i++) { if (this.propIsEnumerable.call(from, symbols[i])) { this.assignKey(to, from, symbols[i]); } } } - return to; },