Field type to validate "free" text inputs
I'm using the FreeTextFieldType class for an input that takes the following form:
<input_name>=<sequence-of-numbers>- e.g.,
arg1=1,0.3,9.8,2
I'm using the free text field as this is the only current suitable option, but I think it would be useful to add an optional parameter to the class constructor with a regex validator string, so we can check whether the input is valid before spinning-up a new model train process.
I think this minor modification to FreeTextFieldType could be useful to more people; and in my use case I'd just implement the input above as: new FreeTextFieldType("", "^((\d+(\.\d*)?,)*(\d+(\.\d*)?))?$") (1st parameter is the default value)
Shall I implement this and send in a PR?
PS: another option would be creating an entirely new FieldType CSVNumericFieldType that would be more specific to my case and would require larger code changes, but would also work.
It's an okay from me. Please remember to not introduce breaking change (e.g., overload the constructor instead of changing its signature)
I think that makes sense, the current validate method is doing nothing anyways :thinking:
Make sure that if no validation is provided the result is still a Optional.empty() to preserve current behavior.
If you need any help, let me know!