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.
This commit is contained in:
Sean Gillespie 2023-06-13 13:18:35 -07:00 committed by GitHub
parent 16a10df1a7
commit 9639773cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -120,7 +120,7 @@ func prepareStdlib(g *typeGraph) {
"manifestTomlEx": g.newSimpleFuncType(stringType, "value", "indent"),
"manifestJsonEx": g.newSimpleFuncType(stringType, "value", "indent"),
"manifestJsonMinified": g.newSimpleFuncType(stringType, "value"),
"manifestYamlDoc": g.newSimpleFuncType(stringType, "value"),
"manifestYamlDoc": g.newFuncType(stringType, []ast.Parameter{required("value"), optional("indent_array_in_object"), optional("quote_keys")}),
"manifestYamlStream": g.newSimpleFuncType(stringType, "value"),
"manifestXmlJsonml": g.newSimpleFuncType(stringType, "value"),

View File

@ -0,0 +1,3 @@
std.manifestYamlDoc({
hello: 'world',
}, indent_array_in_object=false, quote_keys=true)

View File