def METHOD_NAME(self) -> Union[dict, list]:
    """Build the docs."""
    if not self.provider:
        self.provider = os.path.basename(os.path.abspath(self.path))
    requirements = []
    if os.path.exists('requirements.txt'):
        with open('requirements.txt') as f:
            requirements = f.readlines()
            requirements = [line.rstrip() for line in requirements]
    docs = ProviderDocs(
        name=self.provider,
        requirements=requirements,
    )
    # fmt: off
    path = os.path.abspath(os.path.join(self.path, self.hooks_dir))
    # Loop through python files
    importable_files = [i for i in listdir_absolute(path) if
                        i.endswith("py") and not i.endswith('__init__.py')]
    schema_list = []
    for i, f in enumerate(importable_files):
        # Extract out the objects that are derived from the BaseHook
        # We generate a random name because we run this multiple times and getting
        # overlapping pydantic validator config error otherwise.
        random_name = ''.join(
            random.choice(string.ascii_uppercase + string.digits) for _ in range(6))
        loader = importlib.machinery.SourceFileLoader(fullname=random_name,
                                                      path=f)
        module_classes = inspect.getmembers(loader.load_module(), inspect.isclass)
        hooks = [
            i[1]
            for i in module_classes
            if issubclass(i[1], BaseHook) and i[1] != BaseHook
        ]
        # fmt: on
        for h in hooks:
            if h._wip:
                continue
            return_type = get_type_hints(h.METHOD_NAME)
            if 'return' in return_type:
                return_type = hook_type_to_string(return_type['return'])
            else:
                return_type = None
            # Generate the json schema
            # schema = json.loads(h.schema_json(exclude={'default_hook'}))
            schema = json.loads(h.schema_json())
            if self.output_schemas:
                schema_list.append(schema)
            else:
                # Generate the docs object
                hook_doc = HookDoc(
                    properties=get_hook_properties(h),
                    arguments=get_hook_arguments(h),
                    hook_type=inspect.signature(h).parameters['hook_type'].default,
                    # In markdown tables, new lines get messed up so replace with html
                    description=schema['description'].replace("\n\n",
                                                              "<br />").replace(
                        "\n", "")
                    if 'description' in schema
                    else "",
                    return_type=return_type,
                    return_description=h._return_description,
                    hook_file_name=os.path.basename(f),
                    doc_tags=h._doc_tags,
                    issue_numbers=h._issue_numbers,
                    notes=h._notes,
                    order=h._docs_order,
                )
                docs.hooks.append(hook_doc)
    # Sort based on order
    # Sort alphabetically
    docs.hooks = sorted(docs.hooks, key=lambda d: d.hook_type)
    if self.output_schemas:
        return schema_list
    else:
        return docs.dict()