diff --git a/pkg/qlng/ast_nodes.go b/pkg/qlng/ast_nodes.go index fbdde60fe..334a1d8b9 100644 --- a/pkg/qlng/ast_nodes.go +++ b/pkg/qlng/ast_nodes.go @@ -99,7 +99,7 @@ func (t *typedValue) MarshalJSON() ([]byte, error) { ) if t.V == nil { - return nil, nil + return json.Marshal(aux) } aux.Type = t.V.Type() diff --git a/tests/system/report_test.go b/tests/system/report_test.go index 914c339c1..450783786 100644 --- a/tests/system/report_test.go +++ b/tests/system/report_test.go @@ -104,6 +104,55 @@ func TestReportFilterCasting(t *testing.T) { End() } +func TestReportCreate_invalidFilter(t *testing.T) { + h := newHelper(t) + h.clearReports() + helpers.AllowMe(h, types.ComponentRbacResource(), "report.create") + + h.apiInit(). + Post("/reports/"). + Header("Accept", "application/json"). + JSON(`{ + "handle": "test_report", + "meta": { "name": "Test Report", "description": "" }, + "sources": [ + { + "meta": {}, + "step": { + "load": { + "name": "Load", + "source": "composeRecords", + "definition": { + "module": "test", + "namespace": "test" + }, + "columns": null, + "filter": { + "ref": "or", + "args": [ + { + "ref": "eq", + "args": [ + { "symbol": "id_str" }, + { + "value": { "@type": "", "@value": "" } + } + ] + } + ] + } + } + } + } + ], + "blocks": [] + }`). + Expect(t). + Status(http.StatusOK). + Assert(helpers.AssertNoErrors). + End() +} + func TestReportScenarios_create(t *testing.T) { h := newHelper(t) h.clearReports()