-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
002cc12
commit d921f71
Showing
3 changed files
with
158 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import Any, TypeVar | ||
|
||
from arclet.entari.config import config_validator_register | ||
from arclet.entari.plugin import metadata, declare_static | ||
from pydantic import BaseModel, TypeAdapter | ||
|
||
declare_static() | ||
metadata( | ||
"pydantic", | ||
author=["RF-Tar-Railt <rf_tar_railt@qq.com>"], | ||
description="Pydantic Config Model support for entari", | ||
) | ||
|
||
|
||
TB = TypeVar("TB", bound=BaseModel) | ||
|
||
|
||
@config_validator_register(BaseModel) | ||
def _pydantic_validate(data: dict[str, Any], base: type[TB]) -> TB: | ||
return TypeAdapter(base).validate_python(data) | ||
|
||
|
||
__all__ = ["BaseModel"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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