fix(接口自动化): 修复JSONSchema 预览错误问题 #1005335;修复场景检索问题 #1004959
--bug=1005335 --user=赵勇 【github#4790】json-... https://www.tapd.cn/55049933/s/1030096 --bug=1004959 --user=赵勇 【接口自动化】负责人... https://www.tapd.cn/55049933/s/1030095
This commit is contained in:
parent
6465ba583b
commit
1ffbee6435
|
@ -382,11 +382,6 @@
|
|||
<artifactId>kubernetes-client</artifactId>
|
||||
<version>4.13.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.fge</groupId>
|
||||
<artifactId>json-schema-validator</artifactId>
|
||||
<version>2.2.6</version>
|
||||
</dependency>
|
||||
<!-- 添加jmeter包支持导入的jmx能正常执行 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.jmeter</groupId>
|
||||
|
|
|
@ -250,6 +250,18 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key=='principal_name'">
|
||||
and api_scenario.principal in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key=='user_name'">
|
||||
and api_scenario.user_id in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
|
||||
</choose>
|
||||
</if>
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package io.metersphere.commons.json;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.github.fge.jackson.JsonLoader;
|
||||
import com.github.fge.jsonschema.cfg.ValidationConfiguration;
|
||||
import com.github.fge.jsonschema.core.report.ProcessingReport;
|
||||
import com.github.fge.jsonschema.processors.syntax.SyntaxValidator;
|
||||
import com.google.gson.*;
|
||||
import io.metersphere.jmeter.utils.ScriptEngineUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -310,7 +305,6 @@ public class JSONSchemaGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private static final SyntaxValidator VALIDATOR = new SyntaxValidator(ValidationConfiguration.byDefault());
|
||||
|
||||
private static String formerJson(String jsonSchema) {
|
||||
try {
|
||||
|
@ -328,24 +322,13 @@ public class JSONSchemaGenerator {
|
|||
}
|
||||
|
||||
public static String getJson(String jsonSchema) {
|
||||
try {
|
||||
if (StringUtils.isEmpty(jsonSchema)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
JsonNode jsonNode = JsonLoader.fromString(jsonSchema);
|
||||
ProcessingReport report = VALIDATOR.validateSchema(jsonNode);
|
||||
if (report.isSuccess()) {
|
||||
return formerJson(jsonSchema);
|
||||
} else {
|
||||
return report.getExceptionThreshold().toString();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
try {
|
||||
return formerJson(jsonSchema);
|
||||
} catch (Exception e) {
|
||||
return jsonSchema;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue