databricks / sjsonnet

Apache License 2.0
267 stars 55 forks source link

Unknown variables should be rejected statically #122

Closed szeiger closed 3 years ago

szeiger commented 3 years ago

This static verification is required by the Jsonnet specification, but Sjsonnet does not verify references until they are evaluated. Both of these expressions are accepted by Sjsonnet because the illegal references are never evaluated:

$ echo "local x = y; 1" | jsonnet -
STATIC ERROR: <stdin>:1:11: Unknown variable: y

$ echo "local x = self.y; 1" | jsonnet -
STATIC ERROR: <stdin>:1:11-15: Can't use self outside of an object.