diff --git a/src/main.go b/src/main.go index 727f649..9de1a2f 100644 --- a/src/main.go +++ b/src/main.go @@ -14,6 +14,7 @@ var api API //var httptestdir string var tstypemapper map[string]string = make(map[string]string) +var exceptionaltypemapper map[string]string = make(map[string]string) var knownMethods map[string]bool = make(map[string]bool) var httpMapper map[string]map[string]string = make(map[string]map[string]string) var packageName string = "main" @@ -257,6 +258,8 @@ func main() { loadConfig() + exceptionaltypemapper["[]byte"] = "string" + tstypemapper["time.Time"] = "Date" tstypemapper["primitive.ObjectID"] = "string" tstypemapper["time.Duration"] = "Date" diff --git a/src/processGoClientOutput.go b/src/processGoClientOutput.go index 3a19f23..80e2952 100644 --- a/src/processGoClientOutput.go +++ b/src/processGoClientOutput.go @@ -3,7 +3,6 @@ package main import ( "bytes" "fmt" - dc "go.digitalcircle.com.br/golib/base" "io/ioutil" "strings" ) @@ -110,5 +109,7 @@ func invoke(m string, path string, bodyo interface{}) (*json.Decoder, error) { } err := ioutil.WriteFile(f, b.Bytes(), 0600) - dc.Err(err) + if err != nil { + panic(err) + } } diff --git a/src/processGoServerOutput.go b/src/processGoServerOutput.go index 01a2cb9..2ad368c 100644 --- a/src/processGoServerOutput.go +++ b/src/processGoServerOutput.go @@ -115,7 +115,9 @@ ret.Perms["%s_%s"]="%s" } err := ioutil.WriteFile(f, b.Bytes(), 0600) - dc.Err(err) + if err != nil { + panic(err) + } cmd := exec.Command("/bin/sh", "-c", "go fmt "+f) bs, err := cmd.Output() //dc.Err(err) diff --git a/src/processTSClientOutput.go b/src/processTSClientOutput.go index 7d81c9f..9f289df 100644 --- a/src/processTSClientOutput.go +++ b/src/processTSClientOutput.go @@ -3,8 +3,8 @@ package main import ( "bytes" "fmt" - dc "go.digitalcircle.com.br/golib/base" "io/ioutil" + "log" "strings" ) @@ -111,15 +111,26 @@ async function InvokeOk(path: string, method: HTMLMethod, body?: any): Promise %s", f.String(), ftype) + } + + if !ok { + if f.Array { + ftype, ok = tstypemapper["[]"+f.Type] + } else { + ftype, ok = tstypemapper[f.Type] + } + } + if !ok { ftype = f.Type } - if f.Array { - ftype = ftype + "[]" - } else if f.Map { + if f.Map { fm, ok := tstypemapper[f.Mapkey] if !ok { fm = f.Mapkey @@ -155,5 +166,7 @@ async function InvokeOk(path: string, method: HTMLMethod, body?: any): Promise