-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
test-is-valid.yaml
72 lines (63 loc) · 1.16 KB
/
test-is-valid.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cases:
- note: jsonbuiltins/json is_valid
query: data.generated.p = x
modules:
- |
package generated
documents = [
`plainstring`,
`{`,
`{"json": "ok"}`,
]
p = [x | doc = documents[_]; json.is_valid(doc, x)]
strict_error: true
want_result:
- x:
- false
- false
- true
- note: jsonbuiltins/json is_valid not string
modules:
- |
package generated
p = x {
json.is_valid(input.foo, x)
}
query: data.generated.p = x
input: {"foo": 1}
strict_error: true
want_result:
- x: false
- note: jsonbuiltins/yaml is_valid
query: data.generated.p = x
modules:
- |
package generated
documents = [
`foo:
- qux: bar
- baz: 2`,
`foo:
- qux: bar
- baz: {`,
`{"json": "ok"}`,
]
p = [x | doc = documents[_]; yaml.is_valid(doc, x)]
strict_error: true
want_result:
- x:
- true
- false
- true
- note: jsonbuiltins/yaml is_valid not string
modules:
- |
package generated
p = x {
yaml.is_valid(input.foo, x)
}
query: data.generated.p = x
input: {"foo": 1}
strict_error: true
want_result:
- x: false