Skip to content

Commit c8b6342

Browse files
committed
Merge pull request #2 from igorw/master
Major refactoring
2 parents 69af698 + e6fa1e5 commit c8b6342

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+575
-3732
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vendor/symfony/Component/ClassLoader"]
2+
path = vendor/symfony/Component/ClassLoader
3+
url = https://github.com/symfony/ClassLoader.git

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55
```php
66
<?php
77

8-
$json = json_decode($input_json);
9-
$schema = json_decode($input_schema);
10-
$result = JsonSchema::validate($json, $schema);
8+
$validator = new JsonSchema\Validator();
9+
$result = $validator->validate(json_decode($json), json_decode($schema));
1110

1211
if ($result->valid) {
13-
die('success!');
12+
echo "The supplied JSON validates against the schema.\n";
13+
} else {
14+
echo "JSON does not validate. Violations:\n";
15+
foreach ($result->errors as $error) {
16+
echo "[{$error['property']}] {$error['message']}\n";
17+
}
1418
}
15-
else {
16-
die('fail...');
17-
}
18-
```
19+
```
20+
21+
## Running the tests
22+
23+
$ git submodule update --init
24+
$ phpunit

bootstrap.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
{
22
"name": "justinrainbow/json-schema",
3-
"description": "a library to validate a json schema"
3+
"description": "A library to validate a json schema.",
44
"keywords": ["json", "schema"],
55
"homepage": "https://github.com/justinrainbow/json-schema",
66
"type": "library",
7-
"license": "MIT",
7+
"license": "NewBSD",
88
"version": "1.0.0",
99
"authors": [
1010
{
11-
"name": "Justin Rainbow"
11+
"name": "Bruno Prieto Reis",
12+
"email": "[email protected]"
13+
},
14+
{
15+
"name": "Justin Rainbow",
16+
"email": "[email protected]"
1217
}
1318
],
14-
1519
"autoload": {
16-
"psr-0": { "JsonSchema": "libs/", "JsonSchemaUndefined": "libs/"}
20+
"psr-0": { "JsonSchema": "src/" }
1721
}
1822
}
19-

0 commit comments

Comments
 (0)