Skip to content

fix: Change builtInMetadata return type from String to SimpleResponse#148

Merged
imfangs merged 2 commits into
mainfrom
fix/issue-146-builtInMetadata-response-type
Jan 7, 2026
Merged

fix: Change builtInMetadata return type from String to SimpleResponse#148
imfangs merged 2 commits into
mainfrom
fix/issue-146-builtInMetadata-response-type

Conversation

@imfangs

@imfangs imfangs commented Jan 7, 2026

Copy link
Copy Markdown
Owner

Fixes #146

The builtInMetadata API endpoint was returning a Jackson deserialization error because the method was trying to deserialize a JSON object into a String type.

Problem

The error was:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.lang.String from Object value (token JsonToken.START_OBJECT)

This occurred at DefaultDifyDatasetsClient.builtInMetadata() line 439

Root Cause

The actual API response returns a JSON object like {"result": "success"}, but the stricode was exng. According to the Dify API documentation, thepecting a plain endpoint should return aDifyDatas SimpleResponse objectetsClient interface

  • Updated implementation in DefaultDifyDatasetsClient.builtInMetadata() to tring to Si, not a raw string.

Changes

  • Changed return type from SmpleResponse in use SimpleResponse.class instead of String.class

Testing

  • Code compiles successfully with mvn clean compile
  • No compilation errors
  • Return type now matches the actual API response format

🤖 Generated with Claude Code


Note

Fixes deserialization by aligning the datasets API with its actual response and extends workflow event payloads.

  • Change builtInMetadata return type from String to SimpleResponse in DifyDatasetsClient and update DefaultDifyDatasetsClient to use SimpleResponse.class in executePost
  • Add conversation_id field (conversationId) to BaseWorkflowEvent

Written by Cursor Bugbot for commit d92367b. This will update automatically on new commits. Configure here.

imfangs and others added 2 commits January 7, 2026 15:26
## 问题描述
Chatflow的"workflow_started"、"node_started"等workflow事件实体类缺少conversation_id字段。
直接调用dify的HTTP接口能够返回conversation_id,但SDK中只有BaseMessageEvent的子类包含该字段,
而BaseWorkflowEvent的子类缺失,导致前几个SSE事件无法获取conversation_id。

## 修复内容
- 在BaseWorkflowEvent基类中添加conversation_id字段,使其与BaseMessageEvent保持一致
- 所有继承BaseWorkflowEvent的事件类(WorkflowStartedEvent, NodeStartedEvent, NodeFinishedEvent等)
  现在都可以获取conversation_id

## 验证
- 已验证Dify HTTP API在chatflow模式下返回的workflow事件确实包含conversation_id字段
- 代码成功编译通过(mvn clean compile)
- 与BaseMessageEvent保持一致的设计

Fixes #145

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Fixes #146

The builtInMetadata API endpoint returns a JSON object ({"result": "success"})
instead of a plain string. This was causing a MismatchedInputException:
"Cannot deserialize value of type java.lang.String from Object value".

Changed the return type from String to SimpleResponse in both the interface
and implementation to properly handle the API response.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@imfangs imfangs merged commit c8c7322 into main Jan 7, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

更新内置元数据处理返回的时候报错

1 participant