diff --git a/internal/topdata/json_contract.go b/internal/topdata/json_contract.go index 8a3edcf..7da1222 100644 --- a/internal/topdata/json_contract.go +++ b/internal/topdata/json_contract.go @@ -97,10 +97,7 @@ func parseGlobalConditionGroups(injection map[string]any) (globalConditionGroups func parseGlobalConditionList(name string, raw any, requireNonEmpty bool) ([]globalCondition, error) { if raw == nil { - if requireNonEmpty { - return nil, fmt.Errorf("%s must be an array", name) - } - return nil, nil + return nil, fmt.Errorf("%s must be an array", name) } conditions, ok := raw.([]any) diff --git a/internal/topdata/json_contract_test.go b/internal/topdata/json_contract_test.go index 82e043e..1525d48 100644 --- a/internal/topdata/json_contract_test.go +++ b/internal/topdata/json_contract_test.go @@ -98,6 +98,20 @@ func TestParseGlobalConditionGroups(t *testing.T) { UnlessPresent: []globalCondition{}, }, }, + { + name: "require present null is rejected", + injection: map[string]any{ + "require_present": nil, + }, + wantError: "require_present must be an array", + }, + { + name: "unless present null is rejected", + injection: map[string]any{ + "unless_present": nil, + }, + wantError: "unless_present must be an array", + }, { name: "any present must be array", injection: map[string]any{