class staticbo.rules. BrokenRulesOutput
Source: rules/
Represents the public format of broken rules. The output object has a property for each model property that has broken rule.
If the model property is a simple property, i.e. it is defined by
a <a href="bo.dataTypes.DataType.html">data type</a>, then the output property
is an array. The array elements are <a href="bo.rules.RuleNotice.html">rule notice</a>
objects representing the broken rules.
If the model property is a child model, then the output property
is an object as well, whose properties represents model properties
with broken rules, as described above.
If the model property is a child collection, then the output property
is an object as well, whose properties are the indeces of the items of
the collections. The property name is a number in '00000' format. The
property value represents the child item, as described above.
new BrokenRulesOutput()
Creates a new broken rules output instance.
Properties
read-only$count
Returns the count of broken rules.
read-only$length
Returns the count of properties that have broken rules.
Methods
add(propertyName, notice)
Adds a rule notice to the response object.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
propertyName |
string |
|
The name of the property. |
notice |
|
The public form of the broken rule. |
- Throws
-
Argument error: The property name must be a non-empty string.
-
Argument error: The notice must be a RuleNotice object.
addChild(propertyName, output)
Adds a child response object to the response object.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
propertyName |
string |
|
The name of the property. |
output |
|
The response object of a child property. |
- Throws
-
Argument error: The property name must be a non-empty string.
-
Argument error: The output must be a BrokenRulesOutput object.
addChildren(propertyName, outputs)
Adds child response objects to the response object.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
propertyName |
string |
|
The name of the property. |
outputs |
Array of bo.rules.BrokenRulesOutput |
|
The response objects of a child collection property. |
- Throws
-
Argument error: The property name must be a non-empty string.
-
Argument error: The outputs must be an array of BrokenRulesOutput objects or a single BrokenRulesOutput object.