oneOf or string format validators issue
Opened this issue · 0 comments
avaly commented
There seems to be an issue in either the oneOf
logic or the format validators. The following test fixture returns the errors below when unit tests as ran:
[
{
"description": "oneOf bug",
"schema": {
"oneOf": [
{
"type": "string",
"format": "email"
},
{
"type": "string",
"format": "uri"
}
]
},
"tests": [
{
"description": "first oneOf valid",
"data": "foo@bar.com",
"valid": true
},
{
"description": "second oneOf valid",
"data": "http://google.com",
"valid": true
},
{
"description": "neither oneOf valid format",
"data": "asd",
"valid": false
},
{
"description": "neither oneOf valid type",
"data": 1,
"valid": false
}
]
}
]
_bug.json
oneOf bug
1) first oneOf valid
0 passing (7ms)
1 failing
1) _bug.json oneOf bug first oneOf valid:
AssertionError: expected { validation: { oneOf: true } } to equal null
Tested with version 1.0.2
.