Skip to content

Manifesting YAML silently ignores errors in unevaluated imported objects #817

@ThePletch

Description

@ThePletch

When calling std.manifestYamlDoc(thing), for values that:

  • are imported from another file
  • are set to a key of the object being serialized to YAML
  • would produce an error when evaluated
  • are not evaluated at another point during execution of the Jsonnet code,

the error is swallowed and an empty value is rendered in the resulting YAML.

Minimal reproduction:

// imported.libsonnet
{
  key:
    assert false : "it broke";
    "somestring",
}
// main.jsonnet
local busted = import 'imported.libsonnet';

std.manifestYamlDoc({key: busted})

Outputs:

"key":
  

If the value is evaluated by another operation during execution, e.g.:

// main.jsonnet
local busted = import 'imported.libsonnet';

std.manifestYamlDoc(std.trace(std.manifestJson({key: busted}), {key: busted}))

the error is raised as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions