new Schema(definition)
js-data's Schema class.
import {Schema} from 'js-data'
Parameters:
Name | Type | Description |
---|---|---|
definition |
Object | Schema definition according to json-schema.org |
Extends
Members
-
<static> typeGroupValidators :Object
-
TODO
Type:
- Object
-
<static> types :Object
-
TODO
Type:
- Object
-
<static> validationKeywords :Object
-
TODO
Type:
- Object
Methods
-
<static> validate(value, schema, opts)
-
TODO
Parameters:
Name Type Argument Description value
* TODO
schema
Object <optional>
TODO
opts
Object <optional>
Configuration options.
-
dbg()
-
- Inherited From:
- Source:
-
log()
-
- Inherited From:
- Source:
-
validate(target)
-
This adds ES5 getters/setters to the target based on the "properties" in this Schema, which makes possible change tracking and validation on property assignment.
Parameters:
Name Type Description target
Object The prototype to which to apply this schema.
-
validate(value, opts)
-
Validate the provided value against this schema.
Parameters:
Name Type Argument Description value
* Value to validate.
opts
Object <optional>
Configuration options.
Returns:
Array of errors or
undefined
if valid.- Type
- array | undefined