| 
4 | 4 | [](https://packagist.org/packages/justinrainbow/json-schema)  | 
5 | 5 | [](https://packagist.org/packages/justinrainbow/json-schema/stats)  | 
6 | 6 | 
 
  | 
7 |  | -A PHP Implementation for validating `JSON` Structures against a given `Schema` with support for `Schemas` of Draft-3 or Draft-4. Features of newer Drafts might not be supported. See [Table of All Versions of Everything](https://json-schema.org/specification-links.html#table-of-all-versions-of-everything) to get an overview of all existing Drafts.  | 
 | 7 | +A PHP Implementation for validating `JSON` Structures against a given `Schema` with support for `Schemas` of Draft-3,   | 
 | 8 | +Draft-4 or Draft-6.   | 
 | 9 | + | 
 | 10 | +Features of newer Drafts might not be supported. See [Table of All Versions of Everything](https://json-schema.org/specification-links.html#table-of-all-versions-of-everything) to get an overview   | 
 | 11 | +of all existing Drafts.  | 
 | 12 | + | 
8 | 13 | 
 
  | 
9 | 14 | See [json-schema](http://json-schema.org/) for more details.  | 
10 | 15 | 
 
  | 
@@ -187,24 +192,25 @@ A number of flags are available to alter the behavior of the validator. These ca  | 
187 | 192 | third argument to `Validator::validate()`, or can be provided as the third argument to  | 
188 | 193 | `Factory::__construct()` if you wish to persist them across multiple `validate()` calls.  | 
189 | 194 | 
 
  | 
190 |  | -| Flag | Description |  | 
191 |  | -|------|-------------|  | 
192 |  | -| `Constraint::CHECK_MODE_NORMAL` | Validate in 'normal' mode - this is the default |  | 
193 |  | -| `Constraint::CHECK_MODE_TYPE_CAST` | Enable fuzzy type checking for associative arrays and objects |  | 
194 |  | -| `Constraint::CHECK_MODE_COERCE_TYPES` | Convert data types to match the schema where possible |  | 
195 |  | -| `Constraint::CHECK_MODE_EARLY_COERCE` | Apply type coercion as soon as possible |  | 
196 |  | -| `Constraint::CHECK_MODE_APPLY_DEFAULTS` | Apply default values from the schema if not set |  | 
197 |  | -| `Constraint::CHECK_MODE_ONLY_REQUIRED_DEFAULTS` | When applying defaults, only set values that are required |  | 
198 |  | -| `Constraint::CHECK_MODE_EXCEPTIONS` | Throw an exception immediately if validation fails |  | 
199 |  | -| `Constraint::CHECK_MODE_DISABLE_FORMAT` | Do not validate "format" constraints |  | 
200 |  | -| `Constraint::CHECK_MODE_VALIDATE_SCHEMA` | Validate the schema as well as the provided document |  | 
201 |  | - | 
202 |  | -Please note that using `CHECK_MODE_COERCE_TYPES` or `CHECK_MODE_APPLY_DEFAULTS` will modify your  | 
 | 195 | +| Flag                                            | Description                                                     |  | 
 | 196 | +|-------------------------------------------------|-----------------------------------------------------------------|  | 
 | 197 | +| `Constraint::CHECK_MODE_NORMAL`                 | Validate in 'normal' mode - this is the default                 |  | 
 | 198 | +| `Constraint::CHECK_MODE_TYPE_CAST`              | Enable fuzzy type checking for associative arrays and objects   |  | 
 | 199 | +| `Constraint::CHECK_MODE_COERCE_TYPES` [^1][^2]  | Convert data types to match the schema where possible           |  | 
 | 200 | +| `Constraint::CHECK_MODE_EARLY_COERCE` [^2]      | Apply type coercion as soon as possible                         |  | 
 | 201 | +| `Constraint::CHECK_MODE_APPLY_DEFAULTS` [^1]    | Apply default values from the schema if not set                 |  | 
 | 202 | +| `Constraint::CHECK_MODE_ONLY_REQUIRED_DEFAULTS` | When applying defaults, only set values that are required       |  | 
 | 203 | +| `Constraint::CHECK_MODE_EXCEPTIONS`             | Throw an exception immediately if validation fails              |  | 
 | 204 | +| `Constraint::CHECK_MODE_DISABLE_FORMAT`         | Do not validate "format" constraints                            |  | 
 | 205 | +| `Constraint::CHECK_MODE_VALIDATE_SCHEMA`        | Validate the schema as well as the provided document            |  | 
 | 206 | +| `Constraint::CHECK_MODE_STRICT` [^3]            | Validate the scheme using strict mode using the specified draft |   | 
 | 207 | + | 
 | 208 | +[^1]: Please note that using `CHECK_MODE_COERCE_TYPES` or `CHECK_MODE_APPLY_DEFAULTS` will modify your  | 
203 | 209 | original data.  | 
204 |  | - | 
205 |  | -`CHECK_MODE_EARLY_COERCE` has no effect unless used in combination with `CHECK_MODE_COERCE_TYPES`. If  | 
 | 210 | +[^2]: `CHECK_MODE_EARLY_COERCE` has no effect unless used in combination with `CHECK_MODE_COERCE_TYPES`. If  | 
206 | 211 | enabled, the validator will use (and coerce) the first compatible type it encounters, even if the  | 
207 | 212 | schema defines another type that matches directly and does not require coercion.  | 
 | 213 | +[^3]: `CHECK_MODE_STRICT` only can be used for Draft-6 at this point.  | 
208 | 214 | 
 
  | 
209 | 215 | ## Running the tests  | 
210 | 216 | 
 
  | 
 | 
0 commit comments