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
Copy file name to clipboardExpand all lines: src/JsonSchema/Constraints/CollectionConstraint.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -24,12 +24,12 @@ public function check($value, $schema = null, $path = null, $i = null)
24
24
{
25
25
// Verify minItems
26
26
if (isset($schema->minItems) && count($value) < $schema->minItems) {
27
-
$this->addError($path, "There must be a minimum of " . $schema->minItems . " items in the array");
27
+
$this->addError($path, "There must be a minimum of " . $schema->minItems . " items in the array", 'minItems', array('minItems' => $schema->minItems,));
28
28
}
29
29
30
30
// Verify maxItems
31
31
if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
32
-
$this->addError($path, "There must be a maximum of " . $schema->maxItems . " items in the array");
32
+
$this->addError($path, "There must be a maximum of " . $schema->maxItems . " items in the array", 'maxItems', array('maxItems' => $schema->maxItems,));
33
33
}
34
34
35
35
// Verify uniqueItems
@@ -39,7 +39,7 @@ public function check($value, $schema = null, $path = null, $i = null)
$path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items');
95
+
$path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems,));
$this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)));
48
+
$this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format,));
49
49
}
50
50
break;
51
51
52
52
case'utc-millisec':
53
53
if (!$this->validateDateTime($element, 'U')) {
54
-
$this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)));
54
+
$this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format,));
55
55
}
56
56
break;
57
57
58
58
case'regex':
59
59
if (!$this->validateRegex($element)) {
60
-
$this->addError($path, 'Invalid regex format ' . $element);
Copy file name to clipboardExpand all lines: src/JsonSchema/Constraints/NumberConstraint.php
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -26,40 +26,40 @@ public function check($element, $schema = null, $path = null, $i = null)
26
26
if (isset($schema->exclusiveMinimum)) {
27
27
if (isset($schema->minimum)) {
28
28
if ($schema->exclusiveMinimum && $element === $schema->minimum) {
29
-
$this->addError($path, "Must have a minimum value greater than boundary value of " . $schema->minimum);
29
+
$this->addError($path, "Must have a minimum value greater than boundary value of " . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum,));
30
30
} elseif ($element < $schema->minimum) {
31
-
$this->addError($path, "Must have a minimum value of " . $schema->minimum);
31
+
$this->addError($path, "Must have a minimum value of " . $schema->minimum, 'minimum', array('minimum' => $schema->minimum,));
32
32
}
33
33
} else {
34
-
$this->addError($path, "Use of exclusiveMinimum requires presence of minimum");
34
+
$this->addError($path, "Use of exclusiveMinimum requires presence of minimum", 'missingMinimum');
$this->addError($path, "Must have a minimum value of " . $schema->minimum);
37
+
$this->addError($path, "Must have a minimum value of " . $schema->minimum, 'minimum', array('minimum' => $schema->minimum,));
38
38
}
39
39
40
40
// Verify maximum
41
41
if (isset($schema->exclusiveMaximum)) {
42
42
if (isset($schema->maximum)) {
43
43
if ($schema->exclusiveMaximum && $element === $schema->maximum) {
44
-
$this->addError($path, "Must have a maximum value less than boundary value of " . $schema->maximum);
44
+
$this->addError($path, "Must have a maximum value less than boundary value of " . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum,));
45
45
} elseif ($element > $schema->maximum) {
46
-
$this->addError($path, "Must have a maximum value of " . $schema->maximum);
46
+
$this->addError($path, "Must have a maximum value of " . $schema->maximum, 'maximum', array('maximum' => $schema->maximum,));
47
47
}
48
48
} else {
49
-
$this->addError($path, "Use of exclusiveMaximum requires presence of maximum");
49
+
$this->addError($path, "Use of exclusiveMaximum requires presence of maximum", 'missingMinimum');
0 commit comments