refactor(接口测试): 增加参数大小的限制

This commit is contained in:
wxg0103 2024-01-31 14:18:45 +08:00 committed by wxg0103
parent 858996778b
commit 4285d5a82b
35 changed files with 203 additions and 32 deletions

View File

@ -24,6 +24,7 @@ api_definition_template.project_id.not_blank=项目ID不能为空
permission.system_api_scenario.name=场景
api_scenario.name.repeat=场景名称重复
api_scenario.id.not_blank=不能为空
api_scenario.id.length_range=场景ID长度必须在1-50之间
api_scenario.name.length_range=场景名称长度必须在1-200之间
api_scenario.name.not_blank=场景名称不能为空
api_scenario.create_user.length_range=创建人长度必须在1-50之间
@ -42,6 +43,7 @@ api_scenario.deleted.not_blank=删除状态不能为空
api_scenario.environment_group.length_range=是否为环境组长度必须在1-1之间
api_scenario.environment_group.not_blank=是否为环境组不能为空
api_scenario.project_id.length_range=项目ID长度必须在1-50之间
api_scenario.module_id.length_range=模块ID长度必须在1-50之间
api_scenario.project_id.not_blank=项目ID不能为空
api_scenario.request_pass_rate.not_blank=通过率不能为空
api_scenario.request_pass_rate.length_range=通过率长度必须在1-20之间
@ -181,10 +183,6 @@ api_definition_env.environment_id.length_range=环境ID长度必须在1-50之间
api_definition_env.environment_id.not_blank=环境ID不能为空
#moduleApiScenarioBlob
api_scenario_blob.api_scenario_id.not_blank=场景pk不能为空
#moduleApiDefinitionSwagger
api_definition_swagger.id.not_blank=主键不能为空
api_definition_swagger.swagger_url.length_range=url地址长度必须在1-500之间
api_definition_swagger.swagger_url.not_blank=url地址不能为空
#moduleApiTestCase
api_test_case.id.not_blank=接口用例pk不能为空
api_test_case.name.length_range=接口用例名称长度必须在1-200之间
@ -340,8 +338,10 @@ api_debug.name.not_blank=接口名称不能为空
api_debug.name.length_range=接口名称长度必须在1-255之间
api_debug.protocol.not_blank=协议不能为空
api_debug.protocol.length_range=协议长度必须在1-20之间
api_debug.method.length_range=请求类型长度必须在0-20之间
api_debug.project_id.not_blank=项目ID不能为空
api_debug.project_id.length_range=项目ID长度必须在1-50之间
api_debug.project_id.length_range=项目ID长度必须在0-50之间
api_debug.path.length_range=接口路径長度必須在0-500之间
api_debug.module_id.not_blank=模块ID不能为空
api_debug.module_id.length_range=模块ID长度必须在1-50之间
#module: ApiDebugModule
@ -400,3 +400,30 @@ api_scenario_csv.ignore_first_line.not_blank=是否忽略第一行
api_scenario_csv.allow_quoted_data.not_blank=是否允许带引号
api_scenario_csv.recycle_on_eof.not_blank=是否循环
api_scenario_csv.stop_thread_on_eof.not_blank=是否停止线程
#module: ApiDefinitionSwagger
api_definition_swagger.id.not_blank=主键不能为空
api_definition_swagger.id.length_range=主键长度必须在1-50之间
api_definition_swagger.name.not_blank=名称不能为空
api_definition_swagger.name.length_range=名称长度必须在1-255之间
api_definition_swagger.swagger_url.not_blank=swagger url不能为空
api_definition_swagger.swagger_url.length_range=swagger url长度必须在1-500之间
api_definition_swagger.project_id.not_blank=项目ID不能为空
api_definition_swagger.project_id.length_range=项目ID长度必须在1-50之间
api_definition_swagger.module_id.length_range=模块ID长度必须在0-50之间
api_test_case.env_id.length_range=环境ID长度必须在0-50之间
api_test_case.status.length_range=用例状态长度必须在0-20之间
api_test_case.priority.length_range_=用例等级长度必须在0-50之间
api_test_case.id.length_range=接口用例pk长度必须在1-50之间
api_test_case.environment_id.length_range=环境ID长度必须在0-50之间
api_scenario.target_module_id.length_range=目标模块ID长度必须在0-50之间
api_scenario.group_id.length_range=环境组ID长度必须在0-50之间
api_scenario.environment_id.length_range=环境ID长度必须在0-50之间
api_scenario_step.name.length_range=步骤名称长度必须在1-255之间
api_scenario_step.name.not_blank=步骤名称不能为空
api_scenario_step.resource_num.length_range=资源编号长度必须在1-50之间
api_scenario_step.project_id.length_range
api_scenario_step.version_id.length_range

View File

@ -46,6 +46,7 @@ api_scenario.project_id.length_range=Item fk length must be between 1-50
api_scenario.project_id.not_blank=Item fk cannot be empty
api_scenario.request_pass_rate.not_blank=Pass rate cannot be empty
api_scenario.request_pass_rate.length_range=Pass rate length must be between 1-20
api_scenario.module_id.length_range=Module fk length must be between 1-50
#module: ApiScenarioStep
api_scenario_step.id.not_blank=ID cannot be empty
api_scenario_step.id.length_range=Step ID length must be between 1-50
@ -182,10 +183,7 @@ api_definition_env.environment_id.length_range=Environment fk length must be bet
api_definition_env.environment_id.not_blank=Environment fk cannot be empty
#moduleApiScenarioBlob
api_scenario_blob.api_scenario_id.not_blank=scene pk cannot be empty
#moduleApiDefinitionSwagger
api_definition_swagger.id.not_blank=primary key cannot be empty
api_definition_swagger.swagger_url.length_range=The url address length must be between 1-500
api_definition_swagger.swagger_url.not_blank=url address cannot be empty
#moduleApiTestCase
api_test_case.id.not_blank=Interface use case pk cannot be empty
api_test_case.name.length_range=The length of the interface use case name must be between 1-200
@ -348,6 +346,8 @@ api_debug.name.not_blank=Interface name cannot be blank
api_debug.name.length_range=The interface name length must be between 1-255
api_debug.protocol.not_blank=Protocol cannot be blank
api_debug.protocol.length_range=Protocol length must be between 1-20
api_debug.method.length_range=Api method length must be between 0-20
api_debug.path.length_range=Api path length must be between 0-500
api_debug.project_id.not_blank=Project ID cannot be blank
api_debug.project_id.length_range=Project ID length must be between 1-50
api_debug.module_id.not_blank=Module ID cannot be blank
@ -411,4 +411,24 @@ api_scenario_csv.random.not_blank=Random cannot be empty
api_scenario_csv.ignore_first_line.not_blank=Ignore the first line cannot be empty
api_scenario_csv.allow_quoted_data.not_blank=Allow quoted data cannot be empty
api_scenario_csv.recycle_on_eof.not_blank=Recycle on EOF cannot be empty
api_scenario_csv.stop_thread_on_eof.not_blank=Stop thread on EOF cannot be empty
api_scenario_csv.stop_thread_on_eof.not_blank=Stop thread on EOF cannot be empty
#module: ApiDefinitionSwagger
api_definition_swagger.id.not_blank=ID cannot be empty
api_definition_swagger.id.length_range=ID length must be between 1-50
api_definition_swagger.name.not_blank=Name cannot be empty
api_definition_swagger.name.length_range=Name length must be between 1-255
api_definition_swagger.swagger_url.not_blank=Swagger url cannot be empty
api_definition_swagger.swagger_url.length_range=Swagger url length must be between 1-500
api_definition_swagger.project_id.not_blank=Project ID cannot be empty
api_definition_swagger.project_id.length_range=Project ID length must be between 1-50
api_definition_swagger.module_id.length_range=Module ID length must be between 0-50
api_test_case.env_id.length_range=Environment ID length must be between 0-50
api_test_case.status.length_range=Status length must be between 0-20
api_test_case.priority.length_range_=Priority length must be between 0-50
api_test_case.environment_id.length_range=Environment ID length must be between 0-50
api_scenario.target_module_id.length_range=Target module ID length must be between 0-50
api_scenario.group_id.length_range=Group ID length must be between 0-50
api_scenario.environment_id.length_range=Environment ID length must be between 0-50

View File

@ -46,6 +46,7 @@ api_scenario.project_id.length_range=项目ID长度必须在1-50之间
api_scenario.project_id.not_blank=项目ID不能为空
api_scenario.request_pass_rate.not_blank=通过率不能为空
api_scenario.request_pass_rate.length_range=通过率长度必须在1-20之间
api_scenario.module_id.length_range=模块ID长度必须在1-50之间
#module: ApiScenarioStep
api_scenario_step.id.not_blank=ID不能为空
api_scenario_step.id.length_range=步骤ID长度必须在1-50之间
@ -162,10 +163,6 @@ api_definition_env.environment_id.length_range=环境ID长度必须在1-50之间
api_definition_env.environment_id.not_blank=环境ID不能为空
#moduleApiScenarioBlob
api_scenario_blob.api_scenario_id.not_blank=场景pk不能为空
#moduleApiDefinitionSwagger
api_definition_swagger.id.not_blank=主键不能为空
api_definition_swagger.swagger_url.length_range=url地址长度必须在1-500之间
api_definition_swagger.swagger_url.not_blank=url地址不能为空
#moduleApiTestCase
api_test_case.id.not_blank=接口用例pk不能为空
api_test_case.name.length_range=接口用例名称长度必须在1-200之间
@ -317,6 +314,8 @@ api_debug.name.not_blank=接口名称不能为空
api_debug.name.length_range=接口名称长度必须在1-255之间
api_debug.protocol.not_blank=协议不能为空
api_debug.protocol.length_range=协议长度必须在1-20之间
api_debug.method.length_range=请求类型长度必须在0-20之间
api_debug.path.length_range=接口路径長度必須在0-500之間
api_debug.project_id.not_blank=项目ID不能为空
api_debug.project_id.length_range=项目ID长度必须在1-50之间
api_debug.module_id.not_blank=模块ID不能为空
@ -381,3 +380,23 @@ api_scenario_csv.ignore_first_line.not_blank=是否忽略第一行
api_scenario_csv.allow_quoted_data.not_blank=是否允许带引号
api_scenario_csv.recycle_on_eof.not_blank=是否循环
api_scenario_csv.stop_thread_on_eof.not_blank=是否停止线程
#module: ApiDefinitionSwagger
api_definition_swagger.id.not_blank=主键不能为空
api_definition_swagger.id.length_range=主键长度必须在1-50之间
api_definition_swagger.name.not_blank=名称不能为空
api_definition_swagger.name.length_range=名称长度必须在1-255之间
api_definition_swagger.swagger_url.not_blank=swagger url不能为空
api_definition_swagger.swagger_url.length_range=swagger url长度必须在1-500之间
api_definition_swagger.project_id.not_blank=项目ID不能为空
api_definition_swagger.project_id.length_range=项目ID长度必须在1-50之间
api_definition_swagger.module_id.length_range=模块ID长度必须在0-50之间
api_test_case.env_id.length_range=环境ID长度必须在0-50之间
api_test_case.status.length_range=用例状态长度必须在0-20之间
api_test_case.priority.length_range_=用例等级长度必须在0-50之间
api_test_case.environment_id.length_range=环境ID长度必须在0-50之间
api_scenario.target_module_id.length_range=目标模块ID长度必须在0-50之间
api_scenario.group_id.length_range=环境组ID长度必须在0-50之间
api_scenario.environment_id.length_range=环境ID长度必须在0-50之间

View File

@ -46,6 +46,7 @@ api_scenario.project_id.length_range=項目ID長度必須在1-50之間
api_scenario.project_id.not_blank=項目ID不能為空
api_scenario.request_pass_rate.not_blank=通過率不能為空
api_scenario.request_pass_rate.length_range=通過率長度必須在1-20之間
api_scenario.module_id.length_range=模塊ID長度必須在1-50之間
#module: ApiScenarioStep
api_scenario_step.id.not_blank=步骤ID不能為空
api_scenario_step.id.length_range=步骤ID長度必須在1-50之間
@ -162,10 +163,7 @@ api_definition_env.environment_id.length_range=環境ID長度必須在1-50之間
api_definition_env.environment_id.not_blank=環境ID不能為空
#moduleApiScenarioBlob
api_scenario_blob.api_scenario_id.not_blank=場景pk不能為空
#moduleApiDefinitionSwagger
api_definition_swagger.id.not_blank=主鍵不能為空
api_definition_swagger.swagger_url.length_range=url地址長度必須在1-500之間
api_definition_swagger.swagger_url.not_blank=url地址不能為空
#moduleApiTestCase
api_test_case.id.not_blank=接口用例pk不能為空
api_test_case.name.length_range=接口用例名稱長度必須在1-200之間
@ -317,6 +315,8 @@ api_debug.name.not_blank=接口名稱不能為空
api_debug.name.length_range=接口名稱長度必須在1-255之間
api_debug.protocol.not_blank=協定不能為空
api_debug.protocol.length_range=協定長度必須在1-20之間
api_debug.method.length_range=请求类型長度必须在0-20之間
api_debug.path.length_range=接口路径長度必須在0-500之間
api_debug.project_id.not_blank=項目ID不能為空
api_debug.project_id.length_range=項目ID長度必須在1-50之間
api_debug.module_id.not_blank=模塊ID不能為空
@ -380,4 +380,22 @@ api_scenario_csv.random.not_blank=是否随机不能為空
api_scenario_csv.ignore_first_line.not_blank=是否忽略首行不能為空
api_scenario_csv.allow_quoted_data.not_blank=是否允许引用数据不能為空
api_scenario_csv.recycle_on_eof.not_blank=是否循环读取
api_scenario_csv.stop_thread_on_eof.not_blank=是否停止线程
api_scenario_csv.stop_thread_on_eof.not_blank=是否停止线程
#module: ApiDefinitionSwagger
api_definition_swagger.id.not_blank=ID不能為空
api_definition_swagger.id.length_range=ID長度必須在1-50之間
api_definition_swagger.name.not_blank=名稱不能為空
api_definition_swagger.name.length_range=名稱長度必須在1-255之間
api_definition_swagger.swagger_url.not_blank=swagger url不能為空
api_definition_swagger.swagger_url.length_range=swagger url長度必須在1-500之間
api_definition_swagger.project_id.not_blank=項目ID不能為空
api_definition_swagger.project_id.length_range=項目ID長度必須在1-50之間
api_test_case.env_id.length_range=環境ID長度必須在0-50之間
api_test_case.status.length_range=用例狀態長度必須在0-20之間
api_test_case.priority.length_range_=用例等級長度必須在0-50之間
api_test_case.environment_id.length_range=環境ID長度必須在0-50之間
api_scenario.target_module_id.length_range=目標模塊ID長度必須在0-50之間
api_scenario.group_id.length_range=环境組ID長度必須在0-50之間
api_scenario.environment_id.length_range=環境ID長度必須在0-50之間

View File

@ -70,7 +70,7 @@ public class ApiReportController {
@Operation(summary = "接口测试-接口报告-用例报告批量删除")
@CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "api_report")
@RequiresPermissions(PermissionConstants.PROJECT_API_REPORT_DELETE)
public void batchDelete(@RequestBody ApiReportBatchRequest request) {
public void batchDelete(@Validated @RequestBody ApiReportBatchRequest request) {
apiReportService.batchDelete(request, SessionUtils.getUserId());
}

View File

@ -70,7 +70,7 @@ public class ApiScenarioReportController {
@Operation(summary = "接口测试-接口报告-场景报告批量删除")
@CheckOwner(resourceId = "#request.getSelectIds()", resourceType = "api_scenario_report")
@RequiresPermissions(PermissionConstants.PROJECT_API_REPORT_DELETE)
public void batchDelete(@RequestBody ApiReportBatchRequest request) {
public void batchDelete(@Validated @RequestBody ApiReportBatchRequest request) {
apiScenarioReportService.batchDelete(request, SessionUtils.getUserId());
}

View File

@ -29,9 +29,11 @@ public class ApiDebugAddRequest implements Serializable {
private String protocol;
@Schema(description = "http协议类型post/get/其它协议则是协议名(mqtt)")
@Size(max = 20, message = "{api_debug.method.length_range}")
private String method;
@Schema(description = "http协议url/其它协议则为空")
@Size(max = 500, message = "{api_debug.protocol.length_range}")
private String path;
@Schema(description = "项目fk", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -11,7 +11,7 @@ import java.util.List;
@Data
public class ApiDebugRequest {
@Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)")
private List<String> moduleIds;
private List<@NotBlank String> moduleIds;
@Schema(description = "协议", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_debug_module.protocol.not_blank}")

View File

@ -27,9 +27,11 @@ public class ApiDebugUpdateRequest implements Serializable {
private String name;
@Schema(description = "http协议类型post/get/其它协议则是协议名(mqtt)")
@Size(max = 20, message = "{api_debug.method.length_range}")
private String method;
@Schema(description = "http协议路径/其它协议则为空")
@Size(max = 500, message = "{api_debug.protocol.length_range}")
private String path;
@Schema(description = "模块fk", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -1,8 +1,6 @@
package io.metersphere.api.dto.debug;
import io.metersphere.sdk.constants.ModuleConstants;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
@ -15,15 +13,18 @@ public class ModuleCreateRequest {
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{project.id.not_blank}")
@Size(min = 1, max = 50, message = "{api_debug.project_id.length_range}")
private String projectId;
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{file_module.name.not_blank}")
@Pattern(regexp = "^[^\\\\/]*$", message = "{api_debug_module.name.not_contain_slash}")
@Size(min = 1, max = 255, message = "{api_debug_module.name.length_range}")
private String name;
@Schema(description = "父模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{parent.node.not_blank}")
@Size(min = 1, max = 50, message = "{api_debug_module.parent_id.length_range}")
private String parentId = ModuleConstants.ROOT_NODE_PARENT_ID;
}

View File

@ -4,17 +4,20 @@ import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class ModuleUpdateRequest {
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{file_module.id.not_blank}")
@Size(min = 1, max = 50, message = "{api_debug_module.id.length_range}")
private String id;
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{file_module.name.not_blank}")
@Pattern(regexp = "^[^\\\\/]*$", message = "{api_debug_module.name.not_contain_slash}")
@Size(min = 1, max = 255, message = "{api_debug_module.name.length_range}")
private String name;
}

View File

@ -28,10 +28,13 @@ public class ApiCaseBatchEditRequest extends ApiTestCaseBatchRequest implements
@Schema(description = "默认覆盖原标签")
private boolean appendTag = false;
@Schema(description = "环境id")
@Size(max = 50, message = "{api_test_case.env_id.length_range}")
private String envId;
@Schema(description = "用例状态")
@Size(max = 20, message = "{api_test_case.status.length_range}")
private String status;
@Schema(description = "用例等级")
@Size(max = 50, message = "{api_test_case.priority.length_range_}")
private String priority;
public List<String> getTags() {

View File

@ -3,6 +3,7 @@ package io.metersphere.api.dto.definition;
import io.metersphere.system.dto.sdk.BasePageRequest;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -18,6 +19,7 @@ public class ApiCaseExecutePageRequest extends BasePageRequest implements Serial
@Schema(description = "用例pk")
@NotBlank(message = "{api_test_case.id.not_blank}")
@Size(min = 1, max = 50, message = "{api_test_case.id.length_range}")
private String id;
}

View File

@ -40,9 +40,11 @@ public class ApiDefinitionAddRequest implements Serializable {
private String projectId;
@Schema(description = "http协议类型post/get/其它协议则是协议名(mqtt)")
@Size(max = 20, message = "{api_debug.method.length_range}")
private String method;
@Schema(description = "http协议路径/其它协议则为空")
@Size(max = 500, message = "{api_debug.protocol.length_range}")
private String path;
@Schema(description = "接口状态/进行中/已完成", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -1,6 +1,7 @@
package io.metersphere.api.dto.definition;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -17,6 +18,7 @@ public class ApiDefinitionBatchMoveRequest extends ApiDefinitionBatchRequest {
private static final long serialVersionUID = 1L;
@Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(max = 50, message = "{api_definition.module_id.length_range}")
private String moduleId;
}

View File

@ -27,8 +27,10 @@ public class ApiModuleRequest extends BaseCondition {
private String keyword;
@Schema(description = "版本fk")
@Size(max = 50, message = "{api_definition.version_id.length_range}")
private String versionId;
@Schema(description = "版本引用fk")
@Size(max = 50, message = "{api_definition.ref_id.length_range}")
private String refId;
}

View File

@ -2,11 +2,15 @@ package io.metersphere.api.dto.definition;
import io.metersphere.system.dto.table.TableBatchProcessDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class ApiReportBatchRequest extends TableBatchProcessDTO {
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_definition.project_id.not_blank}")
@Size(min = 1, max = 50, message = "{api_definition.project_id.length_range}")
private String projectId;
}

View File

@ -2,11 +2,15 @@ package io.metersphere.api.dto.definition;
import io.metersphere.system.dto.sdk.BasePageRequest;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class ApiReportPageRequest extends BasePageRequest {
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_definition.project_id.not_blank}")
@Size(min = 1, max = 50, message = "{api_definition.project_id.length_range}")
private String projectId;
}

View File

@ -48,6 +48,7 @@ public class ApiTestCaseAddRequest implements Serializable {
String> tags;
@Schema(description = "环境fk")
@Size(max = 50, message = "{api_test_case.environment_id.length_range}")
private String environmentId;
@Schema(description = "请求内容")

View File

@ -18,6 +18,7 @@ public class ApiTestCaseBatchRequest extends TableBatchProcessDTO implements Ser
private static final long serialVersionUID = 1L;
@Schema(description = "接口pk")
@Size(max = 50, message = "{api_definition.id.length_range}")
private String apiDefinitionId;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ -34,9 +35,11 @@ public class ApiTestCaseBatchRequest extends TableBatchProcessDTO implements Ser
private List<@NotBlank String> moduleIds;
@Schema(description = "版本fk")
@Size(max = 50, message = "{api_definition.version_id.length_range}")
private String versionId;
@Schema(description = "版本来源")
@Size(max = 50, message = "{api_definition.ref_id.length_range}")
private String refId;
}

View File

@ -20,6 +20,7 @@ public class ApiTestCasePageRequest extends BasePageRequest implements Serializa
private static final long serialVersionUID = 1L;
@Schema(description = "接口pk")
@Size(max = 50, message = "{api_definition.id.length_range}")
private String apiDefinitionId;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@ -36,9 +37,11 @@ public class ApiTestCasePageRequest extends BasePageRequest implements Serializa
private List<@NotBlank String> moduleIds;
@Schema(description = "版本fk")
@Size(max = 50, message = "{api_definition.version_id.length_range}")
private String versionId;
@Schema(description = "版本来源")
@Size(max = 50, message = "{api_definition.ref_id.length_range}")
private String refId;
}

View File

@ -42,6 +42,7 @@ public class ApiTestCaseUpdateRequest implements Serializable {
String> tags;
@Schema(description = "环境fk")
@Size(max = 50, message = "{api_test_case.environment_id.length_range}")
private String environmentId;
@Schema(description = "请求内容")

View File

@ -2,17 +2,22 @@ package io.metersphere.api.dto.definition;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class EnvApiModuleRequest {
public class EnvApiModuleRequest implements Serializable {
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_definition_module.project_id.not_blank}")
@Size(min = 1, max = 50, message = "{api_definition_module.project_id.length_range}")
private String projectId;
@Schema(description = "关键字")
@Schema(description = "选中的模块")
private List<ApiModuleDTO> selectedModules;
private static final long serialVersionUID = 1L;
}

View File

@ -1,12 +1,19 @@
package io.metersphere.api.dto.definition;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class SwaggerUrlCheck {
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_debug.project_id.not_blank}")
@Size(min = 1, max = 50, message = "{api_debug.project_id.length_range}")
private String projectId;
@Schema(description = "swagger地址", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_definition_swagger.swagger_url.not_blank}")
@Size(min = 1, max = 500, message = "{api_definition_swagger.swagger_url.length_range}")
private String swaggerUrl;
}

View File

@ -13,18 +13,23 @@ import lombok.Data;
public class ApiScheduleRequest {
@Schema(description = "id")
@NotBlank(message = "id不能为空", groups = {Updated.class})
@NotBlank(message = "{api_definition_swagger.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{api_definition_swagger.id.length_range}", groups = {Updated.class})
private String id;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "项目id不能为空", groups = {Created.class, Updated.class})
@NotBlank(message = "{api_definition_swagger.project_id.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 50, message = "{api_definition_swagger.project_id.length_range}", groups = {Created.class, Updated.class})
private String projectId;
@Schema(description = "定时任务名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "定时任务名称不能为空", groups = {Created.class, Updated.class})
@NotBlank(message = "{api_definition_swagger.name.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 255, message = "{api_definition_swagger.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(description = "模块ID")
@Size(max = 50, message = "{api_definition_swagger.module_id.length_range}", groups = {Created.class, Updated.class})
private String moduleId;
@Schema(description = "swagger地址", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "swagger地址不能为空", groups = {Created.class, Updated.class})
@NotBlank(message = "{api_definition_swagger.swagger_url.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 500, message = "{api_definition_swagger.swagger_url.length_range}", groups = {Created.class, Updated.class})
private String swaggerUrl;
private String taskId;
@Schema(description = "是否覆盖模块")

View File

@ -40,6 +40,7 @@ public class ApiScenarioAddRequest {
@Schema(description = "场景模块fk")
@NotBlank(message = "{api_debug.module_id.not_blank}")
@Size(max = 50, message = "{api_scenario.module_id.length_range}")
private String moduleId;
@Schema(description = "描述信息")
@ -52,6 +53,7 @@ public class ApiScenarioAddRequest {
private Boolean grouped;
@Schema(description = "环境或者环境组ID")
@Size(max = 50, message = "{api_scenario.environment_id.length_range}")
private String environmentId;
@Schema(description = "场景的通用配置")

View File

@ -2,6 +2,7 @@ package io.metersphere.api.dto.scenario;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -15,6 +16,7 @@ public class ApiScenarioBatchCopyMoveRequest extends ApiScenarioBatchRequest imp
@Schema(description = "复制的目标模块ID")
@NotBlank
@Size(max = 50, message = "{api_scenario.target_module_id.length_range}")
private String targetModuleId;
}

View File

@ -28,14 +28,18 @@ public class ApiScenarioBatchEditRequest extends ApiScenarioBatchRequest impleme
@Schema(description = "默认覆盖原标签")
private boolean appendTag = false;
@Schema(description = "环境id")
@Size(max = 50, message = "{api_test_case.environment_id.length_range}")
private String envId;
@Schema(description = "使用环境组")
private boolean grouped = false;
@Size(max = 50, message = "{api_scenario.group_id.length_range}")
@Schema(description = "环境组id")
private String groupId;
@Schema(description = "用例状态")
@Size(max = 20, message = "{api_test_case.status.length_range}")
private String status;
@Schema(description = "用例等级")
@Size(max = 50, message = "{api_test_case.priority.length_range}")
private String priority;
public List<String> getTags() {

View File

@ -25,6 +25,7 @@ public class ApiScenarioDebugRequest {
@Schema(description = "环境或者环境组ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank
@Size(max = 50, message = "{api_scenario.environment_id.length_range}")
private String environmentId;
@Schema(description = "场景的通用配置")

View File

@ -3,6 +3,7 @@ package io.metersphere.api.dto.scenario;
import io.metersphere.system.dto.sdk.BaseCondition;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.List;
@ -13,14 +14,17 @@ public class ApiScenarioModuleRequest extends BaseCondition {
private List<@NotBlank String> moduleIds;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_definition_module.project_id.not_blank}")
@Size(min = 1, max = 50, message = "{api_definition_module.project_id.length_range}")
private String projectId;
@Schema(description = "关键字")
private String keyword;
@Schema(description = "版本fk")
@Size(max = 50, message = "{api_definition.version_id.length_range}")
private String versionId;
@Schema(description = "版本引用fk")
@Size(max = 50, message = "{api_definition.ref_id.length_range}")
private String refId;
}

View File

@ -3,6 +3,7 @@ package io.metersphere.api.dto.scenario;
import io.metersphere.sdk.dto.api.task.ApiRunModeConfigDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
@ -10,6 +11,7 @@ public class ApiScenarioScheduleConfigRequest {
@NotBlank(message = "{api_scenario.id.not_blank}")
@Schema(description = "场景ID")
@Size(min = 1, max = 50, message = "{api_scenario.id.length_range}")
private String scenarioId;
@Schema(description = "启用/禁用")

View File

@ -2,6 +2,7 @@ package io.metersphere.api.dto.scenario;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
/**
@ -11,15 +12,19 @@ import lombok.Data;
@Data
public class ApiScenarioStepRequest extends ApiScenarioStepCommonDTO {
@Schema(description = "步骤名称")
@NotBlank
@NotBlank(message = "{api_scenario_step.name.not_blank}")
@Size(min = 1, max = 255, message = "{api_scenario_step.name.length_range}")
private String name;
@Schema(description = "资源编号")
@Size(min = 1, max = 50, message = "{api_scenario_step.resource_num.length_range}")
private String resourceNum;
@Schema(description = "项目fk")
@Size(min = 1, max = 50, message = "{api_scenario_step.project_id.length_range}")
private String projectId;
@Schema(description = "版本号")
@Size(min = 1, max = 50, message = "{api_scenario_step.version_id.length_range}")
private String versionId;
}

View File

@ -38,18 +38,20 @@ public class ApiScenarioUpdateRequest {
private String status;
@Schema(description = "场景模块fk")
@Size(max = 50, message = "{api_scenario.module_id.length_range}")
private String moduleId;
@Schema(description = "描述信息")
private String description;
@Schema(description = "标签")
private List<String> tags;
private List<@NotBlank String> tags;
@Schema(description = "是否为环境组", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean grouped;
@Schema(description = "环境或者环境组ID")
@Size(max = 50, message = "{api_scenario.environment_id.length_range}")
private String environmentId;
@Schema(description = "场景的通用配置")

View File

@ -1,6 +1,8 @@
package io.metersphere.api.dto.scenario;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@ -15,12 +17,15 @@ public class CsvVariable {
private String id;
@Schema(description = "文件id/引用文件id", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(min = 1, max = 50, message = "{api_scenario_csv.file_id.length_range}")
private String fileId;
@Schema(description = "场景id", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(min = 1, max = 50, message = "{api_scenario_csv.scenario_id.length_range}")
private String scenarioId;
@Schema(description = "csv变量名称", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(min = 1, max = 255, message = "{api_scenario_csv.name.length_range}")
private String name;
@Schema(description = "文件名称")
@ -30,6 +35,8 @@ public class CsvVariable {
/**
* @see CsvVariableScope
*/
@NotBlank(message = "{api_scenario_csv.scope.not_blank}")
@Size(min = 1, max = 50, message = "{api_scenario_csv.scope.length_range}")
private String scope;
@Schema(description = "启用/禁用")
@ -44,18 +51,21 @@ public class CsvVariable {
*
* @see CsvEncodingType
*/
@Size(max = 50, message = "{api_scenario_csv.encoding.length_range}")
private String encoding;
@Schema(description = "是否随机")
private Boolean random = false;
@Schema(description = "变量名称(西文逗号间隔)")
@Size(max = 255, message = "{api_scenario_csv.variable_names.length_range}")
private String variableNames;
@Schema(description = "忽略首行(只有在设置了变量名称后才生效)")
private Boolean ignoreFirstLine = false;
@Schema(description = "分隔符")
@Size(max = 50, message = "{api_scenario_csv.delimiter.length_range}")
private String delimiter;
@Schema(description = "是否允许带引号")

View File

@ -1,5 +1,6 @@
package io.metersphere.api.dto.share;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@ -9,6 +10,8 @@ import lombok.Data;
*/
@Data
public class ShareInfoDTO {
@Schema(description = "分享id")
private String id;
@Schema(description = "分享链接")
private String shareUrl;
}