JsDoc Reference - Report

Class Index | File Index

## Classes

- Environment
- InitializationError
- JSONInstance
- JSONSchema
- JSV
- Report
- ValidationError

# Class Report

Defined in: jsv.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| Report() Reports are returned from validation methods to describe the result of a validation.

Field Summary
Field Attributes | Field Name and Description
--- | ---
| errors An array of ValidationError objects that define all the errors generated by the schema against the instance.
| instance If the report is generated by Environment#validate, this field is the generated instance.
| schema If the report is generated by Environment#validate, this field is the generated schema.
| schemaSchema If the report is generated by Environment#validate, this field is the schema's schema.
| validated A hash table of every instance and what schemas were validated against it.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| addError(instance, schema, attr, message, details) Adds a ValidationError object to the `errors` field.
| isValidatedBy(uri, schemaUri) Returns if an instance with the provided URI has been validated by the schema with the provided URI.
| registerValidation(uri, schemaUri) Registers that the provided instance URI has been validated by the provided schema URI.

Class Detail
Report()
Reports are returned from validation methods to describe the result of a validation.

See:
  JSONSchema#validate
  Environment#validate

Field Detail
{Array} errors
An array of ValidationError objects that define all the errors generated by the schema against the instance.

See:
  Report#addError

{JSONInstance} instance
If the report is generated by Environment#validate, this field is the generated instance.

See:
  Environment#validate

{JSONSchema} schema
If the report is generated by Environment#validate, this field is the generated schema.

See:
  Environment#validate

{JSONSchema} schemaSchema
If the report is generated by Environment#validate, this field is the schema's schema. This value is the same as calling `schema.getSchema()`.

See:
  Environment#validate
  JSONSchema#getSchema

{Object} validated
A hash table of every instance and what schemas were validated against it.

The key of each item in the table is the URI of the instance that was validated. The value of this key is an array of strings of URIs of the schema that validated it.

See:
  Report#registerValidation
  Report#isValidatedBy

Method Detail
addError(instance, schema, attr, message, details)
Adds a ValidationError object to the `errors` field.

Parameters:
{JSONInstance|String} instance
  The instance (or instance URI) that is invalid
{JSONSchema|String} schema
  The schema (or schema URI) that was validating the instance
{String} attr
  The attribute that failed to validated
{String} message
  A user-friendly message on why the schema attribute failed to validate the instance
{Any} details
  The value of the schema attribute

{Boolean} isValidatedBy(uri, schemaUri)
Returns if an instance with the provided URI has been validated by the schema with the provided URI.

Parameters:
{String} uri
  The URI of the instance
{String} schemaUri
  The URI of a schema

Returns:
  {Boolean} If the instance has been validated by the schema.

registerValidation(uri, schemaUri)
Registers that the provided instance URI has been validated by the provided schema URI. This is recorded in the `validated` field.

Parameters:
{String} uri
  The URI of the instance that was validated
{String} schemaUri
  The URI of the schema that validated the instance

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Sep 14 2011 18:53:24 GMT-0600 (MDT)