Package org.alexmond.yaml.validator
Class YamlSchemaValidator
java.lang.Object
org.alexmond.yaml.validator.YamlSchemaValidator
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.networknt.schema.SpecVersion.VersionFlaggetSchemaVersion(com.fasterxml.jackson.databind.JsonNode schemaNode) Detects the JSON Schema version from the schema node.Validates a YAML file against a JSON Schema.
-
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 validateschemaPath- 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
-