-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid warning when field type is any (#101)
* fix invalid warning when field type is any * update history
- Loading branch information
Showing
5 changed files
with
48 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ class Optional: | |
def __getitem__(cls, item): | ||
pass | ||
|
||
class Any: | ||
pass | ||
|
||
|
||
class Type: | ||
@classmethod | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from builtins import * | ||
|
||
from typing import * | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class A(BaseModel): | ||
a: int | ||
b: Any | ||
c: Optional[int] | ||
d: Union[str, int, None] | ||
|
||
|
||
A(a=int(123)) | ||
A(a=int(123), b=456, c=789, d=345) | ||
A(<warning descr="Expected type 'int', got 'str' instead">a=str(123)</warning>, b=456, <warning descr="Expected type 'Optional[int]', got 'str' instead">c=str(789)</warning>, <warning descr="Expected type 'Union[str, int, None]', got 'bytes' instead">d=bytes(234)</warning>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters