1 """KNX Entity Store Validation."""
3 from typing
import Literal, TypedDict
5 import voluptuous
as vol
7 from .entity_store_schema
import ENTITY_STORE_DATA_SCHEMA
11 path: list[str] |
None
17 """Negative entity store validation result."""
19 success: Literal[
False]
21 errors: list[_ErrorDescription]
25 """Positive entity store validation result."""
27 success: Literal[
True]
32 """Parse a vol.Invalid exception."""
34 path=[
str(path)
for path
in exc.path],
35 error_message=exc.msg,
36 error_class=type(exc).__name__,
41 """Validate entity data.
43 Return validated data or raise EntityStoreValidationException.
47 return ENTITY_STORE_DATA_SCHEMA(entity_data)
48 except vol.MultipleInvalid
as exc:
52 "error_base":
str(exc),
56 except vol.Invalid
as exc:
60 "error_base":
str(exc),
67 """Entity store validation exception."""
69 def __init__(self, validation_error: EntityStoreValidationError) ->
None:
None __init__(self, EntityStoreValidationError validation_error)
_ErrorDescription parse_invalid(vol.Invalid exc)
dict validate_entity_data(dict entity_data)