From 222826d43a396e5a6651788afa9cc8ed1f7593bd Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Thu, 25 Aug 2022 14:42:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20sw?= =?UTF-8?q?agger=E5=AF=BC=E5=85=A5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --bug=1016313 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016313 --- .../api/dto/definition/parse/Swagger3Parser.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 2745f22ed9..f2268c8c79 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 @@ -536,8 +536,12 @@ public class Swagger3Parser extends SwaggerAbstractParser { Map JsonSchemaProperties = new LinkedHashMap<>(); properties.forEach((key, value) -> { JsonSchemaItem item = new JsonSchemaItem(); - item.setType(schema.getType()); - item.setDescription(schema.getDescription()); + if (StringUtils.isNotBlank(schema.getType())) { + item.setType(schema.getType()); + } + if (StringUtils.isNotBlank(schema.getDescription())) { + item.setDescription(schema.getDescription()); + } JsonSchemaItem proItem = parseSchema(value, refSet); if (proItem != null) JsonSchemaProperties.put(key, proItem); });