Feature: Validation
Opened this issue · 3 comments
What is the recommended way to handle invalid input (i.e., options)? Reports are kinda like models, but they don't have validation. Maybe it would be good if they did. Otherwise, what I can do when report receives bad options except raise an error, which is pretty ugly for the user?
hey @timscott
I think validation is an interesting idea. I personally haven't had to use it yet because I've followed an approach that provides defaults for all user input if they are not in the proper format. It might be nice to add validation in with some sort of option declaration DSL. I'll be thinking on this over the weekend and will hopefully write something up next week. In the mean time PRs are always welcome.
Thanks for using dossier!
@adamhunter
Let me know what you ideas you come up with. I spent 10 minutes trying to monkey patch in ActiveModel::Validation, but I gave up right away. If you come up with ideas how to best approach it and share them here, I might can find time to make PR. Thanks!
If this is a "niche" feature, it might be best to do it as a separate gem and consider rolling it in later if it's popular enough.