-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve error logs when running sync/diff/validate
Currently decK doesn't return very useful and descriptive errors when configuration files are validated. This is particularly painful when the configuration is distributed in several files and the error doesn't specificy which file contains the error. Let's take for example the following files: ``` $ cat services.yaml services: - name: svc1 host: mockbin.org foo: bar consumers: - username: good - name: bad ``` If we run decK, it will return some obscure and incomplete errors: ``` $ deck sync -s services.yaml -s consumers.yaml Error: reading file: validating file content: 1 errors occurred: services.0: Additional property foo is not allowed ``` This commit is going to improve the way decK handles configuration validation error logging in order to provide a more useful description of the problems. When running decK with the new functionality, the following will be returned: ``` $ ./deck sync -s services.yaml -s consumers.yaml Error: 2 errors occurred: reading file services.yaml: validating file content: 1 errors occurred: validation error: object="bar", err=services.0: Additional property foo is not allowed reading file consumers.yaml: validating file content: 3 errors occurred: validation error: object={"name":"bad"}, err=consumers.1: Must validate at least one schema (anyOf) validation error: object={"name":"bad"}, err=consumers.1: username is required validation error: object="bad", err=consumers.1: Additional property name is not allowed ```
- Loading branch information
Showing
4 changed files
with
83 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters