From b71b41fa634cbde1a968c6bc49953b8c104bd7fe Mon Sep 17 00:00:00 2001 From: "antoine.leveugle" Date: Mon, 10 Feb 2020 16:47:11 +0100 Subject: [PATCH] fix: custom type should appear as their parent type if possible --- docparser/parser.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docparser/parser.go b/docparser/parser.go index 50c6390..9b61d95 100644 --- a/docparser/parser.go +++ b/docparser/parser.go @@ -174,6 +174,14 @@ func parseIdentProperty(expr *ast.Ident) (t, format string, err error) { t = "string" format = "binary" default: + if expr.Obj != nil { + // maybe a custom type + if typ, ok := expr.Obj.Decl.(*ast.TypeSpec); ok { + if ident, ok := typ.Type.(*ast.Ident); ok { + return parseIdentProperty(ident) + } + } + } t = expr.Name err = fmt.Errorf("Can't set the type %s", expr.Name) }