justinrainbow/json-schema — pull request #16 by JoakimLofgren (2012-08-10 22:32:45+00:00)
Title: Optional enums

I made a suggested solution to my [issue #15](https://github.com/justinrainbow/json-schema/issues/15).

I updated the Enum constraint to take the required attribute into consideration
when checking an enumeration property and whether a value exists or not for it.

I also refactored it a bit to minimize the code.
The use of in_array should pretty much mimic the "foreach-if-equal-then-found".

Test cases are added to reflect the changes.

I hope everything is satisfactory. :)

Only one unrelated test case is failing, and it must be because
I am using Windows 7 with PHP 5.4.5 at home.
```
There was 1 error:

1) JsonSchema\Tests\Uri\UriRetrieverTest::testResolveRelativeUri with data set #0 ('{
"type":"object",
"title":"child",
"extends":"http://some.host.at/somewhere/parent",
"properties":
{
"childProp":
{
"type":"string"
}
}
}', '{
"type":"object",
"title":"parent",
"properties":
{
"parentProp":
{
"type":"boolean"
}
}
}')
JsonSchema\Exception\UriResolverException: Unable to resolve URI 'grandparent' from base '/somewhere/parent'
...
FAILURES!
Tests: 147, Assertions: 153, Errors: 1.
```