Skip to content

Commit

Permalink
feat: change pydantic model optional id (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanFM committed Jan 24, 2022
1 parent 7a868d3 commit 06cd577
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docarray/document/pydantic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class _NamedScore(BaseModel):


class PydanticDocument(BaseModel):
id: str
id: Optional[str]
parent_id: Optional[str]
granularity: Optional[int]
adjacency: Optional[int]
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,7 @@ def test_to_from_with_blob(protocol, to_fn, blob):
assert d.blob == r_d.blob
if d.blob:
assert isinstance(r_d.blob, bytes)


def test_pydantic_not_id():
_ = PydanticDocument()

0 comments on commit 06cd577

Please sign in to comment.