-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chattier guards #12
Comments
This is a great idea, and one that has been considered. There are some reasons the library's APIs weren't extended to include messaging.
I had done a bunch of work on that second library (or second set of functions in the library) in 2018, but at the time, I couldn't get the TypeScript types to turn out the way I wanted, without cheating. Perhaps I should look into that, again. (also, hi!) |
Good points. Two libraries, one for prod and one for dev, in essence? |
As far as ideology, one would be for guaranteeing correct systems. You can have a completely predictable system, if there is no user input or data; that might not be practical, so likewise, if you guarantee the type of all inputs/user-interactions, you can have a similarly correct system. The second library could be plugged in for development, but it could also be used for quality control and API logging/debugging. So in a bigger system, you could use the first library to check data coming in, and if there was an API problem, you could send the data to a support endpoint for the back-end team to process. The support endpoint could use the second library to automatically generate a report of broken server responses, with the list of all errors, et cetera. Likewise, you could use it to return the list of message keys for all errors for each field in form validation, perhaps. |
When data fails the validator, it would be nice if the information about the specific guard that failed and the data that it failed with could be optionally surfaced, so, for example, it could be included automatically in logs. This would save time doing manual comparisons of the data with the guards to debug the failure.
(👋 Hi)
The text was updated successfully, but these errors were encountered: