def generate_schema_dict(self, example_event, path_list=[], default_required=True, default_nullable=False, required=False, nullable=False): schema_dict = SchemaGenerator(example_event).to_dict( required=default_required, nullable=default_nullable) for path in path_list: SchemaGenerator.set_required(schema_dict, path, required=required, nullable=nullable) # Sanity check that the example event still passes validation jsonschema.validate(example_event, schema_dict) return schema_dict, copy.deepcopy(example_event)
def test_instance(self): schema_dict = json.loads(fixtures.json_schema_1) generator = SchemaGenerator(schema_dict) self.assertIsInstance(generator, SchemaGenerator) self.assertEqual(generator.base_object, schema_dict)