Coverage for src / lilbee / core / config / validators.py: 100%
15 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-06-28 01:01 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-06-28 01:01 +0000
1"""Pydantic ``Field`` wrapper with lilbee-specific schema metadata."""
3from typing import Any
5from pydantic import Field
8def ConfigField( # noqa: N802 pydantic Field wrapper; matches Field's PascalCase
9 *args: Any,
10 writable: bool = False,
11 reindex: bool = False,
12 write_only: bool = False,
13 public: bool = True,
14 **kwargs: Any,
15) -> Any:
16 """Wrap pydantic ``Field`` and attach metadata via ``json_schema_extra``."""
17 extra: dict[str, bool] = {}
18 if writable:
19 extra["writable"] = True
20 if reindex:
21 extra["reindex"] = True
22 if write_only:
23 extra["write_only"] = True
24 if not public:
25 extra["public"] = False
26 if extra:
27 kwargs["json_schema_extra"] = extra
28 return Field(*args, **kwargs)