-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Feature Request
Is your feature request related to a problem? Please describe:
Currently the vet
command outputs either a successful message or lines of error messages and file paths to stdout. This can be problematic to parse when using vet
during CI because the output is not structured.
Describe the feature you'd like:
I would like to a flag that can configure the output format of vet
. For example, --output=table|json|csv
so that we can leverage vet
to continuously validate our files in our pipeline and then propagate the messages up to the user from structured text.
Describe alternatives you've considered:
We've considered parsing the outputs from vet
line-by-line but having a consistent structure will make this easier.
Teachability, Documentation, Adoption, Migration Strategy:
The command could be like the following
Before
kcl vet --format yaml --schema AppConfig samples/example-app-1.yaml kcl/schemas.k
EvaluationError
--> path/to/my/file.yaml:3:9
|
3 | app_name: "test"
| ^ Instance check failed
|
--> /kcl/schemas.k:13:1
|
13 | regex.match(app_name, r"\[(.+?)\]")
| Check failed on the condition
|
After
kcl vet --format yaml --schema AppConfig samples/example-app-1.yaml kcl/schemas.k --output json
{
"errorType": "EvaluationError",
"file": "path/to/my/file.yaml",
"line": 3,
"column": 9,
"details": {
"errorMessage": "Instance check failed",
"codeSnippet": "app_name: \"test\""
},
"schema": {
"filepath": "/kcl/schemas.k",
"lineInFile": 13,
"columnInFile": 1,
"additionalDetails": "Check failed on the condition"
}
}