diff --git a/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger3Parser.java b/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger3Parser.java index 78d9c6fd29..a55a951ba7 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger3Parser.java +++ b/api-test/backend/src/main/java/io/metersphere/api/parse/api/Swagger3Parser.java @@ -1004,9 +1004,12 @@ public class Swagger3Parser extends SwaggerAbstractParser { statusCodeInfo.put("content", buildContent(response)); statusCodeInfo.put("description", StringUtils.EMPTY); JSONObject jsonObject = statusCode.getJSONObject(i); - jsonObject.get("name"); - statusCodeInfo.put("description", jsonObject.get("value")); - responseBody.put(jsonObject.get("name").toString(), statusCodeInfo); + if (jsonObject.optString("value") != null) { + statusCodeInfo.put("description", jsonObject.optString("value")); + } + if (jsonObject.optString("name") != null) { + responseBody.put(jsonObject.optString("name"), statusCodeInfo); + } } return responseBody; }