samedi 3 septembre 2016

What is best way to design rule mechanism for data validation?

I want to validate lots of data for several rules (rule can be added or removed). Data will be in form of dictionary. I have python library like Validator or Cerberus. It has two limitations.

  1. I can not add my customized rule into it. (Maybe I can but I did not find any doc on site so did not tried too much).
  2. It validates row one by one. I want to carry batch operation.

I am looking to design my own rule mechanism where I can address all these issue. I found too many design patterns (Strategy, Chain of Responsibility) but confused which will suite perfectly.

To explain my req in more I will have on data object which will have all data with different fields to validate. I should perform all rules in parallel. After all operations are completed I will have another object which will have all validation errors with bad data.

Can any one please suggest different approached which will be fitted in oops concept and easy to maintain state?

Aucun commentaire:

Enregistrer un commentaire