-
-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Native support for
TypedDict
. (#604)
Allow using instances of `TypedDict` as a type for `data` kwarg. Support openapi docs, `DTO` and `Partial`.
- Loading branch information
1 parent
3556784
commit d0441a9
Showing
19 changed files
with
386 additions
and
89 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
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# nopycln: file | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
|
||
from typing import Type, Union | ||
|
||
from pydantic_factories.protocols import DataclassProtocol | ||
from typing_extensions import TypeAlias, TypedDict | ||
|
||
|
||
__all__ = [ | ||
"DataclassClass", | ||
"DataclassClassOrInstance", | ||
"NoneType", | ||
"TypedDictClass", | ||
] | ||
|
||
DataclassClass: "TypeAlias" = "Type[DataclassProtocol]" | ||
|
||
DataclassClassOrInstance: "TypeAlias" = "Union[DataclassClass, DataclassProtocol]" | ||
|
||
NoneType = type(None) | ||
|
||
# mypy issue: https://github.com/python/mypy/issues/11030 | ||
TypedDictClass: "TypeAlias" = "Type[TypedDict]" # type:ignore[valid-type] |
Oops, something went wrong.