Closed Abdeldjalil-H closed 2 months ago
Hi, thanks for PR! Could you please add some small test, that shows that changed behaviour now works?
Totals | |
---|---|
Change from base Build 8820987871: | 0.01% |
Covered Lines: | 5733 |
Relevant Lines: | 6389 |
I have added a test case @abondar.
Seems like that test passes also on previous version, that doesn't have fix
I assume it is because we already exclude id
somewhere here
https://github.com/tortoise/tortoise-orm/blob/develop/tortoise/contrib/pydantic/creator.py#L272
Did you originally face problem on some more complex case? Are you able to reproduce it using test models?
Yes, I have faced the issue with some models that have created_at
which is auto_now
field. I have changed the test case to modified
on Event
model. By the way, this was working on previous version (with pydantic 1).
The
exclude_readonly
paramter inpydantic_model_creator
is not working, i.e it is ignored.readOnly
is deleted fromfdesc["constraints"]
so instead we read it fromextra_json_schema
.Checklist: