diff --git a/src/caoscrawler/validator.py b/src/caoscrawler/validator.py index e1d36a392f21870e2ff2c20a5548144899f338da..91313daf1cd88539e2dd50182fc0c15a644e9b08 100644 --- a/src/caoscrawler/validator.py +++ b/src/caoscrawler/validator.py @@ -100,5 +100,27 @@ def convert_record(record: db.Record): return pobj -# def validate(schema, records): -# pass + +def validate(records: list[db.Record], schema: dict) -> tuple[list, list]: + """ + Validate a list of records against a JSON schema. + + Arguments: + ---------- + + records: list[db.Record] + List of records that will be validated. + + schema: dict + A JSON schema generated using `load_json_schema_from_datamodel_yaml`. + + Returns: + -------- + A tuple containing two elements: + + - Index 0: A list of boolean values, one for each record in `records` determining whether + the validation was successful. + - Index 1: A list of ValidationErrors (in case of insuccesful validation) or None if + the validation was successful. + """ + pass