You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is an issue or intended behavior, so if you think there is a better place, do not hesitate to tell me where I can move the conversation.
We have a use case where we define custom checks (that inherit from frictionless.Check), with custom types. In the process of migrating from frictionless v4 to v5, we noticed that these custom types would throw errors when using CustomCheck.from_descriptor : [check-error] Check is not valid: check type "custom-check" is not supported
Looking into the codebase, we noticed that this issue was raised by system.select_check_class. In this function, from what I understand, there are two main ways for a class to be selected :
with a plugin overwriting select_check_class (I am not very familiar with plugins, so I may have misunderstood)
I wonder why the allowed types need to be narrowed down to a closed list this way. Is there a way to "register" an additional allowed type, or what is the best/suggested way to implement custom checks with custom types ? Is a plugin the way to go ?
The workaround we found so far consists in overwriting the metadata_select_class method of Check, but this feels a bit clunky.
Sample custom check code
This fails with a CheckError. Uncomment the commented block and it behaves as expected.
fromtypingimportOptionalfromfrictionlessimportCheck, errors, validateclassCustomCheck(Check):
type: str="custom-check"defvalidate_start(self):
yielderrors.Error(note="custom check error")
# Uncomment and it works as expected# @classmethod# def metadata_select_class(cls, _: Optional[str]):# return clsif__name__=="__main__":
report=validate(
source=[["a"], [1]],
checks=[CustomCheck.from_descriptor({"type": "custom-check"})],
)
print(report)
The text was updated successfully, but these errors were encountered:
Not sure if this is an issue or intended behavior, so if you think there is a better place, do not hesitate to tell me where I can move the conversation.
We have a use case where we define custom checks (that inherit from
frictionless.Check
), with customtype
s. In the process of migrating from frictionless v4 to v5, we noticed that these custom types would throw errors when usingCustomCheck.from_descriptor
:[check-error] Check is not valid: check type "custom-check" is not supported
Looking into the codebase, we noticed that this issue was raised by
system.select_check_class
. In this function, from what I understand, there are two main ways for a class to be selected :select_check_class
(I am not very familiar with plugins, so I may have misunderstood)frictionless.checks
)I wonder why the allowed types need to be narrowed down to a closed list this way. Is there a way to "register" an additional allowed type, or what is the best/suggested way to implement custom checks with custom types ? Is a plugin the way to go ?
The workaround we found so far consists in overwriting the
metadata_select_class
method ofCheck
, but this feels a bit clunky.Sample custom check code
This fails with a CheckError. Uncomment the commented block and it behaves as expected.
The text was updated successfully, but these errors were encountered: