Show / Hide Table of Contents

Class Validator

Class Validator implements JSON Type Definition validation.

Inheritance
System.Object
Validator
Namespace: Jtd.Jtd
Assembly: Jtd.Jtd.dll
Syntax
public class Validator : object

Properties

| Improve this Doc View Source

MaxDepth

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.

| Improve this Doc View Source

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 Source

Validate(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 instance that schema rejected. This list will be empty if there are no validation errors.

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 refs deeper than the value of MaxDepth.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX