Recovering operational

master
Paulo Simão 2021-09-06 10:31:56 -03:00
parent ac8771aac4
commit cfb43ba21d
5 changed files with 7 additions and 33 deletions

1
go.mod
View File

@ -5,7 +5,6 @@ go 1.17
require (
github.com/alecthomas/kong v0.2.15
github.com/fatih/structtag v1.2.0
github.com/gin-gonic/gin v1.6.3
github.com/pkg/errors v0.9.1
gopkg.in/yaml.v2 v2.4.0
)

View File

@ -1,19 +0,0 @@
package lib
//type Config struct {
// Gofname string `yaml:"gofname"`
// Goimpldir string `yaml:"goimpldir"`
// Tsfname string `json:"tsfname"`
// Goclifname string `json:"goclifname"`
//}
//
//var config Config
//
//func loadConfig() {
// fname := flag.String("f", ".apigen.yaml", "File with config to load - defaults to '.apigen'")
// flag.Parse()
// bs, err := ioutil.ReadFile(*fname)
// Err(err)
// err = yaml.Unmarshal(bs, &config)
// Err(err)
//}

View File

@ -112,10 +112,4 @@ func Run() {
if err != nil {
panic(err)
}
//loadConfig()
//
//os.Remove(config.Gofname)
//process(&api)
}

View File

@ -122,7 +122,7 @@ func invoke(m string, path string, bodyo interface{}) (*json.Decoder, error) {
for k, v := range api.Methods {
WNL(`func %s(req %s) (res %s, err error){`, k, ResDecType(v.ReqType), ResDecType(v.ResType))
WNL(` var dec *json.Decoder
dec, err = invoke("%s", "%s", res)
dec, err = invoke("%s", "%s", req)
if err!=nil{
return
}

View File

@ -64,15 +64,15 @@ func processGoServerOutput(f string) error {
WNL(` default:
http.Error(w,"Method not allowed",500)`)
WNL(` }`)
}
WNL(` }`)
WNL(` })
return ret
}`)
WNL(` })`)
}
WNL(` return ret
}
`)
for _, v := range api.Methods {
WNL(`func h_%s(w http.ResponseWriter, r *http.Request) {