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

fix: id typing #405

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix: id typing #405

wants to merge 1 commit into from

Conversation

Mokto
Copy link
Contributor

@Mokto Mokto commented Jan 13, 2024

No description provided.

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.14%. Comparing base (a03c327) to head (1c96982).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #405   +/-   ##
=======================================
  Coverage   99.14%   99.14%           
=======================================
  Files          52       52           
  Lines        5057     5057           
  Branches      712      712           
=======================================
  Hits         5014     5014           
  Misses         39       39           
  Partials        4        4           
Flag Coverage Δ
tests-3.10-4.4-standalone 93.61% <ø> (ø)
tests-3.10-5-standalone 93.61% <ø> (ø)
tests-3.10-6-standalone 93.61% <ø> (ø)
tests-3.11-4-replicaSet 98.99% <ø> (ø)
tests-3.11-4.2-sharded 93.61% <ø> (ø)
tests-3.11-4.4-standalone 93.61% <ø> (ø)
tests-3.11-5-standalone 93.61% <ø> (ø)
tests-3.11-6-standalone 93.61% <ø> (ø)
tests-3.8-4.4-standalone 93.56% <ø> (ø)
tests-3.8-5-standalone 93.56% <ø> (ø)
tests-3.8-6-standalone 93.56% <ø> (ø)
tests-3.9-4.4-standalone 93.52% <ø> (ø)
tests-3.9-5-standalone 93.52% <ø> (ø)
tests-3.9-6-standalone 93.52% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@art049
Copy link
Owner

art049 commented Mar 18, 2024

Thanks for the PR. Any reason for removing this Field() I understand this is not useful since it's only there when type checking but did you encounter any bug that made you open this?

@Noah-Haf
Copy link

Noah-Haf commented Jul 27, 2024

+1

@art049 When using a tool such as pylance we get a VS code Problem (Argument missing for parameter "id") if we do not provide an id when defining a class.

You could alternatively do:

id: Union[ObjectId, Any] = Field(default=None) 

Example of issue:

from odmantic import Model

class testing(Model):
	name: str

return await engine.save(
    testing(
        name="hi"
    )
)

Problem: Argument missing for parameter "id"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants