--------------------
name fails regex:

{'persons': [{'id': 'P:001', 'name': 'prince'}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	'prince' does not match '^\\S+ \\S+'

Failed validating 'pattern' in schema['properties']['persons']['items']['properties']['name']:
    {'pattern': '^\\S+ \\S+', 'type': 'string'}

On instance['persons'][0]['name']:
    'prince'

--------------------
missing ID:

{'persons': [{'name': 'prince charming'}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	'id' is a required property

Failed validating 'required' in schema['properties']['persons']['items']:
    {'additionalProperties': False,
     'description': '',
     'properties': {'addresses': {'items': {'$ref': '#/definitions/Address'},
                                  'type': 'array'},
                    'age_in_years': {'type': 'integer'},
                    'aliases': {'items': {'type': 'string'},
                                'type': 'array'},
                    'has_birth_event': {'$ref': '#/definitions/BirthEvent'},
                    'has_employment_history': {'items': {'$ref': '#/definitions/EmploymentEvent'},
                                               'type': 'array'},
                    'has_familial_relationships': {'items': {'$ref': '#/definitions/FamilialRelationship'},
                                                   'type': 'array'},
                    'has_medical_history': {'items': {'$ref': '#/definitions/MedicalEvent'},
                                            'type': 'array'},
                    'id': {'type': 'string'},
                    'name': {'pattern': '^\\S+ \\S+', 'type': 'string'}},
     'required': ['id'],
     'title': 'Person',
     'type': 'object'}

On instance['persons'][0]:
    {'name': 'prince charming'}

--------------------
wrong datatype for age:

{'persons': [{'id': 'P', 'name': 'prince charming', 'age': '33'}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	Additional properties are not allowed ('age' was unexpected)

Failed validating 'additionalProperties' in schema['properties']['persons']['items']:
    {'additionalProperties': False,
     'description': '',
     'properties': {'addresses': {'items': {'$ref': '#/definitions/Address'},
                                  'type': 'array'},
                    'age_in_years': {'type': 'integer'},
                    'aliases': {'items': {'type': 'string'},
                                'type': 'array'},
                    'has_birth_event': {'$ref': '#/definitions/BirthEvent'},
                    'has_employment_history': {'items': {'$ref': '#/definitions/EmploymentEvent'},
                                               'type': 'array'},
                    'has_familial_relationships': {'items': {'$ref': '#/definitions/FamilialRelationship'},
                                                   'type': 'array'},
                    'has_medical_history': {'items': {'$ref': '#/definitions/MedicalEvent'},
                                            'type': 'array'},
                    'id': {'type': 'string'},
                    'name': {'pattern': '^\\S+ \\S+', 'type': 'string'}},
     'required': ['id'],
     'title': 'Person',
     'type': 'object'}

On instance['persons'][0]:
    {'age': '33', 'id': 'P', 'name': 'prince charming'}

--------------------
wrong datatype for name:

{'companies': [{'id': 'ROR:1', 'name': 5}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	5 is not of type 'string'

Failed validating 'type' in schema['properties']['companies']['items']['properties']['name']:
    {'type': 'string'}

On instance['companies'][0]['name']:
    5

--------------------
missing required type field:

{'persons': [{'id': 'P:001', 'name': 'jane smith', 'has_familial_relationships': [{'related_to': 'P:002'}]}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	'type' is a required property

Failed validating 'required' in schema['properties']['persons']['items']['properties']['has_familial_relationships']['items']:
    {'additionalProperties': False,
     'description': '',
     'properties': {'ended_at_time': {'format': 'date', 'type': 'string'},
                    'related_to': {'type': 'string'},
                    'started_at_time': {'format': 'date', 'type': 'string'},
                    'type': {'type': 'string'}},
     'required': ['type', 'related_to'],
     'title': 'FamilialRelationship',
     'type': 'object'}

On instance['persons'][0]['has_familial_relationships'][0]:
    {'related_to': 'P:002'}

--------------------
wrong enum:

{'persons': [{'id': 'P:001', 'name': 'jane smith', 'has_familial_relationships': [{'related_to': 'P:002', 'type': 'NON_EXISTENT_RELATION'}]}]}:
 SKIPPED
--------------------
age lower than threshold:

{'persons': [{'id': 'P', 'name': 'benjamin button', 'age_in_years': -5}]}:
 SKIPPED
--------------------
age higher than threshold:

{'persons': [{'id': 'P', 'name': 'dr who', 'age_in_years': 5000}]}:
 SKIPPED
--------------------
additional properties is closed:

{'persons': [{'id': 'P', 'name': 'john smith', 'made_up_property': 'abc'}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	Additional properties are not allowed ('made_up_property' was unexpected)

Failed validating 'additionalProperties' in schema['properties']['persons']['items']:
    {'additionalProperties': False,
     'description': '',
     'properties': {'addresses': {'items': {'$ref': '#/definitions/Address'},
                                  'type': 'array'},
                    'age_in_years': {'type': 'integer'},
                    'aliases': {'items': {'type': 'string'},
                                'type': 'array'},
                    'has_birth_event': {'$ref': '#/definitions/BirthEvent'},
                    'has_employment_history': {'items': {'$ref': '#/definitions/EmploymentEvent'},
                                               'type': 'array'},
                    'has_familial_relationships': {'items': {'$ref': '#/definitions/FamilialRelationship'},
                                                   'type': 'array'},
                    'has_medical_history': {'items': {'$ref': '#/definitions/MedicalEvent'},
                                            'type': 'array'},
                    'id': {'type': 'string'},
                    'name': {'pattern': '^\\S+ \\S+', 'type': 'string'}},
     'required': ['id'],
     'title': 'Person',
     'type': 'object'}

On instance['persons'][0]:
    {'id': 'P', 'made_up_property': 'abc', 'name': 'john smith'}

--------------------
additional properties is closed on enclosing object:

{'persons': [{'id': 'P', 'name': 'john smith'}], 'made_up_property': 'abc'}:
 SKIPPED
--------------------
non-multivalued address:

{'persons': [{'id': 'P', 'name': 'john smith', 'addresses': {'street': '1 foo street', 'city': 'foo city'}}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	{'street': '1 foo street', 'city': 'foo city'} is not of type 'array'

Failed validating 'type' in schema['properties']['persons']['items']['properties']['addresses']:
    {'items': {'$ref': '#/definitions/Address'}, 'type': 'array'}

On instance['persons'][0]['addresses']:
    {'city': 'foo city', 'street': '1 foo street'}

--------------------
string used in place of object:

{'persons': [{'id': 'P', 'name': 'john smith', 'addresses': ['1 foo street, foo city']}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	'1 foo street, foo city' is not of type 'object'

Failed validating 'type' in schema['properties']['persons']['items']['properties']['addresses']['items']:
    {'additionalProperties': False,
     'description': '',
     'properties': {'city': {'type': 'string'},
                    'street': {'type': 'string'}},
     'required': [],
     'title': 'Address',
     'type': 'object'}

On instance['persons'][0]['addresses'][0]:
    '1 foo street, foo city'

--------------------
inline used where reference expected:

{'activities': [{'id': 'A1', 'was_associated_with': {'id': 'Agent:987'}}]}:

EXPECTED FAILURE: <class 'jsonschema.exceptions.ValidationError'>:
	{'id': 'Agent:987'} is not of type 'string'

Failed validating 'type' in schema['properties']['activities']['items']['properties']['was_associated_with']:
    {'type': 'string'}

On instance['activities'][0]['was_associated_with']:
    {'id': 'Agent:987'}

--------------------
date format:

{'activities': [{'id': 'A1', 'started_at_time': 'not a real date'}]}:
 SKIPPED
