docs.nestjs.com
docs.nestjs.com copied to clipboard
Improve docs around environment variables validation from custom functions
I'm submitting a...
- [ ] Regression
- [ ] Bug report
- [ ] Feature request
- [X] Documentation issue or request (new chapter/page)
- [ ] Support request
Current behavior
The documentation for adding custom configuration files does not make it clear enough that any validation should happen inside the provided function. The schema validation section also makes no reference to custom functions and is assumed that the validationSchema option will work with variables coming from any source including custom functions.
Expected behavior
Expand the example listed using a YAML file at the end of the custom configuartion section to include validation.
Minimal reproduction of the problem with instructions
https://gist.github.com/D10f/552f4fd922f35a5dfbc8496b407faa97
What is the motivation / use case for changing the behavior?
Found about this behavior from a user on Discord asking for help on the topic, and trial and error. As YAML is one of the most popular formats for configuration I think it's worth highlighting this bit of the documentation. This issue has been discussed already but the documentation is still not reflecting this.