Skip to content
This repository was archived by the owner on Dec 21, 2019. It is now read-only.
Edgar Müller edited this page Sep 5, 2016 · 6 revisions

Usage

Versions >= 0.8.x

Since 0.8.x the validator is a class and needs to be instantiated.

val validator = SchemaValidator()
validator.validate(...)

Custom references

A new feature allows handling of custom reference within the schema, for instance the validator now allows references to JSON files that lie on the classpath if an appropriate URL handler has been registered. For examples, please see the test cases here.

Versions prior to 0.8.0 Play 2.5.x

Version 0.7.0 introduced some breaking changes, since the dependency to the Unified Validation library has been removed, i.e. the respective types are not part of the API anymore. This means that VA isn't exposed anymore as well as the toJson acting on Seq[(JsPath, Seq[ValidationError])] instead of Seq[(Path, Seq[ValidationError])]. As a replacement for VA we now use JsResult to express the result of a schema validation, which is already part of play-json.

Play 2.5.x dropped support for Scala 2.10, hence versions >= 0.7.0 are only available for Scala 2.11.

Play 2.4.x

For, Play 2.4.x, the current version is 0.6.5, which supports Scala 2.10 and 2.11

libraryDependencies ++= Seq(
 "com.eclipsesource" %% "play-json-schema-validator" % "0.6.5"
 )
Clone this wiki locally