Answers for "List of Pydantic model. List[BaseModel]"

0

List of Pydantic model. List[BaseModel]

class UserList(BaseModel):
    __root__: List[User]

UserList.parse_obj([
    {'id': '123', 'signup_ts': '2017-06-01 12:22', 'friends': [1, '2', b'3']},
    {'id': '456', 'signup_ts': '2017-06-02 12:22', 'friends': ['you']},
])
Posted by: Guest on April-26-2021

Browse Popular Code Answers by Language