diff --git a/src/JsonSchema/Constraints/Constraint.php b/src/JsonSchema/Constraints/Constraint.php index e0e044bc..14d4de17 100644 --- a/src/JsonSchema/Constraints/Constraint.php +++ b/src/JsonSchema/Constraints/Constraint.php @@ -24,16 +24,35 @@ abstract class Constraint extends BaseConstraint implements ConstraintInterface { protected $inlineSchemaProperty = '$schema'; - const CHECK_MODE_NONE = 0x00000000; - const CHECK_MODE_NORMAL = 0x00000001; - const CHECK_MODE_TYPE_CAST = 0x00000002; - const CHECK_MODE_COERCE_TYPES = 0x00000004; - const CHECK_MODE_APPLY_DEFAULTS = 0x00000008; - const CHECK_MODE_EXCEPTIONS = 0x00000010; - const CHECK_MODE_DISABLE_FORMAT = 0x00000020; - const CHECK_MODE_EARLY_COERCE = 0x00000040; - const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080; - const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100; + /** Bitwise value used to specify no constraint validation options */ + const CHECK_MODE_NONE = 0x00000000; + + /** Bitwise value used to specify normal constraint validation options */ + const CHECK_MODE_NORMAL = 0x00000001; + + /** Bitwise value used to specify the value typecasting constraint validation option */ + const CHECK_MODE_TYPE_CAST = 0x00000002; + + /** Bitwise value used to specify the value type coercion constraint validation option */ + const CHECK_MODE_COERCE_TYPES = 0x00000004; + + /** Bitwise value used to specify the default value constraint validation option */ + const CHECK_MODE_APPLY_DEFAULTS = 0x00000008; + + /** Bitwise value used to specify the exception handling constraint validation option */ + const CHECK_MODE_EXCEPTIONS = 0x00000010; + + /** Bitwise value used to specify the disable format constraint validation option */ + const CHECK_MODE_DISABLE_FORMAT = 0x00000020; + + /** Bitwise value used to specify the early value type coercion constraint validation option */ + const CHECK_MODE_EARLY_COERCE = 0x00000040; + + /** Bitwise value used to specify the default value only for required properties constraint validation option */ + const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080; + + /** Bitwise value used to specify the schema validation constraint validation option */ + const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100; /** * Bubble down the path diff --git a/src/JsonSchema/Constraints/Factory.php b/src/JsonSchema/Constraints/Factory.php index c9296385..b4ed39e6 100644 --- a/src/JsonSchema/Constraints/Factory.php +++ b/src/JsonSchema/Constraints/Factory.php @@ -11,7 +11,6 @@ use JsonSchema\Constraints\Constraint; use JsonSchema\Exception\InvalidArgumentException; -use JsonSchema\Exception\InvalidConfigException; use JsonSchema\SchemaStorage; use JsonSchema\SchemaStorageInterface; use JsonSchema\Uri\UriRetriever; diff --git a/src/JsonSchema/Exception/ExceptionInterface.php b/src/JsonSchema/Exception/ExceptionInterface.php index 439bd277..93969c8f 100644 --- a/src/JsonSchema/Exception/ExceptionInterface.php +++ b/src/JsonSchema/Exception/ExceptionInterface.php @@ -1,7 +1,21 @@ + * @package justinrainbow\json-schema + * + * @license MIT */ class UnresolvableJsonPointerException extends InvalidArgumentException { diff --git a/src/JsonSchema/Exception/UriResolverException.php b/src/JsonSchema/Exception/UriResolverException.php index 13b73033..1cdaaafd 100644 --- a/src/JsonSchema/Exception/UriResolverException.php +++ b/src/JsonSchema/Exception/UriResolverException.php @@ -10,7 +10,11 @@ namespace JsonSchema\Exception; /** - * Wrapper for the UriResolverException + * A URI provided in the JSON schema is unresolvable + * + * @package justinrainbow\json-schema + * + * @license MIT */ class UriResolverException extends RuntimeException { diff --git a/src/JsonSchema/Exception/ValidationException.php b/src/JsonSchema/Exception/ValidationException.php index 65d8849e..157115e0 100644 --- a/src/JsonSchema/Exception/ValidationException.php +++ b/src/JsonSchema/Exception/ValidationException.php @@ -9,6 +9,13 @@ namespace JsonSchema\Exception; +/** + * A JSON schema validation error detailing pointer and constraint information + * + * @package justinrainbow\json-schema + * + * @license MIT + */ class ValidationException extends RuntimeException { } diff --git a/src/JsonSchema/Validator.php b/src/JsonSchema/Validator.php index 092e45b8..85e56d03 100644 --- a/src/JsonSchema/Validator.php +++ b/src/JsonSchema/Validator.php @@ -11,7 +11,6 @@ use JsonSchema\Constraints\BaseConstraint; use JsonSchema\Constraints\Constraint; -use JsonSchema\Exception\InvalidConfigException; use JsonSchema\SchemaStorage; /** @@ -25,12 +24,20 @@ */ class Validator extends BaseConstraint { + /** Media type for JSON Schema */ const SCHEMA_MEDIA_TYPE = 'application/schema+json'; - const ERROR_NONE = 0x00000000; - const ERROR_ALL = 0xFFFFFFFF; - const ERROR_DOCUMENT_VALIDATION = 0x00000001; - const ERROR_SCHEMA_VALIDATION = 0x00000002; + /** Bitwise value used to specify no error context */ + const ERROR_NONE = 0x00000000; + + /** Bitwise value used to specify all error contexts */ + const ERROR_ALL = 0xFFFFFFFF; + + /** Bitwise value used to specify JSON document validation error context */ + const ERROR_DOCUMENT_VALIDATION = 0x00000001; + + /** Bitwise value used to specify JSON schema validation error context */ + const ERROR_SCHEMA_VALIDATION = 0x00000002; /** * Validates the given data against the schema and returns an object containing the results.