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 4c8499928d..78d9c6fd29 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 @@ -330,7 +330,7 @@ public class Swagger3Parser extends SwaggerAbstractParser { Set refSet = new HashSet<>(); Map infoMap = new HashMap(); Schema schema = getSchema(mediaType.getSchema()); - if (content.get(contentType).getExample() != null && schema.getExample() == null) { + if (content.get(contentType) != null && content.get(contentType).getExample() != null && schema.getExample() == null) { schema.setExample(content.get(contentType).getExample()); } Object bodyData = null;