class Json

JSON Schema Validator

Implements schema draft version 03, as defined at http://json-schema.org

Properties

protected $schemaDefinition
protected stdClass $schema

Methods

__construct(string $schemaFile)

Initialize validation object

validate(mixed $entity, string $entityName = null)

Validate schema object

checkFormat(mixed $entity, object $schema, string $entityName)

Check format restriction

validateProperties(object $entity, object $schema, string $entityName)

Validate object properties

validateType(mixed $entity, object $schema, string $entityName)

Validate entity type

checkTypeObject(mixed $entity, object $schema, string $entityName)

Check object type

checkTypeNumber(mixed $entity, object $schema, string $entityName)

Check number type

checkTypeInteger(mixed $entity, object $schema, string $entityName)

Check integer type

checkTypeBoolean(mixed $entity, object $schema, string $entityName)

Check boolean type

checkTypeString(mixed $entity, object $schema, string $entityName)

Check string type

checkTypeArray(mixed $entity, object $schema, string $entityName)

Check array type

checkTypeNull(mixed $entity, object $schema, string $entityName)

Check null type

checkTypeAny(mixed $entity, object $schema, string $entityName)

Check any type

checkMinimum(int|float $entity, object $schema, string $entityName)

Check minimum value

checkMaximum(int|float $entity, object $schema, string $entityName)

Check maximum value

checkExclusiveMinimum(int|float $entity, object $schema, string $entityName)

Check exlusive minimum requirement

checkExclusiveMaximum(int|float $entity, object $schema, string $entityName)

Check exclusive maximum requirement

checkPattern(string $entity, object $schema, string $entityName)

Check value against regex pattern

checkMinLength(string $entity, object $schema, string $entityName)

Check string minimum length

checkMaxLength(string $entity, object $schema, string $entityName)

Check string maximum length

checkMinItems(array $entity, object $schema, string $entityName)

Check array minimum items

checkMaxItems(array $entity, object $schema, string $entityName)

Check array maximum items

checkUniqueItems(array $entity, object $schema, string $entityName)

Check array unique items

checkEnum(array $entity, object $schema, string $entityName)

Check enum restriction

checkItems(array $entity, object $schema, string $entityName)

Check items restriction

checkDisallow(mixed $entity, object $schema, string $entityName)

Check disallowed entity type

checkDivisibleBy(int|float $entity, object $schema, string $entityName)

Check divisibleby restriction

Details

at line 56
__construct(string $schemaFile)

Initialize validation object

Parameters

string $schemaFile

at line 80
Json validate(mixed $entity, string $entityName = null)

Validate schema object

Parameters

mixed $entity
string $entityName

Return Value

Json

at line 99
Json checkFormat(mixed $entity, object $schema, string $entityName)

Check format restriction

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 185
protected Json validateProperties(object $entity, object $schema, string $entityName)

Validate object properties

Parameters

object $entity
object $schema
string $entityName

Return Value

Json

at line 229
protected Json validateType(mixed $entity, object $schema, string $entityName)

Validate entity type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 318
protected Json checkTypeObject(mixed $entity, object $schema, string $entityName)

Check object type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 334
protected Json checkTypeNumber(mixed $entity, object $schema, string $entityName)

Check number type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 357
protected Json checkTypeInteger(mixed $entity, object $schema, string $entityName)

Check integer type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 380
protected Json checkTypeBoolean(mixed $entity, object $schema, string $entityName)

Check boolean type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 394
protected Json checkTypeString(mixed $entity, object $schema, string $entityName)

Check string type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 415
protected Json checkTypeArray(mixed $entity, object $schema, string $entityName)

Check array type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 436
protected Json checkTypeNull(mixed $entity, object $schema, string $entityName)

Check null type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 450
protected Json checkTypeAny(mixed $entity, object $schema, string $entityName)

Check any type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 466
protected Json checkMinimum(int|float $entity, object $schema, string $entityName)

Check minimum value

Parameters

int|float $entity
object $schema
string $entityName

Return Value

Json

at line 486
protected Json checkMaximum(int|float $entity, object $schema, string $entityName)

Check maximum value

Parameters

int|float $entity
object $schema
string $entityName

Return Value

Json

at line 506
protected Json checkExclusiveMinimum(int|float $entity, object $schema, string $entityName)

Check exlusive minimum requirement

Parameters

int|float $entity
object $schema
string $entityName

Return Value

Json

at line 526
protected Json checkExclusiveMaximum(int|float $entity, object $schema, string $entityName)

Check exclusive maximum requirement

Parameters

int|float $entity
object $schema
string $entityName

Return Value

Json

at line 546
protected Json checkPattern(string $entity, object $schema, string $entityName)

Check value against regex pattern

Parameters

string $entity
object $schema
string $entityName

Return Value

Json

at line 566
protected Json checkMinLength(string $entity, object $schema, string $entityName)

Check string minimum length

Parameters

string $entity
object $schema
string $entityName

Return Value

Json

at line 586
protected Json checkMaxLength(string $entity, object $schema, string $entityName)

Check string maximum length

Parameters

string $entity
object $schema
string $entityName

Return Value

Json

at line 606
protected Json checkMinItems(array $entity, object $schema, string $entityName)

Check array minimum items

Parameters

array $entity
object $schema
string $entityName

Return Value

Json

at line 626
protected Json checkMaxItems(array $entity, object $schema, string $entityName)

Check array maximum items

Parameters

array $entity
object $schema
string $entityName

Return Value

Json

at line 646
protected Json checkUniqueItems(array $entity, object $schema, string $entityName)

Check array unique items

Parameters

array $entity
object $schema
string $entityName

Return Value

Json

at line 666
protected Json checkEnum(array $entity, object $schema, string $entityName)

Check enum restriction

Parameters

array $entity
object $schema
string $entityName

Return Value

Json

at line 702
protected Json checkItems(array $entity, object $schema, string $entityName)

Check items restriction

Parameters

array $entity
object $schema
string $entityName

Return Value

Json

at line 753
protected Json checkDisallow(mixed $entity, object $schema, string $entityName)

Check disallowed entity type

Parameters

mixed $entity
object $schema
string $entityName

Return Value

Json

at line 790
protected Json checkDivisibleBy(int|float $entity, object $schema, string $entityName)

Check divisibleby restriction

Parameters

int|float $entity
object $schema
string $entityName

Return Value

Json