Open JakeMHughes opened 3 years ago
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:
ImportTest.java
@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
sjsonnet.Error Unknown variable ds at ....
added test that confirms this bug here https://github.com/datasonnet/datasonnet-mapper/commit/e7b96046d3eeb5c147f561449e8b34b04383f802
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:The error response is
sjsonnet.Error Unknown variable ds at ....
so it does seem to initially evaluate correctly but has issues when actually used