We only seem to be able to use sjsonnet libraries inside of imported files. ( the ds namespace is not recognized)
Here is a simple junit test you can add to the ImportTest.java file to verify:
@Test
void importWithLib() {
Mapper mapper = new Mapper("import 'example.ds'", Collections.emptyList(), Collections.singletonMap("example.ds", "{test: ds.contains([1,2],1)}"));
String result = mapper.transform("{}");
assertEquals("{\"test\":true}", result);
}
The error response is sjsonnet.Error Unknown variable ds at .... so it does seem to initially evaluate correctly but has issues when actually used
We only seem to be able to use sjsonnet libraries inside of imported files. ( the ds namespace is not recognized)
Here is a simple junit test you can add to the
ImportTest.javafile to verify:The error response is
sjsonnet.Error Unknown variable ds at ....so it does seem to initially evaluate correctly but has issues when actually used