fix: jsonSchema不生效

This commit is contained in:
chenjianxing 2021-05-08 16:37:43 +08:00 committed by jianxing
parent 26fc73797a
commit 66e6784bd3
4 changed files with 8 additions and 11 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.api.dto.scenario;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.api.dto.scenario.request.BodyFile;
import io.metersphere.commons.json.JSONSchemaGenerator;
import io.metersphere.commons.utils.FileUtils;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ScriptEngineUtils;
@ -80,14 +81,10 @@ public class Body {
private void parseJonBodyMock() {
try {
// if (StringUtils.isNotBlank(this.format) && "JSON-SCHEMA".equals(this.format) ) {
// if(this.getJsonSchema() != null) {
// JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(this.getJsonSchema()));
// jsonMockParse(jsonObject);
// this.setJsonSchema(jsonObject);
// }
// } else
if (StringUtils.isNotBlank(this.type) && StringUtils.equals(this.type, "JSON")) { // json 文本也支持 mock 参数
if(StringUtils.isNotEmpty(this.format) && this.getJsonSchema() != null
&& "JSON-SCHEMA".equals(this.format)) {
this.raw = JSONSchemaGenerator.getJson(com.alibaba.fastjson.JSON.toJSONString(this.getJsonSchema()));
} else if (StringUtils.isNotBlank(this.type) && StringUtils.equals(this.type, "JSON")) { // json 文本也支持 mock 参数
JSONObject jsonObject = com.alibaba.fastjson.JSON.parseObject(this.getRaw());
jsonMockParse(jsonObject);
this.raw = JSONObject.toJSONString(jsonObject);

View File

@ -210,7 +210,7 @@ task_notification_jenkins=Jenkins Task notification
task_notification=Result notification
message_task_already_exists=Task recipient already exists
#automation
automation_name_already_exists=the scenario already exists in the project and the module
automation_name_already_exists=the scenario already exists in the project
automation_exec_info=There are no test steps to execute
#authsource
authsource_name_already_exists=Authentication source name already exists

View File

@ -211,7 +211,7 @@ task_notification_jenkins=jenkins任务通知
task_notification=任务通知
message_task_already_exists=任务接收人已经存在
#automation
automation_name_already_exists=同一个项目和模块下,场景名称不能重复
automation_name_already_exists=同一个项目下,场景名称不能重复
automation_exec_info=没有测试步骤,无法执行
#authsource
authsource_name_already_exists=认证源名称已经存在

View File

@ -212,7 +212,7 @@ task_notification_=定時任務通知
api_definition_url_not_repeating=接口請求地址已經存在
message_task_already_exists=任務接收人已經存在
#automation
automation_name_already_exists=同一個項目和模塊下,場景名稱不能重複
automation_name_already_exists=同一個項目下,場景名稱不能重複
automation_exec_info=沒有測試步驟,無法執行
#authsource
authsource_name_already_exists=認證源名稱已經存在