Classes
Members
(static) this.attributes :SchemaNode.schema
- Source:
Is the public object given in the second argument of validateCallback
Type:
Methods
coerce(value) → {*}
- Source:
Converts a value to a specified function. Coerce functions are declared with addFormat
, and corresponding to format
property.
Example
Blueconfig.addFormat({
name: 'int',
coerce: (value) => (typeof value !== 'undefined') ? parseInt(value, 10) : value,
validate: function(value) {
assert(Number.isInteger(value), 'must be an integer')
}
})
Parameters:
-
value
* -
Value to coerce
Returns:
value Returns coerced value
- Type
- *
getOrigin() → {string}
- Source:
Returns the name of the getter which gets the current value.
Returns:
value Getter name which origin of the value
- Type
- string
validate(value)
- Source:
Validates value, will call validateCallback
Parameters:
-
value
* -
Value of the property to validate
Type Definitions
validateCallback(value, schema, fullpath)
- Source:
- See:
Validates function, should throw when value is not valid. Throws LISTOFERRORS if you have several error (see LISTOFERRORS example)
Validate functions are declared with addFormat
, and corresponding to format
property.
This:
Example
Blueconfig.addFormat({
name: 'int',
coerce: (value) => (typeof value !== 'undefined') ? parseInt(value, 10) : value,
validate: function(value, schema, fullpath) {
if (Number.isInteger(value)) {
throw new Error('must be an integer')
}
}
})
Parameters:
-
value
* -
Value of the property to validate
-
schema
schemaNode -
schemaNode (= rules) of the property
-
fullpath
string -
Full property path
Throws:
-
-
Throw Error(),
Error
s are transformed toFORMAT_INVALID
. - Type
- Error
-
-
-
Throw LISTOFERRORS() usefull if you validate a children key.
-