diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/Body.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/Body.java index d396e8419b..342820bdb6 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/Body.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/Body.java @@ -1,5 +1,6 @@ package io.metersphere.api.dto.request.http.body; +import com.fasterxml.jackson.annotation.JsonIgnore; import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import lombok.Data; @@ -79,10 +80,12 @@ public class Body { bodyTypeClassMap.put(BodyType.BINARY, BinaryBody.class); } + @JsonIgnore public Class getBodyClassByType() { return bodyTypeClassMap.get(BodyType.valueOf(bodyType)); } + @JsonIgnore public Object getBodyDataByType() { Map boadyDataMap = new HashMap<>(); boadyDataMap.put(BodyType.NONE, noneBody); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/FormDataKV.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/FormDataKV.java index 73ca427dcc..4e0e29b2d6 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/FormDataKV.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/request/http/body/FormDataKV.java @@ -1,5 +1,6 @@ package io.metersphere.api.dto.request.http.body; +import com.fasterxml.jackson.annotation.JsonIgnore; import io.metersphere.api.dto.ApiFile; import jakarta.validation.Valid; import lombok.Data; @@ -27,6 +28,7 @@ public class FormDataKV extends WWWFormKV { */ private String contentType; + @JsonIgnore public boolean isFile() { return StringUtils.equalsIgnoreCase(getParamType(), BodyParamType.FILE.getValue()); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/api/KeyValueParam.java b/backend/services/project-management/src/main/java/io/metersphere/project/api/KeyValueParam.java index dd2ecabec2..d417e9e845 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/api/KeyValueParam.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/api/KeyValueParam.java @@ -1,5 +1,6 @@ package io.metersphere.project.api; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.apache.commons.lang3.StringUtils; @@ -19,10 +20,12 @@ public class KeyValueParam { */ private String value; + @JsonIgnore public boolean isValid() { return StringUtils.isNotBlank(key); } + @JsonIgnore public boolean isNotBlankValue() { return StringUtils.isNotBlank(value); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/MsResponseBodyAssertion.java b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/MsResponseBodyAssertion.java index 79eef69190..e8f39ce18a 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/MsResponseBodyAssertion.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/MsResponseBodyAssertion.java @@ -1,5 +1,6 @@ package io.metersphere.project.api.assertion; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonTypeName; import io.metersphere.project.api.assertion.body.MsDocumentAssertion; import io.metersphere.project.api.assertion.body.MsJSONPathAssertion; @@ -62,10 +63,12 @@ public class MsResponseBodyAssertion extends MsAssertion { bodyAssertionClassMap.put(MsBodyAssertionType.XPATH, MsXPathAssertion.class); } + @JsonIgnore public Class getBodyAssertionClassByType() { return bodyAssertionClassMap.get(MsBodyAssertionType.valueOf(assertionBodyType)); } + @JsonIgnore public Object getBodyAssertionDataByType() { Map boadyAssertionMap = new HashMap<>(); boadyAssertionMap.put(MsBodyAssertionType.JSON_PATH, jsonPathAssertion); diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/MsScriptAssertion.java b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/MsScriptAssertion.java index c81baa647a..5668447545 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/MsScriptAssertion.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/MsScriptAssertion.java @@ -1,5 +1,6 @@ package io.metersphere.project.api.assertion; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonTypeName; import io.metersphere.project.constants.ScriptLanguageType; import io.metersphere.project.dto.CommonScriptInfo; @@ -36,6 +37,7 @@ public class MsScriptAssertion extends MsAssertion { @Valid private CommonScriptInfo commonScriptInfo; + @JsonIgnore public boolean isValid() { if (isEnableCommonScript()) { return commonScriptInfo != null && StringUtils.isNotBlank(commonScriptInfo.getId()); @@ -44,6 +46,7 @@ public class MsScriptAssertion extends MsAssertion { } } + @JsonIgnore public boolean isEnableCommonScript() { return BooleanUtils.isTrue(enableCommonScript); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsJSONPathAssertionItem.java b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsJSONPathAssertionItem.java index 9636e8b17e..4b81117765 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsJSONPathAssertionItem.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsJSONPathAssertionItem.java @@ -1,5 +1,6 @@ package io.metersphere.project.api.assertion.body; +import com.fasterxml.jackson.annotation.JsonIgnore; import io.metersphere.sdk.constants.MsAssertionCondition; import io.metersphere.sdk.valid.EnumValue; import jakarta.validation.constraints.NotBlank; @@ -31,6 +32,7 @@ public class MsJSONPathAssertionItem extends MsBodyAssertionItem { */ private String expectedValue; + @JsonIgnore public boolean isValid() { return StringUtils.isNotBlank(expression) && StringUtils.isNotBlank(condition) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsRegexAssertionItem.java b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsRegexAssertionItem.java index 2956a7866e..354a97ad22 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsRegexAssertionItem.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsRegexAssertionItem.java @@ -1,5 +1,6 @@ package io.metersphere.project.api.assertion.body; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.apache.commons.lang3.StringUtils; @@ -15,6 +16,7 @@ public class MsRegexAssertionItem extends MsBodyAssertionItem { */ private String expression; + @JsonIgnore public boolean isValid() { return StringUtils.isNotBlank(expression) && Boolean.TRUE.equals(this.getEnable()); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsXPathAssertionItem.java b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsXPathAssertionItem.java index 74154cbdee..dc38b9cec2 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsXPathAssertionItem.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/api/assertion/body/MsXPathAssertionItem.java @@ -1,6 +1,7 @@ package io.metersphere.project.api.assertion.body; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.apache.commons.lang3.StringUtils; @@ -20,6 +21,7 @@ public class MsXPathAssertionItem extends MsBodyAssertionItem { */ private String expectedValue; + @JsonIgnore public boolean isValid() { return StringUtils.isNotBlank(expression) && Boolean.TRUE.equals(this.getEnable()); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/api/processor/ScriptProcessor.java b/backend/services/project-management/src/main/java/io/metersphere/project/api/processor/ScriptProcessor.java index bcb58744c6..4206899fe1 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/api/processor/ScriptProcessor.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/api/processor/ScriptProcessor.java @@ -1,5 +1,6 @@ package io.metersphere.project.api.processor; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonTypeName; import io.metersphere.project.constants.ScriptLanguageType; import io.metersphere.project.dto.CommonScriptInfo; @@ -44,7 +45,7 @@ public class ScriptProcessor extends MsProcessor { @Valid private CommonScriptInfo commonScriptInfo; - + @JsonIgnore public boolean isValid() { if (isEnableCommonScript()) { return commonScriptInfo != null && StringUtils.isNotBlank(commonScriptInfo.getId()); @@ -53,6 +54,7 @@ public class ScriptProcessor extends MsProcessor { } } + @JsonIgnore public boolean isEnableCommonScript() { return BooleanUtils.isTrue(enableCommonScript); } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/api/processor/extract/MsExtract.java b/backend/services/project-management/src/main/java/io/metersphere/project/api/processor/extract/MsExtract.java index 35fe946c5b..f0fff98de2 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/api/processor/extract/MsExtract.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/api/processor/extract/MsExtract.java @@ -1,5 +1,6 @@ package io.metersphere.project.api.processor.extract; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.metersphere.sdk.valid.EnumValue; @@ -51,6 +52,7 @@ public abstract class MsExtract { */ private String description; + @JsonIgnore public boolean isValid() { return StringUtils.isNotBlank(variableName) && StringUtils.isNotBlank(expression); }