cosmo
cosmo copied to clipboard
fix: unmarshal YAML once before validation
This way consumers can use the validation function without needing to use Cosmo to directly read the file.
Motivation and Context
Before config validation was somewhat hidden inside of Cosmo. Now config can be loaded from disk and validated outside of the Cosmo library since the config struct contains its own validation logic.
- [x] Tests or benchmark included (existing tests cover behavior)
- [ ] Documentation is changed or added on https://app.gitbook.com/
- [x] PR title must follow conventional-commit-standard
Hi @clayne11
Thanks for the PR.
It looks like there are failing tests. Please could you take a look?
This PR was marked stale due to lack of activity. It will be closed in 14 days.
Closed as inactive. Feel free to reopen if this PR is still being worked on.
@clayne11 is there still interest in this PR? I think the last hurdle were the failing tests.
I am still interested but it wasn't as simple as fixing the tests. The way the validation is being done makes this a bit tricky. The JSON Schema is expecting to validate against the input format (snake_case vs TitleCase), and additionally nulls are not treated the same in the input vs if I re-serialize it out of YAML.
I will probably take another crack at this at some point but it wasn't trivial to fix.