fix: swagger未导入到指定模块
This commit is contained in:
parent
d57ea30f0e
commit
f9ece001a9
|
@ -4,6 +4,7 @@ import io.metersphere.api.parse.ApiImportAbstractParser;
|
||||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||||
import io.metersphere.base.domain.ApiModule;
|
import io.metersphere.base.domain.ApiModule;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -11,7 +12,10 @@ public abstract class SwaggerAbstractParser extends ApiImportAbstractParser<ApiD
|
||||||
|
|
||||||
protected void buildModule(ApiModule parentModule, ApiDefinitionWithBLOBs apiDefinition,
|
protected void buildModule(ApiModule parentModule, ApiDefinitionWithBLOBs apiDefinition,
|
||||||
List<String> tags, String selectModulePath) {
|
List<String> tags, String selectModulePath) {
|
||||||
if (tags != null) {
|
if (CollectionUtils.isEmpty(tags)) {
|
||||||
|
apiDefinition.setModuleId(parentModule.getId());
|
||||||
|
apiDefinition.setModulePath(selectModulePath);
|
||||||
|
} else {
|
||||||
tags.forEach(tag -> {
|
tags.forEach(tag -> {
|
||||||
ApiModule module = ApiDefinitionImportUtil.buildModule(parentModule, tag, this.projectId);
|
ApiModule module = ApiDefinitionImportUtil.buildModule(parentModule, tag, this.projectId);
|
||||||
apiDefinition.setModuleId(module.getId());
|
apiDefinition.setModuleId(module.getId());
|
||||||
|
|
Loading…
Reference in New Issue