Commit 2d245500 authored by fit2-zhao's avatar fit2-zhao Committed by fit2-zhao
Browse files

fix(接口测试): 修复接口参数 JSON-SCHEMA 转换失败问题

--bug=1009239 --user=赵勇 [github #8832]接口参数 JSON-SCHEMA 转换失败 https://www.tapd.cn/55049933/s/1087091
Showing with 8 additions and 31 deletions
+8 -31
......@@ -19,6 +19,7 @@ package io.metersphere.api.jmeter;
import com.alibaba.fastjson.JSON;
import io.metersphere.api.dto.RunningParamKeys;
import io.metersphere.api.exec.queue.PoolExecBlockingQueueUtil;
import io.metersphere.api.service.MsResultService;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
......@@ -105,12 +106,12 @@ public class MsResultCollector extends AbstractListenerElement implements Sample
LoggerUtil.debug("send. " + this.getName());
WebSocketUtils.sendMessageSingle(dto);
WebSocketUtils.onClose(this.getName());
PoolExecBlockingQueueUtil.offer(this.getName());
}
@Override
public void testStarted(String host) {
LogUtil.debug("TestStarted " + this.getName());
}
@Override
......
......@@ -110,6 +110,9 @@ class Convert {
}
let $id = `${name}/properties/${key}`
// 判断当前 element 的值 是否也是对象,如果是就继续递归,不是就赋值给result
if(!result["properties"]){
continue;
}
if (isObject(element)) {
// 创建当前属性的基本信息
result["properties"][key] = this._value2object(element, $id, key)
......@@ -137,7 +140,9 @@ class Convert {
}
} else {
// 一般属性直接获取基本信息
result["properties"][key] = this._value2object(element, $id, key);
if (result["properties"]) {
result["properties"][key] = this._value2object(element, $id, key);
}
}
}
}
......
......@@ -43,7 +43,6 @@
<json-schema-editor v-for="(item,key,index) in pickValue.properties" :value="{[key]:item}" :parent="pickValue" :key="index" :deep="deep+1" :root="false" class="children" :lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType" @reloadItems="reloadItems"/>
</template>
<template v-if="isArray && reloadItemOver">
<!-- <json-schema-editor :value="{items:pickValue.items}" :deep="deep+1" disabled isItem :root="false" class="children" :lang="lang" :custom="custom"/>-->
<json-schema-editor v-for="(item,key,index) in pickValue.items" :value="{[key]:item}" :parent="pickValue" :key="index" :deep="deep+1" :root="false" class="children" :lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"/>
</template>
<!-- 高级设置-->
......@@ -72,31 +71,6 @@
</el-form-item>
</div>
</el-form>
<!--<h3 v-text="$t('schema.add_custom')" v-show="custom">添加自定义属性</h3>
<el-form class="ms-advanced-search-form" v-show="custom">
<el-row :gutter="6">
<el-col :span="8" v-for="item in customProps" :key="item.key">
<el-form-item :label="item.key">
<el-input v-model="item.value" style="width:calc(100% - 30px)" size="small"/>
<el-button icon="close" type="link" @click="customProps.splice(customProps.indexOf(item),1)" size="small"/>
</el-form-item>
</el-col>
<el-col :span="8" v-show="addProp.key != undefined">
<el-form-item>
<el-input slot="label" v-model="addProp.key" size="small"/>
<el-input v-model="addProp.value" size="small"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button icon="check" type="link" @click="confirmAddCustomNode" v-if="customing"/>
<el-tooltip content="$t('schema.add_custom')" v-else>
<el-button icon="el-icon-plus" type="link" @click="addCustomNode"/>
</el-tooltip>
</el-form-item>
</el-col>
</el-row>
</el-form>-->
<p class="tip">{{$t('schema.preview')}} </p>
<pre style="width:100%">{{completeNodeValue}}</pre>
......
......@@ -40,9 +40,6 @@
created() {
if (this.schema.mock && Object.prototype.toString.call(this.schema.mock).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
this.mock = this.schema.mock;
if(typeof(this.mock.mock) === 'number'){
this.mock.mock = this.mock.mock+"";
}
} else {
this.schema.mock = this.mock;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment