Class SystemValidator

java.lang.Object
mekhq.utilities.SystemValidator

public class SystemValidator extends Object
Validates planetary system YAML data files for structural correctness and data integrity.

This validator deserializes each YAML file using the same Jackson pipeline as production code, then checks for required fields, valid ranges, duplicate IDs, and data consistency. It can be run as a standalone Gradle task (./gradlew validateSystems) or called programmatically from unit tests.

  • Constructor Details

    • SystemValidator

      public SystemValidator()
      Creates a new validator, initializing the YAML deserializer and loading known faction codes.
  • Method Details

    • validate

      public ValidationResult validate(String dataPath)
      Validates all planetary system data files found under the given directory path.

      Recursively scans for .yml files and .zip archives containing YAML entries. Each file is deserialized and checked for structural correctness and data integrity.

      Parameters:
      dataPath - the path to the directory containing planetary system data files
      Returns:
      a ValidationResult containing all findings and summary statistics
    • main

      public static void main(String[] args)
      Entry point for the Gradle validateSystems task. Validates all system data files in the specified directory (or the default path) and exits with code 1 if any errors are found.
      Parameters:
      args - optional: path to data directory (defaults to MHQConstants.PLANETARY_SYSTEM_DIRECTORY_PATH)