From 2491fc9ef21cc5988a9d353ca48c2d4c75135caf Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 7 Sep 2022 14:34:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=AF=BC=E5=85=A5=E9=BB=98=E8=AE=A4=E7=94=9F?= =?UTF-8?q?=E6=88=90case=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001016605 --- .../api/dto/ApiTestImportRequest.java | 2 ++ .../parse/PostmanDefinitionParser.java | 19 +++++++++++-------- .../api/service/ApiDefinitionService.java | 6 ++++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/ApiTestImportRequest.java b/backend/src/main/java/io/metersphere/api/dto/ApiTestImportRequest.java index fa1a0946e7..a44dd99649 100644 --- a/backend/src/main/java/io/metersphere/api/dto/ApiTestImportRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/ApiTestImportRequest.java @@ -39,4 +39,6 @@ public class ApiTestImportRequest { private Boolean coverModule; // 当前协议 private String protocol; + //上传文件来源,目前用于辨别是否是idea插件 + private String origin; } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java index 0be4eabb38..9e0c663ea2 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java @@ -25,6 +25,7 @@ public class PostmanDefinitionParser extends PostmanAbstractParserParser cases = new ArrayList<>(); parseItem(postmanCollection.getItem(), modulePath, results, - cases); + cases, addCase); apiImport.setData(results); apiImport.setCases(cases); return apiImport; } protected void parseItem(List items, String modulePath, List results, - List cases) { + List cases, boolean addCase) { for (PostmanItem item : items) { List childItems = item.getItem(); if (childItems != null) { @@ -57,7 +58,7 @@ public class PostmanDefinitionParser extends PostmanAbstractParserParser