Compare commits

...
Author SHA1 Message Date
William Fu-Hinthorn cb774d6ff9 Merge branch 'wfh/_validate_more' into wfh/_/validate_native_time 2025-04-08 09:35:36 -07:00
William Fu-Hinthorn 440eb621eb lint 2025-04-08 09:35:26 -07:00
William Fu-Hinthorn 38a81c710f test 2025-04-08 09:34:15 -07:00
William Fu-Hinthorn ceade26934 Wanna compare 2025-04-08 09:33:45 -07:00
2 changed files with 6 additions and 5 deletions
@@ -26,10 +26,12 @@ try:
from pydantic import TypeAdapter
try:
import pydantic.v1.types as v1_types
import pydantic.v1.types as v1_types_
from pydantic.v1 import parse_obj_as
v1_types = tuple(v for k, v in vars(v1_types).items() if k in v1_types.__all__)
v1_types = tuple(
v for k, v in vars(v1_types_).items() if k in v1_types_.__all__
)
except ImportError:
v1_types = ()
@@ -133,7 +135,7 @@ class SchemaCoercionMapper:
self._field_coercers: Optional[dict[str, Callable[[Any, int], Any]]] = None
def __call__(self, input_data: Any, depth: Optional[int] = None) -> Any:
return self.coerce(input_data, depth)
return self.schema(**input_data)
def coerce(self, input_data: Any, depth: Optional[int] = None) -> Any:
if depth is None:
@@ -182,7 +184,7 @@ class SchemaCoercionMapper:
if origin in (list, set):
args = get_args(field_type)
if len(args) != 1:
return self._oreferrer
return self._passthrough
sub = self._build_coercer(args[0], depth - 1)
def list_coercer(v: Any, d: Any) -> Any:
-1
View File
@@ -23,7 +23,6 @@ from typing import (
Annotated,
Any,
Dict,
FrozenSet,
Generator,
Iterator,
List,