7
7
use JsonSchema \ConstraintError ;
8
8
use JsonSchema \Constraints \Constraint ;
9
9
use JsonSchema \Entity \JsonPointer ;
10
+ use JsonSchema \SchemaStorage ;
11
+ use JsonSchema \Uri \UriRetriever ;
10
12
11
13
class Draft06Constraint extends Constraint
12
14
{
13
- public function __construct ()
15
+ public function __construct (\ JsonSchema \ Constraints \ Factory $ factory = null )
14
16
{
15
- parent ::__construct (new Factory ());
17
+
18
+ parent ::__construct (new Factory (
19
+ $ factory ? $ factory ->getSchemaStorage () : new SchemaStorage (),
20
+ $ factory ? $ factory ->getUriRetriever () : new UriRetriever (),
21
+ $ factory ? $ factory ->getConfig () : Constraint::CHECK_MODE_NORMAL ,
22
+ ));
16
23
}
17
24
18
25
public function check (&$ value , $ schema = null , ?JsonPointer $ path = null , $ i = null ): void
@@ -26,6 +33,7 @@ public function check(&$value, $schema = null, ?JsonPointer $path = null, $i = n
26
33
}
27
34
28
35
// Apply defaults
36
+ $ this ->checkForKeyword ('ref ' , $ value , $ schema , $ path , $ i );
29
37
$ this ->checkForKeyword ('required ' , $ value , $ schema , $ path , $ i );
30
38
$ this ->checkForKeyword ('contains ' , $ value , $ schema , $ path , $ i );
31
39
$ this ->checkForKeyword ('properties ' , $ value , $ schema , $ path , $ i );
0 commit comments