stacki
stacki copied to clipboard
Replace fillParams
fillParams()
as a concept is good but has some issues. It has to be explicitly called, it has some weird typing issues, and at the end, you still have to do substantial amounts of error checking.
The concept could be extended
- Provide a new library that is a series of validation functions (isBool(), inSeq(), isAbove(), etc) in pylib
- Write a dictionary schema that describes desired variables:
- expected type,
- a transform on the data,
- a validation function using (1) (or user-specified...) with args,
- a default value,
- perhaps a relationship to other values (eg, var1 also requires var2),
- maybe an error message
- Add a function to
__init__()
of the Command class to look for and process the data structure from (2) in a given Command subclass and produce error messages before command's run() is ever called. - Place the resultant parameters in a dictionary member variable, something like
self.params
.
If it all works, consider how to handle deprecation of fillParams (which can exist in Pallets).