Output Formats

Introduction

YJ Schema Validator supports multiple output formats to accommodate different use cases and integration scenarios. This guide details each available format and provides usage examples.

Available Formats

Text Output (Default)

The default console output with optional color support:

Text output sample

JSON Output

Structured JSON format is ideal for programmatic processing: json format is based on json schema draft standard Output Formatting

{
  "valid" : false,
  "files" : {
    "src/test/resources/valid.yaml" : {
      "valid" : true
    },
    "src/test/resources/invalid.yaml" : {
      "valid" : false,
      "details" : [ {
        "valid" : false,
        "evaluationPath" : "$.properties.sample.properties.boolean-sample",
        "schemaLocation" : "urn:example:10#/properties/sample/properties/boolean-sample",
        "instanceLocation" : "$.sample.boolean-sample",
        "errors" : {
          "type" : "integer found, boolean expected"
        }
      } ]
    }
  }
}

YAML Output

YAML format for better human readability:

---
valid: false
files:
  src/test/resources/valid.yaml:
    valid: true
  src/test/resources/invalid.yaml:
    valid: false
    details:
      - valid: false
        evaluationPath: "$.properties.sample.properties.boolean-sample"
        schemaLocation: "urn:example:10#/properties/sample/properties/boolean-sample"
        instanceLocation: "$.sample.boolean-sample"
        errors:
          type: "integer found, boolean expected"

JUnit XML Output (Alpha)

JUnit XML format for CI/CD integration:

<testsuites name="SchemaValidationSuite" tests="2" failures="1" errors="0" skipped="0">
    <testsuite name="SchemaValidationSuite" file="src/test/resources" time="0.0" tests="2" failures="1" errors="0" skipped="0">
        <testcase>
            <testcase classname="files" name="src/test/resources/valid.yaml" time="0.0">
                <failure/>
            </testcase>
            <testcase classname="files" name="src/test/resources/invalid.yaml" time="0.0">
                <failure message="Type Mismatch at $.sample.boolean-sample">integer found, boolean expected</failure>
            </testcase>
        </testcase>
    </testsuite>
</testsuites>

Configuration

Option Description Example

--report-type

Output format selection (text, json, yaml, junit, sarif)

--report-type=json

--report-file-name

File to write output (defaults to stdout)

--report-file-name=report.json

--color

Enable/disable a colored output (text format only)

--color=false