diff --git a/harp/schema.py b/harp/schema.py index d60b797..e97ae1a 100644 --- a/harp/schema.py +++ b/harp/schema.py @@ -2,7 +2,8 @@ from os import PathLike from typing import TextIO, Union -from pydantic_yaml import parse_yaml_raw_as +import yaml +from pydantic import TypeAdapter from harp.model import Model, Registers @@ -13,7 +14,8 @@ def _read_common_registers() -> Registers: file = resources.files(__package__) / "common.yml" with file.open("r") as fileIO: - return parse_yaml_raw_as(Registers, fileIO.read()) + raw_reg = yaml.safe_load(fileIO.read()) + return TypeAdapter(Registers).validate_python(raw_reg) def read_schema(file: Union[str, PathLike, TextIO], include_common_registers: bool = True) -> Model: @@ -37,7 +39,8 @@ def read_schema(file: Union[str, PathLike, TextIO], include_common_registers: bo with open(file) as fileIO: return read_schema(fileIO) else: - schema = parse_yaml_raw_as(Model, file.read()) + raw_schema = yaml.safe_load(file.read()) + schema = TypeAdapter(Model).validate_python(raw_schema) if "WhoAmI" not in schema.registers and include_common_registers: common = _read_common_registers() schema.registers = dict(common.registers, **schema.registers) diff --git a/pyproject.toml b/pyproject.toml index c8fcaac..2f1a66a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,8 @@ dynamic = ["version"] license = "MIT" dependencies = [ - "pydantic-yaml", + "pydantic", + "pyyaml", "pandas" ]