Fix: remove delete_documents uuid validation (#14533)

### What problem does this PR solve?

remove delete_documents uuid validation

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
buua436
2026-04-30 18:56:33 +08:00
committed by GitHub
parent a69e0c73c7
commit 05ee7f8bb6
4 changed files with 34 additions and 12 deletions

View File

@@ -47,11 +47,11 @@ class TestDocumentsDeletion:
[
({}, 102, "should either provide doc ids or set delete_all(true), dataset", 3),
({"ids": []}, 102, "should either provide doc ids or set delete_all(true), dataset", 3),
({"ids": ["invalid_id"]}, 101, "Field: <ids> - Message: <Invalid UUID1 format> - Value: <['invalid_id']>", 3),
({"ids": ["invalid_id"]}, 102, "These documents do not belong to dataset", 3),
(
{"ids": ["\n!?。;!?\"'"]},
101,
"Field: <ids> - Message: <Invalid UUID1 format> - Value:",
102,
"These documents do not belong to dataset",
3,
),
(
@@ -117,8 +117,8 @@ class TestDocumentsDeletion:
if callable(payload):
payload = payload(document_ids)
res = delete_documents(HttpApiAuth, dataset_id, payload)
assert res["code"] == 101
assert "Field: <ids> - Message: <Invalid UUID1 format> - Value" in res["message"]
assert res["code"] == 102
assert "These documents do not belong to dataset" in res["message"]
res = list_documents(HttpApiAuth, dataset_id)
assert len(res["data"]["docs"]) == 3

View File

@@ -26,8 +26,8 @@ class TestDocumentsDeletion:
[
({"ids": None}, "should either provide doc ids or set delete_all(true), dataset:", 3),
({"ids": []}, "should either provide doc ids or set delete_all(true), dataset:", 3),
({"ids": ["invalid_id"]}, "Field: <ids> - Message: <Invalid UUID1 format> - Value: <['invalid_id']>", 3),
({"ids": ["\n!?。;!?\"'"]}, "Field: <ids> - Message: <Invalid UUID1 format> - Value:", 3),
({"ids": ["invalid_id"]}, "These documents do not belong to dataset", 3),
({"ids": ["\n!?。;!?\"'"]}, "These documents do not belong to dataset", 3),
("not json", "must be a mapping", 3),
(lambda r: {"ids": r[:1]}, "", 2),
(lambda r: {"ids": r}, "", 0),
@@ -69,7 +69,7 @@ class TestDocumentsDeletion:
with pytest.raises(Exception) as exception_info:
dataset.delete_documents(**payload)
assert "Field: <ids> - Message: <Invalid UUID1 format> - Value: <" in str(exception_info.value), str(exception_info.value)
assert "These documents do not belong to dataset" in str(exception_info.value), str(exception_info.value)
documents = dataset.list_documents()
assert len(documents) == 3, str(documents)

View File

@@ -49,7 +49,7 @@ class TestDocumentsDeletion:
({}, 102, "should either provide doc ids or set delete_all(true), dataset:", 3),
({"invalid_key":[]}, 101, "Field: <invalid_key> - Message: <Extra inputs are not permitted> - Value: <[]>", 3),
({"ids": ""}, 101, "Field: <ids> - Message: <Input should be a valid list> - Value: <>", 3),
({"ids": ["invalid_id"]}, 101, "Field: <ids> - Message: <Invalid UUID1 format> - Value:", 3),
({"ids": ["invalid_id"]}, 102, "These documents do not belong to dataset", 3),
("not json", 101, "Invalid request payload: expected object, got str", 3),
(lambda r: {"ids": r[0]}, 101, "Field: <ids> - Message: <Input should be a valid list> - Value", 3),
(lambda r: {"ids": r}, 0, "", 0),