I would like to have the ability to specify different arguments to the imported variable and change the behaviour of import. For example, I would like to have something like the following:
local foo = import "foo.libsonnet";
{
"foo1": foo["foo1"],
"foo2": foo["foo2"]
}
foo.libsonnet: (something like the switch case in programming that has a default value) I know the following should not work. Just maybe pseudocode for what it could be used.
{
"foo1": "bar1", // only if foo1 is passed
"foo2": "bar2", // only if foo2 is passed
"bar1" : "bar1_value",//default
"bar2" : "bar2_value" //default
}
output:
{
"foo1":{
"foo1": "bar1",
"bar1": "bar1_value",
"bar2" : "bar2_value"
},
"foo2":{
"foo2": "bar2",
"bar1": "bar1_value",
"bar2" : "bar2_value"
}
}