Skip to content

Unable to use DS libraries within an import file #84

@JakeMHughes

Description

@JakeMHughes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions