pydantic / pydantic-core

Core validation logic for pydantic written in rust
MIT License
1.4k stars 232 forks source link

Allow subclassing ValidationError and PydanticCustomError #1413

Open Youssefares opened 1 month ago

Youssefares commented 1 month ago

Change Summary

Related issue number

https://github.com/pydantic/pydantic/issues/9686

1380

https://github.com/pydantic/pydantic/issues/8092

Checklist

Selected Reviewer: @davidhewitt

codspeed-hq[bot] commented 1 month ago

CodSpeed Performance Report

Merging #1413 will not alter performance

Comparing Youssefares:subclass-errors (2d367c8) with main (4113638)

Summary

✅ 155 untouched benchmarks

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.22%. Comparing base (ab503cb) to head (2d367c8). Report is 155 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1413 +/- ## ========================================== - Coverage 90.21% 89.22% -0.99% ========================================== Files 106 112 +6 Lines 16339 17697 +1358 Branches 36 41 +5 ========================================== + Hits 14740 15790 +1050 - Misses 1592 1887 +295 - Partials 7 20 +13 ``` | [Files](https://app.codecov.io/gh/pydantic/pydantic-core/pull/1413?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic) | Coverage Δ | | |---|---|---| | [src/errors/validation\_exception.rs](https://app.codecov.io/gh/pydantic/pydantic-core/pull/1413?src=pr&el=tree&filepath=src%2Ferrors%2Fvalidation_exception.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic#diff-c3JjL2Vycm9ycy92YWxpZGF0aW9uX2V4Y2VwdGlvbi5ycw==) | `93.27% <100.00%> (+0.39%)` | :arrow_up: | | [src/errors/value\_exception.rs](https://app.codecov.io/gh/pydantic/pydantic-core/pull/1413?src=pr&el=tree&filepath=src%2Ferrors%2Fvalue_exception.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic#diff-c3JjL2Vycm9ycy92YWx1ZV9leGNlcHRpb24ucnM=) | `90.56% <100.00%> (-0.51%)` | :arrow_down: | ... and [46 files with indirect coverage changes](https://app.codecov.io/gh/pydantic/pydantic-core/pull/1413/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/pydantic/pydantic-core/pull/1413?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/pydantic/pydantic-core/pull/1413?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic). Last update [4113638...2d367c8](https://app.codecov.io/gh/pydantic/pydantic-core/pull/1413?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic).
Youssefares commented 1 month ago

please review

Youssefares commented 14 hours ago

@davidhewitt would be good to get this moving