From 7270c24eb2b6af28ba5704e4761ebce0185683a1 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 4 Jan 2021 11:40:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20swagger=20=E5=AF=BC=E5=85=A5=E6=A0=88?= =?UTF-8?q?=E6=BA=A2=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/api/parse/Swagger2Parser.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java index d1a312941b..8d78614dad 100644 --- a/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/parse/Swagger2Parser.java @@ -275,6 +275,11 @@ public class Swagger2Parser extends ApiImportAbstractParser { } else if (value instanceof RefProperty) { RefProperty refProperty = (RefProperty) value; String simpleRef = refProperty.getSimpleRef(); + if (refSet.contains(simpleRef)) { + //避免嵌套死循环 + jsonObject.put(key, new JSONArray()); + return; + } refSet.add(simpleRef); Model model = definitions.get(simpleRef); jsonObject.put(key, getBodyParameters(model.getProperties(), refSet));