Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UUID4 support for InspectionError #953

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions beanie/odm/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List
from typing import List, Union

from pydantic import BaseModel
from pydantic import UUID4, BaseModel

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why just UUID 4 and not UUID ?

from beanie.odm.enums import InspectionStatuses
from beanie.odm.fields import PydanticObjectId
Expand All @@ -11,7 +11,7 @@ class InspectionError(BaseModel):
Inspection error details
"""

document_id: PydanticObjectId
document_id: Union[PydanticObjectId, UUID4]
error: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you can technicaly overide id (needs to be tested) with anything that is serializable by beanie... this is is probably not enough (we should probably create Union of Anything serializable probably something here

DEFAULT_CUSTOM_ENCODERS: MutableMapping[type, SingleArgCallable] = {
) (somewhere close to Here
we have str as id and this would not work

I also do not see any tests and it appears there is techical Debt in InspectionErrorCoverage

it is however coverable... you insert with another library somethig that would triger InspectionError

second atitional test is to test if such type can be used as id (so use union of serializable to do that)



Expand Down
Loading