From 197ae58215502d79058d83b8eed39ce0a44ed5d6 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 30 Dec 2021 11:46:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20swagger2=E5=AF=BC=E5=85=A5=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E6=96=87=E4=BB=B6=E8=B5=B0=E7=9A=84swagger3=E7=9A=84?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=B5=81=E7=A8=8B=20--bug=3D1009407=20--user?= =?UTF-8?q?=3D=E9=99=88=E5=BB=BA=E6=98=9F=20[=20github#8970]=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AF=BC=E5=85=A5=EF=BC=9Aswagger=202.0=20json?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=AF=BC=E5=85=A5=E5=90=8E=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E4=BA=9B=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=88=B0MeterSphere=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=87=8C=E3=80=82=20https://www.tapd.cn/55049933/s/10884811?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/dto/definition/parse/Swagger2Parser.java | 2 +- .../io/metersphere/api/dto/definition/parse/Swagger3Parser.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java index 3d7d8a2d0f..716a0faada 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java @@ -37,7 +37,7 @@ public class Swagger2Parser extends SwaggerAbstractParser { swagger = new SwaggerParser().read(request.getSwaggerUrl(), auths, true); } else { sourceStr = getApiTestStr(source); // 导入的二进制文件转换为 String - swagger = new SwaggerParser().readWithInfo(sourceStr, auths, true).getSwagger(); + swagger = new SwaggerParser().readWithInfo(sourceStr).getSwagger(); } if (swagger == null || swagger.getSwagger() == null) { // 不是 2.0 版本,则尝试转换 3.0 Swagger3Parser swagger3Parser = new Swagger3Parser(); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java index 44181590a1..65c0ecfb0e 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger3Parser.java @@ -57,7 +57,7 @@ public class Swagger3Parser extends SwaggerAbstractParser { if (StringUtils.isNotBlank(request.getSwaggerUrl())) { result = new OpenAPIParser().readLocation(request.getSwaggerUrl(), auths, null); } else { - result = new OpenAPIParser().readContents(sourceStr, auths, null); + result = new OpenAPIParser().readContents(sourceStr, null, null); } if (result == null) { MSException.throwException("解析失败,请确认选择的是 swagger 格式!");