File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
tests/JsonSchema/Tests/Constraints Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,39 @@ public function testErrorPropertyIsPopulatedForRequiredIfMissingInInput()
38
38
$ this ->assertErrorHasExpectedPropertyValue ($ error , "foo " );
39
39
}
40
40
41
+ public function testPathErrorPropertyIsPopulatedForRequiredIfMissingInInput ()
42
+ {
43
+ $ validator = new UndefinedConstraint ();
44
+ $ document = json_decode (
45
+ '{
46
+ "foo": [{"baz": 1.5}]
47
+ } '
48
+ );
49
+ $ schema = json_decode (
50
+ '{
51
+ "type": "object",
52
+ "properties": {
53
+ "foo": {
54
+ "type": "array",
55
+ "items": {
56
+ "type": "object",
57
+ "properties": {
58
+ "bar": {"type": "number"},
59
+ "baz": {"type": "number"}
60
+ },
61
+ "required": ["bar"]
62
+ }
63
+ }
64
+ },
65
+ "required": ["foo"]
66
+ } '
67
+ );
68
+
69
+ $ validator ->check ($ document , $ schema );
70
+ $ error = $ validator ->getErrors ();
71
+ $ this ->assertErrorHasExpectedPropertyValue ($ error , "foo[0].bar " );
72
+ }
73
+
41
74
public function testErrorPropertyIsPopulatedForRequiredIfEmptyValueInInput ()
42
75
{
43
76
$ validator = new UndefinedConstraint ();
You can’t perform that action at this time.
0 commit comments