Skip to content

Commit b39ee0a

Browse files
committed
feat: add json output test for vet command
1 parent 01d55dc commit b39ee0a

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kcl vet --format json --schema User data.json main.k --output json
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[
2+
{
3+
"errorType": "EvaluationError",
4+
"file": "data.json",
5+
"line": 1,
6+
"column": 1,
7+
"details": {
8+
"errorMessage": "Instance check failed",
9+
"codeSnippet": "{"
10+
},
11+
"schema": {
12+
"filepath": "main.k",
13+
"lineInFile": 10,
14+
"columnInFile": 1,
15+
"details": {
16+
"errorMessage": "Check failed on the condition",
17+
"codeSnippet": "age > 10"
18+
}
19+
}
20+
}
21+
]

test/e2e/test_suites/test_kcl_vet_output_json_1/stdout

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Alice",
3+
"age": 5,
4+
"message": "This is Alice",
5+
"data": {
6+
"id": 1,
7+
"value": "value1"
8+
},
9+
"labels": {
10+
"key": "value"
11+
},
12+
"hc": [
13+
1,
14+
2,
15+
3
16+
]
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
schema User:
2+
name: str
3+
age: int
4+
message?: str
5+
data: Data
6+
labels: {str:}
7+
hc: [int]
8+
9+
check:
10+
age > 10
11+
12+
schema Data:
13+
id: int
14+
value: str
15+

0 commit comments

Comments
 (0)