Skip to content

Commit fed90cd

Browse files
authored
fix: add std.objectKeysValues to jsonnet-lint (#706)
1 parent 7b9f5fd commit fed90cd

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

linter/internal/types/stdlib.go

+14-12
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@ func prepareStdlib(g *typeGraph) {
2525
"extVar": g.newSimpleFuncType(anyType, "x"),
2626

2727
// Types and reflection
28-
"thisFile": stringType,
29-
"type": g.newSimpleFuncType(stringType, "x"),
30-
"length": g.newSimpleFuncType(numberType, "x"),
31-
"objectHas": g.newSimpleFuncType(boolType, "o", "f"),
32-
"objectFields": g.newSimpleFuncType(arrayOfString, "o"),
33-
"objectValues": g.newSimpleFuncType(anyArrayType, "o"),
34-
"objectHasAll": g.newSimpleFuncType(boolType, "o", "f"),
35-
"objectFieldsAll": g.newSimpleFuncType(arrayOfString, "o"),
36-
"objectValuesAll": g.newSimpleFuncType(anyArrayType, "o"),
37-
"prune": g.newSimpleFuncType(anyObjectType, "a"),
38-
"mapWithKey": g.newSimpleFuncType(anyObjectType, "func", "obj"),
39-
"get": g.newFuncType(anyType, []ast.Parameter{required("o"), required("f"), optional("default"), optional("inc_hidden")}),
28+
"thisFile": stringType,
29+
"type": g.newSimpleFuncType(stringType, "x"),
30+
"length": g.newSimpleFuncType(numberType, "x"),
31+
"objectHas": g.newSimpleFuncType(boolType, "o", "f"),
32+
"objectFields": g.newSimpleFuncType(arrayOfString, "o"),
33+
"objectValues": g.newSimpleFuncType(anyArrayType, "o"),
34+
"objectKeysValues": g.newSimpleFuncType(anyArrayType, "o"),
35+
"objectHasAll": g.newSimpleFuncType(boolType, "o", "f"),
36+
"objectFieldsAll": g.newSimpleFuncType(arrayOfString, "o"),
37+
"objectValuesAll": g.newSimpleFuncType(anyArrayType, "o"),
38+
"objectKeysValuesAll": g.newSimpleFuncType(anyArrayType, "o"),
39+
"prune": g.newSimpleFuncType(anyObjectType, "a"),
40+
"mapWithKey": g.newSimpleFuncType(anyObjectType, "func", "obj"),
41+
"get": g.newFuncType(anyType, []ast.Parameter{required("o"), required("f"), optional("default"), optional("inc_hidden")}),
4042

4143
// isSomething
4244
"isArray": g.newSimpleFuncType(boolType, "v"),

testdata/stdlib_smoke_test.golden

+2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@
140140
"objectFieldsAll": [ ],
141141
"objectHas": false,
142142
"objectHasAll": false,
143+
"objectKeysValues": [ ],
144+
"objectKeysValuesAll": [ ],
143145
"objectValues": [ ],
144146
"objectValuesAll": [ ],
145147
"parseHex": 3735928559,

testdata/stdlib_smoke_test.jsonnet

+2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
objectHas: std.objectHas(o={}, f="fieldname"),
1717
objectFields: std.objectFields(o={}),
1818
objectValues: std.objectValues(o={}),
19+
objectKeysValues: std.objectKeysValues(o={}),
1920
objectHasAll: std.objectHasAll(o={}, f="fieldname"),
2021
objectFieldsAll: std.objectFieldsAll(o={}),
2122
objectValuesAll: std.objectValuesAll(o={}),
23+
objectKeysValuesAll: std.objectKeysValuesAll(o={}),
2224
prune: std.prune(a={x: null, y: [null, "42"]}),
2325
mapWithKey: std.mapWithKey(func=function(key, value) 42, obj={a: 17}),
2426
get: [

0 commit comments

Comments
 (0)