refactor(接口测试): 优化swagger数据兼容

This commit is contained in:
wxg0103 2024-05-09 19:42:45 +08:00 committed by 刘瑞斌
parent da2f95d415
commit 73635fd7b8

View File

@ -468,6 +468,18 @@ public class Swagger3Parser<T> extends ApiImportAbstractParser<ApiDefinitionImpo
return parseArraySchema(arraySchema.getItems(), false);
} else if (modelByRef instanceof ObjectSchema objectSchema) {
return parseObject(objectSchema, false);
} else {
JsonSchemaItem jsonSchemaItem = new JsonSchemaItem();
Map<String, Schema> properties = modelByRef.getProperties();
Map<String, JsonSchemaItem> jsonSchemaProperties = new LinkedHashMap<>();
if (MapUtils.isNotEmpty(properties)) {
properties.forEach((key, value) -> {
JsonSchemaItem item = parseProperty(value, false);
jsonSchemaProperties.put(key, item);
});
}
jsonSchemaItem.setProperties(jsonSchemaProperties);
return jsonSchemaItem;
}
}