- Source:
Methods
(static) conforms(schema, object, strictopt, allowIncompleteopt) → {object}
- Source:
Check whether an object conforms to some schema. This function does not return a boolean, but a result object that takes the following form:
{
conforms: boolean,
warnings: string[],
errors: string[],
}
Note that the strict
flag determines whether or not
to perform coercive validation. If strict=false
and the
code does need to perform coercion in order for validation to pass,
the object will be updated such that it will now pass strict validation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
schema |
schema | The schema that the object should conform to | |
object |
object | The object to check conformance for | |
strict |
boolean |
<optional> |
True if strict type validation is required, false for coercive. Defaults to true. |
allowIncomplete |
boolean |
<optional> |
Do not fail validation if there are fields missing from this object. Defaults to false. |
Returns:
See description above
- Type
- object