dojox/json/schema (version 1.10)

See the dojox/json/schema reference documentation for more information.

Method Summary

  • _validate(instance,schema,_changing)
  • checkPropertyChange(value,schema,property) The checkPropertyChange method will check to see if an value can legally be in property with the given schema This is slightly different than the validate method in that it will fail if the schema is readonly and it will not check for self-validation, it is assumed that the passed in value is already internally valid.
  • mustBeValid(result) This checks to ensure that the result is valid and will throw an appropriate error message if it is not
  • validate(instance,schema) To use the validator call this with an instance object and an optional schema object.

Methods

_validate(instance,schema,_changing)
Defined by dojox/json/schema
Parameter Type Description
instance Any
schema Object
_changing Boolean
checkPropertyChange(value,schema,property)
Defined by dojox/json/schema

The checkPropertyChange method will check to see if an value can legally be in property with the given schema This is slightly different than the validate method in that it will fail if the schema is readonly and it will not check for self-validation, it is assumed that the passed in value is already internally valid. The checkPropertyChange method will return the same object type as validate, see JSONSchema.validate for information.

Parameter Type Description
value Any

The new instance value/object to check

schema Object

The schema to use to validate

property String
Returns:any | undefined

see dojox.validate.jsonSchema.validate

mustBeValid(result)
Defined by dojox/json/schema

This checks to ensure that the result is valid and will throw an appropriate error message if it is not

Parameter Type Description
result undefined
validate(instance,schema)
Defined by dojox/json/schema

To use the validator call this with an instance object and an optional schema object. If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating), that schema will be used to validate and the schema parameter is not necessary (if both exist, both validations will occur).

The validate method will return an object with two properties:

  • valid: A boolean indicating if the instance is valid by the schema
  • errors: An array of validation errors. If there are no errors, then an empty list will be returned. A validation error will have two properties:
  • property: which indicates which property had the error
  • message: which indicates what the error was
Parameter Type Description
instance Any

The instance value/object to validate

schema Object

The schema to use to validate

Error in the documentation? Can’t find what you are looking for? Let us know!