Commit 9d387437 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Emit check error if an unknown custom check is used

parent c425a888
......@@ -5,6 +5,8 @@ from typing import Optional
import frictionless
from validata_core.custom_checks.utils import build_check_error
from .custom_checks import MissingRequiredHeader, available_checks
from .error_messages import error_translate
from .helpers import (
......@@ -108,9 +110,14 @@ def validate(source, schema, **options):
# Dynamically add custom check based on schema needs
check_errors = []
for cc_conf in schema.get("custom_checks", []):
cc_name = cc_conf["name"]
if cc_name in available_checks:
if cc_name not in available_checks:
build_check_error(cc_name, note="custom check inconnu.")
cc_class = available_checks[cc_name]
cc_descriptor = cc_conf["params"]
......@@ -159,6 +166,9 @@ def validate(source, schema, **options):
source_header, required_field_names, original_schema
if check_errors:
report["valid"] = False
# translate errors
report["errors"] = [error_translate(err, schema) for err in report["errors"]]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment