fix(接口测试): 响应切换丢失schema修复

--bug=1047484 --user=白奇 在Schema格式下,修改默认的响应内容,在Json中自动生成失败 https://www.tapd.cn/55049933/s/1591564
This commit is contained in:
baiqi 2024-10-14 16:04:57 +08:00 committed by Craftsman
parent b27da7e476
commit 519c5da10f
1 changed files with 9 additions and 2 deletions

View File

@ -402,11 +402,18 @@
const selectedKeys = ref<string[]>([]);
watchEffect(() => {
if (activeResponse.value.body.jsonBody.jsonSchema) {
if (
activeResponse.value.body.jsonBody.jsonSchema &&
(!activeResponse.value.body.jsonBody.jsonSchemaTableData ||
activeResponse.value.body.jsonBody.jsonSchemaTableData.length === 0)
) {
const { result, ids } = parseSchemaToJsonSchemaTableData(activeResponse.value.body.jsonBody.jsonSchema);
activeResponse.value.body.jsonBody.jsonSchemaTableData = result;
selectedKeys.value = ids;
} else {
} else if (
!activeResponse.value.body.jsonBody.jsonSchemaTableData ||
activeResponse.value.body.jsonBody.jsonSchemaTableData.length === 0
) {
activeResponse.value.body.jsonBody.jsonSchemaTableData = [];
selectedKeys.value = [];
}