microsoft / microsoft/durabletask-java

Jackson deserialization issue with Kotlin and data classes

未关闭
#270 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Needs: Triage :mag:
主要语言
Java
星标
29
派生
18
平均合并
1 天 10 小时
30 天内合并 PR
2

描述

I have a simple durable orchestration function written in Kotlin who's input type is

data class OrchestratorInput(val value: String)

When I run my orchestration, it fails to deserialize JSON text into an instance of OrchestratorInput, probably because data classes in Kotlin does not have any no-arg constructor unless I assign default values to all fields of the class. The output of the orchestration is shown below, containing the error message:

{
  "name": "OrchestrationFunction",
  "instanceId": "f340b4b5-b04d-43a0-bd83-40a12ab419ec",
  "runtimeStatus": "Failed",
  "input": {
    "value": "hello, world!"
  },
  "customStatus": "",
  "output": "com.microsoft.durabletask.DataConverter$DataConverterException: Failed to deserialize the JSON text to org.example.OrchestratorInput. Detailed error message: Cannot construct instance of `org.example.OrchestratorInput` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]",
  "createdTime": "2026-03-10T11:31:29Z",
  "lastUpdatedTime": "2026-03-10T11:31:39Z"
}

Adding jackson-module-kotlin to build.gradle.kts did not help, although it helped when running the orchestration locally with Azurite

implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.21.1")

For some reason the module is not picked up when running in Azure. Is there any way to fix this? Now I'm forced to assign default values to every field of every data class used as input or output of orchestration- and activity functions, which makes the code very verbose.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 build.gradle.kts 开始,将与 Azurite 一起使用的依赖项设置与 Azure 中使用的设置进行比较。跟踪为已部署的 Kotlin 工作负载配置 durable task data converter 的方式;当 OrchestratorInput 和类似的 Kotlin 数据类能够在 Azure 中不使用默认构造函数值进行反序列化时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, kotlin
领域
backend, cloud
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。