type error when using oneOf
misja opened this issue · 1 comments
I have the following schema:
schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"props": {
"type": "array",
"items": {
"oneOf": [
{"type": "string"},
{"type": "number"}
]
}
}
}
}
Validating the following documents raises a ValidationError('Wrong type', 'hello')
error:
doc = {
"props": ["hello"]
}
This is due to validate_type
marking the value "hello"
as not a type number during the recursion, but am not able to trace why this error is bubbling up since validate_one_of
already validated the condition as true. Any ideas?
I just noticed the fix, quite obvious, but I missed it! Thanks :) One other thing that's not too obvious for me at the moment is how to construct a validator by using namespaced schemas I have available via a Edit: last question sorted.FilesystemProvider
(and also to have these globally available via a Registry
). Not sure if this is the best place to ask but if you could provide an example that would be great.