fix(接口测试): 修复jsonSchema相关问题

--bug=1020682 --user=王孝刚
【接口测试】新建接口-请求参数-请求体选择json-未开启schema-保存接口-查看接口文档-响应体显示请求体的数据
https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001020682

--bug=1020664
--user=王孝刚 【接口测试】编辑接口-开启json-schema-数据不显示了
https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001020664
This commit is contained in:
wxg0103 2022-12-06 14:50:46 +08:00 committed by 建国
parent ee2fd5aedd
commit 4d4826f7c3
2 changed files with 6 additions and 3 deletions

View File

@ -246,6 +246,9 @@ export default {
this.body.jsonSchema = MsConvert.format(JSON.parse(this.body.raw)); this.body.jsonSchema = MsConvert.format(JSON.parse(this.body.raw));
} else { } else {
let data = MsConvert.format(JSON.parse(this.body.raw)); let data = MsConvert.format(JSON.parse(this.body.raw));
if (!this.body.jsonSchema.type) {
this.body.jsonSchema.type = data.type;
}
this.body.jsonSchema = this.deepAssign(this.body.jsonSchema, data); this.body.jsonSchema = this.deepAssign(this.body.jsonSchema, data);
} }
} catch (e) { } catch (e) {

View File

@ -122,10 +122,10 @@ export default {
} catch (e) { } catch (e) {
return false; return false;
} }
} else if (jsonType === 'response' && api.requestBodyStructureData) { } else if (jsonType === 'response' && api.responseBodyStructureData) {
try { try {
JSON.parse(api.requestBodyStructureData); JSON.parse(api.responseBodyStructureData);
api.responseJsonSchema = { raw: api.requestBodyStructureData }; api.responseJsonSchema = { raw: api.responseBodyStructureData };
return true; return true;
} catch (e) { } catch (e) {
return false; return false;