Skip to content

Commit 85b1c5a

Browse files
chore(internal): add helper function (#424)
1 parent 10aaf46 commit 85b1c5a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/finch/_models.py

+8
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,14 @@ def validate_type(*, type_: type[_T], value: object) -> _T:
643643
return cast(_T, _validate_non_model_type(type_=type_, value=value))
644644

645645

646+
def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None:
647+
"""Add a pydantic config for the given type.
648+
649+
Note: this is a no-op on Pydantic v1.
650+
"""
651+
setattr(typ, "__pydantic_config__", config) # noqa: B010
652+
653+
646654
# our use of subclasssing here causes weirdness for type checkers,
647655
# so we just pretend that we don't subclass
648656
if TYPE_CHECKING:

0 commit comments

Comments
 (0)