UUIDField skips configured validators when writing values
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Read the UUIDField implementation and compare its to_db_value behavior with field types that run configured validators. Start with a regression test for the direct conversion and database writes, including that nullable fields skip validators for None. Done means invalid UUIDs raise ValidationError on writes while valid values convert as expected; an open pull request (#2408) is already linked.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
UUIDField.to_db_value converts the value to a string without running its configured validators. This also lets invalid values through model creation, saves and queryset updates.
from uuid import uuid1
from tortoise import fields
from tortoise.exceptions import ValidationError
from tortoise.models import Model
def require_v4(value):
if value.version != 4:
raise ValidationError('UUID must be version 4')
field = fields.UUIDField(validators=[require_v4])
field.to_db_value(uuid1(), Model) # returns a string without raising
Expected behavior is to run field validation before converting the value, consistent with other field types. Nullable fields should still skip validators for None.
Reproduced on current develop with Python 3.14 and SQLite. Both a direct field regression and a database-write regression fail because validation does not run.
Upstream commit 5797ac34b4a13b94b3dfc1b69aaf81d032cfcb4d.
- Ngôn ngữ chính
- Python
- Star
- 5.6k
- Fork
- 543
- Merge trung bình
- 4 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 31
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tortoise/tortoise-orm
-
Automatic DatetimeField values bypass custom validatorsCó thể đã có người làm @IlyaKhalafi đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
tortoise/tortoise-orm#2409 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
tortoise/tortoise-orm#668 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
tortoise/tortoise-orm#2406 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
TimeField skips validators for timedelta valuesCó thể đã có người làm @IlyaKhalafi đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
tortoise/tortoise-orm#2404 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Email domain allowlists reject equivalent mixed-case domainsCó thể đã có người làm @IlyaKhalafi đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
tortoise/tortoise-orm#2402 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của tortoise/tortoise-orm
Issue tương tự
-
[yugabyted] xcluster set_up and add_to_replication fail for database names containing - . or (Đang mởkind/bug priority/medium qa_automation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
yugabyte/yugabyte-db#37324 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 87/100
btclib-org/btclib-node#2260 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ChatBedrockConverse changes the keys of JSON tool results to camelCase (`order_id` becomes `orderId`)Có thể đã có người làm @geyazheng đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
langchain-ai/langchain-aws#1469 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GCToggler leaves collection enabled if the body re-enables itCó thể đã có người làm @Gambit-Checkmate đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
EESSI/docs#949 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày