Build your own custom data validator
If you want to implement your own custom Data Validator, you can follow the following steps:- Create a class which inherits from the BaseDataValidator class and override one or more of the abstract methods, depending on the capabilities of the underlying library/service that you want to integrate.
- If you need any configuration, you can create a class which inherits from the
BaseDataValidatorConfig
class. - Bring both of these classes together by inheriting from the
BaseDataValidatorFlavor
. - (Optional) You should also provide some standard steps that others can easily insert into their pipelines for instant access to data validation features.
- The CustomDataValidatorFlavor class is imported and utilized upon the creation of the custom flavor through the CLI.
- The CustomDataValidatorConfig class is imported when someone tries to register/update a stack component with this custom flavor. Especially, during the registration process of the stack component, the config will be used to validate the values given by the user. As
Config
object are inherentlypydantic
objects, you can also add your own custom validators here. - The CustomDataValidator only comes into play when the component is ultimately in use.
CustomDataValidatorFlavor
and the CustomDataValidatorConfig
are implemented in a different module/path than the actual CustomDataValidator
).