diff --git a/backend/framework/sdk/src/main/resources/i18n/plan.properties b/backend/framework/sdk/src/main/resources/i18n/plan.properties index 6f87e15951..b0ecb74332 100644 --- a/backend/framework/sdk/src/main/resources/i18n/plan.properties +++ b/backend/framework/sdk/src/main/resources/i18n/plan.properties @@ -7,6 +7,7 @@ test_plan.module_id.not_blank=测试计划模块ID不能为空 test_plan.parent_id.length_range=测试计划父id长度过长 test_plan.parent_id.not_blank=测试计划父id不能为空 test_plan.name.length_range=测试计划名称长度过长 +test_plan_module.name.length_range=测试计划模块名称长度过长 test_plan.name.not_blank=测试计划名称不能为空 test_plan.name.exist=测试计划名称已存在 test_plan.too_many=测试计划数量不能超过{0}个 diff --git a/backend/framework/sdk/src/main/resources/i18n/plan_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/plan_en_US.properties index 8ee0cbedc8..943b756fda 100644 --- a/backend/framework/sdk/src/main/resources/i18n/plan_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/plan_en_US.properties @@ -7,6 +7,7 @@ test_plan.module_id.not_blank=Test plan module id cannot be empty test_plan.parent_id.length_range=Test plan parent id length too long test_plan.parent_id.not_blank=Test plan parent id cannot be empty test_plan.name.length_range=Test plan name length too long +test_plan_module.name.length_range=Test plan module name length too long test_plan.name.not_blank=Test plan name cannot be empty test_plan.name.exist=Test plan name exist test_plan.too_many=Test plan cannot larger than {0} diff --git a/backend/framework/sdk/src/main/resources/i18n/plan_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/plan_zh_CN.properties index 6f87e15951..b0ecb74332 100644 --- a/backend/framework/sdk/src/main/resources/i18n/plan_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/plan_zh_CN.properties @@ -7,6 +7,7 @@ test_plan.module_id.not_blank=测试计划模块ID不能为空 test_plan.parent_id.length_range=测试计划父id长度过长 test_plan.parent_id.not_blank=测试计划父id不能为空 test_plan.name.length_range=测试计划名称长度过长 +test_plan_module.name.length_range=测试计划模块名称长度过长 test_plan.name.not_blank=测试计划名称不能为空 test_plan.name.exist=测试计划名称已存在 test_plan.too_many=测试计划数量不能超过{0}个 diff --git a/backend/framework/sdk/src/main/resources/i18n/plan_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/plan_zh_TW.properties index 491377a700..885e28a3b4 100644 --- a/backend/framework/sdk/src/main/resources/i18n/plan_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/plan_zh_TW.properties @@ -7,6 +7,7 @@ test_plan.module_id.not_blank=測試計劃模塊ID不能為空 test_plan.parent_id.length_range=測試計劃父id長度過長 test_plan.parent_id.not_blank=測試計劃父id不能為空 test_plan.name.length_range=測試計劃名稱長度過長 +test_plan_module.name.length_range=測試計劃模塊名稱長度過長 test_plan.name.not_blank=測試計劃名稱不能為空 test_plan.name.exist=測試計劃名稱已存在 test_plan.not.exist=測試計劃不存在 diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileModuleCreateRequest.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileModuleCreateRequest.java index cbe8ea0f84..1e70464fad 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileModuleCreateRequest.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileModuleCreateRequest.java @@ -4,6 +4,7 @@ import io.metersphere.sdk.constants.ModuleConstants; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Size; import lombok.Data; @Data @@ -14,6 +15,7 @@ public class FileModuleCreateRequest { @Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "{file_module.name.not_blank}") + @Size(min = 1, max = 255, message = "{file_module.name.length_range}") private String name; @Schema(description = "父模块ID", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileModuleUpdateRequest.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileModuleUpdateRequest.java index 356b77c9f4..a59709136e 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileModuleUpdateRequest.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileModuleUpdateRequest.java @@ -3,6 +3,7 @@ package io.metersphere.project.dto.filemanagement.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Size; import lombok.Data; @Data @@ -13,6 +14,7 @@ public class FileModuleUpdateRequest { @Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "{file_module.name.not_blank}") + @Size(min = 1, max = 255, message = "{file_module.name.length_range}") private String name; } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileRepositoryCreateRequest.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileRepositoryCreateRequest.java index aea6b24344..5ae9a01c7f 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileRepositoryCreateRequest.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileRepositoryCreateRequest.java @@ -3,6 +3,7 @@ package io.metersphere.project.dto.filemanagement.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Size; import lombok.Data; @Data @@ -13,6 +14,7 @@ public class FileRepositoryCreateRequest { @Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{file_repository.name.not_blank}") + @Size(min = 1, max = 255, message = "{file_module.name.length_range}") private String name; @Schema(description = "存储库类型", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileRepositoryUpdateRequest.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileRepositoryUpdateRequest.java index 01e39367f5..92c533bc07 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileRepositoryUpdateRequest.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileRepositoryUpdateRequest.java @@ -2,6 +2,7 @@ package io.metersphere.project.dto.filemanagement.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import lombok.Data; @Data @@ -11,6 +12,7 @@ public class FileRepositoryUpdateRequest { private String id; @Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED) + @Size(min = 1, max = 255, message = "{file_module.name.length_range}") private String name; @Schema(description = "存储库类型", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileUpdateRequest.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileUpdateRequest.java index a9e0fe1724..eae1e033f8 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileUpdateRequest.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/request/FileUpdateRequest.java @@ -2,6 +2,7 @@ package io.metersphere.project.dto.filemanagement.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import lombok.Data; import java.util.ArrayList; @@ -15,6 +16,7 @@ public class FileUpdateRequest { private String id; @Schema(description = "文件名称") + @Size(min = 1, max = 255, message = "{file_metadata.name.length_range}") private String name; //注: tags内的数据确保不重复且有序。所以使用这个数据结构接受 diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanModuleCreateRequest.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanModuleCreateRequest.java index ef549d7ada..071438334a 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanModuleCreateRequest.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanModuleCreateRequest.java @@ -4,6 +4,7 @@ import io.metersphere.sdk.constants.ModuleConstants; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Size; import lombok.Data; @Data @@ -14,6 +15,7 @@ public class TestPlanModuleCreateRequest { @Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "{module.name.not_blank}") + @Size(min = 1, max = 255, message = "{test_plan_module.name.length_range}") private String name; @Schema(description = "父模块ID", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanModuleUpdateRequest.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanModuleUpdateRequest.java index fc73c9296d..6dede72760 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanModuleUpdateRequest.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanModuleUpdateRequest.java @@ -3,6 +3,7 @@ package io.metersphere.plan.dto.request; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Size; import lombok.Data; @Data @@ -13,6 +14,7 @@ public class TestPlanModuleUpdateRequest { @Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "{module.name.not_blank}") + @Size(min = 1, max = 255, message = "{test_plan_module.name.length_range}") private String name; } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanUpdateRequest.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanUpdateRequest.java index d2a28de401..ce148d86f5 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanUpdateRequest.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanUpdateRequest.java @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Max; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import lombok.Data; import java.util.LinkedHashSet; @@ -15,6 +16,7 @@ public class TestPlanUpdateRequest { private String id; @Schema(description = "测试计划名称") + @Size(min = 1, max = 255, message = "{test_plan.name.length_range}") private String name; @Schema(description = "模块ID")