Class Validator
Class Validator
implements JSON Type Definition validation.
Inheritance
Namespace: Jtd.Jtd
Assembly: Jtd.Jtd.dll
Syntax
public class Validator : object
Properties
| Improve this Doc View SourceMaxDepth
Declaration
public int MaxDepth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The maximum number of references that will be followed before Validate(Schema, IJson) raises MaxDepthExceededException. |
MaxErrors
Declaration
public int MaxErrors { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The maximum number of errors that will be be returned from Validate(Schema, IJson). |
Methods
| Improve this Doc View SourceValidate(Schema, IJson)
Validate instance
against schema
, returning a list of validation errors.
Declaration
public IList<ValidationError> Validate(Schema schema, IJson instance)
Parameters
Type | Name | Description |
---|---|---|
Schema | schema | The schema to validate against. |
IJson | instance | The instance ("input") to validate. |
Returns
Type | Description |
---|---|
IList<ValidationError> |
A list of validation errors, indicating parts of If MaxErrors is nonzero, then no more than MaxErrors errors are returned. Otherwise, all errors are returned. |
Remarks
This method implements JSON Type Definition validation. The precise set of validation errors returned are those prescribed by the JSON Type Definition specification. The order of the validation errors is not meaningful.
If schema
is not a correct schema (that is, its
Verify() raises an exception), then the behavior
of this method is undefined.
Exceptions
Type | Condition |
---|---|
MaxDepthExceededException | If MaxDepth is nonzero, and validation runs into a
chain of |