EricWebsmith / pydantic_mermaid

convert Pydantic models to Mermaid charts
MIT License
14 stars 2 forks source link

Make it work with pydantic 2.6 #1

Closed transfluxus closed 6 months ago

transfluxus commented 6 months ago

Hi,

Does this only work with pydantic 1?

I just updated pydantic to 2.6.1 (latest version) and get

File ".venv/lib/python3.11/site-packages/pydantic_mermaid/pydantic_parser.py", line 5, in from pydantic.fields import SHAPE_SINGLETON, ModelField ImportError: cannot import name 'SHAPE_SINGLETON' from 'pydantic.fields' (.venv/lib/python3.11/site-packages/pydantic/fields.py)

transfluxus commented 6 months ago

ok, I actually got it working but the _get_field_dependencies returns an empty set because FieldInfo doesn't realy have any of those props anymore and I dont know any way currently how to get that info about dependencies.

EricWebsmith commented 6 months ago

Hi @transfluxus ,

The Pydantic 2 version is here:

https://github.com/EricWebsmith/pydantic-2-mermaid