code: def validate_files(
      fail_on_warnings: bool,
      max_history: Optional[int],
      importer: TrainingDataImporter,
      stories_only: bool = False,
  ) -> None:
      """Validates either the story structure or the entire project.
  
      Args:
          fail_on_warnings: `True` if the process should exit with a non-zero status
          max_history: The max history to use when validating the story structure.
          importer: The `TrainingDataImporter` to use to load the training data.
          stories_only: If `True`, only the story structure is validated.
      """
      from rasa.validator import Validator
  
      validator = Validator.from_importer(importer)
  
      if stories_only:
          all_good = _validate_story_structure(
              validator, max_history, fail_on_warnings
          )
      else:
          if importer.get_domain().is_empty():
              rasa.shared.utils.cli.print_error_and_exit(
                  "Encountered empty domain during validation."
              )
  
          valid_domain = _validate_domain(validator)
          valid_nlu = _validate_nlu(validator, fail_on_warnings)
          valid_stories = _validate_story_structure(
              validator, max_history, fail_on_warnings
          )
  
          all_good = valid_domain and valid_nlu and valid_stories
  
      validator.warn_if_config_mandatory_keys_are_not_set()
  
      telemetry.track_validate_files(all_good)
      if not all_good:
          rasa.shared.utils.cli.print_error_and_exit(
              "Project validation completed with errors."
          )
  
imports: import json
  import argparse
  import logging
  import os
  import sys
  import time
  from types import FrameType
  from typing import Any, Dict, List, Optional, TYPE_CHECKING, Text, Union, overload
  import randomname
  import rasa.shared.utils.cli
  import rasa.shared.utils.io
  from rasa.shared.importers.importer import TrainingDataImporter
  from rasa.shared.constants import ASSISTANT_ID_DEFAULT_VALUE, ASSISTANT_ID_KEY, DEFAULT_CONFIG_PATH
  from rasa.shared.utils.cli import print_error
  from rasa import telemetry
label_desc: Use image node_id 9 for calling a global function with example usage: validate_files(fail_on_warnings, max_history, importer, stories_only) without return types