|
@@ -41,9 +41,12 @@ class Ref(str):
|
|
|
@classmethod
|
|
@classmethod
|
|
|
# pylint: disable=unused-argument
|
|
# pylint: disable=unused-argument
|
|
|
def __get_pydantic_core_schema__(cls, source, handler) -> core_schema.CoreSchema:
|
|
def __get_pydantic_core_schema__(cls, source, handler) -> core_schema.CoreSchema:
|
|
|
- return core_schema.general_plain_validator_function(
|
|
|
|
|
- lambda s: s and all(t for t in s.split("."))
|
|
|
|
|
- )
|
|
|
|
|
|
|
+
|
|
|
|
|
+ def validate(s, _):
|
|
|
|
|
+ if s and all(t for t in s.split(".")):
|
|
|
|
|
+ return s
|
|
|
|
|
+ raise ValueError("References must be of the form A.B.C etc.")
|
|
|
|
|
+ return core_schema.general_plain_validator_function(validate)
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclasses.dataclass
|
|
@dataclasses.dataclass
|