I have a question about the import
functionality of JSONNet. What I would like is to be able to import one master libsonnet
file, which itself is composed of multiple imports, and be able to access everything from that one import.
I have the following example structure:
.
├── library_one
│ └── init.libsonnet
├── library_two
│ └── init.libsonnet
├── init.libsonnet
└── test.jsonnet
With the following contents for each file:
library_one/init.libsonnet
{
local LibraryOne = self,
some_function(some_argument='default'):: [
'echo "The argument was %s"' % some_argument,
],
}
library_two/init.libsonnet
{
local LibraryTwo = self,
some_other_function(some_other_argument='another_default'):: [
'echo "The other argument was %s"' % some_other_argument,
],
}
And finally, the "master" file init.libsonnet at the root:
local library_one = import 'library_one/init.libsonnet';
local library_two = import 'library_two/init.libsonnet';
{}
However, when I run the file test.jsonnnet with the following contents:
local master = import 'init.libsonnet';
{
some_key: master.library_one.some_function,
some_other_key: master.library_two.some_other_function,
}
I get the error:
RUNTIME ERROR: field does not exist: library_one
test.jsonnet:4:13-31 object <anonymous>
During manifestation
Is this kind of inheritance not possible?