/gradle-json-schema

A Gradle custom task for validating a JSON document using JSON Schema.

Primary LanguageKotlinISC LicenseISC

gradle-json-schema

Release License

A Gradle custom task for validating a JSON document using JSON Schema.

Installation

buildscript {
    repositories {
        mavenCentral()
        maven(url = "https://jitpack.io")
        maven(url = "https://dl.bintray.com/michaelbull/maven")
    }

    dependencies {
        classpath("com.michael-bull.gradle-json-schema:gradle-json-schema:1.0.0")
    }
}

Usage

import com.github.michaelbull.gradle.json.ValidateSchema

val validateExamples by tasks.registering(ValidateSchema::class) {
    description = "Validate example files"

    schema.set(file("example.schema.json"))
    inputDir.set(layout.projectDirectory.dir("input"))
    report.set(reporting.baseDirectory.file("example-report.json"))

    validator {
        failEarly()
    }
}

Contributing

Bug reports and pull requests are welcome on GitHub.

License

This project is available under the terms of the ISC license. See the LICENSE file for the copyright information and licensing terms.