def get_all_refs(schema):
    """Get all ref links in a schema.

    Traverses a schema and extracts all relative ref links from the schema,
    returning a set containing the results.

    Parameters:
        schema: An OAS schema in the form of nested dicts to be traversed.

    Returns:
        set: All of the ref links found during traversal.

    """

    all_refs = set()

    if type(schema) is dict:
        for key, val in schema.items():
            if key == "$ref" and type(val) is str:
                all_refs.add(val)

            all_refs.update(get_all_refs(val))
    elif type(schema) is list:
        for item in schema:
            all_refs.update(get_all_refs(item))

    return all_refs