Skip to content

Commit 9639773

Browse files
authored
Teach jsonnet-lint about optional parameters of std.manifestYamlDoc (#705)
manifestYamlDoc takes two optional parameters, `indent_array_in_object` and `quote_keys`. This commit teaches jsonnet-lint about them so that it doesn't raise errors when you use them. There are other stdlib library functions with this problem; the true solution is probably to auto-generate this from the stdlib AST, but this at least gets the linter happy with this particular function.
1 parent 16a10df commit 9639773

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

linter/internal/types/stdlib.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func prepareStdlib(g *typeGraph) {
120120
"manifestTomlEx": g.newSimpleFuncType(stringType, "value", "indent"),
121121
"manifestJsonEx": g.newSimpleFuncType(stringType, "value", "indent"),
122122
"manifestJsonMinified": g.newSimpleFuncType(stringType, "value"),
123-
"manifestYamlDoc": g.newSimpleFuncType(stringType, "value"),
123+
"manifestYamlDoc": g.newFuncType(stringType, []ast.Parameter{required("value"), optional("indent_array_in_object"), optional("quote_keys")}),
124124
"manifestYamlStream": g.newSimpleFuncType(stringType, "value"),
125125
"manifestXmlJsonml": g.newSimpleFuncType(stringType, "value"),
126126

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
std.manifestYamlDoc({
2+
hello: 'world',
3+
}, indent_array_in_object=false, quote_keys=true)

linter/testdata/stdlib_manifestYamlDoc.linter.golden

Whitespace-only changes.

0 commit comments

Comments
 (0)