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

需要检查所有 Config 类,以确保在 Gson 解析 Json 时能正确使用参数默认值。 #9

Closed
LamGC opened this issue Jun 23, 2022 · 0 comments · Fixed by #8
Assignees
Labels
bug Something isn't working

Comments

@LamGC
Copy link
Owner

LamGC commented Jun 23, 2022

目前测试出现一个新的问题,如果某个 Json 字段为 null 或者不存在的情况下,Gson 将会忽略这个字段的解析(而且还不会调用字段类型的 Serializer 进行处理),导致这个 null-safety 属性为 null。

估计得要为部分配置类写一个 Serializer 来处理这个问题。

至于为啥用 Gson 不用 moshi,我记得是因为 Moshi 对简单 Json 处理不友好,所以没使用 Moshi。
看 Gson 官方估计是不把这个当问题的,得麻烦一下咯。

关联 Pull Request #8

@LamGC LamGC added the bug Something isn't working label Jun 23, 2022
@LamGC LamGC self-assigned this Jun 23, 2022
@LamGC LamGC linked a pull request Jun 23, 2022 that will close this issue
@LamGC LamGC linked a pull request Jun 23, 2022 that will close this issue
LamGC added a commit that referenced this issue Jun 24, 2022
由于 Gson 的解析方式不能正确处理 Kotlin 的 null-safety 属性, 因此添加两个 Serializer, 手动解析 Json 以避开这个问题.

Close #9
@LamGC LamGC closed this as completed Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant