networktocode/diffsync

Pydantic 2.0 Migration

Kircheneer opened this issue · 4 comments

As part of the pydantic 2.0 release, a suite of breaking changes were released. We need to investigate where this breaks diffsync.

Issues already identified

  • extra="allow" is no longer possible
  • The __fields__ attribute is deprecated, furthermore it and its replacement model_fields no longer work with __init_subclass__ for us, because their fields are not populated until after this hook runs (see here for the accompanying discussion)

For more see here.

https://docs.pydantic.dev/latest/usage/model_config/#extra-attributes

extra=allow is still possible as I am using it, it's only not allowed in pydantic.dataclass

Due to a change where fields of type Optional now need explicit None defaults, this change can not be considered backwards-compatible.

Closed with #240