This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Maven plugin for validating JSON and YAML files against JSON Schema. It uses the networknt/json-schema-validator library and supports multiple JSON Schema versions (Draft 4, 6, 7, 2019-09, 2020-12).
mvn clean installmvn testmvn test -Dtest=TestClassName
mvn test -Dtest=TestClassName#methodNamemvn json-yaml-validator:validatemvn validate -Dschema.validator.skip=true- JsonYamlValidatorMojo (
src/main/java/com/dataliquid/maven/plugin/schema/validator/JsonYamlValidatorMojo.java)- Main plugin implementation extending AbstractMojo
- Handles file discovery using includes/excludes patterns
- Validates JSON/YAML files against schema
- Supports schema mappings for $ref resolution
- Configurable failure behavior
- Schema Version Support: Configurable via
schemaVersionparameter (V4, V6, V7, V201909, V202012) - File Pattern Matching: Uses glob patterns for includes/excludes
- Schema Mappings: Maps schema IDs to local files/directories for $ref resolution
- Validation Control:
failOnErrorandfailOnNoFilesFoundparameters
Tests are organized by JSON Schema version:
JsonYamlValidatorMojoV4Test.javaJsonYamlValidatorMojoV6Test.javaJsonYamlValidatorMojoV7Test.javaJsonYamlValidatorMojoV201909Test.javaJsonYamlValidatorMojoV202012Test.javaJsonYamlValidatorMojoFailOnNoFilesTest.java
Test resources:
src/test/resources/schemas/- Test schemas for each versionsrc/test/resources/test-data/- Valid/invalid test filessrc/test/resources/test-poms/- Test POM configurations
- Uses Maven Plugin API with annotations
- Goal prefix:
json-yaml-validator - Default phase:
validate - Test POMs are filtered during build to inject current version