-
-
Notifications
You must be signed in to change notification settings - Fork 603
Closed
Description
Could be my misunderstanding, but it seems the error path for an item in the below example is being incorrectly set (it should be deque([2]) rather than deque([1])). It only seems to occur when items is non-empty.
from jsonschema import Draft4Validator as Validator
schema = {
'type': 'array',
'items': [{
'type': 'object',
'properties': {
'foo': {'type': 'string'}
},
'required': ['foo']
}],
'additionalItems': {
'type': 'object',
'properties': {
'bar': {'type': 'string'}
},
'required': ['bar']
}
}
instance = [
{'foo': 'A'},
{'bar': 'B'},
{},
]
errors = Validator(schema).iter_errors(instance)
for error in errors:
print error.path, error.message
# deque([1]) 'bar' is a required propertyNote: The aim for this schema is that the first item should be different to all remaining items.
Metadata
Metadata
Assignees
Labels
No labels