From f9ece001a912414fb2bd64f0e77d7e381552adff Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 24 Jun 2021 17:14:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20swagger=E6=9C=AA=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=88=B0=E6=8C=87=E5=AE=9A=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/definition/parse/SwaggerAbstractParser.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/SwaggerAbstractParser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/SwaggerAbstractParser.java index c0a4380896..015cdbe2f3 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/SwaggerAbstractParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/SwaggerAbstractParser.java @@ -4,6 +4,7 @@ import io.metersphere.api.parse.ApiImportAbstractParser; import io.metersphere.base.domain.ApiDefinitionWithBLOBs; import io.metersphere.base.domain.ApiModule; import org.apache.commons.lang3.StringUtils; +import org.springframework.util.CollectionUtils; import java.util.List; @@ -11,7 +12,10 @@ public abstract class SwaggerAbstractParser extends ApiImportAbstractParser tags, String selectModulePath) { - if (tags != null) { + if (CollectionUtils.isEmpty(tags)) { + apiDefinition.setModuleId(parentModule.getId()); + apiDefinition.setModulePath(selectModulePath); + } else { tags.forEach(tag -> { ApiModule module = ApiDefinitionImportUtil.buildModule(parentModule, tag, this.projectId); apiDefinition.setModuleId(module.getId());