File size: 220 Bytes
4304c6d
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import pydantic
from pydantic import BaseModel


def dump_model(model: BaseModel) -> dict:
    if hasattr(pydantic, 'model_dump'):
        return pydantic.model_dump(model)
    else:
        return model.dict()