Skip to content

Improve errors for untagged enums #3

Open
@cpg314

Description

@cpg314
$ echo '{ select: { fields: [1, {}]  }}' |  sqlsonnet -
INFO sqlsonnet: Converting Jsonnet file - to SQL
{
   "select": {
      "fields": [
         1,
         { }
      ]
   }
}
Error:   × Failed to interpret query from JSON: data did not match any variant of untagged enum Expr at line 6 column 7
   ╭─[source.json:6:7]
 1 │ {
 2 │    "select": {
 3 │       "fields": [
 4 │          1,
 5 │          { }
 6 │       ]
   ·       ▲
 7 │    }
 8 │ }
   ╰────

This is very suboptimal, as the error points to the end of the fields list without even localizing the invalid field.

Relevant:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions