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 a73ee76db2..d795bce056 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 @@ -947,7 +947,9 @@ public class Swagger3Parser extends SwaggerAbstractParser { } else if (bodyType.equalsIgnoreCase("RAW")) { bodyInfo = new JSONObject(); ((JSONObject) bodyInfo).put("type", "string"); - ((JSONObject) bodyInfo).put("example", body.get("raw").toString()); + if (body != null && body.get("raw") != null) { + ((JSONObject) bodyInfo).put("example", body.get("raw").toString()); + } } else if (bodyType.equalsIgnoreCase("XML")) { String xmlText = body.getString("raw"); JSONObject xmlToJson = XMLUtils.XmlToJson(xmlText);