Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]API数据源,如果接口返回的列表数据中某一行字段不全情况下,会导致整体数据错位 #6612

Closed
cisordeng opened this issue Nov 9, 2023 · 2 comments
Assignees

Comments

@cisordeng
Copy link

cisordeng commented Nov 9, 2023

DataEase 版本
v1.18

运行方式(安装包运行 or 源码运行 ?)
源码运行

浏览器版本
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36

Bug 描述
API数据源,如果接口返回的列表数据中某一行字段不全情况下,会导致数据预览和数据集数据整体错位

Bug 重现步骤(有截图更好)
1.创建API数据源, 由于工作业务接口数据字段过多,这里描述问题方便,假设接口返回数据为

{
    "code": 200,
    "msg": "",
    "data": [{
        "username": "张三",
        "age": "20",
    }, {
        "username": "李四",
        "age": "22",
        "phone": "18200000002",
    }, , {
        "username": "王二",
        "age": "23",
        "phone": "18200000003",
    }]
}

2.此时下一步勾选字段为username, age, phone然后点击下一步

3.设置好API数据源后,点击下一步中的数据预览还有数据集同步的数据,此时都变成了

username age phone
张三 20 18200000002
李四 22 18200000003
王二 23

而正确的数据集数据应该是

username age phone
张三 20
李四 22 18200000002
王二 23 18200000003
@cisordeng
Copy link
Author

cisordeng commented Nov 9, 2023

这个问题我们自己fork的dataease仓库已经参考alibaba/fastjson#3607中提到的jayway的JsonPath设置默认值的方法

jayway的jsonpath是有这种能力的
Configuration conf = Configuration.defaultConfiguration().addOptions(Option.DEFAULT_PATH_LEAF_TO_NULL);
return JsonPath.using(conf).parse(json).read(path);

,修改完成了,测试通过,没有问题,数据集同步的数据也是对的,不会出现错位了,官方也可以作为参考看看需不要优化一下这部分,减少其他人踩坑

@BBchicken-9527
Copy link

感谢你的支持与反馈,我们测试一下没问题将在下一个版本支持;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants