fix: swagger未导入到指定模块

This commit is contained in:
chenjianxing 2021-06-24 17:14:42 +08:00 committed by jianxing
parent 83fe0396fe
commit b19bdb3ea0
1 changed files with 5 additions and 1 deletions

View File

@ -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<ApiD
protected void buildModule(ApiModule parentModule, ApiDefinitionWithBLOBs apiDefinition,
List<String> 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());