class AbstractType(metaclass=ABCMeta):
@abstractmethod
def to_json(self) -> dict[str, Any]:
pass
@classmethod
def from_json(cls, json: Any) -> Optional[AbstractType]:
if json is None:
return None
value: Optional[AbstractType] = NamedType.from_json(json)
if value is not None:
return value
value = EnumType.from_json(json)
if value is not None:
return value
value = BoundaryType.from_json(json)
if value is not None:
return value
return UnionType.from_json(json)