fix(接口测试): 修复jsonSchema参数为null时的转换问题

--bug=1020859 --user=宋天阳
【接口测试】接口json-schema中如果有参数a,关闭json-schema,编辑json字符串把参数a改成null,再开启json-schema,a的值没变
https://www.tapd.cn/55049933/s/1316060
This commit is contained in:
song-tianyang 2022-12-15 19:44:40 +08:00 committed by 建国
parent 288fb32aab
commit 59a923dceb
6 changed files with 25 additions and 23 deletions

View File

@ -11,9 +11,6 @@
<if test="versionId != null"> <if test="versionId != null">
AND version_id = #{versionId} AND version_id = #{versionId}
</if> </if>
<if test="versionId == null">
AND latest = 1
</if>
) )
AND reference_id IS NOT NULL AND reference_id IS NOT NULL
</select> </select>

View File

@ -170,7 +170,6 @@ public class ApiDefinitionService {
private static final String SCHEDULE = "schedule"; private static final String SCHEDULE = "schedule";
public List<ApiDefinitionResult> list(ApiDefinitionRequest request) { public List<ApiDefinitionResult> list(ApiDefinitionRequest request) {
request = this.initRequest(request, true, true); request = this.initRequest(request, true, true);
List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request); List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request);
@ -354,8 +353,8 @@ public class ApiDefinitionService {
definitionList = this.selectEffectiveIdByProjectId(request.getProjectId(), versionId); definitionList = this.selectEffectiveIdByProjectId(request.getProjectId(), versionId);
} }
if (CollectionUtils.isNotEmpty(definitionList)) { if (CollectionUtils.isNotEmpty(definitionList)) {
//如果查询条件中有未覆盖/已覆盖 则需要解析出没有用例的接口中有多少是符合场景覆盖规律的然后将这些接口的id作为查询参数 //如果查询条件中有未覆盖/已覆盖 则需要解析出没有用例的接口中有多少是符合场景覆盖规律的然后将这些接口的id作为查询参数. 这里不根据版本筛选覆盖的url
Map<String, Map<String, String>> scenarioUrlList = apiAutomationService.selectScenarioUseUrlByProjectId(request.getProjectId(), versionId); Map<String, Map<String, String>> scenarioUrlList = apiAutomationService.selectScenarioUseUrlByProjectId(request.getProjectId(), null);
List<String> apiIdInScenario = apiAutomationService.getApiIdInScenario(request.getProjectId(), scenarioUrlList, definitionList); List<String> apiIdInScenario = apiAutomationService.getApiIdInScenario(request.getProjectId(), scenarioUrlList, definitionList);
if (CollectionUtils.isNotEmpty(apiIdInScenario)) { if (CollectionUtils.isNotEmpty(apiIdInScenario)) {
request.setCoverageIds(apiIdInScenario); request.setCoverageIds(apiIdInScenario);
@ -935,21 +934,6 @@ public class ApiDefinitionService {
} }
/** /**
* 获取存储执行结果报告 * 获取存储执行结果报告
* *

View File

@ -0,0 +1,11 @@
const value = {
description: null,
};
const attr = {
description: {
name: '描述',
type: 'string',
},
};
const wrapper = { value, attr };
export default wrapper;

View File

@ -4,6 +4,7 @@ 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 _null from './null';
const TYPE_NAME = ['string', 'number', 'integer', 'object', 'array', 'boolean', 'null']; const TYPE_NAME = ['string', 'number', 'integer', 'object', 'array', 'boolean', 'null'];
@ -14,7 +15,7 @@ const TYPE = {
boolean: _boolean, boolean: _boolean,
integer: _integer, integer: _integer,
number: _number, number: _number,
null: { description: null }, null: _null,
}; };
export { TYPE, TYPE_NAME }; export { TYPE, TYPE_NAME };

View File

@ -212,6 +212,14 @@ export default {
this.assignKey(to, from, key); this.assignKey(to, from, key);
} }
} }
//null
if (to.type && from.type) {
to.type = from.type;
if (from.type === 'null') {
this.assign(Object(to.mock), { mock: '' });
}
}
let property = ['description', 'maxLength', 'minLength', 'pattern', 'format', 'enum', 'default']; let property = ['description', 'maxLength', 'minLength', 'pattern', 'format', 'enum', 'default'];
// //
for (let key in to) { for (let key in to) {

View File

@ -233,6 +233,7 @@ export default {
.api-home-layout :deep(.dashboard-title) { .api-home-layout :deep(.dashboard-title) {
font-size: 18px; font-size: 18px;
font-weight: 500; font-weight: 500;
color: #1f2329;
} }
.api-home-layout :deep(.common-amount) { .api-home-layout :deep(.common-amount) {