blackstork-io / fabric

An open-source command-line tool for reporting workflow automation and a configuration language for reusable templates. Reporting-as-Code
https://blackstork.io/fabric/
Apache License 2.0
10 stars 0 forks source link

Error locations in plugins #160

Open Andrew-Morozko opened 4 weeks ago

Andrew-Morozko commented 4 weeks ago

Plugins can't generate hcl.Ranges for errors that they emit: we're only sending the cty.Value from the fabric, and it doesn't include source code location information.

However plugins should be able to add specs to their diagnostics, which main fabric could turn into error ranges using hcldec.SourceRange.

Alternatively plugins may send a traversal path for the erroneous item:

block {
    expr = {
        "key" = [
                {
            "key_inner" = "erroneous value"
        }]
    }
}

Path would look like []{"expr", "key", 0, "key_inner"}