Skip to content

Commit

Permalink
time.Time now is string in SMD schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sas1024 committed Jul 20, 2018
1 parent 638f3b9 commit 1f71750
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,12 @@ func parseSMDType(expr ast.Expr) (string, string) {
switch v := expr.(type) {
case *ast.StarExpr:
return parseSMDType(v.X)
case *ast.SelectorExpr, *ast.MapType, *ast.InterfaceType:
case *ast.SelectorExpr:
if v.X.(*ast.Ident).Name == "time" && v.Sel.Name == "Time" {
return "String", ""
}
return "Object", ""
case *ast.MapType, *ast.InterfaceType:
return "Object", ""
case *ast.ArrayType:
mainType, itemType := parseSMDType(v.Elt)
Expand Down Expand Up @@ -750,6 +755,10 @@ func parseStruct(expr ast.Expr) *Struct {
return parseStruct(v.X)
case *ast.SelectorExpr:
namespace := v.X.(*ast.Ident).Name
if namespace == "time" && v.Sel.Name == "Time" {
return nil
}

return &Struct{
Name: namespace + "." + v.Sel.Name,
Namespace: namespace,
Expand Down

0 comments on commit 1f71750

Please sign in to comment.