fix(接口定义): 修复json错误格式仍可转jsonSchema的缺陷
--bug=1018522 --user=王孝刚 【接口测试】github#18661,接口请求体参数删除后,点击保存成功 ,JSON-SCHEMA模式下参数实际并没有删除成功 https://www.tapd.cn/55049933/s/1269410
This commit is contained in:
parent
a30ec0e761
commit
f85a2e5a7e
|
@ -221,15 +221,20 @@ export default {
|
|||
});
|
||||
},
|
||||
formatChange() {
|
||||
const MsConvert = new Convert();
|
||||
|
||||
const MsConvert = new Convert();
|
||||
if (this.body.format === 'JSON-SCHEMA') {
|
||||
if (this.body.raw) {
|
||||
if (!this.body.jsonSchema) {
|
||||
this.body.jsonSchema = MsConvert.format(JSON.parse(this.body.raw));
|
||||
} else {
|
||||
let data = MsConvert.format(JSON.parse(this.body.raw));
|
||||
this.body.jsonSchema = this.deepAssign(this.body.jsonSchema, data);
|
||||
try {
|
||||
if (!this.body.jsonSchema) {
|
||||
this.body.jsonSchema = MsConvert.format(JSON.parse(this.body.raw));
|
||||
} else {
|
||||
let data = MsConvert.format(JSON.parse(this.body.raw));
|
||||
this.body.jsonSchema = this.deepAssign(this.body.jsonSchema, data);
|
||||
}
|
||||
} catch (e) {
|
||||
this.body.format = 'JSON';
|
||||
this.$message.error(this.$t('api_definition.body.json_format_error'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -14,6 +14,9 @@ const message = {
|
|||
desc: "Description",
|
||||
type: "Type",
|
||||
default_value: "Default value"
|
||||
},
|
||||
body: {
|
||||
json_format_error: "JSON format error"
|
||||
}
|
||||
},
|
||||
home:{
|
||||
|
|
|
@ -15,6 +15,9 @@ const message = {
|
|||
type: "类型",
|
||||
default_value: "默认值",
|
||||
},
|
||||
body: {
|
||||
json_format_error: "JSON格式错误",
|
||||
}
|
||||
},
|
||||
home: {
|
||||
table: {
|
||||
|
|
|
@ -15,6 +15,9 @@ const message = {
|
|||
type: "類型",
|
||||
default_value: "默認值",
|
||||
},
|
||||
body: {
|
||||
json_format_error: "JSON格式錯誤",
|
||||
}
|
||||
},
|
||||
home: {
|
||||
table: {
|
||||
|
|
Loading…
Reference in New Issue