diff --git a/packages/atproto_client/models/string_formats.py b/packages/atproto_client/models/string_formats.py index 43bca966..4e37d75d 100644 --- a/packages/atproto_client/models/string_formats.py +++ b/packages/atproto_client/models/string_formats.py @@ -1,5 +1,6 @@ import re from datetime import datetime +from functools import wraps from typing import Callable, Mapping, Set, Union, cast from urllib.parse import urlparse @@ -54,7 +55,8 @@ def only_validate_if_strict(validate_fn: Callable[..., str]) -> Callable[..., str]: """Skip pydantic validation if not opting into strict validation via context.""" - # Could likely be generalized to support arbitrary signatures. + # Wrapper could be likely be generalized to support other signatures + @wraps(validate_fn) def wrapper(v: str, info: ValidationInfo) -> str: if info and isinstance(info.context, Mapping) and info.context.get(_OPT_IN_KEY, False): return cast(core_schema.NoInfoValidatorFunction, validate_fn)(v)