refactor(app): use jsonschema for config #854
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thinking forward to the point where we want to be able to create the config yaml from the web UI, I think it will be difficult to maintain long-term if we have more than once source of truth for what fields need to exist and how they are validated.
Switching the python application from using voluptuous to jsonschema allows for 3 key benefits:
Error parsing config: 'mqtt'
becomesERROR : deque(['mqtt']) - 'host' is a required property
(can probably do better, but this is a start)There are still a few issues present that need to be fixed, like validating that
rtmp
anddetect
roles are present. Some of the more complex validation is just a little harder to write.