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 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)