pydantic / pydantic-core

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

tidy up `tagged_union_schema` #1333

Closed davidhewitt closed 3 months ago

davidhewitt commented 3 months ago

Closes #925

While checking out the suggested type hints there and comparing to the implementation, I saw that we stick all unhashable discriminants in a list and to equality comparison on them. So I decided to keep things simple and relax the Hashable bound to Any.

At the same time, I saw that the list was not necessary and we could use a Rust Vec. So I simplified the implementation a little.

codspeed-hq[bot] commented 3 months ago

CodSpeed Performance Report

Merging #1333 will not alter performance

Comparing dh/tagged-union-tidy (e163983) with main (9507a28)

Summary

✅ 155 untouched benchmarks