Context
we need to document the behavior of calling dict() on a BaseDoc. Especially with nested DocList.
class InnerDoc(BaseDoc):
x: int
class MyDoc(BaseDoc):
l: DocList[InnerDoc]
doc = MyDoc(l=[InnerDoc(x=1), InnerDoc(x=2)])
print(f'{doc.dict()=}')
#> doc_view.dict()={'id': 'ab65fc52a60d1da1ce6196c100943e1f', 'l': [{'id': 'e218c3a6904cbbd0f48ccd10130c9f78', 'x': 1}, {'id': 'e30bf3d613bf5c3e805faf0c0dc0f704', 'x': 2}]}
and we need to explain how using dict(doc) is different from using doc.dict()
Context
we need to document the behavior of calling
dict()on a BaseDoc. Especially with nested DocList.and we need to explain how using
dict(doc)is different from usingdoc.dict()