openworm / owmeta-core

Core library for owmeta
MIT License
3 stars 2 forks source link

Add a distinct validation phase for DataSource and DataTranslator #14

Open mwatts15 opened 5 years ago

mwatts15 commented 5 years ago

Currently, DataTranslator can control the type of Translation object is attached to the resulting output DataSource and it can control how the translation is done (obviously). However, for input, there will, in general, be the possibility that one thing or another has gone wrong with the input DataSource. Similarly, for output it's possible that the output DataSource has been created incorrectly. To streamline DataTranslator code, it would be good to

  1. Add an interface method, validate, to DataTranslator to validate its input
  2. Add an interface method, validate, to DataSource to validate their fields regardless of how they are set (e.g., pre or post translation)
  3. Add one or more decorators for decorating validate to change when, in the potentially expensive process of providing capabilities to a DataSource pre-translation, that a validation should occur, with the undecorated validate running after all capabilities are provided
  4. Add places in the pow translate process where validation is called

It shouldn't be necessary to add to the DataTranslator interface a validation after translate has run since their shouldn't be any validation specific to the DataTranslator that can't be put into translate itself.

Exit criteria: