Skip to content

Update Documents Metadata missing validation #17536

@DavideDelbianco

Description

@DavideDelbianco

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.3

Cloud or Self Hosted

Cloud

Steps to reproduce

Use the API call: /datasets/{{dataset_id}}/documents/metadata
Configure the API call as follow:

{
"operation_data": [
{
"document_id": "{{document_id}}",
"metadata_list": [
{
"id": "{{medatadata_id}}",
"value": "metadata-value",
"name": "metadata-name"
}
]
}
]
}

✔️ Expected Behavior

The field "id" (the metadata-id) is required because it is used to create the binding between the doc and metadata
Its value should be validated
The field "name" should be removed because it can be inferred from the database using the metada's "id"
And since it is not validated it also causes the addition of invalid data

❌ Actual Behavior

"id" can have any value, it invalid it will not be added to the bindings table
The value for the metadata is saved using as keyvalue "name":"value" and if "name" does not match the metadata name (retrieved by "id") the value is not displayed

Metadata

Metadata

Assignees

Labels

cloudWhen the version is cloud and it is a bug report🐞 bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions