Skip to content

Commit

Permalink
cleanup some paths to clearly show errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MetalBlueberry committed Aug 26, 2024
1 parent 0ed68c7 commit 5d9e5ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 0 additions & 3 deletions generator/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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{}",
}
Expand Down
7 changes: 5 additions & 2 deletions generator/typefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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 {
Expand Down

0 comments on commit 5d9e5ec

Please sign in to comment.