diff --git a/core/asset/type.go b/core/asset/type.go index 6bb9cf05..b6bf378b 100644 --- a/core/asset/type.go +++ b/core/asset/type.go @@ -10,7 +10,7 @@ var ( errTypeInvalidCharacter = errors.New("type must be combination of alphanumeric and underscores") ) -var invalidTypePattern = regexp.MustCompile(`[^a-zA-Z0-9-]`) +var invalidTypePattern = regexp.MustCompile(`[^a-z0-9_]`) const ( typeMinLength = 3 diff --git a/core/asset/type_test.go b/core/asset/type_test.go index 8a18f278..fba92b69 100644 --- a/core/asset/type_test.go +++ b/core/asset/type_test.go @@ -132,10 +132,15 @@ func TestRegisterSupportedTypes(t *testing.T) { expectedErrorMsg: "type length must be 3 to 16 inclusive", }, { - name: "contains character outside alphanumeric and underscore", + name: "contains character outside lower case alphanumeric and underscore, with exclamation mark", input: asset.Type("abcd_efgh!"), expectedErrorMsg: "type must be combination of alphanumeric and underscores", }, + { + name: "contains character outside lower case alphanumeric and underscore, with upper case A", + input: asset.Type("Abcd_efgh"), + expectedErrorMsg: "type must be combination of alphanumeric and underscores", + }, } for _, tc := range testCases { @@ -183,11 +188,13 @@ func TestRegisterSupportedTypes(t *testing.T) { asset.Type("model"), asset.Type("query"), asset.Type("metric"), - asset.Type("dataset"), + asset.Type("fact_source"), + asset.Type("dimension_01a"), } inputTypes := []asset.Type{ - asset.Type("dataset"), + asset.Type("fact_source"), + asset.Type("dimension_01a"), } actualError := asset.RegisterSupportedTypes(inputTypes...)