File tree 2 files changed +6
-8
lines changed
2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 11
11
12
12
}
13
13
],
14
- "minimum-stability" : " dev " ,
14
+ "minimum-stability" : " stable " ,
15
15
"require" : {
16
16
"php" : " ^5.4 || ^7.0" ,
17
- "justinrainbow/json-schema" : " ^1.6 " ,
17
+ "justinrainbow/json-schema" : " ^2.0 " ,
18
18
"mtdowling/jmespath.php" : " ^2.3"
19
19
},
20
20
"require-dev" : {
Original file line number Diff line number Diff line change 12
12
namespace EnricoStahn \JsonAssert ;
13
13
14
14
use JsonSchema \RefResolver ;
15
+ use JsonSchema \Uri \UriResolver ;
15
16
use JsonSchema \Uri \UriRetriever ;
16
17
use JsonSchema \Validator ;
17
18
@@ -36,16 +37,13 @@ trait Assert
36
37
*/
37
38
public static function assertJsonMatchesSchema ($ schema , $ content )
38
39
{
39
- $ retriever = new UriRetriever ();
40
- $ schema = $ retriever ->retrieve ('file:// ' .realpath ($ schema ));
41
-
42
40
// Assume references are relative to the current file
43
41
// Create an issue or pull request if you need more complex use cases
44
- $ refResolver = new RefResolver ($ retriever );
45
- $ refResolver ->resolve ($ schema, $ schema -> id );
42
+ $ refResolver = new RefResolver (new UriRetriever (), new UriResolver () );
43
+ $ schemaObj = $ refResolver ->resolve (' file:// ' . realpath ( $ schema) );
46
44
47
45
$ validator = new Validator ();
48
- $ validator ->check ($ content , $ schema );
46
+ $ validator ->check ($ content , $ schemaObj );
49
47
50
48
$ message = '- Property: %s, Contraint: %s, Message: %s ' ;
51
49
$ messages = array_map (function ($ exception ) use ($ message ) {
You can’t perform that action at this time.
0 commit comments