pydantic-core
pydantic-core copied to clipboard
add frozen to Config
closes #231
I think we need a different error message, e.g something like "Model is frozen", rather than "Field".
Codecov Report
Merging #237 (3629ce3) into main (837a6ce) will increase coverage by
0.00%
. The diff coverage is100.00%
.
Additional details and impacted files
@@ Coverage Diff @@
## main #237 +/- ##
=======================================
Coverage 98.61% 98.61%
=======================================
Files 51 51
Lines 5342 5352 +10
Branches 39 39
=======================================
+ Hits 5268 5278 +10
Misses 74 74
Impacted Files | Coverage Δ | |
---|---|---|
src/errors/kinds.rs | 99.15% <ø> (ø) |
|
pydantic_core/core_schema.py | 100.00% <100.00%> (ø) |
|
src/validators/typed_dict.rs | 99.12% <100.00%> (+0.02%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 837a6ce...3629ce3. Read the comment docs.
@samuelcolvin Thanks for your remark and sorry for coming back to it so late. Is https://github.com/pydantic/pydantic-core/pull/237/commits/3629ce31a2664efae8cc75522bbe475e3d150edd ok for you?
Maybe it would all be simpler if we just added frozen
to SchemaValidator
, then check checked in validate_assignment
?
That way we can "freeze" any schema.
E.g. if we added validate_assignment
logic to tuples, frozen would just work.
If not that, then I think we should just add frozen
to TypedDictValidator
do the check in TypedDictValidator.validate_assignment
.
WDYT?
replaced by #462