def get_reference_value_from_spec(openapi_spec: dict, reference_path: str) -> dict:
    """Follows the reference path passed in and returns the object at the end of the path

    Args:
        openapi_spec (dict): The openapi.json specification object
        reference_path (str): a path formatted as "#/foo/bar/baz"

    Returns:
        dict: The object if you follow the path
    """
    path_elements = reference_path.split("/")
    reference_val = openapi_spec

    for elem in path_elements:
        if elem == "#":
            continue
        else:
            reference_val = reference_val.get(elem, {})
    return reference_val