databricks / sjsonnet

Apache License 2.0
267 stars 55 forks source link

Sjsonnet is more lenient than google/jsonnet in calling 0-argument function values during materialization #168

Open lihaoyi-databricks opened 1 year ago

lihaoyi-databricks commented 1 year ago

Input:

{
  foo(): 123
}

google/jsonnet output:

Error: RUNTIME ERROR: couldn't manifest function as JSON
    Field "foo" 
    During manifestation    

Sjsonnet output:

{
  "foo": 123
}

It appears that google/jsonnet will only auto-evaluate a function during materialization if it's at the top level, whereas sjsonnet will auto-evaluate it anywhere in the jsonnet document