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());