Closed roman closed 6 years ago
This would be hugely helpful for newbs! I ran into a few of these similar situations where I had a simple error/mistake in the config spec but did not get the error message until runtime.
Specifically, I've seen both:
ᐅ app say_hi
app: InvalidConfiguration Nothing "Error in $['etc/entries'].env.cli.commands[1]: expected Cmd (say_hi), encountered String"
and:
ᐅ app say_hi
app: CommandKeyMissing
For the first one, I have both mispelled commands and had tried to access keys in a command that wasn't included in the key's entry in the spec.
Using Template Haskell, provide a function that can read a JSON FilePath, parse the config spec and lift the config spec in the code.
This utility will allow users to validate the config spec at compile time, and not at runtime.