from typing import Dict
from pathlib import Path
import inspect
import json


def load_schema(rel_path: str) -> Dict:
    """
    Loads a schema from a relative path of the caller of this function.
    :param rel_path: Relative path from the caller. e.g. ../schemas/schema.json
    :return: Loaded schema as a `dict`.
    """
    caller_path = Path((inspect.stack()[1])[1]).parent
    fp = (caller_path / rel_path).resolve()

    with open(fp, "r") as fh:
        data = json.loads(fh.read())
        return data