diff --git a/src/cattrs/v/__init__.py b/src/cattrs/v/__init__.py index b7e73b0d..0329fc3a 100644 --- a/src/cattrs/v/__init__.py +++ b/src/cattrs/v/__init__.py @@ -1,5 +1,7 @@ """Cattrs validation.""" -from typing import Callable, List, Union +from typing import Any, Callable, List, Union + +from attrs import frozen from .._compat import ExceptionGroup from ..errors import ( @@ -31,6 +33,13 @@ ] +@frozen +class VAnnotation: + """Use this with Annotated to get validation.""" + + validators: tuple[Callable[[Any], Any]] + + def format_exception(exc: BaseException, type: Union[type, None]) -> str: """The default exception formatter, handling the most common exceptions.