Skip to content

Major refactoring #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Dec 10, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
38d2ce2
rename libs to src
igorw Sep 30, 2011
eea4243
add src/JsonSchema
igorw Sep 30, 2011
59ee775
add namespace
igorw Sep 30, 2011
8620623
remove useless Dbg class
igorw Sep 30, 2011
eddad9a
rename JsonSchema to Validator
igorw Sep 30, 2011
2319086
replace static with dynamic
igorw Sep 30, 2011
927c136
convert CRLF to LF
igorw Sep 30, 2011
8fe526e
add symfony ClassLoader component
igorw Sep 30, 2011
64e08f4
remove suffix from phpunix.xml
igorw Sep 30, 2011
9ab1249
remove webroot
igorw Sep 30, 2011
8fccda0
rm selenium test cases
igorw Sep 30, 2011
cb88336
reorganize tests
igorw Sep 30, 2011
3098d25
make tests passing again
igorw Sep 30, 2011
bf2a3fe
convert indentation to 4 spaces
igorw Sep 30, 2011
561c671
remove JsonFormatValidator
igorw Sep 30, 2011
3bfb7c2
rename JsonSchemaUndefined to Undefined
igorw Sep 30, 2011
341e7bc
replace "optional" attribute with "required" (optional is deprecated …
igorw Oct 1, 2011
dfe7d35
added composer.json
digitalkaoz Dec 9, 2011
ce9093f
fixed README, fixed required/optional (optional is default)
digitalkaoz Dec 9, 2011
ffcdb2e
fix up composer.json autoload path
igorw Dec 10, 2011
cea0c65
add test instructions to README
igorw Dec 10, 2011
8acbb48
Merge remote-tracking branch 'upstream/master'
igorw Dec 10, 2011
abd08ce
add a proper file header
igorw Dec 10, 2011
c4944bc
fix composer.json
igorw Dec 10, 2011
6361474
fix CS
igorw Dec 10, 2011
b318e8d
more CS
igorw Dec 10, 2011
deb250c
correct README example
igorw Dec 10, 2011
e6fa1e5
CS
igorw Dec 10, 2011
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vendor/symfony/Component/ClassLoader"]
path = vendor/symfony/Component/ClassLoader
url = https://github.com/symfony/ClassLoader.git
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
```php
<?php

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

if ($result->valid) {
die('success!');
echo "The supplied JSON validates against the schema.\n";
} else {
echo "JSON does not validate. Violations:\n";
foreach ($result->errors as $error) {
echo "[{$error['property']}] {$error['message']}\n";
}
}
else {
die('fail...');
}
```
```

## Running the tests

$ git submodule update --init
$ phpunit
5 changes: 0 additions & 5 deletions bootstrap.php

This file was deleted.

15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
{
"name": "justinrainbow/json-schema",
"description": "a library to validate a json schema"
"description": "A library to validate a json schema.",
"keywords": ["json", "schema"],
"homepage": "https://github.com/justinrainbow/json-schema",
"type": "library",
"license": "MIT",
"license": "NewBSD",
"version": "1.0.0",
"authors": [
{
"name": "Justin Rainbow"
"name": "Bruno Prieto Reis",
"email": "[email protected]"
},
{
"name": "Justin Rainbow",
"email": "[email protected]"
}
],

"autoload": {
"psr-0": { "JsonSchema": "libs/", "JsonSchemaUndefined": "libs/"}
"psr-0": { "JsonSchema": "src/" }
}
}

Loading