SchemaValidator

com.eclipsesource.schema.SchemaValidator
See theSchemaValidator companion object
class SchemaValidator(val schemaVersion: Option[SchemaVersion], val formats: Map[String, SchemaFormat], val resolverFactory: UrlStreamResolverFactory, val cache: DocumentCache)(implicit val lang: Lang)

The schema validator.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

Add a custom format

Add a custom format

Value parameters

format

the custom format

Attributes

Returns

a new validator instance containing the custom format

def addSchema(id: String, schema: SchemaType): SchemaValidator

Add a schema.

Add a schema.

Value parameters

id

the id of the schema

schema

the schema

Attributes

def addUrlHandler(handler: URLStreamHandler, scheme: String): SchemaValidator

Add a URLStreamHandler that is capable of handling absolute with a specific scheme.

Add a URLStreamHandler that is capable of handling absolute with a specific scheme.

Value parameters

handler

the UrlHandler to be added

Attributes

Returns

a new validator instance

def validate(schemaUrl: URL): JsValue => JsResult[JsValue]
def validate(schemaSource: Source): JsValue => JsResult[JsValue]
def validate[A](schemaSource: Source, input: => JsValue, reads: Reads[A]): JsResult[A]

Validate the given JsValue against the schema located at the given URL and convert the result via the specified Reads instance in case it has been successful.

Validate the given JsValue against the schema located at the given URL and convert the result via the specified Reads instance in case it has been successful.

Value parameters

input

the value to be validated

schemaSource

source from where to read the schema from

Attributes

Returns

a JsResult holding the validation result

def validate[A](schemaUrl: URL, input: => JsValue, reads: Reads[A]): JsResult[A]

Validate the given JsValue against the schema located at the given URL and convert the result via the specified Reads instance in case it has been successful.

Validate the given JsValue against the schema located at the given URL and convert the result via the specified Reads instance in case it has been successful.

Value parameters

input

the value to be validated

schemaUrl

the URL from where to read the schema from

Attributes

Returns

a JsResult holding the validation result

def validate[A](schemaSource: Source, input: => A, writes: Writes[A]): JsResult[JsValue]

Convert the given value via the specified Writes instance to a JsValue and validate it against the schema located at the given URL.

Convert the given value via the specified Writes instance to a JsValue and validate it against the schema located at the given URL.

Value parameters

input

the value to be validated

schemaSource

source from where to read the scheam from

Attributes

Returns

a JsResult holding the valid result

def validate[A](schemaUrl: URL, input: => A, writes: Writes[A]): JsResult[JsValue]

Convert the given value via the specified Writes instance to a JsValue and validate it against the schema located at the given URL.

Convert the given value via the specified Writes instance to a JsValue and validate it against the schema located at the given URL.

Value parameters

input

the value to be validated

schemaUrl

the URL from where to read the schema from

Attributes

Returns

a JsResult holding the valid result

def validate[A : Format](schemaSource: Source, input: A): JsResult[A]

Convert the given value via the specified Format instance to a JsValue, validate it against the schema at the given URL, and convert it back.

Convert the given value via the specified Format instance to a JsValue, validate it against the schema at the given URL, and convert it back.

Value parameters

input

the value to be validated

schemaSource

source from where to read the scheam from

Attributes

Returns

a JsResult holding the valid result

def validate[A : Format](schemaUrl: URL, input: A): JsResult[A]

Convert the given value via the specified Format instance to a JsValue, validate it against the schema at the given URL, and convert it back.

Convert the given value via the specified Format instance to a JsValue, validate it against the schema at the given URL, and convert it back.

Value parameters

input

the value to be validated

schemaUrl

source from where to read the scheam from

Attributes

Returns

a JsResult holding the valid result

def validate(schema: SchemaType)(input: => JsValue): JsResult[JsValue]

Validate the given JsValue against the given schema.

Validate the given JsValue against the given schema.

Value parameters

input

the value to be validated

schema

the schema to validate against

Attributes

Returns

a JsResult holding the valid result

def validate[A](schema: SchemaType, input: => JsValue, reads: Reads[A]): JsResult[A]

Validate the given JsValue against the schema and convert the result via the specified Reads instance in case it has been successful.

Validate the given JsValue against the schema and convert the result via the specified Reads instance in case it has been successful.

Value parameters

input

the value to be validated

schema

the schema to validate against

Attributes

Returns

a JsResult holding the validation result

def validate[A](schema: SchemaType, input: A, writes: Writes[A]): JsResult[JsValue]

Convert the given value via the specified Writes instance to a JsValue and validate it against the schema.

Convert the given value via the specified Writes instance to a JsValue and validate it against the schema.

Value parameters

input

the value to be validated

schema

the schema to validate against

Attributes

Returns

a JsResult holding the valid result

def validate[A : Format](schema: SchemaType, input: A): JsResult[A]

Convert the given value via the specified Format instance to a JsValue, validate it against the given schema and convert it back.

Convert the given value via the specified Format instance to a JsValue, validate it against the given schema and convert it back.

Value parameters

input

the value to be validated

schema

the schema to validate against

Attributes

Returns

a JsResult holding the valid result

Implicits

Implicits

implicit val lang: Lang