Closed chrisjsewell closed 7 months ago
It is getting annoying to have to keep fixing our use of pydantic v2 due to all their "growing pains". This marks the third time they broke compatibility with v2.x 😡
I believe the fix is to just pin to pydantic v2.5 and change the annotated type:
CSSClassType = Annotated[
str, pydantic.AfterValidator(nodes.make_id)
]
This may not be considered a breaking change on their part. The namespace pydantic.functional_validators
was copied from their migration guide, but their docs now seem to import AfterValidator
from the root namespace pydantic
. This is another reason why emphasizing docs that only lead by example is a bad idea (especially without diligent review).
As far as I can tell, the AfterValidator
object was made available in the root namespace around pydantic v2.2. We are already pinned to v2.4.
Cheers dude!
Fantastic! 🎉
Doh (https://github.com/pydantic/pydantic/releases/tag/v2.5.0)