// handle RAML advanced data type func (o *object) handleAdvancedType() { if o.T.Type == nil { o.T.Type = "object" } strType := commons.InterfaceToString(o.T.Type) switch { case len(strings.Split(strType, ",")) > 1: //multiple inheritance // TODO case strings.ToLower(strType) == "object": // plain type case o.T.IsArray(): o.makeArray(strType) } }
// handle advance type type into structField // example: // Mammal: // type: Animal // properties: // name: // type: string // the additional fieldDef would be Animal composition func (sd *structDef) handleAdvancedType() { if sd.T.Type == nil { sd.T.Type = "object" } strType := commons.InterfaceToString(sd.T.Type) switch { case len(strings.Split(strType, ",")) > 1: //multiple inheritance sd.addMultipleInheritance(strType) case sd.T.IsUnion(): sd.buildUnion() case sd.T.IsArray(): // arary type sd.buildArray() case strings.ToLower(strType) == "object": // plain type return case sd.T.IsEnum(): // enum sd.buildEnum() case strType != "" && len(sd.T.Properties) == 0: // type alias sd.buildTypeAlias() default: // single inheritance sd.addSingleInheritance(strType) } }