diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java index d3c0c0c16a..196ed26a13 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java @@ -300,7 +300,7 @@ public class Swagger2Parser extends SwaggerAbstractParser { item.setType("object"); handleRefProperties(item, value, refSet); } else { - handleBaseProperties(item, value, refSet); + handleBaseProperties(item, value); } if (value.getExample() != null) { item.getMock().put("mock", value.getExample()); @@ -324,12 +324,12 @@ public class Swagger2Parser extends SwaggerAbstractParser { subItem.setType("object"); subItem.setProperties(parseSchemaProperties(((ObjectProperty) value).getProperties(), refSet)); } else { - handleBaseProperties(subItem, value, refSet); + handleBaseProperties(subItem, value); } item.getItems().add(subItem); } - private void handleBaseProperties(JsonSchemaItem item, Property value, HashSet refSet) { + private void handleBaseProperties(JsonSchemaItem item, Property value) { if (value instanceof StringProperty || value instanceof DateProperty || value instanceof DateTimeProperty ) { item.setType("string"); } else if (value instanceof IntegerProperty) { 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 3da9d7e9fc..00d3ac43ad 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 @@ -343,17 +343,17 @@ public class Swagger3Parser extends SwaggerAbstractParser { private void parseKvBody(Schema schema, Body body, Object data, Map infoMap) { if (data instanceof JSONObject) { ((JSONObject) data).forEach((k, v) -> { - _parseKvBody(schema, body, k, infoMap); + parseKvBodyItem(schema, body, k, infoMap); }); } else { if(data instanceof Schema) { Schema dataSchema = (Schema) data; - _parseKvBody(schema, body, dataSchema.getName(), infoMap); + parseKvBodyItem(schema, body, dataSchema.getName(), infoMap); } } } - private void _parseKvBody(Object schemaObject, Body body, String name, Map infoMap) { + private void parseKvBodyItem(Object schemaObject, Body body, String name, Map infoMap) { Schema schema = (Schema) schemaObject; if (schema == null) return; KeyValue kv = new KeyValue(name, String.valueOf(schema.getExample() == null ? "" : schema.getExample()), schema.getDescription());