fix(接口测试): 文档结构根保护处理防止解析错误
--bug=1009952 --user=赵勇 【接口测试】文档结构断言-跟随api定义,接口响应格式错误时会报错 https://www.tapd.cn/55049933/s/1098029
This commit is contained in:
parent
a3c6f213b6
commit
d3b810c062
|
@ -17,11 +17,11 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-select v-model="pickValue.type" :disabled="disabledType" class="ms-col-type" @change="onChangeType" size="small">
|
<el-select v-model="pickValue.type" :disabled="disabledType" class="ms-col-type" @change="onChangeType" size="small">
|
||||||
<el-option :key="t" :value="t" :label="t" v-for="t in TYPE_NAME"/>
|
<el-option :key="t" :value="t" :label="t" v-for="t in types"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<ms-mock :disabled="pickValue.type==='object' || pickValue.type==='array' || pickValue.type==='null'" :schema="pickValue"/>
|
<ms-mock :disabled="pickKey ==='root' || pickValue.type==='object' || pickValue.type==='array' || pickValue.type==='null'" :schema="pickValue"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-input v-model="pickValue.description" class="ms-col-title" :placeholder="$t('schema.description')" size="small"/>
|
<el-input v-model="pickValue.description" class="ms-col-title" :placeholder="$t('schema.description')" size="small"/>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {isNull} from './util'
|
import {isNull} from './util'
|
||||||
import {TYPE_NAME, TYPE} from './type/type'
|
import {TYPE_NAME, TYPE, TYPES} from './type/type'
|
||||||
import MsMock from './mock/MockComplete'
|
import MsMock from './mock/MockComplete'
|
||||||
import MsDialogFooter from '../../../components/MsDialogFooter'
|
import MsDialogFooter from '../../../components/MsDialogFooter'
|
||||||
import {getUUID} from "@/common/js/utils";
|
import {getUUID} from "@/common/js/utils";
|
||||||
|
@ -149,6 +149,9 @@
|
||||||
advanced() {
|
advanced() {
|
||||||
return TYPE[this.pickValue.type]
|
return TYPE[this.pickValue.type]
|
||||||
},
|
},
|
||||||
|
types(){
|
||||||
|
return TYPES(this.pickKey);
|
||||||
|
},
|
||||||
advancedAttr() {
|
advancedAttr() {
|
||||||
return TYPE[this.pickValue.type].attr
|
return TYPE[this.pickValue.type].attr
|
||||||
},
|
},
|
||||||
|
@ -169,7 +172,6 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
TYPE_NAME,
|
|
||||||
hidden: false,
|
hidden: false,
|
||||||
countAdd: 1,
|
countAdd: 1,
|
||||||
modalVisible: false,
|
modalVisible: false,
|
||||||
|
|
|
@ -4,6 +4,8 @@ import _array from './array'
|
||||||
import _boolean from './boolean'
|
import _boolean from './boolean'
|
||||||
import _integer from './integer'
|
import _integer from './integer'
|
||||||
import _number from './number'
|
import _number from './number'
|
||||||
|
import {LicenseKey} from "@/common/js/constants";
|
||||||
|
|
||||||
const TYPE_NAME = ['string', 'number', 'integer', 'object', 'array', 'boolean']
|
const TYPE_NAME = ['string', 'number', 'integer', 'object', 'array', 'boolean']
|
||||||
|
|
||||||
const TYPE = {
|
const TYPE = {
|
||||||
|
@ -15,3 +17,10 @@ const TYPE = {
|
||||||
'number': _number
|
'number': _number
|
||||||
}
|
}
|
||||||
export {TYPE, TYPE_NAME}
|
export {TYPE, TYPE_NAME}
|
||||||
|
|
||||||
|
export function TYPES(key) {
|
||||||
|
if (key && key === 'root') {
|
||||||
|
return ['object', 'array'];
|
||||||
|
}
|
||||||
|
return TYPE_NAME;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue