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

在简单设备属性上从 Fastjson 设置属性错误 #41

Open
leandromsales opened this issue Aug 14, 2023 · 2 comments
Open

在简单设备属性上从 Fastjson 设置属性错误 #41

leandromsales opened this issue Aug 14, 2023 · 2 comments

Comments

@leandromsales
Copy link

leandromsales commented Aug 14, 2023

我正在使用 tuya-spring-boot-starter 版本 1.3.0 来查询设备详细信息,如下所示:

TuyaClient.java:

public interface TuyaClient {

    @GET("/v1.0/devices/{device_id}")
    Device getById(@Path("device_id") String deviceId);

}

Device.java:

@Data
@AllArgsConstructor
@NoArgsConstructor
@FieldDefaults(level = AccessLevel.PUBLIC)
public class Device {
    String id;

    @JSONField(name="update_time")
    Long update_time;

    @JSONField(name="create_time")
    Long createTime;

    Boolean online;

    String icon;

    // other fields here
}

问题:

某些字段(例如“update_time”)没有被 Fastjson 反序列化,没有明确的原因,从而产生以下错误:

调用连接器时出错。 原因:com.alibaba.fastjson.JSONException:设置属性错误,mypackage.models.Device#update_time"

我想知道为什么会发生这种情况,因为例如,与“update_time”具有相同类型的字段“create_time”正在被正确反序列化。

有什么线索吗?

Java version: 20
tuya-spring-boot-starter: 1.3.0

@leandromsales leandromsales changed the title Set property error from Fastjson on simple device property 在简单设备属性上从 Fastjson 设置属性错误 Aug 14, 2023
@leandromsales
Copy link
Author

leandromsales commented Aug 16, 2023

FYI, I have tried with 1.3.2 and still the same issue. Anyone to help me on this?

@leandromsales
Copy link
Author

Why nobody in this project address this issue yet? Is there someone looking at this?

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

No branches or pull requests

1 participant