diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/plugin/JdbcDriverPluginDescriptorFinder.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/plugin/JdbcDriverPluginDescriptorFinder.java index 91bace08c2..7a0565f962 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/plugin/JdbcDriverPluginDescriptorFinder.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/plugin/JdbcDriverPluginDescriptorFinder.java @@ -1,11 +1,11 @@ package io.metersphere.sdk.plugin; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import org.pf4j.ManifestPluginDescriptorFinder; import org.pf4j.PluginDescriptor; import org.pf4j.PluginRuntimeException; import org.pf4j.util.FileUtils; -import org.pf4j.util.StringUtils; import java.io.IOException; import java.io.InputStream; @@ -61,18 +61,32 @@ public class JdbcDriverPluginDescriptorFinder extends ManifestPluginDescriptorFi // 将类名作为ID String id = driverClass; pluginDescriptor.setPluginId(id.split("\n")[0]); - if (StringUtils.isNullOrEmpty(id)) { + if (StringUtils.isBlank(id)) { return null; } String description = attributes.getValue("Plugin-Description"); - if (StringUtils.isNullOrEmpty(description)) { + if (StringUtils.isBlank(description)) { pluginDescriptor.setPluginDescription(""); } else { pluginDescriptor.setPluginDescription(description); } String version = attributes.getValue("Implementation-Version"); - if (StringUtils.isNotNullOrEmpty(version)) { + if (StringUtils.isNotBlank(version)) { pluginDescriptor.setPluginVersion(version); + } else { + // 如果没有 Implementation-Version 属性,就查找是否有版本相关的属性,设置为版本 + for (Object key : attributes.keySet()) { + Object var = attributes.get(key); + if (key != null && var != null && StringUtils.containsIgnoreCase(key.toString(), "Version")) { + pluginDescriptor.setPluginVersion(var.toString()); + break; + } + } + } + + if (StringUtils.isBlank(version)) { + // 没有版本相关的属性,就用id兜底 + pluginDescriptor.setPluginVersion(id); } String provider = attributes.getValue("Implementation-Vendor"); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionRunRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionRunRequest.java index 10d4c75811..68e9d11b01 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionRunRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionRunRequest.java @@ -2,7 +2,6 @@ package io.metersphere.api.dto.definition; import io.metersphere.api.dto.debug.ApiDebugRunRequest; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; import lombok.Data; @@ -12,11 +11,9 @@ public class ApiDefinitionRunRequest extends ApiDebugRunRequest { private String environmentId; @Schema(description = "http协议类型post/get/其它协议则是协议名(mqtt)") - @NotBlank private String method; @Schema(description = "http协议路径/其它协议则为空") - @NotBlank private String path; @Schema(description = "模块fk")