Class YamlSchemaValidator

java.lang.Object
org.alexmond.yaml.validator.YamlSchemaValidator

@Component public class YamlSchemaValidator extends Object
A validator for YAML files against JSON Schema definitions. This component provides functionality to validate YAML/JSON content against JSON Schema specifications, supporting both local file system and HTTP(S) schema sources.
  • Constructor Details

    • YamlSchemaValidator

      public YamlSchemaValidator()
  • Method Details

    • validate

      public Map<String,com.networknt.schema.output.OutputUnit> validate(String filePath, String schemaPath)
      Validates a YAML file against a JSON Schema.
      Parameters:
      filePath - Path to the YAML file to validate
      schemaPath - Path to the JSON Schema file (can be local file path or HTTP URL)
      Returns:
      Map containing validation results where key is the file path and value is the validation output
    • getSchemaVersion

      public com.networknt.schema.SpecVersion.VersionFlag getSchemaVersion(com.fasterxml.jackson.databind.JsonNode schemaNode)
      Detects the JSON Schema version from the schema node. Falls back to V202012 if version cannot be detected.
      Parameters:
      schemaNode - JSON node containing the schema
      Returns:
      Detected schema version or default version if detection fails