pydantic v2 support

The current version of pydantic is pinned to "<1.11, >=1.9.0". However there has been significant performance improvements in the new version, as well as more ergonomic syntax which would be nice to have access to.

Version one could still be allowed and the changes to the code can me possibly mitigated in the short term by using the “import pydantic.v1” backward compatibility layer.