diff --git a/generator/renderer.go b/generator/renderer.go index de746ad..8e5bfdb 100644 --- a/generator/renderer.go +++ b/generator/renderer.go @@ -606,8 +606,6 @@ func (r *Renderer) WriteUnmarshalTests(w io.Writer) error { // valTypeMap maps between ValTypes and go types var valTypeMap = map[ValType]string{ - ValTypeDataArray: "*types.DataArrayType", - ValTypeEnum: "NO-TYPE", ValTypeBoolean: "types.BoolType", ValTypeNumber: "types.NumberType", ValTypeInteger: "types.IntegerType", @@ -617,7 +615,6 @@ var valTypeMap = map[ValType]string{ ValTypeColorscale: "*types.ColorScale", ValTypeAngle: "types.NumberType", ValTypeSubplotID: "types.StringType", - ValTypeFlagList: "NO-TYPE", ValTypeAny: "interface{}", ValTypeInfoArray: "interface{}", } diff --git a/generator/typefile.go b/generator/typefile.go index e3ac0e6..a32e5df 100644 --- a/generator/typefile.go +++ b/generator/typefile.go @@ -208,7 +208,7 @@ func (file *typeFile) parseAttributes(JSONPath string, typePrefix string, attrs }) case attr.ValType == ValTypeDataArray: - typeName := valTypeMap[attr.ValType] + typeName := "*types.DataArrayType" fields = append(fields, structField{ Name: xstrings.ToCamelCase(attr.Name), @@ -225,7 +225,10 @@ func (file *typeFile) parseAttributes(JSONPath string, typePrefix string, attrs }) default: - typeName := valTypeMap[attr.ValType] + typeName, ok := valTypeMap[attr.ValType] + if !ok { + panic("valType typeName not defined") + } // Special case, the attribute color may also be a ColorScale if attr.ValType == ValTypeColor && attr.Name == "color" && attrs["colorscale"] != nil {