You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that the specifics of Ecmascript regular expressions are not respected. Instead, regular expressions are evaluated as PERL regular expressions.
This means that the specifics of Ecmascript regular expressions are not respected. Instead, regular expressions are evaluated as PERL regular expressions.
40
+
22
41
```
23
42
composer require ropi/json-schema-evaluator
24
43
```
25
-
26
-
## Basic usage
44
+
## Basic examples
45
+
###Basic usage
27
46
```php
28
-
<?php
29
47
$schema = json_decode('{
30
48
"type": "string",
31
49
"maxLength": 5
@@ -62,8 +80,14 @@ foreach ($results as $result) {
62
80
}
63
81
}
64
82
```
65
-
The results can also be formatted.
66
-
In this example errors will be formatted to [Basic Output Structure](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.12.4.2).
83
+
Output of above example:
84
+
```
85
+
Error keyword location: '/maxLength'
86
+
Error instance location: ''
87
+
Error message: At most 5 characters are allowed, but there are 10.
88
+
```
89
+
### Formatting results
90
+
In the following example, the results are formatted as [Basic Output Structure](https://json-schema.org/draft/2020-12/json-schema-core#name-basic).
67
91
```php
68
92
$formattedResults = (new \Ropi\JsonSchemaEvaluator\Output\BasicOutput($valid, $results))->format();
If a default value is defined with the [default keyword](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.9.2), it can be automatically applied during evaluation.
113
+
If a default value is defined with the [default keyword](https://json-schema.org/draft/2020-12/json-schema-validation#name-default), it can be automatically applied during evaluation.
If encoded content is defined with the [contentEncoding keyword](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.8.3), it can be automatically decoded during evaluation.
142
+
### Content decoding
143
+
If encoded content is defined with the [contentEncoding keyword](https://json-schema.org/draft/2020-12/json-schema-validation#name-contentencoding), it can be automatically decoded during evaluation.
If content media type is defined with the [contentMediaType keyword](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.8.4), it can be respected during evaluation.
If format is defined with the [format keyword](https://json-schema.org/draft/2020-12/json-schema-core.html#rfc.section.12.1), it can be respected during evaluation.
187
+
###Assert format
188
+
If format is defined with the [format keyword](https://json-schema.org/draft/2020-12/json-schema-validation#name-format-annotation-vocabular), it can be respected during evaluation.
0 commit comments