Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

groupon/json-schema-validator

Repository files navigation

json-schema-validator

License: Apache 2 Travis Build Maven Artifact

Maven plugin to validate json files against a json schema. Uses https://github.com/fge/json-schema-validator library under the covers.

Usage

Determine the latest version of the validator in Maven Central.

Add the plugin to your pom either in the plugins or pluginManagement block:

<plugin>
    <groupId>com.groupon.maven.plugin.json</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>VERSION</version>
</plugin>

Configure one or more validation blocks for the plugin in the plugins block:

<plugin>
    <artifactId>json-schema-validator</artifactId>
    <groupId>com.groupon.maven.plugin.json</groupId>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>validate</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <validations>
            <validation>
                <directory>${basedir}/src/main/resources/data</directory>
                <jsonSchema>${basedir}/src/test/resources/data.schema</jsonSchema>
                <includes>
                    <include>**/*.json</include>
                </includes>
            </validation>
        </validations>
    </configuration>
</plugin>

Each validation block specifies the jsonSchema file to validate with as well as the json file(s) to validate from a root directory with standard includes and excludes to select specific file(s).

Building

Prerequisites:

Building:

json-schema-validator> mvn verify

To use the local version you must first install it locally:

json-schema-validator> mvn install

You can determine the version of the local build from the pom file. Using the local version is intended only for testing or development.

License

Published under Apache Software License 2.0, see LICENSE

© Groupon Inc., 2014

About

Maven plugin to validate json files against a json schema. Uses https://github.com/fge/json-schema-validator library under the covers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5

Languages