fix(pydantic): turn on pydantic smart union#73
Conversation
Codecov Report
@@ Coverage Diff @@
## main #73 +/- ##
=======================================
Coverage 83.06% 83.07%
=======================================
Files 70 70
Lines 3402 3404 +2
=======================================
+ Hits 2826 2828 +2
Misses 576 576
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
docarray/document/pydantic_model.py
Outdated
| weight: Optional[float] | ||
| uri: Optional[str] | ||
| tags: Optional[Dict[str, '_StructValueType']] | ||
| tags: Optional[Dict[str, Any]] |
There was a problem hiding this comment.
This however makes tags unschema
There was a problem hiding this comment.
I think is right having tags unschema, it is the free part of Document
There was a problem hiding this comment.
but the "free-part" still have to be a valid JSON
There was a problem hiding this comment.
the right way is to turn on pydantic smart union, as in https://pydantic-docs.helpmanual.io/usage/model_config/#smart-union
|
the original title of the PR is misleading, the default behavior is not "smart union" according to https://pydantic-docs.helpmanual.io/usage/model_config/#smart-union This PR in fact turns on the "smart union". |
attempt to address #72