1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Author: Abdulwahed Mansour
"""
Rust-accelerated validators for Django model instances.
Usage:
from django_pyforge.validators import validate_model_instance
report = validate_model_instance(instance)
if not report["is_valid"]:
for error in report["errors"]:
print(f"{error['field']}: {error['message']}")
"""
=
=
"""
Validate all fields of a Django model instance.
Extracts field values and runs them through Rust validation.
For batches above 64 fields, validation runs in parallel.
Args:
instance: A Django model instance.
schema: Optional pre-compiled ModelSchema. If None, compiled on the fly.
Returns:
A dict with:
is_valid (bool): True if all fields pass validation.
valid_count (int): Number of valid fields.
error_count (int): Number of failed fields.
errors (list[dict]): Per-field error details.
"""
=
return
"""
Validate a batch of field values using the Rust validation engine.
For batches above 64 entries, validation runs in parallel.
Args:
descriptors: List of field descriptor dicts.
values: List of Python values aligned by index with descriptors.
Returns:
A dict with is_valid, valid_count, error_count, errors.
"""
return