From 1796b3473a6abb8c102c494d9a9737d21c74b847 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 22 Dec 2021 18:39:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E5=80=92=E5=85=A5Swagger=E6=8F=90=E7=A4=BA=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009120 --user=郭雨琦 【ID1009120】【接口定义】倒入Swagger提示解析出错 --- .../api/dto/definition/parse/Swagger3Parser.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 7a6b50d732..309c955533 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 @@ -246,8 +246,8 @@ public class Swagger3Parser extends SwaggerAbstractParser { msResponse.setType(RequestType.HTTP); // todo 状态码要调整? msResponse.setStatusCode(new ArrayList<>()); - ApiResponse apiResponse = responses.get("200"); if (responses != null) { + ApiResponse apiResponse = responses.get("200"); if (apiResponse == null) { responses.forEach((responseCode, response) -> { parseResponseHeader(response, msResponse.getHeaders()); @@ -257,10 +257,10 @@ public class Swagger3Parser extends SwaggerAbstractParser { parseResponseHeader(apiResponse, msResponse.getHeaders()); parseResponseBody(apiResponse, msResponse.getBody()); } + responses.forEach((responseCode, response) -> { + parseResponseCode(msResponse.getStatusCode(), responseCode, response); + }); } - responses.forEach((responseCode, response) -> { - parseResponseCode(msResponse.getStatusCode(), responseCode, response); - }); return msResponse; }